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

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/-iu9-C_lan/-iu9-C_lan.md +373 -0
  2. md/train/33TBJachvOX/33TBJachvOX.md +322 -0
  3. md/train/5Ya8PbvpZ9/5Ya8PbvpZ9.md +314 -0
  4. md/train/6UdQLhqJyFD/6UdQLhqJyFD.md +412 -0
  5. md/train/AuVKs6JmBtY/AuVKs6JmBtY.md +240 -0
  6. md/train/B1e9Y2NYvS/B1e9Y2NYvS.md +318 -0
  7. md/train/B1lKS2AqtX/B1lKS2AqtX.md +299 -0
  8. md/train/BklSv34KvB/BklSv34KvB.md +275 -0
  9. md/train/BydrOIcle/BydrOIcle.md +463 -0
  10. md/train/GvqjmSwUxkY/GvqjmSwUxkY.md +359 -0
  11. md/train/H1exf64KwH/H1exf64KwH.md +426 -0
  12. md/train/H1lJJnR5Ym/H1lJJnR5Ym.md +386 -0
  13. md/train/H1xSNiRcF7/H1xSNiRcF7.md +385 -0
  14. md/train/HJIoJWZCZ/HJIoJWZCZ.md +342 -0
  15. md/train/HJfQrs0qt7/HJfQrs0qt7.md +691 -0
  16. md/train/Hk8N3Sclg/Hk8N3Sclg.md +238 -0
  17. md/train/HkepKG-Rb/HkepKG-Rb.md +364 -0
  18. md/train/Hyl7ygStwB/Hyl7ygStwB.md +455 -0
  19. md/train/Hyx4knR9Ym/Hyx4knR9Ym.md +0 -0
  20. md/train/J28lNO4p3ki/J28lNO4p3ki.md +294 -0
  21. md/train/J4gRj6d5Qm/J4gRj6d5Qm.md +231 -0
  22. md/train/JHcqXGaqiGn/JHcqXGaqiGn.md +0 -0
  23. md/train/K9uApq7iyyI/K9uApq7iyyI.md +500 -0
  24. md/train/KBnXrODoBW/KBnXrODoBW.md +242 -0
  25. md/train/OJiM1R3jAtZ/OJiM1R3jAtZ.md +450 -0
  26. md/train/Oa9RlXNggGy/Oa9RlXNggGy.md +266 -0
  27. md/train/S1ejj64YvS/S1ejj64YvS.md +497 -0
  28. md/train/S1m6h21Cb/S1m6h21Cb.md +772 -0
  29. md/train/SJlJSaEFwS/SJlJSaEFwS.md +273 -0
  30. md/train/Sk9yuql0Z/Sk9yuql0Z.md +329 -0
  31. md/train/SkaPsfZ0W/SkaPsfZ0W.md +409 -0
  32. md/train/SkeAaJrKDS/SkeAaJrKDS.md +539 -0
  33. md/train/Sy0GnUxCb/Sy0GnUxCb.md +250 -0
  34. md/train/Syx79eBKwr/Syx79eBKwr.md +292 -0
  35. md/train/SyxtJh0qYm/SyxtJh0qYm.md +580 -0
  36. md/train/UVH3Ucewd-IXZ/UVH3Ucewd-IXZ.md +218 -0
  37. md/train/ZUvaSolQZh3/ZUvaSolQZh3.md +253 -0
  38. md/train/b4YiFnQH3gN/b4YiFnQH3gN.md +314 -0
  39. md/train/hbHkvGBZB9/hbHkvGBZB9.md +261 -0
  40. md/train/jCxDyge46t2/jCxDyge46t2.md +528 -0
  41. md/train/r1gIdySFPH/r1gIdySFPH.md +529 -0
  42. md/train/r1gzoaNtvr/r1gzoaNtvr.md +302 -0
  43. md/train/r1lZ7AEKvB/r1lZ7AEKvB.md +581 -0
  44. md/train/rJlEojAqFm/rJlEojAqFm.md +291 -0
  45. md/train/rJzIBfZAb/rJzIBfZAb.md +398 -0
  46. md/train/rkQkBnJAb/rkQkBnJAb.md +273 -0
  47. md/train/ryfz73C9KQ/ryfz73C9KQ.md +332 -0
  48. md/train/ryxwJhC9YX/ryxwJhC9YX.md +355 -0
  49. md/train/ucEXZQncukK/ucEXZQncukK.md +507 -0
  50. md/train/wXgk_iCiYGo/wXgk_iCiYGo.md +639 -0
md/train/-iu9-C_lan/-iu9-C_lan.md ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cycle Self-Training for Domain Adaptation
2
+
3
+ Hong Liu Dept of Electronic Engineering Tsinghua University hongliu9903@gmail.com
4
+
5
+ Jianmin Wang
6
+ School of Software, BNRist
7
+ Tsinghua University
8
+ jimwang@tsinghua.edu.cn Mingsheng Long⇤
9
+ School of Software, BNRist Tsinghua University
10
+ mingsheng@tsinghua.edu.cn
11
+
12
+ # Abstract
13
+
14
+ Mainstream approaches for unsupervised domain adaptation (UDA) learn domaininvariant representations to narrow the domain shift, which are empirically effective but theoretically challenged by the hardness or impossibility theorems. Recently, self-training has been gaining momentum in UDA, which exploits unlabeled target data by training with target pseudo-labels. However, as corroborated in this work, under distributional shift, the pseudo-labels can be unreliable in terms of their large discrepancy from target ground truth. In this paper, we propose Cycle Self-Training (CST), a principled self-training algorithm that explicitly enforces pseudo-labels to generalize across domains. CST cycles between a forward step and a reverse step until convergence. In the forward step, CST generates target pseudo-labels with a source-trained classifier. In the reverse step, CST trains a target classifier using target pseudo-labels, and then updates the shared representations to make the target classifier perform well on the source data. We introduce the Tsallis entropy as a confidence-friendly regularization to improve the quality of target pseudo-labels. We analyze CST theoretically under realistic assumptions, and provide hard cases where CST recovers target ground truth, while both invariant feature learning and vanilla self-training fail. Empirical results indicate that CST significantly improves over the state-of-the-arts on visual recognition and sentiment analysis benchmarks.
15
+
16
+ # 1 Introduction
17
+
18
+ Transferring knowledge from a source domain with rich supervision to an unlabeled target domain is an important yet challenging problem. Since deep neural networks are known to be sensitive to subtle change in underlying distributions [70], models trained on one labeled dataset often fail to generalize to another unlabeled dataset [58, 1]. Unsupervised domain adaptation (UDA) addresses the challenge of distributional shift by adapting the source model to the unlabeled target data [50, 43].
19
+
20
+ The mainstream paradigm for UDA is feature adaptation, a.k.a. domain alignment. By reducing the distance of the source and target feature distributions, these methods learn invariant representations to facilitate knowledge transfer between domains [34, 22, 36, 54, 37, 73], with successful applications in various areas such as computer vision [63, 27, 77] and natural language processing [75, 49]. Despite their popularity, the impossibility theories [6] uncovered intrinsic limitations of learning invariant representations when it comes to label shift [74, 32] and shift in the support of domains [29].
21
+
22
+ Recently, self-training (a.k.a. pseudo-labeling) [21, 78, 30, 32, 47, 68] has been gaining momentum as a promising alternative to feature adaptation. Originally tailored to semi-supervised learning, self-training generates pseudo-labels of unlabeled data, and jointly trains the model with source labels and target pseudo-labels [31, 39, 30]. However, the distributional shift in UDA makes pseudo-labeling more difficult. Directly using all pseudo-labels is risky due to accumulated error and even trivial solution [14]. Thus previous works tailor self-training to UDA by selecting trustworthy pseudo-labels. Using confidence threshold or reweighting, recent works try to alleviate the negative effect of domain shift in standard self-training [78, 47], but they can be brittle and require expensive tweaking of the threshold or weight for different tasks, and their performance gain is still inconsistent.
23
+
24
+ ![](images/a98d2d44c2b974a909fc041a6f8726476f59f9bdcb19e5febe93a6d25e86dd55.jpg)
25
+ Figure 1: Standard self-training vs. cycle self-training. In standard self-training, we generate target pseudolabels with a source model, and then train the model with both source ground-truths and target pseudo-labels. In cycle self-training, we train a target classifier with target pseudo-labels in the inner loop, and make the target classifier perform well on the source domain by updating the shared representations in the outer loop.
26
+
27
+ In this work, we first analyze the quality of pseudo-labels with or without domain shift to delve deeper into the difficulty of standard self-training in UDA. On popular benchmark datasets, when the source and target are the same, our analysis indicates that the pseudo-label distribution is almost identical to the ground-truth distribution. However, with distributional shift, their discrepancy can be very large with examples of several classes mostly misclassified into other classes. We also study the difficulty of selecting correct pseudo-labels with popular criteria under domain shift. Although entropy and confidence are reasonable selection criteria for correct pseudo-labels without domain shift, the domain shift makes their accuracy decrease sharply.
28
+
29
+ Our analysis shows that domain shift makes pseudo-labels unreliable and that self-training on selected target instances with accurate pseudo-labels is less successful. Thereby, more principled improvement of standard self-training should be tailored to UDA and address the domain shift explicitly. In this work, we propose Cycle Self-Training (CST), a principled self-training approach to UDA, which overcomes the limitations of standard self-training (see Figure 1). Different from previous works to select target pseudo-labels with hard-to-tweak protocols, CST learns to generalize the pseudo-labels across domains. Specifically, CST cycles between the use of target pseudo-labels to train a target classifier, and the update of shared representations to make the target classifier perform well on the source data. In contrast to the standard Gibbs entropy that makes the target predictions over-confident, we propose a confidence-friendly uncertainty measure based on the Tsallis entropy in information theory, which adaptively minimizes the uncertainty without manually tuning or setting thresholds. Our method is simple and generally applicable to vision and language tasks with various backbones.
30
+
31
+ We empirically evaluate our method on a series of standard UDA benchmarks. Results indicate that CST outperforms previous state-of-the-art methods in 21 out of 25 tasks for object recognition and sentiment classification. Theoretically, we prove that the minimizer of CST objective is endowed with general guarantees of target performance. We also study hard cases on specific distributions, showing that CST recovers target ground-truths while both feature adaptation and standard self-training fail.
32
+
33
+ # 2 Preliminaries
34
+
35
+ We study unsupervised domain adaptation (UDA). Consider a source distribution $P$ and a target distribution $Q$ over the input-label space $\mathcal { X } \times \mathcal { V }$ . We have access to $n _ { s }$ labeled i.i.d. samples $\widehat { P } = \{ x _ { i } ^ { s } , y _ { i } ^ { s } \} _ { i = 1 } ^ { n _ { s } }$ from $P$ and $n _ { t }$ unlabeled i.i.d. samples $\widehat { Q } = \{ x _ { i } ^ { t } \} _ { i = 1 } ^ { n _ { t } }$ from $Q$ . The model $f$ comprises a feature extractor $h _ { \phi }$ parametrized by $\phi$ and a head (linear classifier) $g _ { \theta }$ parametrized by $\theta$ , i.e. $\bar { f } _ { \theta , \phi } ( x ) = g _ { \theta } ( h _ { \phi } ( x ) )$ . The loss function is $\ell ( \cdot , \cdot )$ . Denote by $L _ { P } ( \theta , \phi ) : = \mathbb { E } _ { ( x , y ) \sim P } \ell ( f _ { \theta , \phi } ( x ) , y )$ the expected error on $P$ . Similarly, we use ${ \cal L } _ { \widehat { P } } ( \theta , \phi )$ to denote the empirical error on dataset $\widehat { P }$ .
36
+
37
+ We discuss two mainstream UDA methods and their formulations: feature adaptation and self-training.
38
+
39
+ Feature Adaptation trains the model $f$ on the source dataset $\widehat { P }$ , and simultaneously matches the source and target distributions in the representation space $\mathcal { Z } = h ( \mathcal { X } )$ :
40
+
41
+ $$
42
+ \operatorname* { m i n } _ { \theta , \phi } L _ { \widehat { P } } ( \theta , \phi ) + d ( h _ { \sharp } \widehat { P } , h _ { \sharp } \widehat { Q } ) .
43
+ $$
44
+
45
+ ![](images/b47a38073ca7224e33f9ab2c301d27144b2711ff9fb5bf238f28f0fb56f3274f.jpg)
46
+ Figure 2: Analysis of pseudo-labels under domain shift on VisDA-2017. Left: Pseudo-label distributions with and without domain shift. Middle: Changes of pseudo-label distributions throughout training. Right: Quality of pseudo-labels under different pseudo-label selection criteria.
47
+
48
+ Here, $h _ { \sharp } \widehat { P }$ denotes the pushforward distribution of $\widehat { P }$ , and $d ( \cdot , \cdot )$ is some distribution distance. For instance, Long et al. [34] used maximum mean discrepancy $d _ { \mathrm { M M D } }$ , and Ganin et al. [22] approximated the $\mathcal { H } \Delta \mathcal { H }$ -distance $d _ { \mathcal { H } \Delta \mathcal { H } }$ [7] with adversarial training. Despite its pervasiveness, recent works have shown the intrinsic limitations of feature adaptation under real-world situations [6, 74, 33, 32, 29].
49
+
50
+ Self-Training is considered a promising alternative to feature adaptation. In this work we mainly focus on pseudo-labeling [31, 30]. Stemming from semi-supervised learning, standard self-training trains a source model $f _ { s }$ on the source dataset $\widehat { P }$ $: \mathrm { m i n } _ { \theta _ { s } , \phi _ { s } } L _ { \widehat { P } } ( \theta _ { s } , \phi _ { s } )$ . The target pseudo-labels are then generated by $f _ { s }$ on the target dataset $\widehat { Q }$ . To leverage unlabeled target data, self-training trains the model on the source and target datasets together with source ground-truths and target pseudo-labels:
51
+
52
+ $$
53
+ \operatorname* { m i n } _ { \theta , \phi } L _ { \widehat { P } } ( \theta , \phi ) + \mathbb { E } _ { x \sim \widehat { Q } } \ell ( f _ { \theta , \phi } ( x ) , \arg \operatorname* { m a x } _ { i } \{ f _ { \theta , \phi _ { s } } ( x ) _ { [ i ] } \} ) .
54
+ $$
55
+
56
+ Self-training also uses label-sharpening as a standard protocol [31, 57]. Another popular variant of pseudo-labeling is the teacher-student model [4, 61], which iteratively improves the quality of pseudo-labels via alternatively replacing $\theta _ { s }$ and $\phi _ { s }$ with $\theta$ and $\phi$ of the previous iteration.
57
+
58
+ # 2.1 Limitations of Standard Self-Training
59
+
60
+ Standard self-training with pseudo-labels uses unlabeled data efficiently for semi-supervised learning [31, 39, 57]. Here we carry out exploratory studies on the popular VisDA-2017 [45] dataset using ResNet-50 backbones. We find that domain shift makes the pseudo-labels biased towards several classes and thereby unreliable in UDA. See Appendix C.1 for details and results on more datasets.
61
+
62
+ Pseudo-label distributions with or without domain shift. We resample the original VisDA-2017 to simulate different relationship between source and target domains: 1) i.i.d., 2) covariate shift, and 3) label shift. We train the model on the three variants of source dataset and use it to generate target pseudo-labels. We show the distributions of target ground-truths and pseudo-labels in Figure 2 (Left). When the source and target distributions are identical, the distribution of pseudo-labels is almost the same as ground-truths, indicating the reliability of pseudo-labels. In contrast, when exposed to label shift or covariate shift, the distribution of pseudo-labels is significantly different from target ground-truths. Note that classes 2, 7, 8 and 12 appear rarely in the target pseudo-labels in the covariate shift setting, indicating that the pseudo-labels are biased towards several classes due to domain shift. Self-training with these pseudo-labels is risky since it may lead to misalignment of distributions and misclassify many examples of classes 2, 7, 8 and 12.
63
+
64
+ Change of pseudo-label distributions throughout training. To further study the change of pseudolabels in standard self-training, we compute the total variation (TV) distance between target groundtruths and target pseudo-labels: $\begin{array} { r } { d _ { \mathrm { T V } } ( c , \dot { c ^ { \prime } } ) = \frac { 1 } { 2 } \sum _ { i } \| c _ { i } - c _ { i } ^ { \prime } \| } \end{array}$ , where $c _ { i }$ is the ratio of class $i$ . We plot its change during training in Figure 2 (Middle). Although the error rate of pseudo-labels continues to decrease, $d _ { \mathrm { T V } }$ remains almost unchanged at 0.26 throughout training. Note that $d _ { \mathrm { T V } }$ is the lower bound of the error rate of the pseudo-labels (shown in Appendix C.1). If $d _ { \mathrm { T V } }$ converges to 0.26, then the accuracy of pseudo-labels is upper-bounded by 0.74. This indicates that the important denoising ability [66] of pseudo-labels in standard self-training is hindered by domain shift.
65
+
66
+ Difficulty of selecting reliable pseudo-labels under domain shift. To mitigate the negative effect of false pseudo-labels, recent works proposed to select correct pseudo-labels based on thresholding the entropy or confidence criteria [35, 21, 37, 57]. However, it remains unclear whether these strategies are still effective under domain shift. Here we compare the quality of pseudo-labels selected by different strategies with or without domain shift. For each strategy, we compute False Positive Rate and True Positive Rate for different thresholds and plot its ROC curve in Figure 2 (Right). When the source and target distributions are identical, both entropy and confidence are reasonable strategies for selecting correct pseudo-labels $( \mathrm { A U C } { = } 0 . 8 9 )$ ). However, when the target pseudo-labels are generated by the source model, the quality of pseudo-labels decreases sharply under domain shift $\mathrm { \Delta A U C { = } 0 . 7 8 }$ ).
67
+
68
+ # 3 Approach
69
+
70
+ We present Cycle Self-Training (CST) to improve pseudo-labels under domain shift. An overview of our method is given in Figure 1. Cycle Self-Training iterates between a forward step and a reverse step to make self-trained classifiers generalize well on both target and source domains.
71
+
72
+ # 3.1 Cycle Self-Training
73
+
74
+ Forward Step. Similar to standard self-training, we have a source classifier $\theta _ { s }$ trained on top of the shared representations $\phi$ on the labeled source domain, and use it to generate target pseudo-labels as
75
+
76
+ $$
77
+ y ^ { \prime } = \arg \operatorname* { m a x } _ { i } \{ f _ { \theta _ { s } , \phi } ( x ) _ { [ i ] } \} ,
78
+ $$
79
+
80
+ for each $x$ in the target dataset $\widehat { Q }$ . Traditional self-training methods use confidence thresholding or reweighting to select reliable pseudo-labels. For example, Sohn et al. [57] select pseudo-labels with softmax value and Long et al. [37] add entropy reweighting to rely on examples with more confidence prediction. However, the output of deep networks is usually miscalibrated [25], and is not necessarily related to the ground-truth confidence even on the same distribution. In domain adaptation, as shown in Section 2.1, the discrepancy between the source and target domains makes pseudo-labels even more unreliable, and the performance of commonly used selection strategies is also unsatisfactory. Another drawback is the expensive tweaking in order to find the optimal confidence threshold for new tasks. To better apply self-training to domain adaptation, we expect that the model can gradually refine the pseudo-labels by itself without the cumbersome selection or thresholding.
81
+
82
+ Reverse Step. We design a complementary step with the following insights to improve self-training. Intuitively, the labels on the source domain contain both useful information that can transfer to the target domain and harmful information that can make pseudo-labels incorrect. Similarly, reliable pseudo-labels on the target domain can transfer to the source domain in turn, while models trained with incorrect pseudo-labels on the target domain cannot transfer to the source domain. In this sense, if we explicitly train the model to make target pseudo-labels informative of the source domain, we can gradually make the pseudo-labels more accurate and learn to generalize to the target domain.
83
+
84
+ Specifically, with the pseudo-labels $y ^ { \prime }$ generated by the source classifier $\theta _ { s }$ at hand as in equation 3, we train a target head $\hat { \theta } _ { t } ( \phi )$ on top of the representation $\phi$ with pseudo-labels on the target domain $\widehat { Q }$
85
+
86
+ $$
87
+ \hat { \theta } _ { t } ( \phi ) = \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { \boldsymbol { x } \sim \hat { \boldsymbol { Q } } } \ell ( f _ { \theta , \phi } ( \boldsymbol { x } ) , y ^ { \prime } ) .
88
+ $$
89
+
90
+ We wish to make the target pseudo-labels informative of the source domain and gradually refine them. To this end, we update the shared feature extractor $\phi$ to predict accurately on the source domain and jointly enforce the target classifier $\hat { \theta } _ { t } ( \phi )$ to perform well on the source domain. This naturally leads to the objective of Cycle Self-Training:
91
+
92
+ $$
93
+ \operatorname* { m i n i m i z e } _ { \theta _ { s } , \phi } L _ { \mathrm { C y c l e } } ( \theta _ { s } , \phi ) : = L _ { \hat { P } } ( \theta _ { s } , \phi ) + L _ { \hat { P } } ( \hat { \theta } _ { t } ( \phi ) , \phi ) .
94
+ $$
95
+
96
+ Bi-level Optimization. The objective in equation 5 relies on the solution $\hat { \theta } _ { t } ( \phi )$ to the objective in equation 4. Thus, CST formulates a bi-level optimization problem. In the inner loop we generate target pseudo-labels with the source classifier (equation 3), and train a target classifier with target pseudo-labels (equation 4). After each inner loop, we update the feature extractor $\phi$ for one step in the outer loop (equation 5), and start a new inner loop again. However, since the inner loop of the optimization in equation 4 only involves the light-weight linear head $\theta _ { t }$ , we propose to calculate the analytical form of $\hat { \theta } _ { t } ( \phi )$ and directly back-propagate to the feature extractor $\phi$ instead of calculating the second-order derivatives as in MAML [18]. The resulting framework is as fast as training two heads jointly. Also note that the solution $\hat { \theta } _ { t } ( \phi )$ relies on $\theta _ { s }$ implicitly through $y ^ { \prime }$ . However, both standard self-training and our implementation use label sharpening, making $y ^ { \prime }$ not differentiable. Thus we follow vanilla self-training and do not consider the gradient of $\hat { \theta } _ { t } ( \phi )$ w.r.t. $y ^ { \prime }$ in the outer loop optimization. We defer the derivation and implementation of bi-level optimization to Appendix B.2.
97
+
98
+ # 3.2 Tsallis Entropy Minimization
99
+
100
+ Gibbs entropy is widely used by existing semi-supervised learning methods to regularize the model output and minimize the uncertainty of predictions on unlabeled data [24]. In this work, we generalize Gibbs entropy to Tsallis entropy [62] in information theory. Suppose the softmax output of a model is $\boldsymbol { y } \in \mathbb { R } ^ { K }$ , then the $\alpha$ -Tsallis entropy is defined as
101
+
102
+ $$
103
+ S _ { \alpha } ( y ) = \frac { 1 } { \alpha - 1 } \left( 1 - \sum y _ { [ i ] } ^ { \alpha } \right) ,
104
+ $$
105
+
106
+ where $\alpha > 0$ is the entropic-index. Note that $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \to 1 } S _ { \alpha } ( y ) = \sum _ { i } - y _ { [ i ] } \mathrm { l o g } ( y _ { [ i ] } ) } \end{array}$ which exactly recovers the Gibbs entropy. When $\alpha = 2$ , $S _ { \alpha } ( y )$ becomes the Gini impurity $1 - \textstyle \sum _ { i } y _ { [ i ] } ^ { 2 }$ .
107
+
108
+ We propose to control the uncertainty of target pseudo-labels based on Tsallis entropy minimization:
109
+
110
+ $$
111
+ L _ { \widehat { Q } , \mathrm { T s a l l i s } , \alpha } ( \theta , \phi ) : = \mathbb { E } _ { \boldsymbol { x } \sim \widehat { Q } } S _ { \alpha } ( f _ { \theta , \phi } ( \boldsymbol { x } ) ) .
112
+ $$
113
+
114
+ Figure 3 shows the change of Tsallis entropy with different entropic-indices $\alpha$ for binary problems. Intuitively, smaller $\alpha$ exerts more penalization on uncertain predictions and larger $\alpha$ allows several scores $y _ { i }$ ’s to be similar. This is critical in self-training since an overly small $\alpha$ (as in Gibbs entropy) will make the incorrect dimension of pseudo-labels close to 1 and have no chance to be corrected throughout training. In Section 5.4, we further verify this property with experiments.
115
+
116
+ ![](images/1ee6c84356d7e7a52e7c51e6a8539defd26596a9b539b8488d28b38233853582.jpg)
117
+ Figure 3: Tsallis entropy vs. entropic-index $\alpha$
118
+
119
+ An important improvement of the Tsallis entropy over Gibbs entropy is that it can choose the suitable measure of uncertainty for different systems to avoid over-confidence caused by overly penalizing the uncertain pseudo-labels. To automatically find the suitable $\alpha$ , we adopt a similar strategy as Section 3.1. The intuition is that if we use the suitable entropic-index $\alpha$ to train the source classifier $\theta _ { s , \alpha }$ , the target pseudo-labels generated by $\theta _ { s , \alpha }$ will contain desirable knowledge of the source dataset, i.e. a target classifier $\theta _ { t , \alpha }$ trained with these pseudo-labels will perform well on the source domain. Therefore, we semi-supervisedly train a classifier $\widehat { \theta } _ { s , \alpha }$ on the source domain with the $\alpha$ -Tsallis entropy regularization $L _ { \widehat { Q } , \mathrm { T s a l l i s } , \alpha }$ on the target domain as: $\hat { \theta } _ { s , \alpha } = \arg \operatorname* { m i n } _ { \theta } L _ { \widehat { P } } ( \theta , \phi ) + L _ { \widehat { Q } , \mathrm { T s a l l i s } , \alpha } ( \theta , \phi )$ , from which we obtain the target pseudo-labels. Then we train another head $\widehat { \theta } _ { t , \alpha }$ with target pseudo-labels. We automatically find $\alpha$ by minimizing the loss of $\widehat { \theta } _ { t , \alpha }$ on the source data:
120
+
121
+ $$
122
+ \hat { \alpha } = \underset { \alpha \in [ 1 , 2 ] } { \arg \operatorname* { m i n } } L _ { \widehat { P } } ( \widehat { \theta } _ { t , \alpha } , \phi )
123
+ $$
124
+
125
+ To solve equation 10, we discretize the feasible region [1, 2] of $\alpha$ and use discrete optimization to lower computational cost. We also update $\alpha$ at the start of each epoch, since we found more frequent
126
+
127
+ # Algorithm 1 Cycle Self-Training (CST)
128
+
129
+ 1: Input: source dataset $\widehat { P }$ and target dataset $\widehat { Q }$ .
130
+ 2: for epoch $= 0$ to MaxEpoch do
131
+ 3: Select $\hat { \alpha }$ as equation 10 at the start of each epoch.
132
+ 4: for $t = 0$ to MaxIter do
133
+ 5: Forward Step
134
+ 6: Generate pseudo-labels on the target domain with $\phi$ and $\theta _ { s }$ ${ \mathrm { ~ \mu ~ } } _ { 3 } \colon y ^ { \prime } = \arg \operatorname* { m a x } _ { i } \{ f _ { \theta _ { s } , \phi } ( x ) _ { [ i ] } \}$ .
135
+ 7: Reverse Step
136
+ 8: Train a target head $\hat { \theta } _ { t } ( \phi )$ with target pseudo-labels $y ^ { \prime }$ on the feature extractor $\phi$ :
137
+ $\hat { \theta } _ { t } ( \phi ) = \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { x \sim \hat { Q } } \ell ( f _ { \theta , \phi } ( x ) , y ^ { \prime } ) .$
138
+ 9: Update the feature extractor $\phi$ and the source head $\theta _ { s }$ to make $\hat { \theta } _ { t } ( \phi )$ perform well on the
139
+ source dataset and minimize the $\hat { \alpha }$ -Tsallis entropy on the target dataset:
140
+
141
+ $$
142
+ \begin{array} { r l } & { \phi \phi - \eta \nabla _ { \phi } [ L _ { \widehat { P } } ( \theta _ { s } , \phi ) + L _ { \widehat { P } } ( \widehat { \theta } _ { t } ( \phi ) , \phi ) + L _ { \widehat { Q } , \mathrm { T s a l l i s } , \widehat { \alpha } } ( \theta _ { s } , \phi ) ] . } \\ & { \qquad \theta _ { s } \theta _ { s } - \eta \nabla _ { \theta _ { s } } [ L _ { \widehat { P } } ( \theta _ { s } , \phi ) + L _ { \widehat { Q } , \mathrm { T s a l l i s } , \widehat { \alpha } } ( \theta _ { s } , \phi ) ] . } \end{array}
143
+ $$
144
+
145
+ 10: end for
146
+ 11: end for
147
+
148
+ update leads to no performance gain. Details are deferred to Appendix B.3. Finally, with the optimal $\hat { \alpha }$ found, we add the $\hat { \alpha }$ -Tsallis entropy minimization term $L _ { \widehat { Q } , \mathrm { T s a l l i s } , \widehat { \alpha } }$ to the overall objective:
149
+
150
+ $$
151
+ \operatorname* { m i n i m i z e } _ { \theta _ { s } , \phi } L _ { \mathrm { C y c l e } } ( \theta _ { s } , \phi ) + L _ { \hat { Q } , \mathrm { T s a l l i s } , \hat { \alpha } } ( \theta _ { s } , \phi ) .
152
+ $$
153
+
154
+ In summary, Algorithm 1 depicts the complete training procedure of Cycle Self-Training (CST).
155
+
156
+ # 4 Theoretical Analysis
157
+
158
+ We analyze the properties of CST theoretically. First, we prove that the minimizer of the CST loss $L _ { \mathrm { C S T } } ( f _ { s } , f _ { t } )$ will lead to small target loss $\mathrm { E r r } _ { Q } ( f _ { s } )$ under a simple but realistic expansion assumption. Then, we further demonstrate a concrete instantiation where cycle self-training provably recovers the target ground truth, but both feature adaptation and standard self-training fail. Due to space limit, we state the main results here and defer all proof details to Appendix $A$ .
159
+
160
+ # 4.1 CST Provably Works under the Expansion Assumption
161
+
162
+ We start from a $K$ -way classification model, $f : \mathcal { X } \to [ 0 , 1 ] ^ { K } \in \mathcal { F }$ and ${ \tilde { f } } ( x ) : = \arg \operatorname* { m a x } _ { i } f ( x ) _ { [ i ] }$ denotes the prediction. Denote by $P _ { i }$ the conditional distribution of $P$ given $y = i$ . Assume the supports of $P _ { i }$ and $P _ { j }$ are disjoint for $i \neq j$ . The definition is similar for $Q _ { i }$ . We further Assume $P ( y = i ) = Q ( y = i )$ . For any $x \in \mathcal { X }$ , $\mathcal { N } ( x )$ is defined as the neighboring set of $x$ with a proper metric $d ( \cdot , \cdot )$ $\vert , \mathcal { N } ( x ) = \{ x ^ { \prime } : d ( x , x ^ { \prime } ) \leq \xi \}$ . ${ \mathcal { N } } ( A ) : = \cup _ { x \in A } { \mathcal { N } } ( x )$ . Denote the expected error on the target domain by $\mathrm { E r r } _ { Q } ( f ) : = \mathbb { E } _ { ( x , y ) \sim Q } \mathbb { I } ( \tilde { f } ( x ) \neq y )$ .
163
+
164
+ We study the CST algorithm under the expansion assumption of the mixture distribution [66, 11]. Intuitively, this assumption indicates that the conditional distributions $P _ { i }$ and $Q _ { i }$ are closely located and regularly shaped, enabling knowledge transfer from the source domain to the target domain.
165
+
166
+ Definition 1 $[ q , \epsilon )$ -constant expansion [66]). We say $P$ and $Q$ satisfy $( q , \epsilon )$ -constant expansion for some constant $q , \epsilon \in ( 0 , 1 )$ , if for any set $A \in { \mathcal { X } }$ and any $i \in [ K ]$ with ${ \textstyle \frac { 1 } { 2 } } > P _ { \frac { 1 } { 2 } ( P _ { i } + Q _ { i } ) } ( A ) > q$ , we have $P _ { \frac { 1 } { 2 } ( P _ { i } + Q _ { i } ) } ( { \mathcal { N } } ( A ) \backslash A ) > \operatorname* { m i n } \{ \epsilon , P _ { \frac { 1 } { 2 } ( P _ { i } + Q _ { i } ) } ( A ) \} .$ .
167
+
168
+ Based on this expansion assumption, we consider a robustness-constrained version of CST. Later we will show that the robustness is closely related to the uncertainty. Denote by $f _ { s }$ the source model and $f _ { t }$ the model trained on the target with pseudo-labels. Let $R ( f _ { t } ) : = P _ { \frac { 1 } { 2 } ( P + Q ) } ( \{ x : \exists x ^ { \prime } \in$ $\mathcal { N } ( x ) , \tilde { f } _ { t } ( x ) \neq \tilde { f } _ { t } ( x ^ { \prime } ) \} )$ represent the robustness [66] of $f _ { t }$ on $P$ and $Q$ . Suppose $\mathbb { E } _ { ( x , y ) \sim Q } \mathbb { I } ( \tilde { f } _ { s } ( x ) \neq$ $\tilde { f } _ { t } ( x ) ) \leq c$ and $R ( f _ { t } ) \leq \rho$ . The following theorem states that when $f _ { s }$ and $f _ { t }$ behave similarly on the target domain $Q$ and $f _ { t }$ is robust to local changes in input, the minimizer of the cycle source error $\mathrm { E r r } _ { P } ( f _ { t } )$ will guarantee low error of $f _ { s }$ on the target domain $Q$ .
169
+
170
+ Theorem 1. Suppose Definition 1 holds for $P$ and $Q$ . For any $f _ { s } , f _ { t }$ satisfying $\mathbb { E } _ { ( x , y ) \sim Q } \mathbb { I } ( \tilde { f } _ { s } ( x ) \neq$ $\tilde { f } _ { t } ( x ) ) \leq c$ and $R ( f _ { t } ) \leq \rho _ { : }$ , the expected error of $f _ { s }$ on the target domain $Q$ is bounded,
171
+
172
+ $$
173
+ \mathrm { E r r } _ { Q } ( f _ { s } ) \le \mathrm { E r r } _ { P } ( f _ { t } ) + c + 2 q + \frac { \rho } { \mathrm { m i n } \{ \epsilon , q \} } .
174
+ $$
175
+
176
+ To further relate the expected error with the CST training objective and obtain finite-sample guarantee, we use the multi-class margin loss: $l _ { \gamma } ( f ( x ) , y ) : = \bar { \psi _ { \gamma } } ( - { \cal M } ( f ( x ) , y ) )$ , where $\mathcal { M } ( v , y ) =$ $v _ { [ y ] } - \operatorname* { m a x } _ { y ^ { \prime } \ne y } v _ { [ y ^ { \prime } ] }$ and $\psi _ { \gamma }$ is the ramp function. We then extend the margin loss: $\mathcal { M } ( v ) =$ $\begin{array} { r } { \operatorname* { m a x } _ { y } \big ( v _ { [ y ] } - \operatorname* { m a x } _ { y ^ { \prime } \neq y } v _ { [ y ^ { \prime } ] } \big ) } \end{array}$ (The difference between the largest and the second largest scores in $v )$ , and $\dot { l } _ { \gamma } ( f _ { t } ( x ) , f _ { s } ( x ) ) : = \psi _ { \gamma } ( - \mathcal { M } ( f _ { t } ( x ) , \tilde { f } _ { s } ( x ) ) )$ . Further suppose $f _ { [ i ] }$ is $L _ { f }$ -Lipschitz w.r.t. the metric $d ( \cdot , \cdot )$ and $\tau : = 1 - 2 L _ { f } \xi \operatorname* { m i n } \{ \epsilon , q \} > 0$ . Consider the following training objective for CST, denoted by $L _ { \mathrm { C S T } } ( f _ { s } , f _ { t } )$ , where $\mathcal { L } _ { \widehat { P } , \gamma } ( f _ { t } ) : = \mathbb { E } _ { ( x , y ) \sim \widehat { P } } l _ { \gamma } ( f _ { t } ( x ) , y )$ corresponds to the cycle source loss in equation 5, $L _ { \widehat { Q } , \gamma } ( f _ { t } , f _ { s } ) : = \mathbb { E } _ { ( x , y ) \sim \widehat { Q } } l _ { \gamma } ( f _ { t } ( x ) , f _ { s } ( x ) )$ is consistent with the target loss in equation 4, and $\mathcal { M } ( f _ { t } ( x ) )$ is closely related to the uncertainty of predictions in equation 11.
177
+
178
+ $$
179
+ \operatorname* { m i n } L _ { \mathrm { C S T } } ( f _ { s } , f _ { t } ) : = L _ { \widehat { P } , \gamma } ( f _ { t } ) + L _ { \widehat { Q } , \gamma } ( f _ { t } , f _ { s } ) + \frac { 1 - \mathbb { E } _ { ( x , y ) \sim \frac { 1 } { 2 } ( \widehat { P } + \widehat { Q } ) } \mathcal { M } ( f _ { t } ( x ) ) } { \tau } .
180
+ $$
181
+
182
+ The following theorem shows that the minimizer of the training objective $L _ { \mathrm { C S T } } ( f _ { s } , f _ { t } )$ guarantees low population error of $f _ { s }$ on the target domain $Q$ .
183
+
184
+ Theorem 2. $ { \widehat { \mathcal { R } } } ( \mathcal { F } | _ { { \widehat { P } } } )$ denotes the empirical Rademacher complexity of function class $\mathcal { F }$ on dataset $\widehat { P }$ . For any solution of equation $^ { 1 3 }$ and $\gamma > 0$ , with probability larger than $1 - \delta$ ,
185
+
186
+ $\mathrm { E r r } _ { Q } ( f _ { s } ) \leq L _ { \mathrm { C S T } } ( f _ { s } , f _ { t } ) + 2 q + \frac { 4 K } { \gamma } \left[ \widehat { R } ( \mathcal { F } | _ { \widehat { P } } ) + \widehat { \mathcal { R } } ( \tilde { \mathcal { F } } \times \mathcal { F } | _ { \widehat { Q } } ) \right] + \frac { 2 } { \tau } \left[ \widehat { R } ( \mathcal { F } | _ { \widehat { P } } ) + \widehat { \mathcal { R } } ( \mathcal { F } | _ { \widehat { Q } } ) \right] + \zeta ,$ where $\zeta = O \left( \sqrt { \log ( 1 / \delta ) / n _ { s } } + \sqrt { \log ( 1 / \delta ) / n _ { t } } \right)$ is a low-order term. $\tilde { \mathcal { F } } \times \mathcal { F }$ refers to the function class $\{ x f ( \overleftarrow { x } ) _ { [ \tilde { f } ^ { \prime } ( x ) ] } : f , f ^ { \prime } \in \mathcal { F } \} _ { }$ .
187
+
188
+ Main insights. Theorem 2 justifies CST under the expansion assumption. The generalization error of the classifier $f _ { s }$ on the target domain is bounded with the CST loss objective $L _ { \mathrm { C S T } } ( f _ { s } , f _ { t } )$ , the intrinsic property of the data distribution $q$ , and the complexity of the function classes. In our algorithm, $\bar { L _ { \mathrm { C S T } } } ( f _ { s } , f _ { t } )$ is minimized by the neural networks and $q$ is a constant. The complexity of the function class can be controlled with proper regularization.
189
+
190
+ # 4.2 Hard Case for Feature Adaptation and Standard Self-Training
191
+
192
+ To gain more insight, we study UDA in a quadratic neural network $f _ { \theta , \phi } ( x ) = \theta ^ { \top } ( \phi ^ { \top } x ) ^ { \odot 2 }$ , where $\odot$ is element-wise power. In UDA, the source can have multiple solutions but we aim to learn the one working on the target [34]. We design the underlying distributions $p$ and $q$ in Table 6 to reflect this. Consider the following $P$ and $Q$ . $x _ { [ 1 ] }$ and $x _ { [ 2 ] }$ are sampled i.i.d. from distribution $p$ on $P$ , and from $q$ on $Q$ . For $i \in [ 3 , d ]$ , $x _ { [ i ] } = \sigma _ { i } x _ { [ 2 ] }$ on $P$ and $x _ { [ i ] } = \sigma _ { i } x _ { [ 1 ] }$ on $Q$ . $\sigma _ { i } \in \{ \pm 1 \}$ are i.i.d. and uniform. We also assume realizability: for all $y = x _ { [ 1 ] } ^ { 2 } - x _ { [ 2 ] } ^ { 2 }$ $i \in [ 2 , d ]$ for both source and target. Note that are solutions to $P$ but only $y = x _ { [ 1 ] } ^ { 2 } - x _ { [ 2 ] } ^ { 2 }$ $y = x _ { [ 1 ] } ^ { 2 } - x _ { [ i ] } ^ { 2 }$ [1] [i]works on $Q$ . We visualize this specialized setting in Figure 4.
193
+
194
+ Table 1: The design of $p$ and $q$ .
195
+
196
+ <table><tr><td rowspan=1 colspan=1>Distribution</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>+1</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>Source p</td><td rowspan=1 colspan=1>[0.05</td><td rowspan=1 colspan=1>0.05</td><td rowspan=1 colspan=1>0.90</td></tr><tr><td rowspan=1 colspan=1>Target q</td><td rowspan=1 colspan=1>0.25</td><td rowspan=1 colspan=1>0.25</td><td rowspan=1 colspan=1>0.50</td></tr></table>
197
+
198
+ ![](images/c5b098da78c5868e7858cc364d018d8dfcb55a8acb4b0000cd134653d0e02a42.jpg)
199
+ Figure 4: The hard case where $d = 3$ . Green dots for $y = 1$ , red dots for $y = 0$ , and blue dots for $y = - 1$ . The grey curve is the classification boundary of different features. The good feature $x _ { [ 1 ] } ^ { 2 } - x _ { [ 2 ] } ^ { 2 }$ works on the target domain (shown in (a) and (c)), whereas the spurious feature $x _ { [ 1 ] } ^ { 2 } - x _ { [ 3 ] } ^ { 2 }$ only works on the source domain (shown in (b) andwhile CST learns tion 4.2, we show that feature adaptation and standard self-training learn . $x _ { [ 1 ] } ^ { 2 } - x _ { [ 3 ] } ^ { 2 }$ , $x _ { [ 1 ] } ^ { 2 } - x _ { [ 2 ] } ^ { 2 }$
200
+
201
+ To make the features more tractable, we study the norm-constrained version of the algorithms (details are deferred to Section A.3.2). We compare the features learned by feature adaptation, standard selftraining, and CST. Intuitively, feature adaptation fails because the ideal target solution $y = x _ { [ 1 ] } ^ { 2 } - x _ { [ 2 ] } ^ { 2 }$ has larger distance in the feature space than other spurious solutions y = x2[1] $y = x _ { [ 1 ] } ^ { 2 } - x _ { [ i ] } ^ { 2 }$ x2[i] . Standard selftraining also fails since it will choose randomly among all solutions. In comparison, CST can recover the ground truth, because it can distinguish the spurious solution resulting in bad pseudo-labels. A classifier trained with those pseudo-labels cannot work on the source domain in turn. This intuition is rigorously justified in the following two theorems.
202
+
203
+ Theorem 3. For $\epsilon \in ( 0 , 0 . 5 )$ , the following statements hold for feature adaptation and self-training:
204
+
205
+ • For failure rate $\xi > 0$ , and target dataset size $n _ { t } > \Theta ( \log { \frac { 1 } { \xi } } )$ , with probability at least $1 - \xi$ over the sampling of target data, the solution $( \hat { \theta } _ { \mathrm { F A } } , \hat { \phi } _ { \mathrm { F A } } )$ found by feature adaptation satisfies
206
+
207
+ $$
208
+ \mathrm { E r r } _ { Q } ( \hat { \theta } _ { \mathrm { F A } } , \hat { \phi } _ { \mathrm { F A } } ) \geq \epsilon .
209
+ $$
210
+
211
+ • With probability at least $1 - { \frac { 1 } { d - 1 } }$ , the solution $( \hat { \theta } _ { \mathrm { S T } } , \hat { \phi } _ { \mathrm { S T } } )$ of standard self-training satisfies
212
+
213
+ $$
214
+ \mathrm { E r r } _ { Q } ( \hat { \theta } _ { \mathrm { S T } } , \hat { \phi } _ { \mathrm { S T } } ) \geq \epsilon .
215
+ $$
216
+
217
+ Theorem 4. For failure rate $\xi > 0$ , and target dataset size $\begin{array} { r } { n _ { t } > \Theta ( \log { \frac { 1 } { \xi } } ) } \end{array}$ , with probability at least $1 - \xi ,$ , the solution of $C S T ( \hat { \phi } _ { \mathrm { C S T } } , \hat { \theta } _ { \mathrm { C S T } } )$ recovers the ground truth of the target dataset:
218
+
219
+ $$
220
+ \mathrm { E r r } _ { Q } ( \hat { \theta } _ { \mathrm { C S T } } , \hat { \phi } _ { \mathrm { C S T } } ) = 0 .
221
+ $$
222
+
223
+ # 5 Experiments
224
+
225
+ We test the performance of the proposed method on both vision and language datasets. Cycle SelfTraining (CST) consistently outperforms state-of-the-art feature adaptation and self-training methods. Code is available at https://github.com/Liuhong99/CST.
226
+
227
+ # 5.1 Setup
228
+
229
+ Datasets. We experiment on visual object recognition and linguistic sentiment classification tasks: Office-Home [64] has 65 classes from four kinds of environment with large domain gap: Artistic (Ar), Clip Art (Cl), Product $( \mathbf { P r } )$ , and Real-World (Rw); VisDA-2017 [45] is a large-scale UDA dataset with two domains named Synthetic and Real. The datasets consist of over $2 0 0 \mathrm { k }$ images from 12 categories of objects; Amazon Review [10] is a linguistic sentiment classification dataset of product reviews in four products: Books $\mathbf { ( B ) }$ , DVDs (D), Electronics (E), and Kitchen $\mathbf { \eta } ( \mathbf { K } )$ .
230
+
231
+ Implementation. We use ResNet-50 [26] (pretrained on ImageNet [53]) as feature extractors for vision tasks, and BERT [16] for linguistic tasks. On VisDA-2017, we also provide results of ResNet101 to include more baselines. We use cross-entropy loss for classification on the source domain. When training the target head $\widehat { \theta } _ { t }$ and updating the feature extractor with CST, we use squared loss to get the analytical solution of $\widehat { \theta } _ { t }$ directly and avoid calculating second order derivatives as metalearning [18]. Details on adapting squared loss to multi-class classification are deferred to Appendix B. We adopt SGD with initial learning rate $\eta _ { 0 } = 2 e - 3$ for image classification and $\eta _ { 0 } = 5 e - 4$ for sentiment classification. Following standard protocol in [26], we decay the learning rate by 0.1 each 50 epochs until 150 epochs. We run all the tasks 3 times and report mean and deviation in top-1 accuracy. For VisDA-2017, we report the mean class accuracy. Following Theorem 2, we also enhance CST with sharpness-aware regularization [19] $( \mathbf { C S T + S A M } )$ , which help regularize the Lipschitzness of the function class. Due to space limit, we report mean accuracies in Tables 2 and 3 and defer standard deviation to Appendix C.
232
+
233
+ # 5.2 Baselines
234
+
235
+ We compare with two lines of works in domain adaptation: feature adaptation and self-training. We also compare with more complex state-of-the-arts and create stronger baselines by combining feature adaptation and self-training.
236
+
237
+ Feature Adaptation: DANN [22], MCD [54], CDAN [37] (which improves DANN with pseudolabel conditioning), MDD [73] (which improves previous domain adaptation with margin theory), Implicit Alignment (IA) [28] (which improves MDD to deal with label shift).
238
+
239
+ Self-Training. We include VAT [40], MixMatch [8] and FixMatch [57] in the semi-supervised learning literature as self-training methods. We also compare with self-training methods for UDA: CBST [77], which considers class imbalance in standard self-training, and KLD [78], which improves CBST with label regularization. However, these methods involve tricks specified for convolutional networks. Thus, in sentiment classification tasks where we use BERT backbones, we compare with other consistency regularization baselines: VAT [40], VAT $^ { \cdot } +$ Entropy Minimization.
240
+
241
+ Feature Adaptation $^ +$ Self-Training. DIRT-T [56] combines DANN, VAT, and entropy minimization. We also create more powerful baselines: CDAN $^ +$ VAT $^ +$ Entropy and MDD $+$ Fixmatch.
242
+
243
+ Other SOTA. AFN [69] boosts transferability by large norm. STAR [38] aligns domains with stochastic classifiers. SENTRY [48] selects confident examples with a committee of random augmentations.
244
+
245
+ # 5.3 Results
246
+
247
+ Results on 12 pairs of Office-Home tasks are shown in Table 2. When domain shift is large, standard self-training methods such as VAT and FixMatch suffer from the decay in pseudo-label quality. CST outperforms feature adaptation and self-training methods significantly in 9 out of 12 tasks. Note that CST does not involve manually setting confidence threshold or reweighting.
248
+
249
+ Table 2: Accuracy $( \% )$ on Office-Home for unsupervised domain adaptation (ResNet-50).
250
+
251
+ <table><tr><td>Method</td><td>|Ar-Cl Ar-Pr Ar-Rw Cl-Ar Cl-Pr Cl-Rw Pr-Ar Pr-CIPr-Rw Rw-Ar Rw-Cl Rw-Pr|Avg.</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>DANN [22]</td><td>45.6</td><td>59.3</td><td>70.1</td><td>47.0</td><td>58.5</td><td>60.9</td><td>46.1</td><td>43.7</td><td>68.5</td><td>63.2</td><td>51.8</td><td>76.8</td><td>57.6</td></tr><tr><td>CDAN [37]</td><td>50.7</td><td>70.6</td><td>76.0</td><td>57.6</td><td>70.0</td><td>70.0</td><td>57.4</td><td>50.9</td><td>77.3</td><td>70.9</td><td>56.7</td><td>81.6</td><td>65.8</td></tr><tr><td>CDAN+VAT+Entropy</td><td>52.2</td><td>71.5</td><td>76.4</td><td>61.1</td><td>70.3</td><td>67.8</td><td>59.5</td><td>54.4</td><td>78.6</td><td>73.2</td><td>59.0</td><td>82.7</td><td>67.3</td></tr><tr><td>FixMatch [57]</td><td>51.8</td><td>74.2</td><td>80.1</td><td>63.5</td><td>73.8</td><td>61.3</td><td>64.7</td><td>51.4</td><td>80.0</td><td>73.3</td><td>56.8</td><td>81.7</td><td>67.7</td></tr><tr><td>MDD [73]</td><td>54.9</td><td>73.7</td><td>77.8</td><td>60.0</td><td>71.4</td><td>71.8</td><td>61.2</td><td>53.6</td><td>78.1</td><td>72.5</td><td>60.2</td><td>82.3</td><td>68.1</td></tr><tr><td>MDD+IA [28]</td><td>56.2</td><td>77.9</td><td>79.2</td><td>64.4</td><td>73.1</td><td>74.4</td><td>64.2</td><td>54.2</td><td>79.9</td><td>71.2</td><td>58.1</td><td>83.1</td><td>69.5</td></tr><tr><td>SENTRY [48]</td><td>61.8</td><td>77.4</td><td>80.1</td><td>66.3</td><td>71.6</td><td>74.7</td><td>66.8</td><td>63.0</td><td>80.9</td><td>74.0</td><td>66.3</td><td>84.1</td><td>72.2</td></tr><tr><td>CST</td><td>59.0</td><td>79.6</td><td>83.4</td><td>68.4</td><td>77.1</td><td>76.7</td><td>68.9</td><td>56.4</td><td>83.0</td><td>75.3</td><td>62.2</td><td>85.1</td><td>|73.0</td></tr></table>
252
+
253
+ Table 3: Accuracy $( \% )$ on Multi-Domain Sentiment Dataset for domain adaptation with BERT.
254
+
255
+ <table><tr><td>Method</td><td>B-D</td><td>B-E</td><td>B-K</td><td>D-B</td><td>D-E</td><td>D-K</td><td>E-B</td><td>E-D</td><td>E-K</td><td>K-B</td><td>K-D</td><td></td><td>K-E</td><td>Avg.</td></tr><tr><td>Source-only</td><td>89.7</td><td>88.4</td><td>90.9</td><td>90.1</td><td>88.5</td><td>90.2</td><td>86.9</td><td>88.5</td><td></td><td>91.5</td><td>87.6</td><td>87.3</td><td>91.2</td><td>89.2</td></tr><tr><td>DANN [22]</td><td>90.2</td><td>89.5</td><td>90.9</td><td>91.0</td><td>90.6</td><td>90.2</td><td>87.1</td><td>87.5</td><td></td><td>92.8</td><td>87.8</td><td>87.6</td><td>93.2</td><td>89.9</td></tr><tr><td>VAT[40]</td><td>90.6</td><td>91.0</td><td>91.7</td><td>90.8</td><td>90.8</td><td>92.0</td><td>87.2</td><td>86.9</td><td>92.6</td><td></td><td>86.9</td><td>87.7</td><td>92.9</td><td>90.1</td></tr><tr><td>VAT+Entropy</td><td>90.4</td><td>91.3</td><td>91.5</td><td>91.0</td><td>91.1</td><td>92.4</td><td>87.5</td><td>86.3</td><td>92.4</td><td></td><td>86.5</td><td>87.5</td><td>93.1</td><td>90.1</td></tr><tr><td>MDD [73]</td><td>90.4</td><td>90.4</td><td>91.8</td><td>90.2</td><td>90.9</td><td>91.0</td><td>87.5</td><td>86.3</td><td>92.5</td><td></td><td>89.0</td><td>87.9</td><td>92.1</td><td>90.0</td></tr><tr><td>CST</td><td>91.5</td><td>92.9</td><td>92.6</td><td>91.9</td><td>92.6</td><td>93.5</td><td>90.2</td><td>89.4</td><td></td><td>93.8</td><td>87.9</td><td>88.3</td><td>93.5</td><td>91.5</td></tr></table>
256
+
257
+ Table 4 shows the results on VisDA-2017. CST surpasses state-of-the-arts with ResNet-50 and ResNet101 backbones. We also combine feature adaptation and self-training (DIRT-T, CDAN+VAT+entropy and MDD $^ { + }$ FixMatch) to test if feature adaptation alleviates the negative effect of domain shift in standard self-training. Results indicate that CST is a better solution than simple combination.
258
+
259
+ While most traditional self-training methods include techniques specified for ConvNets such as Mixup [72], CST is a universal method and can directly work on sentiment classification by simply replacing the head and training objective of BERT [16]. In Table 3, most feature adaptation baselines improve over source only marginally, but CST outperforms all baselines on most tasks significantly.
260
+
261
+ # 5.4 Analysis
262
+
263
+ Ablation Study. We study the role of each part of CST in self-training. CST w/o Tsallis removes the Tsallis entropy $L _ { \mathrm { T s a l l i s } , \alpha }$ . CST $+$ Entropy replaces the Tsallis entropy with standard entropy. FixMatch+Tsallis adds $L _ { \mathrm { T s a l l i s } , \alpha }$ to standard self-training. Observations are shown in Table 5. $\mathrm { C S T + l }$ Entropy performs $3 . 7 \%$ worse than CST, indicating that Tsallis entropy is a better regularization for pseudolabels than standard entropy. CST performs $5 . 4 \%$ better than FixMatch, indicating that CST is better adapted to domain shift than standard self-training. While FixMatch+Tsallis outperforms FixMatch, it is still $3 . 6 \%$ behind CST, with much larger total variation distance $d _ { \mathrm { T V } }$ between pseudo-labels and ground-truths, indicating that CST makes pseudo-labels more reliable than standard self-training under domain shift.
264
+
265
+ Table 5: Ablation on VisDA-2017.
266
+
267
+ <table><tr><td>Method</td><td>Accuracy ↑|</td><td>drv↓</td></tr><tr><td>FixMatch [57]</td><td>74.5 ± 0.2</td><td>0.22</td></tr><tr><td>Fixmatch+Tsallis</td><td>76.3 ± 0.8</td><td>0.15</td></tr><tr><td>CST w/o Tsallis</td><td>72.0 ± 0.4</td><td>0.16</td></tr><tr><td>CST+Entropy</td><td>76.2 ± 0.6</td><td>0.20</td></tr><tr><td>CST</td><td>79.9 ± 0.5</td><td>0.12</td></tr></table>
268
+
269
+ Quality of Pseudo-labels. We visualize the error of pseudo-labels during training on VisDA-2017 in Figure 5 (Left). The error of target classifier $\theta _ { t }$ on the source domain decreases quickly in training, when both the error of pseudo-labels (error of $\theta _ { s }$ on $Q$ ) and the total variation (TV) distance between pseudo-labels and ground-truths continue to decay, indicating that CST gradually refines pseudolabels. This forms a clear contrast to standard self-training as visualized in Figure 2 (Middle), where the distance $d _ { \mathrm { T V } }$ remains nearly unchanged throughout training.
270
+
271
+ Comparison of Gibbs entropy and Tsallis entropy. We compare the pseudo-labels learned with standard Gibbs entropy and Tsallis entropy on $\mathbf { A r { } C l }$ with ResNet-50 at epoch 40. We compute the difference between the largest and the second largest softmax scores of each target example and plot the histogram in Figure 5 (Right). Gibbs entropy makes the largest softmax output close to 1, indicating over-confidence. In this case, if the prediction is wrong, it can be hard to correct it using self-training. In contrast, Tsallis entropy allows the largest and the second largest scores to be similar.
272
+
273
+ Table 4: Mean Class Accuracy $( \% )$ for unsupervised domain adaptation on VisDA-2017.
274
+
275
+ <table><tr><td>Method</td><td>ResNet-50</td><td>ResNet-101</td><td>Method</td><td>ResNet-50</td><td>ResNet-101</td></tr><tr><td>DANN [22]</td><td>69.3</td><td>79.5</td><td>CBST[77]</td><td>1</td><td>76.4 ± 0.9</td></tr><tr><td>VAT [40]</td><td>68.0±0.3</td><td>73.4 ± 0.5</td><td>KLD [78]</td><td>1</td><td>78.1 ± 0.2</td></tr><tr><td>DIRT-T [56]</td><td>68.2 ± 0.3</td><td>77.2 ± 0.5</td><td>MDD[73]</td><td>74.6</td><td>81.6 ± 0.3</td></tr><tr><td>MCD [54]</td><td>69.2</td><td>77.7</td><td>AFN [69]</td><td>1</td><td>76.1</td></tr><tr><td>CDAN [37]</td><td>70.0</td><td>80.1</td><td>MDD+IA [28]</td><td>75.8</td><td>1</td></tr><tr><td>CDAN+VAT+Entropy</td><td>76.5 ± 0.5</td><td>80.4± 0.7</td><td>MDD+FixMatch</td><td>77.8 ± 0.3</td><td>82.4 ± 0.4</td></tr><tr><td>MixMatch</td><td>69.3 ± 0.4</td><td>77.0 ± 0.5</td><td>STAR [38]</td><td>1</td><td>82.7</td></tr><tr><td>FixMatch [57]</td><td>74.5 ± 0.2</td><td>79.5 ± 0.3</td><td>SENTRY [48]</td><td>76.7</td><td>1</td></tr><tr><td>CST</td><td>79.9 ± 0.5</td><td>84.8± 0.6</td><td>CST+SAM</td><td>80.6 ± 0.5</td><td>86.5 ± 0.7</td></tr></table>
276
+
277
+ ![](images/b438078399476e8bc688a6c6252f161f15cda1ea9f72241d501cd24f973a4fac.jpg)
278
+ Figure 5: Analysis. Left: Error of pseudo-labels and reverse pseudo-labels. The error of target classifier $\theta _ { t }$ on the source domain decreases, indicating the quality of pseudo-labels is refined. Right: Histograms of the difference between the largest and the second largest softmax scores. Tsallis entropy avoids over-confidence.
279
+
280
+ # 6 Related Work
281
+
282
+ Self-Training. Self-training is a mainstream technique for semi-supervised learning [13]. In this work, we focus on pseudo-labeling [52, 31, 2], which uses unlabeled data by training on pseudo-labels generated by a source model. Other lines of work study consistency regularization [4, 51, 55, 40]. Recent works demonstrate the power of such methods [67, 57, 23]. Equipped with proper training techniques, these methods can achieve comparable results as standard training that uses much more labeled examples [17]. Zoph et al. [76] compare self-training to pre-training and joint training. Vu et al. [65], Mukherjee & Awadallah [42] show that task-level self-training works well in few-shot learning. These methods are tailored to semi-supervised learning or general representation learning and do not take domain shift into consideration explicitly. Wei et al. [66], Frei et al. [20] provide the first nice theoretical analysis of self-training based on the expansion assumption.
283
+
284
+ Domain Adaptation. Inspired by the generalization error bound of Ben-David et al. [7], Long et al. [34], Zellinger et al. [71] minimize distance measures between source and target distributions to learn domain-invariant features. Ganin et al. [22] (DANN) proposed to approximate the domain distance by adversarial learning. Follow-up works proposed various improvement upon DANN [63, 54, 37, 73, 28]. Popular as they are, failure cases exist in situation like label shift [74, 32], shift in support of domains [29], and large discrepancy between source and target [33]. Another line of works try to address domain adaptation with self-training. Shu et al. [56] improves DANN with VAT and entropy minimization. French et al. [21], Zou et al. [78], Li et al. [32] incorporated various semi-supervised learning techniques to boost domain adaptation performance. Kumar et al. [30], Chen et al. [15] and Cai et al. [11] showed self-training provably works in domain adaptation under certain assumptions.
285
+
286
+ # 7 Conclusion
287
+
288
+ We propose cycle self-training in place of standard self-training to explicitly address the distribution shift in domain adaptation. We show that our method provably works under the expansion assumption and demonstrate hard cases for feature adaptation and standard self-training. Self-training (or pseudolabeling) is only one line of works in the semi-supervised learning literature. Future work can delve into the behaviors of other semi-supervised learning techniques including consistency regularization and data augmentation under distribution shift, and exploit them extensively for domain adaptation.
289
+
290
+ # Acknowledgements
291
+
292
+ This work was supported by the National Natural Science Foundation of China under Grants 62022050 and 62021002, Beijing Nova Program under Grant Z201100006820041, China’s Ministry of Industry and Information Technology, the MOE Innovation Plan and the BNRist Innovation Fund.
293
+
294
+ # References
295
+
296
+ [1] Albadawy, E. A., Saha, A., and Mazurowski, M. A. Deep learning for segmentation of brain tumors: Impact of cross-institutional training and testing. Medical Physics, 45(3), 2018.
297
+ [2] Arazo, E., Ortego, D., Albert, P., O’Connor, N. E., and McGuinness, K. Pseudo-labeling and confirmation bias in deep semi-supervised learning. CoRR, abs/1908.02983, 2019.
298
+ [3] Arora, S., Du, S. S., Hu, W., Li, Z., Salakhutdinov, R. R., and Wang, R. On exact computation with an infinitely wide neural net. In NeurIPS, pp. 8141–8150. 2019.
299
+ [4] Bachman, P., Alsharif, O., and Precup, D. Learning with pseudo-ensembles. In NeurIPS, volume 27, pp. 3365–3373, 2014.
300
+ [5] Bartlett, P. L. and Mendelson, S. Rademacher and gaussian complexities: Risk bounds and structural results. JMLR, 3(Nov):463–482, 2002.
301
+ [6] Ben-David, S. and Urner, R. On the hardness of domain adaptation and the utility of unlabeled target samples. In ALT, pp. 139–153, 2012.
302
+ [7] Ben-David, S., Blitzer, J., Crammer, K., Kulesza, A., Pereira, F., and Vaughan, J. W. A theory of learning from different domains. Machine Learning, 79(1-2):151–175, 2010.
303
+ [8] Berthelot, D., Carlini, N., Goodfellow, I., Papernot, N., Oliver, A., and Raffel, C. Mixmatch: A holistic approach to semi-supervised learning. arXiv preprint arXiv:1905.02249, 2019.
304
+ [9] Bertinetto, L., Henriques, J. F., Torr, P., and Vedaldi, A. Meta-learning with differentiable closed-form solvers. In ICLR, 2019.
305
+ [10] Blitzer, J., Dredze, M., and Pereira, F. Biographies, Bollywood, boom-boxes and blenders: Domain adaptation for sentiment classification. In ACL, pp. 440–447, 2007.
306
+ [11] Cai, T., Gao, R., Lee, J. D., and Lei, Q. A theory of label propagation for subpopulation shift, 2021.
307
+ [12] Carlini, N. Poisoning the unlabeled dataset of semi-supervised learning, 2021.
308
+ [13] Chapelle, O., Scholkopf, B., and Zien, A. ¨ Semi-supervised learning. MIT press Cambridge, 2006.
309
+ [14] Chen, C., Xie, W., Huang, W., Rong, Y., Ding, X., Huang, Y., Xu, T., and Huang, J. Progressive feature alignment for unsupervised domain adaptation. In CVPR, pp. 627–636, 2019.
310
+ [15] Chen, Y., Wei, C., Kumar, A., and Ma, T. Self-training avoids using spurious features under domain shift. In NeurIPS, pp. 21061–21071, 2020.
311
+ [16] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL, pp. 4171–4186, 2019.
312
+ [17] Du, J., Grave, E., Gunel, B., Chaudhary, V., Celebi, O., Auli, M., Stoyanov, V., and Conneau, A. Self-training improves pre-training for natural language understanding. In NAACL, pp. 5408–5418, 2021.
313
+ [18] Finn, C., Abbeel, P., and Levine, S. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, pp. 1126–1135, 2017.
314
+ [19] Foret, P., Kleiner, A., Mobahi, H., and Neyshabur, B. Sharpness-aware minimization for efficiently improving generalization. In ICLR, 2021.
315
+ [20] Frei, S., Zou, D., Chen, Z., and Gu, Q. Self-training converts weak learners to strong learners in mixture models. arXiv preprint arXiv:2106.13805, 2021.
316
+ [21] French, G., Mackiewicz, M., and Fisher, M. Self-ensembling for visual domain adaptation. In ICLR, 2018.
317
+ [22] Ganin, Y., Ustinova, E., Ajakan, H., Germain, P., Larochelle, H., Marchand, M., and Lempitsky, V. Domain-adversarial training of neural networks. JMLR, 17(1):2096–2030, 2016.
318
+ [23] Ghiasi, G., Zoph, B., Cubuk, E. D., Le, Q. V., and Lin, T.-Y. Multi-task self-training for learning general representations. In ICCV, pp. 8856–8865, 2021.
319
+ [24] Grandvalet, Y. and Bengio, Y. Semi-supervised learning by entropy minimization. In NeurIPS, pp. 529–536, 2004.
320
+ [25] Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. On calibration of modern neural networks. In ICML, pp. 1321–1330, 2017.
321
+ [26] He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016.
322
+ [27] Hoffman, J., Tzeng, E., Park, T., Zhu, J., Isola, P., Saenko, K., Efros, A. A., and Darrell, T. Cycada: Cycle-consistent adversarial domain adaptation. In ICML, pp. 1994–2003, 2018.
323
+ [28] Jiang, X., Lao, Q., Matwin, S., and Havaei, M. Implicit class-conditioned domain alignment for unsupervised domain adaptation. In ICML, pp. 4816–4827, 2020.
324
+ [29] Johansson, F. D., Sontag, D., and Ranganath, R. Support and invertibility in domain-invariant representations. In AISTATS, pp. 527–536, 2019.
325
+ [30] Kumar, A., Ma, T., and Liang, P. Understanding self-training for gradual domain adaptation. In ICML, pp. 5468–5479, 2020.
326
+ [31] Lee, D.-H. Pseudo-label : The simple and efficient semi-supervised learning method for deep neural networks. ICML Workshop: Challenges in Representation Learning (WREPL), 2013.
327
+ [32] Li, B., Wang, Y., Che, T., Zhang, S., Zhao, S., Xu, P., Zhou, W., Bengio, Y., and Keutzer, K. Rethinking distributional matching based domain adaptation. ArXiv, abs/2006.13352, 2020.
328
+ [33] Liu, H., Long, M., Wang, J., and Jordan, M. Transferable adversarial training: A general approach to adapting deep classifiers. In ICML, volume 97, pp. 4013–4022, 2019.
329
+ [34] Long, M., Cao, Y., Wang, J., and Jordan, M. I. Learning transferable features with deep adaptation networks. In ICML, pp. 97–105, 2015.
330
+ [35] Long, M., Zhu, H., Wang, J., and Jordan, M. I. Unsupervised domain adaptation with residual transfer networks. In NeurIPS, pp. 136–144, 2016.
331
+ [36] Long, M., Zhu, H., Wang, J., and Jordan, M. I. Deep transfer learning with joint adaptation networks. In ICML, pp. 2208–2217, 2017.
332
+ [37] Long, M., Cao, Z., Wang, J., and Jordan, M. I. Conditional adversarial domain adaptation. In NeurIPS, pp. 1640–1650. 2018.
333
+ [38] Lu, Z., Yang, Y., Zhu, X., Liu, C., Song, Y.-Z., and Xiang, T. Stochastic classifiers for unsupervised domain adaptation. In CVPR, pp. 9111–9120, 2020.
334
+ [39] Mey, A. and Loog, M. A soft-labeled self-training approach. In ICPR, 2016.
335
+ [40] Miyato, T., Maeda, S., Ishii, S., and Koyama, M. Virtual adversarial training: A regularization method for supervised and semi-supervised learning. TPAMI, 2018.
336
+ [41] Mohri, M., Rostamizadeh, A., and Talwalkar, A. Foundations of machine learning. MIT press, 2018.
337
+ [42] Mukherjee, S. and Awadallah, A. Uncertainty-aware self-training for few-shot text classification. In NeurIPS, volume 33, pp. 21199–21212, 2020.
338
+ [43] Pan, S. J. and Yang, Q. A survey on transfer learning. TKDE, 22(10):1345–1359, 2010.
339
+ [44] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., and Chintala, S. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, volume 32, pp. 8026–8037, 2019.
340
+ [45] Peng, X., Usman, B., Kaushik, N., Hoffman, J., Wang, D., and Saenko, K. Visda: The visual domain adaptation challenge. CoRR, abs/1710.06924, 2017.
341
+ [46] Peng, X., Bai, Q., Xia, X., Huang, Z., Saenko, K., and Wang, B. Moment matching for multi-source domain adaptation. In ICCV, pp. 1406–1415, 2019.
342
+ [47] Prabhu, V., Khare, S., Kartik, D., and Hoffman, J. Sentry: Selective entropy optimization via committee consistency for unsupervised domain adaptation, 2020.
343
+ [48] Prabhu, V., Khare, S., Kartik, D., and Hoffman, J. Sentry: Selective entropy optimization via committee consistency for unsupervised domain adaptation. In ICCV, pp. 8558–8567, October 2021.
344
+ [49] Qu, X., Zou, Z., Cheng, Y., Yang, Y., and Zhou, P. Adversarial category alignment network for cross-domain sentiment classification. In NAACL, 2019.
345
+ [50] Quionero-Candela, J., Sugiyama, M., Schwaighofer, A., and Lawrence, N. D. Dataset Shift in Machine Learning. The MIT Press, 2009.
346
+ [51] Rasmus, A., Berglund, M., Honkala, M., Valpola, H., and Raiko, T. Semi-supervised learning with ladder networks. In NeurIPS, volume 28, pp. 3546–3554, 2015.
347
+ [52] Rosenberg, C., Hebert, M., and Schneiderman, H. Semi-supervised self-training of object detection models. In WACV, volume 1, pp. 29–36, 2005.
348
+ [53] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., Berg, A. C., and Fei-Fei, L. ImageNet Large Scale Visual Recognition Challenge. IJCV, 115(3):211–252, 2015.
349
+ [54] Saito, K., Watanabe, K., Ushiku, Y., and Harada, T. Maximum classifier discrepancy for unsupervised domain adaptation. In CVPR, pp. 3723–3732, 2018.
350
+ [55] Sajjadi, M., Javanmardi, M., and Tasdizen, T. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In NeurIPS, volume 29, pp. 1163–1171, 2016.
351
+ [56] Shu, R., Bui, H., Narui, H., and Ermon, S. A DIRT-t approach to unsupervised domain adaptation. In ICLR, 2018.
352
+ [57] Sohn, K., Berthelot, D., Carlini, N., Zhang, Z., Zhang, H., Raffel, C. A., Cubuk, E. D., Kurakin, A., and Li, C.-L. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. In NeurIPS, 2020.
353
+ [58] Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., and Fergus, R. Intriguing properties of neural networks. In ICLR, 2014.
354
+ [59] Talagrand, M. Upper and lower bounds for stochastic processes: modern methods and classical problems, volume 60. Springer Science & Business Media, 2014.
355
+ [60] Tan, S., Peng, X., and Saenko, K. Class-imbalanced domain adaptation: An empirical odyssey. In ECCV Workshop, 2020.
356
+ [61] Tarvainen, A. and Valpola, H. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, volume 30, pp. 1195–1204, 2017.
357
+ [62] Tsallis, C. Possible generalization of boltzmann-gibbs statistics. Journal of Statistical Physics, 52(1-2):479–487, 1988.
358
+ [63] Tzeng, E., Hoffman, J., Saenko, K., and Darrell, T. Adversarial discriminative domain adaptation. In CVPR, pp. 7167–7176, 2017.
359
+ [64] Venkateswara, H., Eusebio, J., Chakraborty, S., and Panchanathan, S. Deep hashing network for unsupervised domain adaptation. In CVPR, pp. 5018–5027, 2017.
360
+ [65] Vu, T., Luong, M.-T., Le, Q. V., Simon, G., and Iyyer, M. Strata: Self-training with task augmentation for better few-shot learning. arXiv preprint arXiv:2109.06270, 2021.
361
+ [66] Wei, C., Shen, K., Yining, C., and Ma, T. Theoretical analysis of self-training with deep networks on unlabeled data. In ICLR, 2021.
362
+ [67] Xie, Q., Luong, M. T., Hovy, E., and Le, Q. V. Self-training with noisy student improves imagenet classification. In CVPR, 2020.
363
+ [68] Xie, S. M., Kumar, A., Jones, R., Khani, F., Ma, T., and Liang, P. In-n-out: Pre-training and self-training using auxiliary information for out-of-distribution robustness. In ICLR, 2021.
364
+ [69] Xu, R., Li, G., Yang, J., and Lin, L. Larger norm more transferable: An adaptive feature norm approach for unsupervised domain adaptation. In ICCV, 2019.
365
+ [70] Yosinski, J., Clune, J., Bengio, Y., and Lipson, H. How transferable are features in deep neural networks? In NeurIPS, pp. 3320–3328. 2014.
366
+ [71] Zellinger, W., Grubinger, T., Lughofer, E., Natschlager, T., and Saminger-Platz, S. Central ¨ moment discrepancy (CMD) for domain-invariant representation learning. In ICLR, 2017.
367
+ [72] Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. mixup: Beyond empirical risk minimization. In ICLR, 2018.
368
+ [73] Zhang, Y., Liu, T., Long, M., and Jordan, M. Bridging theory and algorithm for domain adaptation. In ICML, pp. 7404–7413, 2019.
369
+ [74] Zhao, H., Combes, R. T. D., Zhang, K., and Gordon, G. On learning invariant representations for domain adaptation. In ICML, volume 97, pp. 7523–7532, 2019.
370
+ [75] Ziser, Y. and Reichart, R. Pivot based language modeling for improved neural domain adaptation. In NAACL, pp. 1241–1251, 2018.
371
+ [76] Zoph, B., Ghiasi, G., Lin, T.-Y., Cui, Y., Liu, H., Cubuk, E. D., and Le, Q. Rethinking pre-training and self-training. In NeurIPS, volume 33, pp. 3833–3845, 2020.
372
+ [77] Zou, Y., Yu, Z., Vijaya Kumar, B. V. K., and Wang, J. Unsupervised domain adaptation for semantic segmentation via class-balanced self-training. In ECCV, pp. 297–313, 2018.
373
+ [78] Zou, Y., Yu, Z., Liu, X., Kumar, B. V., and Wang, J. Confidence regularized self-training. In ICCV, October 2019.
md/train/33TBJachvOX/33TBJachvOX.md ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # H O W T O C O M PA R E A D V E R S A R I A L R O B U S TN E S S O F C L A S S I F I E R S F R O M A G L O B A L P E R - S P E C T I V E
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # A B S T R A C T
6
+
7
+ Adversarial robustness of machine learning models has attracted considerable attention over recent years. Adversarial attacks undermine the reliability of and trust in machine learning models, but the construction of more robust models hinges on a rigorous understanding of adversarial robustness as a property of a given model. Point-wise measures for specific threat models are currently the most popular tool for comparing the robustness of classifiers and are used in most recent publications on adversarial robustness. In this work, we use robustness curves to show that point-wise measures fail to capture important global properties that are essential to reliably compare the robustness of different classifiers. We introduce new ways in which robustness curves can be used to systematically uncover these properties and provide concrete recommendations for researchers and practitioners when assessing and comparing the robustness of trained models. Furthermore, we characterize scale as a way to distinguish small and large perturbations, and relate it to inherent properties of data sets, demonstrating that robustness thresholds must be chosen accordingly. We hope that our work contributes to a shift of focus away from point-wise measures of robustness and towards a discussion of the question what kind of robustness could and should reasonably be expected. We release code to reproduce all experiments presented in this paper, which includes a Python module to calculate robustness curves for arbitrary data sets and classifiers, supporting a number of frameworks, including TensorFlow, PyTorch and JAX.
8
+
9
+ # 1 I N T R O D U C T I O N
10
+
11
+ Despite their astonishing success in a wide range of classification tasks, deep neural networks can be lead to incorrectly classify inputs altered with specially crafted adversarial perturbations (Szegedy et al. 2014; Goodfellow et al. 2015). These perturbations can be so small that they remain almost imperceptible to human observers (J. P. Göpfert et al. 2020). Adversarial robustness describes a model’s ability to behave correctly under such small perturbations crafted with the intent to mislead the model. The study of adversarial robustness – with its definitions, their implications, attacks, and defenses – has attracted considerable research interest. This is due to both the practical importance of trustworthy models as well as the intellectual interest in the differences between decisions of machine learning models and our human perception. A crucial starting point for any such analysis is the definition of what exactly a small input perturbation is – requiring (a) the choice of a distance function to measure perturbation size, and (b) the choice of a particular scale to distinguish small and large perturbations. Together, these two choices determine a threat model that defines exactly under which perturbations a model is required to be robust.
12
+
13
+ The most popular choice of distance function is the class of distances induced by $\ell _ { p }$ norms (Szegedy et al. 2014; Goodfellow et al. 2015; Carlini, Athalye, et al. 2019), in particular $\ell _ { 1 } , \ell _ { 2 }$ and $\ell _ { \infty }$ , although other choices such as Wasserstein distance have been explored as well (Wong, Schmidt, et al. 2019). Regarding scale, the current default is to pick some perturbation threshold $\varepsilon$ without providing concrete reasons for the exact choice. Analysis then focuses on the robust error of the model, the proportion of test inputs for which the model behaves incorrectly under some perturbation up to size $\varepsilon$ . This means that the scale is defined as a binary distinction between small and large perturbations based on the perturbation threshold. A set of canonical thresholds have emerged in the literature. For example, in the publications referenced in this section, the MNIST data set is typically evaluated at a perturbation threshold $\varepsilon \in \{ 0 . 1 , 0 . 3 \}$ for the $\ell _ { \infty }$ norm, while CIFAR-10 is evaluated at $\varepsilon \in \{ 2 / 2 5 5 , 4 / 2 5 5 , 8 / 2 5 5 \}$ , stemming from the three 8-bit color channels used to represent images.
14
+
15
+ Based on these established threat models, researchers have developed specialized methods to minimize the robust error during training, which results in more robust models. Popular approaches include specific data augmentation, sometimes used under the umbrella term adversarial training (Guo et al. 2017; Madry et al. 2018; Carmon et al. 2019; Hendrycks et al. 2019), training under regularization that encourages large margins and smooth decision boundaries in the learned model (Hein and Andriushchenko 2017; Wong and Kolter 2018; Croce, Andriushchenko, and Hein 2019; Croce and Hein 2020), and post-hoc processing or randomized smoothing of predictions in a learned model (Lecuyer et al. 2019; Cohen et al. 2019).
16
+
17
+ In order to show the superiority of a new method, robust accuracies of differently trained models are typically compared for a handful of threat models and data sets, eg., $\ell _ { \infty } ( \varepsilon = 0 . 1 )$ and $\ell _ { 2 } ( \varepsilon = 0 . 3 )$ for MNIST. Out of 22 publications on adversarial robustness published at NeurIPS 2019, ICLR 2020, and ICML 2020, 12 publications contain results for only a single perturbation threshold. In five publications, robust errors are calculated for at least two different perturbation thresholds, but still, only an arbitrary number of thresholds is considered. Only in five out of the total 22 publications do we find extensive considerations of different perturbation thresholds and the respective robust errors. Out of these five, three are analyses of randomized smoothing, which naturally gives rise to certification radii (B. Li et al. 2019; Carmon et al. 2019; Pinot et al. 2019). Najafi et al. (2019) follow a learning-theoretical motivation, which results in an error bound as a function of the perturbation threshold. Only Maini et al. (2020) do not rely on randomization and still provide a complete, empirical analysis of robust error for varying perturbation thresholds1.
18
+
19
+ Our contributions: In this work, we demonstrate that point-wise measures of $\ell _ { p }$ robustness are not sufficient to reliably and meaningfully compare the robustness of different classifiers. We show that, both in theory and practice, results of model comparisons based on point-wise measures may fail to generalize to threat models with even slightly larger or smaller $\varepsilon$ and that robustness curves avoid this pitfall by design. Furthermore, we show that point-wise measures are insufficient to meaningfully compare the efficacy of different defense techniques when distance functions are varied, and that robustness curves, again, are able to reliably detect and visualize this property. Finally, we analyze how scale depends on the underlying data space, choice of distance function, and distribution. Based on our findings we suggest that robustness curves should become the standard tool when comparing adversarial robustness of classifiers, and that the perturbation threshold of threat models should be selected carefully in order to be meaningful, considering inherent characteristics of the data set. We release code to reproduce all experiments presented in this paper2, which includes a Python module with an easily accessible interface (similar to Foolbox, Rauber et al. (2017)) to calculate robustness curves for arbitrary data sets and classifiers. The module supports classifiers written in most of the popular machine learning frameworks, such as TensorFlow, PyTorch and JAX.
20
+
21
+ # 2 M E T H O D S
22
+
23
+ An adversarial perturbation for a classifier $f$ and input-output pair $( x , y )$ is a small perturbation $\delta$ with $f ( x + \delta ) \neq y$ . Because the perturbation $\delta$ is small, it is assumed that the label $y$ would still be the correct prediction for $x + \delta$ . The resulting point $x + \delta$ is called an adversarial example. The points vulnerable to adversarial perturbations are the points that are either already misclassified when unperturbed, or those that lie close to a decision boundary.
24
+
25
+ One tool to visualize and study the robustness behavior of a classifier are robustness curves, first used by Wong and Kolter (2018) and later formalized by C. Göpfert et al. (2020). A robustness curve captures the distribution of shortest distances between a set of points and the decision boundaries of a classifier:
26
+
27
+ ![](images/2e441453be53fe49f4057fccee418ce82da939e3049ef38ecb9e0ba33b3149ce.jpg)
28
+ Figure 1: Excerpt of a toy data set with two decision boundaries (left) and respective robustness curves (right). The data is separated perfectly by one smooth boundary (blue robustness curve), and one squiggly boundary (orange robustness curve). We indicate margins around the boundaries at distances $\varepsilon$ and $2 \varepsilon$ . Selecting a single perturbation threshold is not sufficient to decide which classifier is more robust.
29
+
30
+ Definition 1. Given an input space $\mathcal { X }$ and label set $\mathcal { V } _ { : }$ , distance function $d$ on $\mathcal { X } \times \mathcal { X }$ , and classifier $f : \mathcal { X } \mathcal { Y } .$ . Assume $( x , y ) \sim _ { i . i . d . } P$ for some distribution $P$ on $\mathcal { X } \times \mathcal { V }$ . Then the $d$ -robustness curve for $f$ is the graph of the function
31
+
32
+ $$
33
+ { R } _ { d } ^ { f } ( \varepsilon ) : = P \left( \{ ( x , y ) s . t . \exists x ^ { \prime } : d ( x , x ^ { \prime } ) \leqslant \varepsilon \land f ( x ^ { \prime } ) \neq y \} \right)
34
+ $$
35
+
36
+ A model’s robustness curve shows how data points are distributed in relation to the decision boundaries of the model, essentially visualizing simultaneously an extremely large number of point-wise measures. This allows us to take a step back from robustness regarding a specific perturbation threshold and instead compare global robustness for different classifiers, distributions and distance functions. To see why this is relevant, consider Figure 1, which shows toy data along with two possible classifiers that perfectly separate the data. For a perturbation threshold of $\varepsilon$ , the blue classifier has robust error 0.5, while the orange classifier is perfectly robust. However, for a perturbation threshold of $2 \varepsilon$ , the orange classifier has robust error 1, while the blue classifier remains at 0.5. By freely choosing a single perturbation threshold for comparison, it is therefore possible to make either classifier appear to be much better than the other, and no single threshold can capture the whole picture. In fact, for any two disjoint sets of perturbation thresholds, it is possible to construct a data distribution and two classifiers $f , f ^ { \prime }$ , such that the robust error of $f$ is lower than that of $f ^ { \prime }$ for all perturbation thresholds in the first set, and that of $f ^ { \prime }$ is lower than that of $f$ for all perturbation thresholds in the second set. See Appendix A for a constructive proof. This shows that even computing multiple point-wise measures to compare two models may give misleading results.
37
+
38
+ # 3 E X P E R I M E N T S
39
+
40
+ In the following, we empirically evaluate the robustness of a number of recently published models, and demonstrate that the weaknesses of point-wise measures described above are not limited to toy examples, but occur for real-world data and models.
41
+
42
+ # 3 . 1 E X P E R I M E N T A L S E T U P
43
+
44
+ We evaluate and compare the robustness of models obtained using the following training methods:
45
+
46
+ 1. Standard training (ST), i. e., training without specific robustness considerations.
47
+ 2. Adversarial training (AT) (Madry et al. 2018).
48
+ 3. Training with robust loss (KW) (Wong and Kolter 2018).
49
+ 4. Maximum margin regularization for a single $\ell _ { p }$ norm together with adversarial training $( \mathrm { M M R } + \mathrm { \mathbb { A } T } )$ (Croce, Andriushchenko, and Hein 2019).
50
+ 5. Maximum margin regularization simultaneously for $\ell _ { \infty }$ and $\ell _ { 1 }$ margins (MMR-UNIV) (Croce and Hein 2020).
51
+
52
+ Table 1: Three point-wise measures for different threat models. All threat models use the $\ell _ { \infty }$ distance function, but differ in choice of perturbation threshold (denoted by $\varepsilon$ ). Each row contains the robust test errors for one point-wise measure. Each column contains the robust test errors for one model, trained with a specific training method (marked by column title). The lower the number, the better the robustness for the specific threat model. Each point-wise measure results in a different relative ordering of the classifiers based on the errors. The order is visualized by different tones of gray in the background of the cells.
53
+
54
+ <table><tr><td>E</td><td>ST</td><td>AT</td><td>KW</td><td>MMR +AT</td><td>MMR-UNIV</td></tr><tr><td>1/255</td><td>0.60</td><td>0.38</td><td>0.43</td><td>0.42</td><td>0.54</td></tr><tr><td>4/255</td><td>0.99</td><td>0.68</td><td>0.57</td><td>0.63</td><td>0.74</td></tr><tr><td>8/255</td><td>1.00</td><td>0.92</td><td>0.73</td><td>0.84</td><td>0.91</td></tr></table>
55
+
56
+ Together with each training method, we state the threat model the trained model is optimized to defend against, eg., $\ell _ { \infty } ( \varepsilon = 0 . 1 )$ for perturbations in $\ell _ { \infty }$ norm with perturbation threshold $\varepsilon = 0 . 1$ , if any. The trained models are those made publicly available by Croce, Andriushchenko, and Hein $( 2 0 1 9 ) ^ { 3 }$ and Croce and Hein $( 2 0 2 0 ) ^ { 4 }$ . The network architecture is a convolutional network with two convolutional layers, two fully connected layers and ReLU activation functions. The evaluation is based on six real-world datasets: MNIST, Fashion-MNIST (FMNIST) (Xiao et al. 2017), German Traffic Signs (GTS) (Houben et al. 2013), CIFAR-10 (Krizhevsky 2009), Tiny-Imagenet200 (TINY-IMG) (F.-F. Li et al. 2016), and Human Activity Recognition (HAR) (Anguita et al. 2013). For specifics on model training (hyperparameters, architecture details), refer to Appendix C. Models are generally trained on the full training set for the corresponding data set, and robustness curves evaluated on the full test set, unless stated otherwise.
57
+
58
+ For complex models, calculating the exact distance of a point to the closest decision boundary, and thus estimating the true robustness curve, is computationally very intensive, if not intractable. Therefore we bound the true robustness curve from below using strong adversarial attacks, which is consistent with the literature on empirical evaluation of adversarial robustness and also applicable to many different types of classifiers. We base our selection of attacks on the recommendations by Carlini, Athalye, et al. (2019). Specifically, we use the $\ell _ { 2 }$ -attack proposed by (Carlini and Wagner 2017) for $\ell _ { 2 }$ robustness curves and PGD (Madry et al. 2018) for $\ell _ { \infty }$ robustness curves. For both attacks, we use the implementations of Foolbox (Rauber et al. 2017). See Appendix C for information on adversarial attack hyperparameters. In the following, “robustness curve” refers to this empirical approximation of the true robustness curve.
59
+
60
+ # 3 . 2 T H E W E A K N E S S E S O F P O I N T - W I S E M E A S U R E S
61
+
62
+ Point-wise measures are used to quantify robustness of classifiers by measuring the robust test error for a specific distance function and a perturbation threshold (eg., $\bar { \ell } _ { \infty } ( \varepsilon = 4 / \bar { 2 } 5 5 ) )$ ). In Table 1 we show three point-wise measures to compare the robustness of five different classifiers on CIFAR-10. If we compare the robustness of the four robust training methods (latter four columns of the table) based on the first point-wise threat model $\ell _ { \infty } ( \varepsilon = 1 / 2 5 5 )$ (first row of the table), we can see that the classifier trained with AT is the most robust, followed by $\mathrm { M M R } + \mathrm { \mathbb { A } T }$ , followed by KW, and MMR-UNIV results in the least robust classifier. However, if we increase the $\varepsilon$ of our threat model to $\varepsilon = 4 / 2 5 5$ (second row of the table), KW is more robust than AT. For a even larger $\varepsilon$ (third row of the table), we would conclude that MMR-UNIV is preferable over AT, and that AT results in the least robust classifier. All three statements are true for the particular perturbation threshold $( \varepsilon )$ , and the magnitude of all perturbation thresholds is reasonable: publications on adversarial robustness typically evaluate CIFAR-10 on perturbation thresholds $\leqslant 1 0 / 2 5 5$ for $\ell _ { \infty }$ perturbations. Meaningful conclusions on the robustness of the classifiers relative to each other can not be made without taking all possible $\varepsilon$ into account. In other words, a global perspective is needed.
63
+
64
+ ![](images/f19bcbff3ca1e3db0c5d5002965f2864e4b210f98ae13ccc89e4c508438c72ca.jpg)
65
+ Figure 2: $\ell _ { \infty }$ robustness curves (left plot) and $\ell _ { 2 }$ robustness curves (right plot) resulting from different training methods (indicated by label), optimized for different threat models (indicated by label). The dashed vertical lines visualize the three point-wise measures from Table 1. The models are trained and evaluated on the full training-/test sets of CIFAR-10. The curves allow us to reliably compare the robustness of the classifiers, unbiased by choice of perturbation threshold.
66
+
67
+ # 3 . 2 . 1 A G L O B A L P E R S P E C T I V E
68
+
69
+ Figure 2 shows the robustness of different classifiers for the $\ell _ { \infty }$ (right plot) and $\ell _ { 2 }$ (left plot) distance functions from a global perspective using robustness curves. The plot reveals why the three pointwise measures (marked by vertical black dashed lines in the left plot) lead to different results in the relative ranking of robustness of the classifiers. Both for the classifiers trained to be robust against attacks in $\ell _ { \infty }$ distance (left plot) and $\ell _ { 2 }$ distance (right plot), we can observe multiple intersections of robustness curves, corresponding to changes in the relative ranking of the robustness of the compared classifiers. The robustness curves allow us to reliably compare the robustness of classifiers for all possible perturbation thresholds. Furthermore, the curves clearly show the perturbation threshold intervals with strong and weak robustness for each classifier, and are not biased by an arbitrarily chosen perturbation threshold.
70
+
71
+ # . 2 . 2 O V E R F I T T I N G T O S P E C I F I C P E R T U R B AT I O N T H R E S H O L D
72
+
73
+ In addition to the problem of robustness curve intersection, relying on point-wise robustness measures to evaluate adversarial robustness is prone to overfitting when designing training procedures. Figure 3 shows $\ell _ { \infty }$ robustness curves for $\mathtt { M M R } + \mathtt { A T }$ with $\ell _ { \infty }$ threat model as provided by Croce, Andriushchenko, and Hein (2019). The models trained on MNIST and FMNIST both show a change in slope, which could be a sign of overfitting to the specific threat models for which the classifiers were optimized for, since the change of slope occurs approximately at the chosen perturbation threshold $\varepsilon$ . This showcases a potential problem with the use of point-wise measures during training. The binary separation of “small” and “large” perturbations based on the perturbation threshold is not sufficient to capture the intricacies of human perception under perturbations, but a simplification based on the idea that perturbations below the perturbation threshold should almost certainly not lead to a change in classification. If a training procedure moves decision boundaries so that data points lie just beyond this threshold, it may achieve a low robust error, without furthering the actual goals of adversarial robustness research. Using robustness curves for evaluation cannot prevent this effect, but can be used to detect it.
74
+
75
+ # . 2 . 3 T R A N S F E R O F R O B U S T N E S S A C R O S S D I S T A N C E F U N C T I O N
76
+
77
+ In the following, we analyze to which extent properties of robustness curves transfer across different choices of distance functions. If properties transfer, it may not be necessary to individually analyze robustness for each distance function.
78
+
79
+ In Figure 4 we compare the robustness of different models for the $\ell _ { \infty }$ (left plot) and $\ell _ { 2 }$ (right plot) distance functions. The difference to Figure 2 is that the models (indicated by colour) are the same models in the left plot and in the right plot. We find that for $\mathtt { M M R } + \mathtt { A T }$ , the $\ell _ { \infty }$ threat model leads to better robustness than the $\ell _ { 2 }$ threat model both for $\ell _ { \infty }$ and $\ell _ { 2 }$ robustness curves. In fact, $\mathtt { M M R } + \mathtt { A T }$ with the $\ell _ { \infty }$ threat model even leads to better $\ell _ { \infty }$ and $\ell _ { 2 }$ robustness curves than MMR-UNIV, which is specifically designed to improve robustness for all $\ell _ { p }$ norms. Overall, the plots are visually similar.
80
+
81
+ ![](images/fb50a0d8e19edada5d7b81e67ca15bd856dc1a21f03714104698d0822ea831db.jpg)
82
+ Figure 3: $\ell _ { \infty }$ robustness curves for multiple data sets. Each curve is calculated for a different model and a different test data set. The data sets are indicated by the labels. The models are trained with $\mathtt { M M R } + \mathtt { A T }$ , Threat Models: MNIST: $\ell _ { \infty } ( \varepsilon = 0 . 1 )$ , FMNIST: $\ell _ { \infty } ( \varepsilon = 0 . 1 )$ , GTS: $\ell _ { \infty } ( \varepsilon = 4 / 2 5 5 )$ , CIFAR-10: $\ell _ { \infty } ( \varepsilon = 2 / 2 5 5 )$ . The curves for MNIST and FMNIST both show a change in slope, which can not be captured with point-wise measures and could be a sign of overfitting to the specific threat models for which the classifiers were optimized for.
83
+
84
+ ![](images/2e2f6a31502e5bf9c310bfcf517937916d9a0f9dd865298922735420400a2590.jpg)
85
+ Figure 4: $\ell _ { \infty }$ robustness curves (left plot) and $\ell _ { 2 }$ robustness curves (right plot) resulting from different training methods (indicated by color and label), optimized for different threat models (indicated by label). The models are trained and evaluated on the full training-/test sets of $\mathtt { C I F A R - 1 0 }$ . The curves allow us to reliably compare the transfer of robustness of the classifiers across distance functions, unbiased by choice of threat model.
86
+
87
+ However, since both plots contain multiple robustness curve intersections, the ranking of methods remains sensitive to the choice of perturbation threshold. For example, a perturbation threshold of $\varepsilon = 3 / 2 5 5$ (vertical black dashed line) for the $\ell _ { \infty }$ distance function (left subplot) shows that the classifier trained with $\mathtt { M M R } + \mathtt { A T }$ $\ell _ { 2 } ( \varepsilon = 0 . 1 ) )$ is approximately as robust as the classifier trained with MMR-UNIV. The same perturbation threshold for the $\ell _ { 2 }$ distance function (right subplot) shows that the classifier trained with $\mathrm { M M R } + \mathrm { \mathbb { A } T }$ is more robust than the classifier trained with MMR-UNIV for $\ell _ { 2 }$ threat models. Using typical perturbation thresholds from the literature for each distance function does not alleviate this issue: At perturbation threshold $\varepsilon = 2 / 2 5 5$ for $\ell _ { \infty }$ distance, the classifier trained with $\mathtt { M M R } + \mathtt { A T }$ $( \ell _ { 2 } ( \varepsilon = 0 . 1 )$ ) is more robust than the one trained with MMR-UNIV, while at perturbation threshold $\varepsilon = 0 . 1$ for $\ell _ { 2 }$ distance, the opposite is true. This shows that even when robustness curves across various distance functions are qualitatively similar, this may be obscured by the choice of threat model(s) to compare on.
88
+
89
+ We also emphasize that in general, robustness curves across various distance functions may be qualitatively dissimilar. In particular:
90
+
91
+ 1. For linear classifiers, the shape of a robustness curve is identical for distances induced by different $\ell _ { p }$ norms. This follows from Theorem 2 in Appendix B, which is an extension of a weaker result in C. Göpfert et al. (2020). For non-linear classifiers, different $\ell _ { p }$ norms may induce different robustness curve shapes. See C. Göpfert et al. (2020) for an example.
92
+ 2. Even for linear classifiers, robustness curve intersections do not transfer between distances induced by different $\ell _ { p }$ norms. That is, for two linear classifiers, there may exist $p , p ^ { \prime }$ such that the robustness curves for the $\ell _ { p }$ distance intersect, but not the robustness curves for the $\ell _ { p ^ { \prime } }$ distance. See Appendix A for an example.
93
+
94
+ ![](images/f5441ce2e54e4bc16b2b3900f3aba15065852b93c73865b0dfcc7d3e74ede670.jpg)
95
+ Figure 5: Minimum inter-class distances of all data sets considered in this work, measured in $\ell _ { \infty }$ (left), $\ell _ { 2 }$ (middle), and $\ell _ { 1 }$ (right) norm. See Table 2 for size and dimensionality. The shapes of the curves and the threshold from which any classifier must necessarily trade of between accuracy and robustness differ strongly between data sets.
96
+
97
+ # 3 . 3 O N T H E R E L AT I O N S H I P B E T W E E N S C A L E A N D D AT A
98
+
99
+ As the previous sections show, robustness curves can be used to reveal properties of robust models that may be obscured by point-wise measures. However, some concept of scale, that is, some way to judge whether a perturbation is small or large, remains necessary. Especially when robustness curves intersect, it is crucial to be able to judge how critical it is for a model to be stable under the given perturbations. For many pairs of distance function and data set, canonical perturbation thresholds have emerged in the literature, but to the best of our knowledge, no reasons for these choices are given.
100
+
101
+ Since the assumption behind adversarial examples is that small perturbations should not affect classification behavior, the question of scale cannot be answered independently of the data distribution. In order to understand how to interpret different perturbation sizes, it can be helpful to understand how strongly the data point would need to be perturbed to actually change the correct classification. We call this the inter-class distance and analyze the distribution of inter-class distances for several popular data sets.
102
+
103
+ In Figure 5 we compare the inter-class distance distributions in $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ norm for all data sets considered in this work. We observe that for the $\ell _ { 1 }$ and $\ell _ { 2 }$ norms, the shape of the curves is similar across data sets, but their extent is determined by the dimensionality of the data space. In the $\ell _ { \infty }$ norm, vastly different curves emerge for the different data sets. We hypothesize that, because the inter-class distance distributions vary more strongly for $\ell _ { \infty }$ distances than for $\ell _ { 1 }$ distances, the results of robustifying a model w. r. t. $\ell _ { \infty }$ distances may depend more strongly on the underlying data distribution than the results of robustifying w. r. t. $\ell _ { 1 }$ distances. This is an interesting avenue for future work.
104
+
105
+ When we look at the smallest inter-class distances in the $\ell _ { \infty }$ norm (where all distances lie in the interval $[ 0 , 1 ] )$ , we can make several observations. Because the smallest inter-class distance for $\mathrm { M N I } \mathrm { S T }$ in the $\ell _ { \infty }$ norm is around 0.9, we can see that transforming an input from one class to one from a different class almost always requires completely flipping at least one pixel from almost-black to almost-white or vice versa. For the other datasets, the inter-class distance distributions are more spread out than the inter-class distance distribution of MNIST. We observe that for CIFAR-10 with $\ell _ { \infty }$ perturbations of size $\geqslant 0 . 2 5$ , it becomes possible to transform samples from different classes into each other, so starting from this threshold, any classifier must necessarily trade off between accuracy and robustness. The shapes of the curves and the threshold from which any classifier must necessarily trade of between accuracy and robustness differ strongly between data sets – refer to Table 2 for exact values for the threshold.
106
+
107
+ In Table 2, we summarize the smallest and largest inter-class distances in different norms together with additional information about the size, number of classes, and dimensionality of the all the data sets we consider in this work. The values correspond directly to Figure 5, but even in this simplified view, we can quickly make out key differences between the data sets. Compare, for example, MNIST and GTS: While it appears reasonable to expect $\ell _ { \infty }$ robustness of 0.3 for MNIST, the same threshold for GTS is not possible. Relating Table 2 and Figure 3, we find entirely plausible the strong robustness results for MNIST, and the small perturbation threshold for GTS. Based on inter-class distances we also expect less $\ell _ { \infty }$ robustness for CIFAR-10 than for FMNIST, but not as seen in Figure 3. In any case, it is safe to say that, when judging the robustness of a model by a certain threshold, that number must be set with respect to the distribution the model operates on.
108
+
109
+ Table 2: Smallest and largest inter-class distances for subsets of several data sets, measured in $l _ { \infty }$ , $l _ { 2 }$ , and $l _ { 1 }$ norm, together with basic contextual information about the data sets. All data has been been normalized to lie within the interval [0, 1], and duplicates and corrupted data points have been removed. Apart from HAR, all data sets contain images – the dimensionality reported specifies their sizes and number of channels.
110
+
111
+ <table><tr><td></td><td></td><td></td><td></td><td colspan="6">Inter-class Distance</td></tr><tr><td>Dataset</td><td>Samples</td><td>Classes</td><td></td><td></td><td>Smallest</td><td></td><td></td><td>Largest</td><td></td></tr><tr><td></td><td></td><td></td><td> Dimensionality</td><td>l8</td><td>l2</td><td>l1</td><td>1</td><td>l2</td><td>l1</td></tr><tr><td>MNIST</td><td>10000</td><td>10</td><td>28×28×1</td><td>0.88</td><td>3.03</td><td>19.16</td><td>1.00</td><td>10.18</td><td>132.38</td></tr><tr><td>TINY-IMG FMNIST</td><td>98139 10000</td><td>200 10</td><td>64 × 64×3</td><td>0.27</td><td>5.24</td><td>369.29</td><td>0.71</td><td>47.49</td><td>4184.37</td></tr><tr><td>GTS</td><td>10000</td><td>43</td><td>28 × 28 ×1 32 × 32 × 3</td><td>0.36 0.07</td><td>2.00 0.90</td><td>24.87 31.46</td><td>1.00 0.62</td><td>10.70 19.54</td><td>194.29 833.22</td></tr><tr><td>CIFAR-10</td><td>10000</td><td>10</td><td>32 × 32 × 3</td><td>0.27</td><td>3.61</td><td>130.77</td><td>0.70</td><td>18.57</td><td>831.44</td></tr><tr><td>HAR</td><td>2947</td><td>6</td><td></td><td>0.26</td><td>1.26</td><td>12.95</td><td>0.87</td><td>4.29</td><td>73.19</td></tr><tr><td></td><td></td><td></td><td>561</td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
112
+
113
+ Overall, the strong dependence of robustness curves on the data set and the chosen norm, emphasizes the necessity of informed and conscious decisions regarding robustness thresholds. We provide an easily accessible reference in the form of Table 2, that should prove useful while judging scales in a threat model.
114
+
115
+ # 4 D I S C U S S I O N
116
+
117
+ We have demonstrated that comparisons of robustness of different classifiers using point-wise measures can be heavily biased by the choice of perturbation threshold and distance function of the threat model, and that conclusions about rankings of classifiers with regards to their robustness based on point-wise measures therefore only provide a narrow view of the actual robustness behavior of the classifiers. Further, we have demonstrated different ways of using robustness curves to overcome the shortcomings of point-wise measures, and therefore recommend using them as the standard tool for comparing the robustness of classifiers. Finally, we have demonstrated how suitable perturbation thresholds necessarily depend on the data they pertain to.
118
+
119
+ It is our hope that practitioners and researchers alike will use the methodology proposed in this work, especially when developing and comparing adversarial defenses, and carefully motivate any concrete threat models they might choose, taking into account all available context.
120
+
121
+ Limitations: Computing approximate robustness curves for state-of-the-art classifiers and large data sets is computationally very intensive, due to the need of computing approximate minimal adversarial perturbations with strong adversarial attacks. Developing adversarial attacks which are both strong and fast is an ongoing challenge in the field of adversarial robustness.
122
+
123
+ One way to reduce the computational cost is to approximate the robustness curves by computing a set of point-wise measures. However, since robustness curves may intersect at arbitrarily many points, this may give misleading results. It would be interesting to investigate how closely robustness curves need to be approximated in order to estimate the number of intersections, if any, and their location, with high certainty.
124
+
125
+ Another limitation of our work is the focus on a small group of distance functions (mainly $\ell _ { \infty }$ and $\ell _ { 2 }$ norms). Even though it does intuitively make sense that models should at least be robust against these types of perturbations, a more general evaluation able to consider more distance functions simultaneously could be advantageous.
126
+
127
+ # R E F E R E N C E S
128
+
129
+ Jean-Baptiste Alayrac, Jonathan Uesato, Po-Sen Huang, Alhussein Fawzi, Robert Stanforth, and Pushmeet Kohli (2019). “Are Labels Required for Improving Adversarial Robustness?” In: Advances in Neural Information Processing Systems 32, pp. 12214–12223.
130
+
131
+ Davide Anguita, Alessandro Ghio, Luca Oneto, Xavier Parra, and J Reyes-Ortiz (Jan. 2013). “A Public Domain Dataset for Human Activity Recognition using Smartphones”. In: ESANN.
132
+
133
+ Akhilan Boopathy, Sijia Liu, Gaoyuan Zhang, Cynthia Liu, Pin-Yu Chen, Shiyu Chang, and Luca Daniel (2020). “Proper Network Interpretability Helps Adversarial Robustness in Classification”. en. In: Proceedings of the International Conference on Machine Learning 1.
134
+
135
+ Wieland Brendel, Jonas Rauber, Matthias Kümmerer, Ivan Ustyuzhaninov, and Matthias Bethge (2019). “Accurate, reliable and fast robustness evaluation”. In: Advances in Neural Information Processing Systems 32, pp. 12861–12871.
136
+
137
+ Nicholas Carlini, Anish Athalye, et al. (2019). On Evaluating Adversarial Robustness. arXiv: 1902.06705.
138
+
139
+ Nicholas Carlini and David A. Wagner (2017). “Towards Evaluating the Robustness of Neural Networks”. In: 2017 IEEE Symposium on Security and Privacy (SP). arXiv: 1608.04644.
140
+
141
+ Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C. Duchi (2019). Unlabeled Data Improves Adversarial Robustness. arXiv: 1905.13736.
142
+
143
+ Jeremy Cohen, Elan Rosenfeld, and Zico Kolter (2019). “Certified Adversarial Robustness via Randomized Smoothing”. In: Proceedings of the 36th International Conference on Machine Learning, ICML. Vol. 97, pp. 1310–1320.
144
+
145
+ Francesco Croce, Maksym Andriushchenko, and Matthias Hein (2019). “Provable Robustness of ReLU networks via Maximization of Linear Regions”. In: Proceedings of Machine Learning Research. arXiv: 1810.07481.
146
+
147
+ Francesco Croce, Maksym Andriushchenko, Vikash Sehwag, Nicolas Flammarion, Mung Chiang, Prateek Mittal, and Matthias Hein (2020). “RobustBench: a standardized adversarial robustness benchmark”. In: arXiv preprint arXiv:2010.09670.
148
+
149
+ Francesco Croce and Matthias Hein (2020). “Provable robustness against all adversarial $l _ { p }$ -perturbations for $p \geqslant 1 ^ { \mathfrak { r } }$ . In: International Conference on Learning Representations. arXiv: 1905.11213.
150
+
151
+ Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy (2015). “Explaining and Harnessing Adversarial Examples”. In: 3rd International Conference on Learning Representations. arXiv: 1412.6572.
152
+
153
+ Christina Göpfert, Jan Philip Göpfert, and Barbara Hammer (2020). “Adversarial Robustness Curves”. In: Machine Learning and Knowledge Discovery in Databases. arXiv: 1908.00096.
154
+
155
+ Jan Philip Göpfert, André Artelt, Heiko Wersing, and Barbara Hammer (2020). “Adversarial attacks hidden in plain sight”. In: Symposium on Intelligent Data Analysis. arXiv: 1902.09286.
156
+
157
+ Chuan Guo, Mayank Rana, Moustapha Cisse, and Laurens van der Maaten (2017). Countering Adversarial Images using Input Transformations. arXiv: 1711.00117.
158
+
159
+ Matthias Hein and Maksym Andriushchenko (2017). Formal Guarantees on the Robustness of a Classifier against Adversarial Manipulation. arXiv: 1705.08475.
160
+
161
+ Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song (2019). “Using Self-Supervised Learning Can Improve Model Robustness and Uncertainty”. In: Advances in Neural Information Processing Systems 32, pp. 15663–15674. arXiv: 1901.09960.
162
+
163
+ Sebastian Houben, Johannes Stallkamp, Jan Salmen, Marc Schlipsing, and Christian Igel (2013). “Detection of Traffic Signs in Real-World Images: The German Traffic Sign Detection Benchmark”. In: IJCNN. 1288.
164
+
165
+ Diederik P. Kingma and Jimmy Ba (2014). Adam: A Method for Stochastic Optimization. arXiv: 1412.6980.
166
+
167
+ Alex Krizhevsky (2009). Learning multiple layers of features from tiny images. Tech. rep.
168
+
169
+ M. Lecuyer, V. Atlidakis, R. Geambasu, D. Hsu, and S. Jana (2019). “Certified Robustness to Adversarial Examples with Differential Privacy”. In: 2019 IEEE Symposium on Security and Privacy (SP), pp. 656–672. arXiv: 1802.03471.
170
+
171
+ Guang-He Lee, Yang Yuan, Shiyu Chang, and Tommi Jaakkola (2019). “Tight Certificates of Adversarial Robustness for Randomly Smoothed Classifiers”. In: Advances in Neural Information Processing Systems 32, pp. 4910–4921.
172
+
173
+ Bai Li, Changyou Chen, Wenlin Wang, and Lawrence Carin (2019). “Certified Adversarial Robustness with Additive Noise”. In: Advances in Neural Information Processing Systems 32, pp. 9464–9474.
174
+ Fei-Fei Li, Andrej Karpathy, and Justin Johnson (2016). CS231n: Convolutional Neural Networks for Visual Recognition. [Online; accessed March 28, 2020]. U R L: http://cs231n.stanford.edu/2016/project.html.
175
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu (2018). “Towards Deep Learning Models Resistant to Adversarial Attacks”. In: ICLR. arXiv: 1706.06083.
176
+ Saeed Mahloujifar, Xiao Zhang, Mohammad Mahmoody, and David Evans (2019). “Empirically Measuring Concentration: Fundamental Limits on Intrinsic Robustness”. In: Advances in Neural Information Processing Systems 32, pp. 5209–5220.
177
+ Pratyush Maini, Eric Wong, and Zico Kolter (2020). “Adversarial Robustness Against the Union of Multiple Threat Models”. en. In: Proceedings of the International Conference on Machine Learning 1.
178
+ Chengzhi Mao, Ziyuan Zhong, Junfeng Yang, Carl Vondrick, and Baishakhi Ray (2019). “Metric Learning for Adversarial Robustness”. In: Advances in Neural Information Processing Systems 32, pp. 480–491. arXiv: 1909.00900.
179
+ Amir Najafi, Shin-ichi Maeda, Masanori Koyama, and Takeru Miyato (2019). “Robustness to Adversarial Perturbations in Learning from Incomplete Data”. In: Advances in Neural Information Processing Systems 32, pp. 5541–5551.
180
+ Rafael Pinot, Laurent Meunier, Alexandre Araujo, Hisashi Kashima, Florian Yger, Cedric Gouy-Pailler, and Jamal Atif (2019). “Theoretical evidence for adversarial robustness through randomization”. In: Advances in Neural Information Processing Systems 32, pp. 11838–11848.
181
+ Chongli Qin et al. (2019). “Adversarial Robustness through Local Linearization”. In: Advances in Neural Information Processing Systems 32, pp. 13847–13856.
182
+ Jonas Rauber, Wieland Brendel, and Matthias Bethge (2017). Foolbox: A Python toolbox to benchmark the robustness of machine learning models. arXiv: 1707.04131.
183
+ Leslie Rice, Eric Wong, and Zico Kolter (2020). “Overfitting in adversarially robust deep learning”. en. In: Proceedings of the International Conference on Machine Learning 1.
184
+ Vikash Sehwag, Shiqi Wang, Prateek Mittal, and Suman Jana (2020). HYDRA: Pruning Adversarially Robust Neural Networks. arXiv: 2002.10509 [cs.CV].
185
+ Sahil Singla and Soheil Feizi (2020). “Second-Order Provable Defenses against Adversarial Attacks”. en. In: Proceedings of the International Conference on Machine Learning 1.
186
+ Chuanbiao Song, Kun He, Jiadong Lin, Liwei Wang, and John E. Hopcroft (Apr. 2020). “Robust Local Features for Improving the Generalization of Adversarial Training”. en. In.
187
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus (2014). Intriguing properties of neural networks. arXiv: 1312.6199.
188
+ Florian Tramer and Dan Boneh (2019). “Adversarial Training and Robustness for Multiple Perturbations”. In: Advances in Neural Information Processing Systems 32, pp. 5866–5876.
189
+ Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu (Apr. 2020). “Improving Adversarial Robustness Requires Revisiting Misclassified Examples”. en. In.
190
+ Eric Wong and Zico Kolter (2018). “Provable Defenses against Adversarial Examples via the Convex Outer Adversarial Polytope”. In: Proceedings of the 35th International Conference on Machine Learning. arXiv: 1711.00851.
191
+ Eric Wong, Leslie Rice, and J. Zico Kolter (Apr. 2020). “Fast is better than free: Revisiting adversarial training”. en. In.
192
+ Eric Wong, Frank R. Schmidt, and J. Zico Kolter (2019). “Wasserstein Adversarial Examples via Projected Sinkhorn Iterations”. In: Proceedings of the 36th International Conference on Machine Learning, ICML. Vol. 97. Proceedings of Machine Learning Research, pp. 6808–6817.
193
+ Dongxian Wu, Shu-tao Xia, and Yisen Wang (2020). Adversarial Weight Perturbation Helps Robust Generalization. arXiv: 2004.05884.
194
+ Han Xiao, Kashif Rasul, and Roland Vollgraf (2017). Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms. arXiv: 1708.07747.
195
+
196
+ ![](images/be00d18e3527505ed1703a96b10dbfea1454075cd95a7135371b7d4ce4b8f8bc.jpg)
197
+ Figure 6: Example of a data distribution and two linear classifiers such that the $\ell _ { 2 }$ robustness curves intersect, but not the $\ell _ { \infty }$ robustness curves.
198
+
199
+ Cihang Xie and Alan Yuille (Apr. 2020). “Intriguing Properties of Adversarial Training at Scale”. en. In.
200
+
201
+ Jingfeng Zhang, Xilie Xu, Bo Han, Gang Niu, Lizhen Cui, Masashi Sugiyama, and Mohan Kankanhalli (2020). “Attacks Which Do Not Kill Training Make Adversarial Learning Stronger”. en. In: Proceedings of the International Conference on Machine Learning 1.
202
+
203
+ # A R O B U S T N E S S C U R V E S W I T H A R B I T R A R Y I N T E R S E C T I O N S
204
+
205
+ Theorem 1. Let $T _ { 1 } , T _ { 2 } \subset \mathbb { R } ^ { > 0 }$ be two disjoint finite sets. Then there exists a distribution $P$ on $\mathbb { R } \times \{ 0 , 1 \}$ and two classifiers $c _ { 1 } , c _ { 2 } : \mathbb { R } \{ 0 , 1 \}$ such that $R _ { | \cdot | } ^ { c _ { 1 } } ( t ) < R _ { | \cdot | } ^ { c _ { 2 } } ( t )$ for all $t \in T _ { 1 }$ and $R _ { | \cdot | } ^ { c _ { 1 } } ( t ) > R _ { | \cdot | } ^ { c _ { 2 } } ( t )$ for all $t \in T _ { 2 }$ .
206
+
207
+ Proof. Without loss of generality, assume that $T _ { 1 } = \{ t _ { 1 } , \ldots , t _ { n } \}$ and $T _ { 2 } ~ = ~ \{ t _ { 1 } ^ { \prime } , \ldots , t _ { n } ^ { \prime } \}$ with $t _ { i } ~ < ~ t _ { i } ^ { \prime } < t _ { i + 1 }$ for $i \in \{ 1 , \ldots , n \}$ . We will construct $c _ { 1 } , c _ { 2 }$ such that the robustness curves $R _ { | \cdot | } ^ { c _ { 1 } } ( \cdot ) , R _ { | \cdot | } ^ { c _ { 2 } } ( \cdot )$ intersect at exactly the points $( t _ { i } + t _ { i } ^ { \prime } ) / 2$ and $( t _ { i } + t _ { i + 1 } ^ { \prime } ) / 2$ on the interval $( t _ { 1 } , t _ { n } ^ { \prime } ]$ . Let $d = t _ { n } ^ { \prime }$ and
208
+
209
+ $$
210
+ P \left( - d - \frac { t _ { i } + t _ { i + 1 } ^ { \prime } } { 2 } , 0 \right) = P \left( d + \frac { t _ { i } + t _ { i } ^ { \prime } } { 2 } , 1 \right) = \frac { 2 } { 4 n + 1 }
211
+ $$
212
+
213
+ and
214
+
215
+ $$
216
+ P \left( - d - \frac { t _ { 1 } } { 2 } , 0 \right) = \frac { 1 } { 4 n + 1 } .
217
+ $$
218
+
219
+ Let $c _ { 1 } ( x ) = \mathbb { 1 } _ { x \geqslant - d }$ and $c _ { 2 } ( x ) = \mathbb { 1 } _ { x \geqslant d }$ . Both classifiers have perfect accuracy on $P$ , meaning that $R _ { | \cdot | } ^ { c _ { i } } ( 0 ) = 0$ . The closest point to the decision boundary of $c _ { 1 }$ is $- d - \frac { t _ { 1 } } { 2 }$ with weight 14n+1 , so $\begin{array} { r } { R _ { | \cdot | } ^ { c _ { 1 } } ( \frac { t _ { 1 } } { 2 } ) = \frac { 1 } { 4 n + 1 } } \end{array}$ . The second-closest point is $\begin{array} { r } { - d - \frac { t _ { 1 } + t _ { 2 } ^ { \prime } } { 2 } } \end{array}$ with weight $\frac { 2 } { 4 n + 1 }$ , so $\begin{array} { r } { R _ { | \cdot | } ^ { c _ { 1 } } ( \frac { t _ { 1 } + t _ { 2 } ^ { \prime } } { 2 } ) = \frac { 3 } { 4 n + 1 } } \end{array}$ , the closest point to the deci, the second-closest point is undary of with wei $c _ { 2 }$ t + t1+t012 with weight $\frac { 2 } { 4 n + 1 }$ ,, so Rc2|·| ( t1+t012 ) $d \frac { t _ { 2 } + t _ { 2 } ^ { \prime } } { 2 }$ h 24n+1 , so Rc2|·| ( t2 $\begin{array} { r } { R _ { | \cdot | } ^ { c _ { 2 } } ( \frac { t _ { 2 } + t _ { 2 } ^ { \prime } } { 2 } ) = \frac { 4 } { 4 n + 1 } } \end{array}$ and so on. □
220
+
221
+ Example 1. To see that robustness curve intersections do not transfer between different $\ell _ { p }$ norms, consider the example in Figure 6. The blue and orange linear classifiers both perfectly separate the displayed data. The $\ell _ { \infty }$ robustness curves of the classifiers do not intersect, meaning that the robust error of the blue classifier is always better than that of the orange classifier. In $\ell _ { 2 }$ distance, the robustness curves intersect, so that there is a range of perturbation sizes where the orange classifier has better robust error than the blue classifier.
222
+
223
+ # B R O B U S T N E S S C U RV E D E P E N D E N C E O F S H A P E O N D I S TA N C E F U N C T I O N
224
+
225
+ Theorem 2. Let $f ( x ) = \mathrm { s g n } ( w ^ { T } x + b )$ be a linear classifier. Then the shape of the robustness curve for $f$ regarding an $\ell _ { p }$ norm-induced distance does not depend on the choice of $p$ . It holds that
226
+
227
+ $$
228
+ R _ { \ell _ { p _ { 1 } } } ^ { f } ( \varepsilon ) = R _ { \ell _ { p _ { 2 } } } ^ { f } ( c \cdot \varepsilon ) \quad \forall \varepsilon f o r c = \frac { \| w \| _ { q _ { 1 } } } { \| w \| _ { q _ { 2 } } } , q _ { i } = \frac { p _ { i } } { p _ { i } - 1 } .
229
+ $$
230
+
231
+ Lemma 1. Let $x \in \mathbb { R } ^ { m }$ with $w ^ { T } x + b \neq 0 .$ . Let $p \in [ 1 , \infty ]$ and $q$ such that $\textstyle { \frac { 1 } { p } } + { \frac { 1 } { q } } = 1$ , where we take $\begin{array} { r } { \frac { 1 } { \infty } = 0 } \end{array}$ . Then
232
+
233
+ $$
234
+ \operatorname* { m i n } \{ \| \delta \| _ { p } : \mathrm { s g n } ( w ^ { T } ( x + \delta ) + b ) \neq \mathrm { s g n } ( w ^ { T } x + b ) \} = \frac { | w ^ { T } + b | } { \| w \| _ { q } }
235
+ $$
236
+
237
+ and the minimum is attained by
238
+
239
+ $$
240
+ \delta = \left\{ \begin{array} { l l } { \frac { - w ^ { T } x - b } { \| w \| _ { \infty } } \operatorname { s g n } ( w _ { j } ) e _ { j } , j = \arg \operatorname* { m a x } _ { i } \left| w _ { i } \right| } & { p = 1 } \\ { \frac { - w ^ { T } x - b } { \| w \| _ { q } ^ { q } } ( \operatorname { s g n } ( w _ { i } ) | w _ { i } | ^ { \frac { 1 } { p - 1 } } ) _ { i = 1 } ^ { d } } & { p \in ( 1 , \infty ] . } \end{array} \right.
241
+ $$
242
+
243
+ where $x ^ { \frac { 1 } { \infty - 1 } } = x ^ { 0 } = 1$ and $e _ { j }$ is the $j$ -th unit vector.
244
+
245
+ Proof of Theorem 2. By Hölder’s inequality, for any $\delta$ ,
246
+
247
+ $$
248
+ \sum _ { i = 1 } ^ { m } | w _ { i } \delta _ { i } | \leqslant \| \delta \| _ { p } \| w \| _ { q } .
249
+ $$
250
+
251
+ For $\delta$ such that $\operatorname { s g n } ( w ^ { T } ( x + \delta ) + b ) \neq \operatorname { s g n } ( w ^ { T } x + b )$ it follows that
252
+
253
+ $$
254
+ \| \delta \| _ { p } \geqslant \frac { \sum _ { i = 1 } ^ { m } \left| w _ { i } \delta _ { i } \right| } { \| w \| _ { q } } \geqslant \frac { \left| \sum _ { i = 1 } ^ { m } w _ { i } \delta _ { i } \right| } { \| w \| _ { q } } \geqslant \frac { | w ^ { T } x + b | } { \| w \| ^ { q } } .
255
+ $$
256
+
257
+ Using the identity $q \ = \ { \frac { p } { p - 1 } }$ , it is easy to check that for every $p \in [ 1 , \infty ]$ , with $\delta$ as defined in Equation (3),
258
+
259
+ 1. $w ^ { T } \delta = - w ^ { T } x - b$ , so that $\boldsymbol { w } ^ { T } ( \boldsymbol { x } + \boldsymbol { \delta } ) + \boldsymbol { b } = \boldsymbol { 0 }$ , and
260
+ 2. $\begin{array} { r } { \| \delta \| _ { p } = \frac { | \boldsymbol { w } ^ { T } \boldsymbol { x } + b | } { \| \boldsymbol { w } \| _ { q } } } \end{array}$
261
+
262
+ Item 1 shows that $\delta$ is a feasible point, while Item 2 in combination with Equation (5) shows that $\| \delta \| _ { p }$ is minimal. □
263
+
264
+ Using Lemma 1, we are ready to prove Theorem 2.
265
+
266
+ Proof. By definition,
267
+
268
+ $$
269
+ \begin{array} { r } { R _ { \ell _ { p _ { 1 } } } ^ { f } ( \varepsilon ) = P ( \underbrace { \{ ( x , y ) \mathrm { s . t . } \exists \delta : \| \delta \| _ { p _ { 1 } } \leqslant \varepsilon \land f ( x + \delta ) \neq y \} } _ { \mathcal { R } _ { p _ { 1 } } ( \varepsilon ) } ) . } \end{array}
270
+ $$
271
+
272
+ We can split $\mathcal { R } _ { p _ { 1 } } ( \varepsilon )$ into the disjoint sets
273
+
274
+ $$
275
+ \begin{array} { r } { \underbrace { \left\{ \left( x , y \right) : f ( x ) \neq y \right\} } _ { = M } } \\ { \dot { \cup } \qquad } \\ { \underbrace { \left\{ \left( x , y \right) \mathrm { s . t . } \exists \delta : \| \delta \| _ { p _ { 1 } } \leqslant \varepsilon \wedge y = f ( x ) \neq f ( x + \delta ) \right\} } _ { = B _ { p _ { 1 } } ( \varepsilon ) } . } \end{array}
276
+ $$
277
+
278
+ Choose $q _ { 1 } , q _ { 2 }$ such that $\begin{array} { r } { \frac { 1 } { p _ { i } } + \frac { 1 } { q _ { i } } = 1 } \end{array}$ . By Lemma 1, and using that $f ( x ) = \mathrm { s g n } ( w ^ { T } x + b )$
279
+
280
+ $$
281
+ \begin{array} { r l } & { B _ { p _ { 1 } } ( \varepsilon ) = \{ ( x , y ) : \mathrm { s g n } ( w ^ { T } x + b ) = y \wedge \displaystyle \frac { | w ^ { T } x + b | } { \| w \| _ { q _ { 1 } } } \leqslant \varepsilon \} } \\ & { \qquad = \{ ( x , y ) : \mathrm { s g n } ( w ^ { T } x + b ) = y \wedge \displaystyle \frac { | w ^ { T } x + b | } { \| w \| _ { q _ { 2 } } } \leqslant \frac { \| w \| _ { q _ { 1 } } } { \| w \| _ { q _ { 2 } } } \varepsilon \} } \\ & { \qquad = B _ { p _ { 2 } } \left( \displaystyle \frac { \| w \| _ { q _ { 1 } } } { \| w \| _ { q _ { 2 } } } \varepsilon \right) . } \end{array}
282
+ $$
283
+
284
+ This shows that
285
+
286
+ $$
287
+ \begin{array} { r l } & { R _ { \ell _ { p _ { 1 } } } ^ { f } ( \varepsilon ) = P ( M ) + P ( B _ { p _ { 1 } } ( \varepsilon ) ) } \\ & { \qquad = P ( M ) + P \left( B _ { p _ { 2 } } \left( \frac { \| w \| _ { q _ { 1 } } } { \| w \| _ { q _ { 2 } } } \varepsilon \right) \right) } \\ & { \qquad = R _ { \ell _ { p _ { 2 } } } ^ { f } \left( \frac { \| w \| _ { q _ { 1 } } } { \| w \| _ { q _ { 2 } } } \varepsilon \right) . } \end{array}
288
+ $$
289
+
290
+ # C E X P E R I M E N T A L D E T A I L S
291
+
292
+ # C . 1 M O D E L T R A I N I N G
293
+
294
+ We use the same model architecture as Croce, Andriushchenko, and Hein (2019) and Wong and Kolter (2018). Unless explicitly stated otherwise, the trained models are taken from Croce, Andriushchenko, and Hein (2019). The exact architecture of the model is: Convolutional layer (number of filters: 16, size: $4 \mathbf { x } 4$ , stride: 2), ReLu activation function, convolutional layer (number of filters: 32, size: 4x4, stride: 2), ReLu activation function, fully connected layer (number of units: 100), ReLu activation function, output layer (number of units depends on the number of classes). All models are trained with Adam Optimizer (Kingma and Ba 2014) for 100 epochs, with batch size 128 and a default learning rate of 0.001. More information on the training can be found in the experimental details section of the appendix of Croce, Andriushchenko, and Hein (2019). The trained models are those made publicly available by Croce, Andriushchenko, and Hein (2019)5and Croce and Hein $( 2 0 2 0 ) ^ { 6 }$ .
295
+
296
+ # C . 2 A P P R O X I M AT E D R O B U S T N E S S C U R V E S
297
+
298
+ We use state-of-the-art adversarial attacks to approximate the true minimal distances of input datapoints to the decision boundary of a classifier for our adversarial robustness curves (see Definition 1). We base our selection of attacks on the recommendations of Carlini, Athalye, et al. (2019). Specifically, we use the following attacks: For $\ell _ { 2 }$ robustness curves we use the $\ell _ { 2 }$ -attack proposed by Carlini and Wagner (2017) and for $\ell _ { \infty }$ robustness curves we use PGD (Madry et al. 2018). For both attacks, we use the implementations of Foolbox (Version 2.4) (Rauber et al. 2017). For the $\ell _ { \infty }$ attack, the implementation of Foolbox automatically performs a hyperparameter search over different epsilon and uses the smallest resulting adversarial perturbation. For the rest of the hyperparameters, we use the standard values of the Foolbox implementation. For the $\ell _ { 2 }$ attack, we increase the number of binary search steps that are used to find the optimal tradeoff-constant between distance and confidence from 5 to 10, which we found empirically to improve the results. For the rest of the hyperparameters, we again use the standard values of the Foolbox implementation.
299
+
300
+ # C . 3 C O M P U T AT I O N A L A R C H I T E C T U R E
301
+
302
+ # We executed all programs on an architecture with $2 \mathrm { ~ x ~ }$ Intel Xeon(R) CPU E5-2640 v4 $@$ 2.4 GHz, 2 x Nvidia GeForce GTX 1080 TI 12G and 128 GB RAM.
303
+
304
+ ![](images/9db793b07a403a384bb75869bd85fde777a90dbb40782597b95ccedee7b9665c.jpg)
305
+ Figure 7: Visualization of four images from CIFAR-10 (top row), together with adversarial examples (bottom row), calculated with PGD (Madry et al. 2018) for a model trained with $\mathtt { M M R } + \mathtt { A T }$ , Threat Model: $\ell _ { \infty } ( \varepsilon = 2 / 2 5 5 )$ . The resulting perturbation sizes of the adversarial examples are (from left to right) 17/255, 18/255, 18/255, 18/255. Even for perturbation sizes far greater than popular choices of point-wise measures, adversarial examples can be very hard to detect for humans.
306
+
307
+ ![](images/f15e3749a59206b3693d421521d5f8fae8a027e3ff208893e0c0979ea6a44480.jpg)
308
+ Figure 8: $\ell _ { \infty }$ robustness curves for two state-of-the-art robust models with a large architecture (WideResNet-28-10). The labels indicate the training method (Sehwag2020Hydra: (Sehwag et al. 2020), Wu20Adversarial: (Wu et al. 2020)). The trained models are taken from Croce, Andriushchenko, Sehwag, et al. (2020). The models are trained on the full training set of CIFAR-10, and robustness curves are based on a sample of 1000 points from the test set.
309
+
310
+ # D V I S U A L I Z A T I O N O F A D V E R S A R I A L E X A M P L E S
311
+
312
+ As we pointed out in Section 1, adversarial robustness of classifiers trained on CIFAR-10 is usually evaluated at a perturbation threshold $\varepsilon \in \{ 2 / 2 5 5 , 4 / 2 5 5 , 8 / 2 5 5 \}$ for the $\ell _ { \infty }$ norm. Robustness curves allow us to investigate robustness of classifiers for perturbation thresholds beyond those which are used in the literature. It should not be necessary for the model to be invariant under large perturbations, if these perturbations are clearly perceptible or change the “correct” classification of the input. However, the thresholds that models are currently optimized for are small enough that even larger perturbations may not be perceptible. Figure 7 shows four images of CIFAR-10 (top row), together with adversarial examples (bottom row). With perturbation sizes $\varepsilon \in \{ 1 7 / 2 5 5 , 1 8 / 2 5 5 \}$ , the perturbations are more than two times larger than the biggest perturbation threshold used in the literature, and still almost imperceptible for untrained humans.
313
+
314
+ # E R O B U S T N E S S C U RV E S F O R L A R G E R M O D E L S
315
+
316
+ In Section 3, we demonstrate the usefulness of robustness curves on a small convolutional network architecture used by Croce, Andriushchenko, and Hein (2019). The choice of a small architecture allows us to compute robustness curves for a large number of different defensive strategies with limited computational resources. Figure 8 shows approximate robustness curves for two state-of-theart robust models with a large network architecture (WideResNet-28-10), computed for a sample of
317
+
318
+ 1000 data points from CIFAR-10. Due to the small number of points used, the approximation may be rough, so the following observations should be taken with a grain of salt.
319
+
320
+ 1. Both robust models are indeed much more robust than the model obtained by standard training even for perturbation thresholds that are significantly larger than the threshold of $8 / 2 5 5$ that the models are optimized for. This observation may help decide whether it is worthwhile to stop using a conventionally trained model, sacrificing accuracy for robustness.
321
+ 2. Wu et al. (2020) has slightly worse accuracy than Sehwag et al. (2020) roughly up to perturbation size $1 / 2 5 5$ . This is a trade-off for better accuracy between perturbation sizes $\bar { 4 } / 2 5 5$ and 0.1. From perturbation size 0.1 onward, Sehwag et al. (2020) appears to have slightly better accuracy than Wu et al. (2020). This observation may help decide which of the two robust models is preferable, based on the robustness requirements of a concrete application.
322
+ 3. The gap between the performance of $\mathrm { W u }$ et al. (2020) and Sehwag et al. (2020) is even wider at perturbation size 0.04 than $8 / 2 5 5$ , but overall, the robustness curves of the robust models are quite similar. This observation may help decide whether it is worthwhile to switch from one model to the other, if one of the models is already in use or preferable for other reasons.
md/train/5Ya8PbvpZ9/5Ya8PbvpZ9.md ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BARTSCORE: Evaluating Generated Text as Text Generation
2
+
3
+ Weizhe Yuan Carnegie Mellon University weizhey@cs.cmu.edu
4
+
5
+ Graham Neubig Carnegie Mellon University gneubig@cs.cmu.edu
6
+
7
+ Pengfei Liu ∗ Carnegie Mellon University pliu3@cs.cmu.edu
8
+
9
+ # Abstract
10
+
11
+ A wide variety of NLP applications, such as machine translation, summarization, and dialog, involve text generation. One major challenge for these applications is how to evaluate whether such generated texts are actually fluent, accurate, or effective. In this work, we conceptualize the evaluation of generated text as a text generation problem, modeled using pre-trained sequence-to-sequence models. The general idea is that models trained to convert the generated text to/from a reference output or the source text will achieve higher scores when the generated text is better. We operationalize this idea using BART [32], an encoder-decoder based pre-trained model, and propose a metric BARTSCORE with a number of variants that can be flexibly applied in an unsupervised fashion to evaluation of text from different perspectives (e.g. informativeness, fluency, or factuality). BARTSCORE is conceptually simple and empirically effective. It can outperform existing top-scoring metrics in 16 of 22 test settings, covering evaluation of 16 datasets (e.g., machine translation, text summarization) and 7 different perspectives (e.g., informativeness, factuality). Code to calculate BARTScore is available at https://github.com/neulab/BARTScore, and we have released an interactive leaderboard for meta-evaluation at http: //explainaboard.nlpedia.ai/leaderboard/task-meval/ on the EXPLAINABOARD platform [38], which allows us to interactively understand the strengths, weaknesses, and complementarity of each metric.
12
+
13
+ # 1 Introduction
14
+
15
+ One defining feature of recent NLP models is the use of neural representations trained on raw text, using unsupervised objectives such as language modeling [6,53], or denoising autoencoding [9,32,54]. By learning to predict the words or sentences in natural text, these models simultaneously learn to extract features that not only benefit mainstream NLP tasks such as information extraction [23, 37], question answering [1, 26], text summarization [40, 77] but also have proven effective in development of automatic metrics for evaluation of text generation itself [62, 65]. For example, BERTScore [75] and MoverScore [76] take features extracted by BERT [9] and apply unsupervised matching functions to compare system outputs against references. Other works build supervised frameworks that use the extracted features to learn to rank [56] or regress [62] to human evaluation scores.
16
+
17
+ However, in the context of generation evaluation, one may note that there is a decided disconnect between how models are pre-trained using text generation objectives and how they are used as down-stream feature extractors. This leads to potential under-utilization of the pre-trained model parameters. For example, the output prediction layer is not used at all in this case. This disconnect is particularly striking because of the close connection between the pre-training objectives and the generation tasks we want to evaluate.
18
+
19
+ In this paper, we instead argue for a formulation of evaluation of generated text as a text generation problem, directly evaluating text through the lens of its probability of being generated from or generating other textual inputs and outputs. This is a better match with the underlying pre-training tasks and allows us to more fully take advantage of the parameters learned during the pre-training phase. We solve the modeling problem with a pre-trained sequence-to-sequence (seq2seq) model, specifically BART [32], and devise a metric named BARTSCORE, which has the following characteristics: (1) BARTSCORE is parameter- and data-efficient. Architecturally there are no extra parameters beyond those used in pre-training itself, and it is an unsupervised metric that doesn’t require human judgments to train. (2) BARTSCORE can better support evaluation of generated text from different perspectives (e.g., informativeness, coherence, factuality, $\ S 4$ ) by adjusting the inputs and outputs of the conditional text generation problem, as we demonstrate in $\ S 3 . 2$ . This is in contrast to most previous work, which mostly examines correlation of the devised metrics with output quality from a limited number of perspectives. (3) BARTSCORE can be further enhanced by (i) providing textual prompts that bring the evaluation task closer to the pre-training task, or (ii) updating the underlying model by fine-tuning BART based on downstream generation tasks (e.g., text summarization).
20
+
21
+ Experimentally, we evaluate different variants of BARTSCORE from 7 perspectives on 16 datasets. BARTSCORE achieves the best performance in 16 of 22 test settings against existing top-scoring metrics. Empirical results also show the effectiveness of the prompting strategy supported by BARTSCORE. For example, simply adding the phrase “such as” to the translated text when using BARTSCORE can lead to a $3 \%$ point absolute improvement in correlation on “German-English” machine translation (MT) evaluation. Additional analysis shows that BARTSCORE is more robust when dealing with high-quality texts generated by top-performing systems.
22
+
23
+ # 2 Preliminaries
24
+
25
+ # 2.1 Problem Formulation
26
+
27
+ As stated above, our goal is to assess the quality of generated text [3, 46]. In this work, we focus on conditional text generation (e.g., machine translation), where the goal is to generate a hypothesis $( \boldsymbol { h } = h _ { 1 } , \cdots , h _ { m } )$ based on a given source text $( s = s _ { 1 } , \cdots , s _ { n } )$ . Commonly, one or multiple human-created references $( r = r _ { 1 } , \cdots , r _ { l } )$ are provided to aid this evaluation.
28
+
29
+ # 2.2 Gold-standard Human Evaluation
30
+
31
+ In general, the gold-standard method for evaluating such texts is still human evaluation, where human annotators assess the generated texts’ quality. This evaluation can be done from perspectives, and we list a few common varieties below (all are investigated in $\ S 4$ ):
32
+
33
+ 1. Informativeness (INFO): How well the generated hypothesis captures the key ideas of the source text [18].
34
+ 2. Relevance (REL): How consistent the generated hypothesis is with respect to the source text [19].
35
+ 3. Fluency (FLU): Whether the text has no formatting problems, capitalization errors or obviously ungrammatical sentences (e.g., fragments, missing components) that make the text difficult to read [13].
36
+ 4. Coherence (COH): Whether the text builds from sentence to sentence to a coherent body of information about a topic [7].
37
+ 5. Factuality (FAC): Whether the generated hypothesis contains only statements entailed by the source text [30].
38
+ 6. Semantic Coverage (COV): How many semantic content units from reference texts are covered by the generated hypothesis [49].
39
+ 7. Adequacy (ADE): Whether the output conveys the same meaning as the input sentence, and none of the message is lost, added, or distorted [29].
40
+
41
+ Most existing evaluation metrics were designed to cover a small subset of these perspectives. For example, BLEU [50] aims to capture the adequacy and fluency of translations, while ROUGE [36] was designed to match the semantic coverage metric. Some metrics, particularly trainable ones, can perform evaluation from different perspectives but generally require maximizing correlation with each type of judgment separately [8].
42
+
43
+ ![](images/6dc5bc0e6cf11512055650092647de02eabd130d83aa9f95c1a0baa74e5cfd9f.jpg)
44
+ Figure 1: Evaluation metrics as different tasks, where $s _ { i }$ , $h _ { i }$ and $r _ { j }$ represent source, hypothesis and reference words respectively.
45
+
46
+ As we describe more in $\ S 4$ , BARTSCORE can evaluate text from the great majority of these perspecFactuality Relevance Factuality Relevance tives, significantly expanding its applicability compared to these metrics.
47
+
48
+ # s r2.3 Evaluation as Different Tasks
49
+
50
+ There is a recent trend that leverages neural models for automated evaluation in different ways, as shown in Fig. 1. We first elaborate on their characteristics by highlighting differences in task formulation and evaluation perspectives.
51
+
52
+ T1: Unsupervised Matching. Unsupervised matching metrics aim to measure the semantic equivalence between the reference and hypothesis by using a token-level matching functions in distributed representation space, such as BERTScore [75], MoverScore [76] or discrete string space like ROUGE [35], BLEU [50], CHRF [52]. Although similar matching functions can be used to assess the quality beyond semantic equivalence (e.g, factuality, a relationship between source text and hypothesis), to our knowledge prior research has not attested to the capability of unsupervised matching methods in this regard; we explore this further in our experiments (Tab. 5).
53
+
54
+ T2: Supervised Regression. Regression-based models introduce a parameterized regression layer, which would be learned in a supervised fashion to accurately predict human judgments. Examples include recent metrics BLEURT [62], COMET [56] and traditional metrics like ${ \bar { S } } ^ { 3 }$ [51], VRM [21].
55
+
56
+ T3: Supervised Ranking. Evaluation can also be conceived as a ranking problem, where the main idea is to learn a scoring function that assigns a higher score to better hypotheses than to worse ones. Examples include COMET [56] and BEER [64], where COMET focuses the machine translation task and relies on human judgments to tune parameters in ranking or regression layers, and BEER combines many simple features in a tunable linear model of MT evaluation metrics.
57
+
58
+ T4: Text Generation. In this work, we formulate evaluating generated text as a text generation task from pre-trained language models. The basic idea is that a high-quality hypothesis will be easily generated based on source or reference text or vice-versa. This has not been covered as extensively in previous work, with one notable exception being PRISM [65]. Our work differs from PRISM in several ways: (i) PRISM formulates evaluation as a paraphrasing task, whose definition that two texts are with the same meaning limits its applicable scenarios, like factuality evaluation in text summarization that takes source documents and generated summaries as input whose semantic space are different. (ii) PRISM trained a model from scratch on parallel data while BARTSCORE is based on open-sourced pre-trained seq2seq models. (iii) BARTSCORE supports prompt-based learning [59, 63] which hasn’t been examined in PRISM.
59
+
60
+ # 3 BARTScore
61
+
62
+ # 3.1 Sequence-to-Sequence Pre-trained Models
63
+
64
+ Although pre-trained models differ along different axes, one of the main axes of variation is the training objective, with two main variants: language modeling objectives (e.g., masked language modeling [9]) and seq2seq objectives [54]. In particular, seq2seq pre-trained models are particularly well-suited to conditioned generation tasks since they consist of both an encoder and a decoder, and predictions are made auto-regressively [32]. In this work, we operationalize our idea by using
65
+
66
+ BART [32] as our backbone due to its superior performance in text generation [12, 42, 71]. We also report preliminary experiments comparing BART with T5 [54] and PEGASUS [74] in the Appendix.
67
+
68
+ Given a seq2seq model parameterized by $\theta$ , a source sequence containing $n$ tokens $\mathbf { x } = \{ x _ { 1 } , \cdots , x _ { n } \}$ and a target sequence containing $m$ tokens $\mathbf { y } = \{ y _ { 1 } , \dots , y _ { m } \}$ . We can factorize the generation probability of $\mathbf { y }$ conditioned on $\mathbf { x }$ as follows:
69
+
70
+ $$
71
+ p ( \mathbf { y } | \mathbf { x } , \theta ) = \prod _ { t = 1 } ^ { m } p ( \mathbf { y } _ { t } | \mathbf { y } _ { < t } , \mathbf { x } , \theta )
72
+ $$
73
+
74
+ By exploring these probabilities, we design metrics that can gauge the quality of the generated text.
75
+
76
+ # 3.2 BARTScore
77
+
78
+ The most general form of our proposed BARTSCORE is shown in Eq. 2, where we use the weighted log probability of one text y given another text $\mathbf { x }$ . The weights are used to put different emphasis on different tokens, which can be instantiated using different methods like Inverse Document Frequency (IDF) [25] etc. In our work, we weigh each token equally.2
79
+
80
+ $$
81
+ \mathbf { B A R T S C O R E } = \sum _ { t = 1 } ^ { m } \omega _ { t } \log p ( \mathbf { y } _ { t } | \mathbf { y } _ { < t } , \mathbf { x } , \theta )
82
+ $$
83
+
84
+ Due to its generation task-based formulation and ability to utilize the entirety of BART’s pre-trained parameters, BARTSCORE can be flexibly used in different evaluation scenarios. We specifically present four methods for using BARTSCORE based on different generation directions, which are,
85
+
86
+ • Faithfulness $s \to h$ ): from source document to hypothesis $p ( \boldsymbol { h } | \boldsymbol { s } , \boldsymbol { \theta } )$ . This direction measures how likely it is that the hypothesis could be generated based on the source text. Potential application scenarios are factuality and relevance introduced in $\ S 2 . 2$ . This measure can also be used for estimating measures of the quality of only the target text, such as coherence and fluency $( \ S 2 . 2 )$ .
87
+ • Precision $( r h )$ ): from reference text to system-generated text $p ( \boldsymbol { h } | \boldsymbol { r } , \boldsymbol { \theta } )$ . This direction assesses how likely the hypothesis could be constructed based on the gold reference and is suitable for the
88
+ precision-focused scenario.
89
+ • Recall $( h \to r$ ): from system-generated text to reference text $p ( \pmb { r } | \pmb { h } , \theta )$ . This version quantifies how easily a gold reference could be generated by the hypothesis and is suitable for pyramid-based evaluation (i.e., semantic coverage introduced in $\ S 2 . 2$ ) in summarization task since pyramid score measures fine-grained Semantic Content Units (SCUs) [49] covered by system-generated texts.
90
+ • $\mathcal { F }$ score $( r h$ ): Consider both directions and use the arithmetic average of Precision and Recall ones. This version can be broadly used to evaluate the semantic overlap (informativeness, adequacy detailed in $\ S 2 . 2 \AA ,$ ) between reference texts and generated texts.
91
+
92
+ # 3.3 BARTScore Variants
93
+
94
+ We also investigate two extensions to BARTSCORE: (i) changing $\mathbf { x }$ and $\mathbf { y }$ through prompting, which can bring the evaluation task closer to the pre-training task. (ii) changing $\theta$ by considering different fine-tuning tasks, which can bring the pre-training domain closer to the evaluation task.
95
+
96
+ # 3.3.1 Prompt
97
+
98
+ Prompting is a practice of adding short phrases to the input or output to encourage pre-trained models to perform specific tasks, which has been proven effective in several other NLP scenarios [24,57,58,60,63]. The generative formulation of BARTSCORE makes it relatively easy to incorporate these insights here as well; we name this variant BARTSCORE-PROMPT.
99
+
100
+ Given a prompt of $l$ tokens $\mathbf { z } = \{ z _ { 1 } , \cdots , z _ { l } \}$ , we can either (i) append it to the source text, in which case we get $\mathbf { x } ^ { \prime } = \{ x _ { 1 } , \cdot \cdot \cdot , x _ { n } , \dot { z } _ { 1 } , \cdot \cdot \cdot , z _ { l } \}$ , and calculate the score based on this new source text using Eq.2. or (ii) prepend it to the target text, getting $\mathbf { y } ^ { \prime } = \{ z _ { 1 } , \cdot \cdot \cdot , z _ { l } , y _ { 1 } , \cdot \cdot \cdot , y _ { m } \}$ . Then we can also use Eq.2 given the new target text.
101
+
102
+ # 3.3.2 Fine-tuning Task
103
+
104
+ Different from BERT-based metrics, which typically use classification-based tasks (e.g., natural language inference) [67] to fine-tune, BARTSCORE can be fine-tuned using generation-based tasks, which will make the pre-training domain closer to the evaluation task. In this paper, we explore two downstream tasks. (1) Summarization. We use BART fine-tuned on CNNDM dataset [20], which is available off-the-shelf in Huggingface Transformers [70]. (2) Paraphrasing. We continue fine-tuning BART from (1) on ParaBank2 dataset [22], which contains a large paraphrase collection. We used a random subset of 30,000 data and fine-tuned for one epoch with a batch size of 20 and a learning rate of $5 e ^ { - 5 }$ . We used two 2080Ti GPUs, and the training time is less than one hour.
105
+
106
+ # 4 Experiment
107
+
108
+ This section aims to evaluate the reliability of different automated metrics, which is commonly achieved by quantifying how well different metrics correlate with human judgments using measures (e.g., Spearman Correlation [72]) defined below (§4.1.2).
109
+
110
+ # 4.1 Baselines and Datasets
111
+
112
+ # 4.1.1 Evaluation Metrics
113
+
114
+ We comprehensively examine metrics outlined in $\ S 2 . 3$ , which either require human judgments to train (i.e., supervised metrics): COMET [56], BLEURT [62], or are human judgment-free (i.e., unsupervised): BLEU [50] ROUGE-1 and ROUGE-2, ROUGE-L, CHRF [52], PRISM [65], MoverScore [76], BERTScore [75]. The detailed comparisons of those metrics can be found in Appendix. We use the official code for each metric.
115
+
116
+ # 4.1.2 Measures for Meta Evaluation
117
+
118
+ Pearson Correlation [15] measures the linear correlation between two sets of data. Spearman Correlation [72] assesses the monotonic relationships between two variables. Kendall’s Tau [27] measures the ordinal association between two measured quantities. Accuracy, in our experiments, measures the percentage of correct ranking between factual texts and non-factual texts. We follow previous works in the choices of measures for different datasets to make a fair comparison.
119
+
120
+ # 4.1.3 Datasets
121
+
122
+ The datasets we use are summarized in Tab. 1. We consider three different tasks: summarization (SUM), machine translation (MT), and data-to-text (D2T).
123
+
124
+ Machine Translation We obtain the source language sentences, machine-translated texts and reference texts from the WMT19 metrics shared task [44]. We use the DARR corpus and consider 7 language pairs, which are de-en, fi-en, gu-en, kk-en, lt-en, ru-en, zh-en.
125
+
126
+ Text Summarization (1) REALSumm [4] is a metaevaluation dataset for text summarization which measures pyramid recall of each system-generated summary. (2) SummEval [13] is a collection of human judgments of model-generated summaries on the CNNDM dataset annotated by both expert judges and crowd-source workers. Each system generated summary is gauged through the lens of coherence, consistency, fluency and relevance.3 (3) NeR18 The
127
+
128
+ Table 1: A summary of tasks, datasets, and evaluation perspectives that we have covered in our experiments. Explanation of evaluation perspectives can be found in $\ S 2 . 2$ .
129
+
130
+ <table><tr><td>Tasks</td><td>Datasets</td><td>Eval. Perspectives</td></tr><tr><td rowspan="5">SUM</td><td>REALSUM</td><td>Cov</td></tr><tr><td>SummEval</td><td>COH FAC FLU INFO</td></tr><tr><td>NeR18</td><td>COH FLU REL INFO</td></tr><tr><td>Rank19 QAGS-C QAGS-X</td><td>FAC</td></tr><tr><td>DE FI GU KK IT RU ZH</td><td>ADE FLU</td></tr><tr><td>MT D2T</td><td>BAGEL SFHOT SFRES</td><td>INFO</td></tr></table>
131
+
132
+ NEWSROOM dataset [18] contains 60 articles with summaries generated by 7 different methods are annotated with human scores in terms of coherence, fluency, informativeness, relevance.
133
+
134
+ Factuality (1) Rank19 [14] is used to meta-evaluate factuality metrics. It is a collection of 373 triples of a source sentence with two summary sentences, one correct and one incorrect. (2) QAGS20 [66] collected 235 test outputs on CNNDM dataset from [16] and 239 test outputs on XSUM dataset [47] from BART fine-tuned on XSUM. Sentences in each summary are annotated with correctness scores w.r.t. factuality.
135
+
136
+ Data to Text We consider the following datasets which target utterance generation for spoken dialogue systems. (1) BAGEL [45] provides information about restaurants. (2) SFHOT [69] provides information about hotels in San Francisco. (3) SFRES [69] provides information about restaurants in San Francisco. They contain 202, 398, and 581 samples respectively, each sample consists of one meaning representation, multiple references, and utterances generated by different systems.
137
+
138
+ # 4.2 Setup
139
+
140
+ # 4.2.1 Prompt Design
141
+
142
+ To perform prompting, we first need to find proper prompts within a search space. Instead of considering a large discrete search space $[ 6 3 ] ^ { 4 }$ or continuous search space [34], we use simple heuristics to narrow our search space. In particular, we use manually devised seed prompts and gather paraphrases to construct our prompt set.5 The seed prompts and some examples of paraphrased prompts are shown in Tab. 2. Details are listed in the Appendix.
143
+
144
+ Table 2: Seed prompts and examples of final prompts. “Number” denotes the size of our final prompt set that was acquired from the seed prompts.
145
+
146
+ <table><tr><td>Usage</td><td>Number</td><td colspan="3">Seed</td><td colspan="5">Example</td></tr><tr><td>s→h</td><td>70</td><td></td><td>in summary</td><td>in short,</td><td>in</td><td>word, a</td><td></td><td>to</td><td>sum up</td><td></td></tr><tr><td>h←r</td><td>34</td><td>in</td><td>other words</td><td>to</td><td>rephrase it,</td><td></td><td>that is</td><td>to</td><td>say,</td><td>i.e.</td></tr></table>
147
+
148
+ # 4.2.2 Settings
149
+
150
+ Variants. We consider four variants of BARTSCORE, which are (1) BARTSCORE, which uses the vanilla BART; (2) BARTSCORE-CNN, which uses the BART fine-tuned on the summarization dataset CNNDM; (3) BARTSCORE-CNN-PARA, where BART is first fine-tuned on CNNDM, then fine-tuned on ParaBank2. (4) BARTSCORE-PROMPT, which is enhanced by adding prompts.
151
+
152
+ Selection of Prompts. For the summarization and data-to-text tasks, we use all entries (either all prompts designed for $s h$ or all prompts designed for $h r$ depending on the BARTScore usage chosen) in the prompt set by prefixing the decoder input and getting different generation scores (calculated by Eq.2) for each hypothesis based on different prompts. We finally get the score for one hypothesis by taking the average of all its generation scores using different prompts ( [24]; details about prompt ensembling can be found in the Appendix). For the machine translation task, due to the more expensive computational cost brought by larger text sets, we first use WMT18 [43] as a development set to search for one best prompt and obtain the phrase “Such as”, which is then used for the test language pairs.
153
+
154
+ Selection of BARTScore Usage. Although BARTSCORE can be used in different ways (shown in $\ S 3 . 2 )$ ), in different tasks, they can be chosen based on how targeted evaluation perspectives are defined (described in $\ S 2 . 2 \AA$ ) as well as the types of tasks. Specifically, (i) For those datasets whose gold standard human evaluation are obtained based on recall-based pyramid method, we adopt recall-based BARTSCORE $( h \to r$ ). (ii) For those datasets whose human judgments focus on linguistic quality (coherence, fluency) and factual correctness (factuality), or the source and hypothesis texts are in the same modality (i.e., language), we use faithfulness-based BARTSCORE $s h$ ). (iii) For data-to-text and machine translation tasks, to make a fair comparison, we use BARTSCORE with the F-score version that other existing works [65] have adopted when evaluating generated texts.
155
+
156
+ Table 3: Kendall’s Tau correlation of different metrics on WMT19 dataset. The highest correlation for each language pair achieved by unsupervised method is bold, and the highest correlation overall is underlined. Avg. denotes the average correlation achieved by a metric across all language pairs.
157
+
158
+ <table><tr><td></td><td>de-en</td><td>fi-en</td><td> gu-en</td><td>kk-en</td><td>lt-en</td><td>ru-en</td><td>zh-en</td><td>Avg.</td></tr><tr><td>SUPERVISED METHODS</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BLEURT</td><td>0.174</td><td>0.374</td><td>0.313</td><td>0.372</td><td>0.388</td><td>0.220</td><td>0.436</td><td>0.325</td></tr><tr><td>COMET</td><td>0.219</td><td>0.369</td><td>0.316</td><td>0.378</td><td>0.405</td><td>0.226</td><td>0.462</td><td>0.339</td></tr><tr><td>UNSUPERVISED METHODS</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BLEU</td><td>0.054</td><td>0.236</td><td>0.194</td><td>0.276</td><td>0.249</td><td>0.115</td><td>0.321</td><td>0.206</td></tr><tr><td>CHRF</td><td>0.123</td><td>0.292</td><td>0.240</td><td>0.323</td><td>0.304</td><td>0.177</td><td>0.371</td><td>0.261</td></tr><tr><td>PRISM</td><td>0.199</td><td>0.366</td><td>0.320</td><td>0.362</td><td>0.382</td><td>0.220</td><td>0.434</td><td>0.326</td></tr><tr><td>BERTScore</td><td>0.190</td><td>0.354</td><td>0.292</td><td>0.351</td><td>0.381</td><td>0.221</td><td>0.430</td><td>0.317</td></tr><tr><td>BARTSCORE</td><td>0.156</td><td>0.335</td><td>0.273</td><td>0.324</td><td>0.322</td><td>0.167</td><td>0.389</td><td>0.281</td></tr><tr><td>+CNN</td><td>0.190</td><td>0.365</td><td>0.300</td><td>0.348</td><td>0.384</td><td>0.208</td><td>0.425</td><td>0.317</td></tr><tr><td>+ CNN+Para</td><td>0.205t</td><td>0.370t</td><td>0.316</td><td>0.378t</td><td>0.386†</td><td>0.219</td><td>_0.442t</td><td>0.331</td></tr><tr><td>+ CNN +Para +Prompt</td><td>0.238</td><td>0.374</td><td>0.318</td><td>0.376t</td><td>0.386+</td><td>0.219</td><td>0.447</td><td>0.337</td></tr></table>
159
+
160
+ Table 4: Spearman correlation of different metrics on three human judgement datasets. For promptbased learning, we consider adding prompts to the best-performing BARTSCORE $( \Omega )$ on each dataset. The highest correlation overall for each aspect on each dataset is bold.
161
+
162
+ <table><tr><td rowspan="2"></td><td>REALSumm</td><td colspan="4">SummEval</td><td colspan="4">NeR18</td><td rowspan="2">Avg.</td></tr><tr><td>Cov</td><td>COH</td><td>FAC</td><td>FLU</td><td>INFO</td><td>COH</td><td>FLU</td><td>INFO</td><td>REL</td></tr><tr><td>ROUGE-1</td><td>0.498</td><td>0.167</td><td>0.160</td><td>0.115</td><td>0.326</td><td>0.095</td><td>0.104</td><td>0.130</td><td>0.147</td><td>0.194</td></tr><tr><td>ROUGE-2</td><td>0.423</td><td>0.184</td><td>0.187</td><td>0.159</td><td>0.290</td><td>0.026</td><td>0.048</td><td>0.079</td><td>0.091</td><td>0.165</td></tr><tr><td>ROUGE-L</td><td>0.488</td><td>0.128</td><td>0.115</td><td>0.105</td><td>0.311</td><td>0.064</td><td>0.072</td><td>0.089</td><td>0.106</td><td>0.164</td></tr><tr><td>BERTScore</td><td>0.440</td><td>0.284</td><td>0.110</td><td>0.193</td><td>0.312</td><td>0.147</td><td>0.170</td><td>0.131</td><td>0.163</td><td>0.217</td></tr><tr><td>MoverScore</td><td>0.372</td><td>0.159</td><td>0.157</td><td>0.129</td><td>0.318</td><td>0.161</td><td>0.120</td><td>0.188</td><td>0.195</td><td>0.200</td></tr><tr><td>PRISM</td><td>0.411</td><td>0.249</td><td>0.345</td><td>0.254</td><td>0.212</td><td>0.573</td><td>0.532</td><td>0.561</td><td>0.553</td><td>0.410</td></tr><tr><td>BARTSCORE</td><td>0.441</td><td>0.322†</td><td>0.311</td><td>0.248</td><td>0.264</td><td>0.679†</td><td>0.670t</td><td>0.646†</td><td>0.604t</td><td>0.465</td></tr><tr><td>+ CNN</td><td>0.475</td><td>0.448‡</td><td>0.382†</td><td>0.356t</td><td>0.356t</td><td>0.653†</td><td>0.640t</td><td>0.616†</td><td>0.567</td><td>0.499</td></tr><tr><td>+ CNN+Para</td><td>0.471</td><td>0.424†</td><td>0.401‡</td><td>0.378t</td><td>0.313</td><td>0.657t</td><td>0.652t</td><td>0.614†</td><td>0.562</td><td>0.497</td></tr><tr><td>+Ω+Prompt</td><td>0.488</td><td>0.407</td><td>0.378</td><td>0.338f</td><td>0.368f</td><td>0.701t</td><td>0.679t</td><td>0.686t</td><td>0.620</td><td>0.518</td></tr></table>
163
+
164
+ Significance Tests. To perform rigorous analysis, we adopt the bootstrapping method (p-value $<$ 0.05) [28] for pair-wise significance tests. In all tables, we use $\dagger$ on BARTSCORE if it significantly $( p < 0 . 0 5 )$ outperforms other unsupervised metrics excluding BARTSCORE variants. We use $\ddagger$ on BARTSCORE if it significantly outperforms all other unsupervised metrics including BARTSCORE variants.
165
+
166
+ # 4.3 Experimental Results
167
+
168
+ # 4.3.1 Machine Translation
169
+
170
+ Tab. 3 illustrates Kendall’s Tau correlation of diverse metrics on different language pairs. We can observe that: (1) BARTSCORE enhanced by fine-tuning tasks $\left( \mathrm { C N N + P a r a } \right)$ can significantly outperform all other unsupervised methods on five language pairs and achieve comparable results on the other two. (2) The performance of BARTSCORE can be further improved by simply adding a prompt (i.e., such as) without any other overhead. Notably, on the language pair ${ \tt d e } \mathrm { - } \in \mathrm { n }$ , using the prompt results in a 0.033 improvement, which even significantly surpasses existing state-of-the-art supervised metrics BLEURT and COMET. This suggests a promising future direction for metric design: searching for proper prompts to better leverage knowledge stored in pre-trained language models instead of training on human judgment data [31].
171
+
172
+ # 4.3.2 Text Summarization
173
+
174
+ Tab. 4 shows the meta-evaluation results of different metrics on the summarization task. We can observe that: (1) Simply vanilla BARTSCORE can outperform BERTScore and MoverScore by a large margin on 8 settings except the INFO perspective on SummEval. Strikingly, it achieves improvements of 0.251 and 0.265 over BERTScore and MoverScore respectively. (2) The improvement on REALSum and SummEval datasets can be further improved when introducing fine-tuning tasks. However, fine-tuning does not improve on the NeR18 dataset, likely because this dataset only contains 7 systems with easily distinguishable quality, and vanilla BARTSCORE can already achieve a high level of correlation $( > 0 . 6$ on average). (3) Our prompt combination strategy can consistently improve the performance on informativeness, up to 0.072 Spearman correlation on the NeR18 dataset and 0.055 on SummEval. However, the performance from other perspectives such as fluency and factuality do not show consistent improvements, which we will elaborate on later (§4.4.2).
175
+
176
+ Analysis on Factuality Datasets The goal of these datasets is to judge whether a short generated summary is faithful to the original long documents. As shown in Tab. 5, we observe that (1) BARTSCORE $+ \thinspace C N N$ can almost match human baseline on Rank19 and outperform all other metrics, including the most recent top-performing factuality metrics FactCC and QAGS by a large margin. (2) Using paraphrase as a fine-tuning task will reduce BARTSCORE’s performance, which is reasonable since these two texts (i.e., the summary and document) shouldn’t maintain the paraphrased relationship in general. (3) Introducing prompts does not bring an improvement, even resulting in a performance decrease.
177
+
178
+ Table 5: Results on Rank19 and QAGS datasets. where “Q” represents QAGS. Metrics achieve highest correlation are bold.
179
+
180
+ <table><tr><td></td><td colspan="2">Rank19 Q-CNN</td><td>Q-XSUM</td></tr><tr><td></td><td>Acc.</td><td colspan="2">Pearson</td></tr><tr><td>ROUGE-1</td><td>0.568</td><td>0.338</td><td>-0.008</td></tr><tr><td>ROUGE-2</td><td>0.630</td><td>0.459</td><td>0.097</td></tr><tr><td>ROUGE-L</td><td>0.587</td><td>0.357</td><td>0.024</td></tr><tr><td>BERTScore</td><td>0.713</td><td>0.576</td><td>0.024</td></tr><tr><td>MoverScore</td><td>0.713</td><td>0.414</td><td>0.054</td></tr><tr><td>PRISM</td><td>0.780</td><td>0.479</td><td>0.025</td></tr><tr><td>FactCC [30] QAGS [66]</td><td>0.700 0.721</td><td>1 0.545</td><td>1 0.175</td></tr><tr><td>Human [14] BARTSCORE</td><td>0.839</td><td>1</td><td>1 0.009</td></tr><tr><td>+CNN</td><td>0.684 0.836‡</td><td>0.661† 0.735±</td><td>0.184‡</td></tr><tr><td>+ CNN+Para</td><td></td><td>0.680t</td><td>0.074</td></tr><tr><td></td><td>0.788</td><td></td><td></td></tr><tr><td>+CNN +Prompt</td><td>70.796</td><td>0.719f</td><td>0.094</td></tr></table>
181
+
182
+ # 4.3.3 Data-to-text
183
+
184
+ The experiment results on data-to-text datasets are shown in Tab. 6. We observe that (1) finetuning on the CNNDM dataset can consistently boost the correlation, for example, up to 0.056 gain on BAGEL. (2) Additionally, further finetuning on paraphrase datasets results in even higher performance compared to the version without any fine-tuning, up to 0.083 Spearman correlation on BAGEL dataset. These results surpass all existing top-performing metrics. (3) Our proposed prompt combination strategy can consistently improve correlation, on average 0.028 Spearman correlation. This is consistent with the findings in $\ S 4 . 3 . 2$ that we can improve the aspect of informativeness through proper prompting.
185
+
186
+ Table 6: Results on data-to-text datasets. We report Spearman correlation. Metrics achieve highest correlation are bold.
187
+
188
+ <table><tr><td></td><td>BAGEL</td><td>SFRES</td><td>SFHOT</td><td>Avg.</td></tr><tr><td>ROUGE-1</td><td>0.234</td><td>0.115</td><td>0.118</td><td>0.156</td></tr><tr><td>ROUGE-2</td><td>0.199</td><td>0.116</td><td>0.088</td><td>0.134</td></tr><tr><td>ROUGE-L</td><td>0.189</td><td>0.103</td><td>0.110</td><td>0.134</td></tr><tr><td>BERTScore</td><td>0.289</td><td>0.156</td><td>0.135</td><td>0.193</td></tr><tr><td>MoverScore</td><td>0.284</td><td>0.153</td><td>0.172</td><td>0.203</td></tr><tr><td>PRISM</td><td>0.305</td><td>0.155</td><td>0.196</td><td>0.219</td></tr><tr><td>BARTSCORE</td><td>0.247</td><td>0.164†</td><td>0.158</td><td>0.190</td></tr><tr><td>+ CNN</td><td>0.303</td><td>0.191†</td><td>0.190</td><td>0.228</td></tr><tr><td>+ CNN+Para</td><td>0.330t</td><td>0.185t</td><td>0.211†</td><td>0.242</td></tr><tr><td>+Ω+Prompt</td><td>0.336</td><td>0.238t</td><td>0.235t</td><td>0.270</td></tr></table>
189
+
190
+ # 4.4 Analysis
191
+
192
+ We design experiments to better understand the mechanism by which BARTSCORE obtains these promising results, specifically asking three questions: Q1: Compared to other unsupervised metrics, where does BARTSCORE outperform them? Q2: How does adding prompts benefit evaluation? Q3: Will BARTScore introduce biases in unpredictable ways?
193
+
194
+ ![](images/78f8c1e31ba1ab4fbe0920e68cff9da08fddef39259e3f11e995865e34618d98.jpg)
195
+ Figure 2: Fine-grained analysis (a,b) and prompt analysis (c). In (a, b), BE, PR, BL, CO, BA represent BERTScore, PRISM, BLEURT, COMET and BARTSCORE respectively. In (c), SEM, LIN, FAC denote semantic overlap, linguistic quality and factual correctness respectively.
196
+
197
+ # 4.4.1 Fine-grained Analysis
198
+
199
+ To answer Q1, we choose the MT task and break down the performance of each metric into different buckets based on different axes.
200
+
201
+ Top-k Systems We report the average correlation across all language pairs achieved by each metric given only translations from top- $k$ systems. We vary the number of $k$ , and the results are shown in Fig. 2-(a). We can see that BARTSCORE can outperform all other metrics (including one supervised metric BLEURT) except the existing state-of-the-art supervised metric COMET for different $k$ , and the decrease in correlation becomes smoother than others when considering top-scoring systems. This indicates that BARTSCORE is robust to high-quality generated texts.
202
+
203
+ Reference Length We break down each test set into four buckets based on the reference length, which are [15, 25), [25, 35), [35, 45), [45, 54] and compute the Kendall’s Tau average correlation of different metrics across all language pairs within each bucket.6 The results are shown in Fig. 2-(b). We observe that BARTSCORE can outperform or tie with other unsupervised metrics over different reference lengths. Also, its correlation with human judgments is more stable compared to all other metrics. This indicates its robustness to different input lengths. More other analyses can be found in Appendix.
204
+
205
+ # 4.4.2 Prompt Analysis
206
+
207
+ For Q2, we choose the summarization and data-to-text tasks for analysis where we used all prompts from our prompt set. We first group all the evaluation perspectives into three categories: (1) semantic overlap (informativeness, pyramid score, and relevance) (2) linguistic quality (fluency, coherence) (3) factual correctness (factuality). We then calculate the percentage of prompts that result in performance improvements for each perspective within a dataset. Finally, we compute the average percentage of prompts that can lead to performance gains for each category. The results are shown in Tab. 2-(c). We can see that for semantic overlap, almost all prompts can lead to the performance increase, while for factuality only a few prompts can improve the performance. This also explains the results in $\ S 4 . 3 . 2$ where we found that combining the results of different prompts can lead to consistent increases in semantic overlap but worse performance in factuality. Regarding linguistic quality, the effect of adding a prompt is not that predictive, which is also consistent with our findings in $\ S 4 . 3 . 2$ .
208
+
209
+ # 4.4.3 Bias Analysis
210
+
211
+ To answer Q3, we conduct bias analysis. Bias would indicate that the scores are too high or too low compared to the scores they are given by human annotators. Therefore, to see whether such biases exist, we inspected the rank differences given by human annotators and BARTScore (fine-tuned on CNNDM dataset) on the REALSumm dataset where 24 systems are considered, including both abstractive models and extractive models as well as models based on pre-trained models and models that are trained from scratch. We list all the systems below. And the resulting rank difference is shown in Fig. 3.
212
+
213
+ ![](images/71ce21efad222c710fbe5f7a584a046b9f08143d9d25180689982349d95a3ce5.jpg)
214
+ Figure 3: Bias analysis of BARTScore. The “Rank Difference" is the rank obtained using human judgements minus the rank got from BARTScore. Systems beginning with letter “E" are extractive systems while systems beginning with letter “A" are abstractive systems.
215
+
216
+ Extractive Systems E1: BanditSum [11]; E2: Refresh [48]; E3: NeuSum [80]; E4: LSTMPN-RL [79]; E5: BERT-TF-SL [79]; E6: BERT-TF-PN [79]; E7: BERT-LSTM-PN-RL [79]; E8: BERT-LSTM-PN [79]; E9: HeterGraph [68]; E10: MatchSum [78].
217
+
218
+ Abstractive Systems A1: Ptr-Gen [61]; A2: Bottom-up [17]; A3: Fast-Abs-RL [5]; A4: Two-stageRL [73]; A5: BERT-Ext-Abs [41]; A6: BERT-Abs [41]; A7: Trans-Abs [41]; A8: UniLM-1 [10]; A9: UniLM-2 [2]; A10: T5-base [55]; A11: T5-large [55]; A12: T5-11B [55]; A13: BART [33]; A14: SemSim [42].
219
+
220
+ As shown in Fig. 3, BARTScore is less effective at distinguishing the quality of extractive summarization systems while much better at distinguishing the quality of abstractive summarization systems. However, given that there is a trend for using abstractive systems as more and more pre-trained sequence-to-sequence models being proposed, BARTScore’s weaknesses on extractive systems will be mitigated.
221
+
222
+ # 5 Implications and Future Directions
223
+
224
+ In this paper, we proposed a metric BARTSCORE that formulates evaluation of generated text as a text generation task, and empirically demonstrated its efficacy. Without the supervision of human judgments, BARTSCORE can effectively evaluate texts from 7 perspectives and achieve the best performance on 16 of 22 settings against existing top-scoring metrics. We highlight potential future directions based on what we have learned.
225
+
226
+ Prompt-augmented metrics As an easy-to-use but powerful method, prompting [39] has achieved impressive performance particularly on semantic overlap-based evaluation perspectives. However, its effectiveness in factuality and linguistic quality-based perspectives has not been fully demonstrated in this paper. In the future, more works can explore how to make better use of prompts for these and other evaluation scenarios.
227
+
228
+ Co-evolving evaluation metrics and systems BARTSCORE builds the connection between metric design and system design, which allows them to share their technological advances, thereby progressing together. For example, a better BART-based summarization system may be directly used as a more reliable automated metric for evaluating summaries, and this work makes them connected.
229
+
230
+ # Acknowledgments
231
+
232
+ The authors would like to thank the anonymous reviewers for their insightful comments and suggestions. The authors also thank Wei Zhao for assisting with reproducing baseline results. This work was supported by the Air Force Research Laboratory under agreement number FA8750-19-2-0200. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. 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 the Air Force Research Laboratory or the U.S. Government.
233
+
234
+ References
235
+ [1] Akari Asai, Kazuma Hashimoto, Hannaneh Hajishirzi, Richard Socher, and Caiming Xiong. Learning to retrieve reasoning paths over wikipedia graph for question answering. arXiv preprint arXiv:1911.10470, 2019.
236
+ [2] Hangbo Bao, Li Dong, Furu Wei, Wenhui Wang, Nan Yang, Xiaodong Liu, Yu Wang, Jianfeng Gao, Songhao Piao, Ming Zhou, and Hsiao-Wuen Hon. Unilmv2: Pseudo-masked language models for unified language model pre-training. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 642–652. PMLR, 2020.
237
+ [3] Manik Bhandari, Pranav Narayan Gour, Atabak Ashfaq, and Pengfei Liu. Metrics also disagree in the low scoring range: Revisiting summarization evaluation metrics. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5702–5711, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics.
238
+ [4] Manik Bhandari, Pranav Narayan Gour, Atabak Ashfaq, Pengfei Liu, and Graham Neubig. Re-evaluating evaluation in text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9347–9359, Online, November 2020. Association for Computational Linguistics.
239
+ [5] Yen-Chun Chen and Mohit Bansal. Fast abstractive summarization with reinforce-selected sentence rewriting. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 675–686, Melbourne, Australia, July 2018. Association for Computational Linguistics.
240
+ [6] Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015.
241
+ [7] Hoa Trang Dang. Overview of duc 2005. In Proceedings of the document understanding conference, volume 2005, pages 1–12, 2005.
242
+ [8] Michael Denkowski and Alon Lavie. Extending the METEOR machine translation evaluation metric to the phrase level. In Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pages 250–253, Los Angeles, California, June 2010. Association for Computational Linguistics.
243
+ [9] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, 2019.
244
+ [10] Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. Unified language model pre-training for natural language understanding and generation. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d’Alché-Buc, Emily B. Fox, and Roman Garnett, editors, Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 13042–13054, 2019.
245
+ [11] Yue Dong, Yikang Shen, Eric Crawford, Herke van Hoof, and Jackie Chi Kit Cheung. BanditSum: Extractive summarization as a contextual bandit. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3739–3748, Brussels, Belgium, October-November 2018. Association for Computational Linguistics.
246
+ [12] Zi-Yi Dou, Pengfei Liu, Hiroaki Hayashi, Zhengbao Jiang, and Graham Neubig. GSum: A general framework for guided neural abstractive summarization. In Meeting of the North American Chapter of the Association for Computational Linguistics (NAACL), Mexico City, June 2021.
247
+ [13] A. R. Fabbri, Wojciech Kryscinski, Bryan McCann, R. Socher, and Dragomir Radev. Summeval: Re-evaluating summarization evaluation. Trans. Assoc. Comput. Linguistics, 9:391–409, 2021.
248
+ [14] Tobias Falke, Leonardo FR Ribeiro, Prasetya Ajie Utama, Ido Dagan, and Iryna Gurevych. Ranking generated summaries by correctness: An interesting but challenging application for natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2214–2220, 2019.
249
+ [15] David Freedman, Robert Pisani, and Roger Purves. Statistics (international student edition). Pisani, R. Purves, 4th edn. WW Norton & Company, New York, 2007.
250
+ [16] Sebastian Gehrmann, Yuntian Deng, and Alexander Rush. Bottom-up abstractive summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4098–4109, 2018.
251
+ [17] Sebastian Gehrmann, Yuntian Deng, and Alexander Rush. Bottom-up abstractive summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4098–4109, Brussels, Belgium, October-November 2018. Association for Computational Linguistics.
252
+ [18] Max Grusky, Mor Naaman, and Yoav Artzi. Newsroom: A dataset of 1.3 million summaries with diverse extractive strategies. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 708–719, New Orleans, Louisiana, June 2018. Association for Computational Linguistics.
253
+ [19] Max Grusky, Mor Naaman, and Yoav Artzi. Newsroom: A dataset of 1.3 million summaries with diverse extractive strategies. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), volume 1, pages 708–719, 2018.
254
+ [20] K. Hermann, Tomás Kociský, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and P. Blunsom. Teaching machines to read and comprehend. In NIPS, 2015.
255
+ [21] Tsutomu Hirao, Manabu Okumura, Norihito Yasuda, and Hideki Isozaki. Supervised automatic evaluation for summarization with voted regression model. Information Processing & Management, 43(6):1521–1535, 2007.
256
+ [22] J. Edward Hu, Abhinav Singh, Nils Holzenberger, Matt Post, and Benjamin Van Durme. Largescale, diverse, paraphrastic bitexts via sampling and clustering. In Proceedings of the $2 3 r d$ Conference on Computational Natural Language Learning (CoNLL), pages 44–54, Hong Kong, China, November 2019. Association for Computational Linguistics.
257
+ [23] Sarthak Jain, Madeleine van Zuylen, Hannaneh Hajishirzi, and Iz Beltagy. Scirex: A challenge dataset for document-level information extraction. arXiv preprint arXiv:2005.00512, 2020.
258
+ [24] Zhengbao Jiang, Frank F. Xu, Jun Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020.
259
+ [25] Karen Sparck Jones. A statistical interpretation of term specificity and its application in retrieval. Journal of documentation, 1972.
260
+ [26] Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, ˘ Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. arXiv preprint arXiv:2004.04906, 2020.
261
+ [27] M. G. Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81–93, 1938.
262
+ [28] Philipp Koehn. Statistical significance tests for machine translation evaluation. In Proceedings of the 2004 Conference on Empirical Methods in Natural Language Processing, pages 388–395, Barcelona, Spain, July 2004. Association for Computational Linguistics.
263
+ [29] Philipp Koehn. Statistical machine translation. Cambridge University Press, 2009.
264
+ [30] Wojciech Kryscinski, Bryan McCann, Caiming Xiong, and Richard Socher. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9332–9346, Online, November 2020. Association for Computational Linguistics.
265
+ [31] Teven Le Scao and Alexander Rush. How many data points is a prompt worth? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2627–2636, Online, June 2021. Association for Computational Linguistics.
266
+ [32] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
267
+ [33] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7871–7880, Online, July 2020. Association for Computational Linguistics.
268
+ [34] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. ArXiv, abs/2101.00190, 2021.
269
+ [35] Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. Text Summarization Branches Out, 2004.
270
+ [36] Chin-Yew Lin and Eduard Hovy. Automatic evaluation of summaries using n-gram cooccurrence statistics. In Proceedings of the 2003 Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics, pages 150–157, 2003.
271
+ [37] Ying Lin, Heng Ji, Fei Huang, and Lingfei Wu. A joint neural model for information extraction with global features. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7999–8009, 2020.
272
+ [38] Pengfei Liu, Jinlan Fu, Yang Xiao, Weizhe Yuan, Shuaicheng Chang, Junqi Dai, Yixin Liu, Zihuiwen Ye, and Graham Neubig. Explainaboard: An explainable leaderboard for nlp. arXiv preprint arXiv:2104.06387, 2021.
273
+ [39] Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing, 2021.
274
+ [40] Yang Liu and Mirella Lapata. Text summarization with pretrained encoders. arXiv preprint arXiv:1908.08345, 2019.
275
+ [41] Yang Liu and Mirella Lapata. Text summarization with pretrained encoders. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3730–3740, Hong Kong, China, November 2019. Association for Computational Linguistics.
276
+ [42] Yixin Liu and Pengfei Liu. Simcls: A simple framework for contrastive learning of abstractive summarization. arXiv preprint arXiv:2106.01890, 2021.
277
+ [43] Qingsong Ma, Ondˇrej Bojar, and Yvette Graham. Results of the WMT18 metrics shared task: Both characters and embeddings achieve good performance. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 671–688, Belgium, Brussels, October 2018. Association for Computational Linguistics.
278
+ [44] Qingsong Ma, Johnny Wei, Ondˇrej Bojar, and Yvette Graham. Results of the WMT19 metrics shared task: Segment-level and strong MT systems pose big challenges. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 62–90, Florence, Italy, August 2019. Association for Computational Linguistics.
279
+ [45] François Mairesse, Milica Gasic, Filip Jurcicek, Simon Keizer, Blaise Thomson, Kai Yu, and Steve Young. Phrase-based statistical language generation using graphical models and active learning. In Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics, pages 1552–1561, 2010.
280
+ [46] Nitika Mathur, Timothy Baldwin, and Trevor Cohn. Tangled up in BLEU: Reevaluating the evaluation of automatic machine translation evaluation metrics. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4984–4997, Online, July 2020. Association for Computational Linguistics.
281
+ [47] Shashi Narayan, Shay B Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1797–1807, 2018.
282
+ [48] Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Ranking sentences for extractive summarization with reinforcement learning. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1747–1759, New Orleans, Louisiana, June 2018. Association for Computational Linguistics.
283
+ [49] Ani Nenkova and Rebecca Passonneau. Evaluating content selection in summarization: The pyramid method. In Proceedings of the Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics: HLT-NAACL 2004, pages 145–152, Boston, Massachusetts, USA, May 2 - May 7 2004. Association for Computational Linguistics.
284
+ [50] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311–318, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics.
285
+ [51] Maxime Peyrard, Teresa Botschen, and Iryna Gurevych. Learning to score system summaries for better content selection evaluation. In Proceedings of the Workshop on New Frontiers in Summarization, pages 74–84, Copenhagen, Denmark, September 2017. Association for Computational Linguistics.
286
+ [52] Maja Popovic. chrF: character n-gram F-score for automatic MT evaluation. In ´ Proceedings of the Tenth Workshop on Statistical Machine Translation, pages 392–395, Lisbon, Portugal, September 2015. Association for Computational Linguistics.
287
+ [53] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
288
+ [54] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020.
289
+ [55] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1–140:67, 2020.
290
+ [56] Ricardo Rei, Craig Stewart, Ana C Farinha, and Alon Lavie. COMET: A neural framework for MT evaluation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 2685–2702, Online, November 2020. Association for Computational Linguistics.
291
+ [57] Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm. In Extended Abstracts of the 2021 CHI Conference on Human Factors in Computing Systems, pages 1–7, 2021.
292
+ [58] Timo Schick and Hinrich Schütze. Exploiting cloze questions for few-shot text classification and natural language inference. arXiv preprint arXiv:2001.07676, 2020.
293
+ [59] Timo Schick and Hinrich Schütze. Few-shot text generation with pattern-exploiting training. arXiv preprint arXiv:2012.11926, 2020.
294
+ [60] Timo Schick and Hinrich Schütze. It’s not just size that matters: Small language models are also few-shot learners. arXiv preprint arXiv:2009.07118, 2020.
295
+ [61] Abigail See, Peter J. Liu, and Christopher D. Manning. Get to the point: Summarization with pointer-generator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1073–1083, Vancouver, Canada, July 2017. Association for Computational Linguistics.
296
+ [62] Thibault Sellam, Dipanjan Das, and Ankur Parikh. BLEURT: Learning robust metrics for text generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7881–7892, Online, July 2020. Association for Computational Linguistics.
297
+ [63] Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv preprint arXiv:2010.15980, 2020.
298
+ [64] Miloš Stanojevic and Khalil Sima’an. BEER: BEtter evaluation as ranking. In ´ Proceedings of the Ninth Workshop on Statistical Machine Translation, pages 414–419, Baltimore, Maryland, USA, June 2014. Association for Computational Linguistics.
299
+ [65] Brian Thompson and Matt Post. Automatic machine translation evaluation in many languages via zero-shot paraphrasing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 90–121, Online, November 2020. Association for Computational Linguistics.
300
+ [66] Alex Wang, Kyunghyun Cho, and M. Lewis. Asking and answering questions to evaluate the factual consistency of summaries. In ACL, 2020.
301
+ [67] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 353–355, Brussels, Belgium, November 2018. Association for Computational Linguistics.
302
+ [68] Danqing Wang, Pengfei Liu, Yining Zheng, Xipeng Qiu, and Xuanjing Huang. Heterogeneous graph neural networks for extractive document summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6209–6219, Online, July 2020. Association for Computational Linguistics.
303
+ [69] Tsung-Hsien Wen, Milica Gasic, Nikola Mrksic, Pei-Hao Su, David Vandyke, and Steve Young. Semantically conditioned lstm-based natural language generation for spoken dialogue systems. arXiv preprint arXiv:1508.01745, 2015.
304
+ [70] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38–45, Online, October 2020. Association for Computational Linguistics.
305
+ [71] Weizhe Yuan, Pengfei Liu, and Graham Neubig. Can we automate scientific reviewing? arXiv preprint arXiv:2102.00176, 2021.
306
+ [72] Jerrold H Zar. Spearman rank correlation. Encyclopedia of Biostatistics, 7, 2005.
307
+ [73] Haoyu Zhang, Jingjing Cai, Jianjun Xu, and Ji Wang. Pretraining-based natural language generation for text summarization. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 789–797, Hong Kong, China, November 2019. Association for Computational Linguistics.
308
+ [74] Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter Liu. Pegasus: Pre-training with extracted gap-sentences for abstractive summarization. In International Conference on Machine Learning, pages 11328–11339. PMLR, 2020.
309
+ [75] Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. In International Conference on Learning Representations, 2020.
310
+ [76] Wei Zhao, Maxime Peyrard, Fei Liu, Yang Gao, Christian M. Meyer, and Steffen Eger. MoverScore: Text generation evaluating with contextualized embeddings and earth mover distance. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 563–578, Hong Kong, China, November 2019. Association for Computational Linguistics.
311
+ [77] Ming Zhong, Pengfei Liu, Yiran Chen, Danqing Wang, Xipeng Qiu, and Xuanjing Huang. Extractive summarization as text matching. arXiv preprint arXiv:2004.08795, 2020.
312
+ [78] Ming Zhong, Pengfei Liu, Yiran Chen, Danqing Wang, Xipeng Qiu, and Xuanjing Huang. Extractive summarization as text matching. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6197–6208, Online, July 2020. Association for Computational Linguistics.
313
+ [79] Ming Zhong, Pengfei Liu, Danqing Wang, Xipeng Qiu, and Xuanjing Huang. Searching for effective neural extractive summarization: What works and what’s next. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1049–1058, Florence, Italy, July 2019. Association for Computational Linguistics.
314
+ [80] Qingyu Zhou, Nan Yang, Furu Wei, Shaohan Huang, Ming Zhou, and Tiejun Zhao. Neural document summarization by jointly learning to score and select sentences. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 654–663, Melbourne, Australia, July 2018. Association for Computational Linguistics.
md/train/6UdQLhqJyFD/6UdQLhqJyFD.md ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PARAMETER EFFICIENT MULTIMODAL TRANSFORMERS FOR VIDEO REPRESENTATION LEARNING
2
+
3
+ Sangho Lee, Youngjae Yu, Gunhee Kim
4
+ Seoul National University
5
+ {sangho.lee,yj.yu}@vision.snu.ac.kr, gunhee@snu.ac.kr
6
+
7
+ Thomas Breuel, Jan Kautz NVIDIA Research {tbreuel,jkautz}@nvidia.com
8
+
9
+ Yale Song
10
+ Microsoft Research
11
+ yalesong@microsoft.com
12
+
13
+ # ABSTRACT
14
+
15
+ The recent success of Transformers in the language domain has motivated adapting it to a multimodal setting, where a new visual model is trained in tandem with an already pretrained language model. However, due to the excessive memory requirements from Transformers, existing work typically fixes the language model and train only the vision module, which limits its ability to learn cross-modal information in an end-to-end manner. In this work, we focus on reducing the parameters of multimodal Transformers in the context of audio-visual video representation learning. We alleviate the high memory requirement by sharing the parameters of Transformers across layers and modalities; we decompose the Transformer into modality-specific and modality-shared parts so that the model learns the dynamics of each modality both individually and together, and propose a novel parameter sharing scheme based on low-rank approximation. We show that our approach reduces parameters of the Transformers up to $9 7 \%$ , allowing us to train our model end-to-end from scratch. We also propose a negative sampling approach based on an instance similarity measured on the CNN embedding space that our model learns together with the Transformers. To demonstrate our approach, we pretrain our model on 30-second clips (480 frames) from Kinetics-700 and transfer it to audio-visual classification tasks.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Learning multimodal representation from unlabeled videos has received considerable attention (Baltrušaitis et al., 2018). Audio-visual learning is of particular interest due to the abundance of videos with natural audio-visual co-occurrence (Owens & Efros, 2018; Owens et al., 2018; Arandjelovic & Zisserman, 2018; Ephrat et al., 2018; Gao & Grauman, 2019; Alwassel et al., 2019). However, existing approaches learn localized representations from short videos (hundreds of milliseconds to just under a few seconds), capturing only short-term dependencies in data. While this is useful for certain applications, e.g., source separation (Ephrat et al., 2018) and atomic action recognition (Gu et al., 2018), learning representation that captures long-term dependencies is equally important, e.g., for activity recognition (Kay et al., 2017; Carreira et al., 2019; Sigurdsson et al., 2016). Unfortunately, processing long videos requires large memory resource and capturing long-term dependencies is a long-standing problem (Hochreiter & Schmidhuber, 1997; Cho et al., 2014; Vaswani et al., 2017).
20
+
21
+ In language understanding, strong progress has been made in large-scale learning of contextualized language representations using Transformers (Vaswani et al., 2017; Howard & Ruder, 2018; Peters et al., 2018; Radford et al., 2018; 2019; Devlin et al., 2019; Liu et al., 2019; Yang et al., 2019). Riding on the success of Transformers, several recent works have extended it to the multimodal setting by adding an additional vision module to the Transformer framework (Sun et al., 2019b; Lu et al., 2019). However, these models are typically not end-to-end trained; they rely on a language-pretrained BERT (Devlin et al., 2019), which is fixed throughout, and train only the visual components. While the pretrained BERT helps accelerate convergence and brings reliable extra supervision signal to the vision component, this partial learning setup can be undesirable if the text data comes from different distributions (of topics, dialects, or foreign languages) or if we want to apply it to different modalities (e.g., audio-visual). Unfortunately, end-to-end training of such multimodal Transformer architectures is challenging for most existing compute environments due to the excessive memory requirement.
22
+
23
+ ![](images/ec7a499eb1816cbea6560807a25e2ab536cf8f8b4c3ca522b5ae15513ee23387.jpg)
24
+ Figure 1: (Left) Our model consists of CNNs encoding short-term dynamics of each modality and Transformers encoding long-term dynamics of audio-visual information from videos. (Right) To alleviate excessive memory requirements, we propose an efficient parameter sharing scheme based on matrix decomposition with low-rank approximation, which allows us to train our model end-to-end.
25
+
26
+ In this work, we make three key contributions. First, we propose an end-to-end trainable bidirectional transformer architecture that learns contextualized audio-visual representations of long videos. Our model, shown in Figure 1, consists of audio/visual CNNs, audio/visual Transformers, and a multimodal Transformer. The CNNs operate on short (e.g., one second) video clips and are intended to capture short-term dynamics within each modality. The Transformer layers operate on long video sequences (e.g., 30 seconds), capturing long-term dynamics. To enable end-to-end training, we propose a novel parameter reduction technique that shares parts of weight parameters across Transformers and across layers within each Transformer. We show that this results in up to $9 7 \%$ parameter reduction, enabling end-to-end training of our model, with a minimal performance degradation. To the best of our knowledge, our work is the first to report end-to-end trained multimodal Transformers, and the first to apply Transformers for audio-visual representation learning.
27
+
28
+ The quality of negative samples is crucial in contrastive learning, which is part of our learning objective. As our second contribution, we propose a content-aware negative sampling strategy that favors negatives sufficiently similar to a positive instance. Our approach measures the similarity by reusing the CNN embeddings obtained during model training, and thus do not introduce extra parameters to learn. We show that this improves performance over the standard sampling strategies.
29
+
30
+ Our third contribution is a systematic evaluation of different modality fusion strategies. Existing works on multimodal BERT (all using vision-and-language data) typically apply one fusion strategy without thoroughly comparing with alternatives, e.g., some works perform early fusion (Sun et al., 2019b; Su et al., 2020) while others perform mid-level fusion (Lu et al., 2019; Tan & Bansal, 2019). As a result, it is unclear how different fusion methods affect the final performance. In this work, we compare three fusion strategies (early, mid, late) and show the superiority of mid-level fusion.
31
+
32
+ To demonstrate our approach, we pretrain our model on long (30-second) video clips from Kinetics700 (Carreira et al., 2019) and finetune it on various video classification tasks. One benefit of the modular design of our architecture is flexibility: once pretrained, we can use any of the subnetworks for downstream tasks depending on the modalities involved (audio-only, visual-only, audio-visual) and video lengths (short and long). To show this, we evaluate our model on UCF101 (Soomro et al., 2012) and ESC-50 (Gemmeke et al., 2017) for short-term visual/audio classification, and Charades (Sigurdsson et al., 2016) and Kinetics-Sounds (Arandjelovic & Zisserman, 2017) for long-term audio-visual action recognition.
33
+
34
+ # 2 APPROACH
35
+
36
+ Figure 1 shows an overview of the proposed model architecture. The input to our model is a sequence of visual clips $\mathbf { v } _ { 1 : T }$ and the corresponding sequence of audio streams $\mathbf { a } _ { 1 : T }$ . For example, each sequence is a 30 second-long video divided into 30 non-overlapping clips (each clip is one second long). We divide our model into three parts with different characteristics, which are explained below.
37
+
38
+ Local Feature Embedding. We feed each of $T$ video clips to a visual CNN $f _ { V } ( \mathbf { v } _ { t } )$ to obtain $\mathbf { x } _ { 1 : T } ^ { v } \in \mathbb { R } ^ { T \times D }$ , and each audio stream to an audio CNN $f _ { A } ( \mathbf { a } _ { t } )$ to obtain $\mathbf { x } _ { 1 : T } ^ { a } \in \mathbb { R } ^ { T \times D }$ .1 Intuitively, the CNN outputs are temporally local embeddings as they have access to only a short-range temporal window of the entire video sequence. Thus, they are suitable for representing short-range atomic actions (e.g., sit down, raise arms) that constitute long-range events (e.g., gym workout). We use the SlowFast network (Feichtenhofer et al., 2019) with a ResNet-50 backbone (He et al., 2016) as a visual CNN $f _ { V }$ , and a ResNet-50 as an audio CNN $f _ { A }$ . The weights of both CNNs are randomly initialized and trained end-to-end with the Transformer layers.
39
+
40
+ Unimodal Contextualized Embedding. The local feature embeddings capture short-term dynamics but lack long-term contextual information. We use Transformers (Vaswani et al., 2017) to enrich the embeddings with sequence-level context. We start by learning unimodal contextualized representations using the visual Transformer $g _ { V }$ and the audio Transformer $g _ { A }$ , respectively.
41
+
42
+ The Transformer consists of $\mathrm { L }$ layers, each with two sub-layers: a multi-head attention layer and a feed-forward layer. Given an input sequence of embeddings $\mathbf { x } \in \mathbb { R } ^ { T \times D }$ and $A$ attention heads, the $j$ -th head in the attention layer computes the output embedding sequence $\mathbf { a } _ { j } \in \mathbb { R } ^ { T \times \gamma } , \gamma = D / A$ as
43
+
44
+ $$
45
+ { \bf a } _ { j } = \mathrm { s o f t m a x } \left( \frac { Q _ { j } K _ { j } ^ { \top } } { \sqrt { \gamma } } \right) V _ { j } , \qquad Q _ { j } = { \bf x } W _ { j } ^ { q } , K _ { j } = { \bf x } W _ { j } ^ { k } , V _ { j } = { \bf x } W _ { j } ^ { v }
46
+ $$
47
+
48
+ where $W _ { j . } ^ { q } , W _ { j } ^ { k } , W _ { j . } ^ { v } \in \mathbb { R } ^ { D \times \gamma }$ are weight matrices for computing the (query, key, value) triplet given the input $\mathbf { x }$ . This operation is repeated for each attention head, and the outputs are combined (with concatenation followed by one linear layer with weights $W ^ { b } \in \mathbb { R } ^ { D \times D } )$ , producing $\mathbf { a } \in \mathbb { R } ^ { T \times D }$ . Next, the feed-forward layer takes this intermediate output and computes $\mathbf { o } \in \mathbb { R } ^ { T \times D }$ using a twolayer fully-connected network with weights $W ^ { c } \in \mathbb { R } ^ { D \times E }$ and $W ^ { d } \in \mathbb { R } ^ { E \times D }$ . The output of each sub-layer is computed using a residual function followed by layer normalization (Ba et al., 2016), i.e., LayerNorm $( { \overline { { x } } } + { \mathrm { S u b l a y e r } } ( x ) )$ . In this work, we set the number of layers $L = 6$ , the number of attention heads $A = 1 2$ , the feature dimension $D = 7 6 8$ and the intermediate dimension $E = 3 0 7 2$ . For simplicity, we use this design for all layers across all three Transformers in our model.
49
+
50
+ Before feeding local embeddings $\mathbf { x } ^ { v }$ and $\mathbf { x } ^ { a }$ to unimodal Transformers, we augment them with “positional” embeddings. Specifically, we append to the beginning of each sequence a special vector BOS (beginning of sequence), i.e., $\mathbf { x } _ { 0 } ^ { v }$ for visual and $\mathbf { x } _ { 0 } ^ { a }$ for audio streams; their dimensions are same as $\mathbf { x } _ { t } ^ { v }$ and $\mathbf { x } _ { t } ^ { a }$ , respectively. We also define positional embeddings $\mathbf { p } _ { 0 : T }$ encoding time indices (we call this “time” embedding). This is necessary to preserve information about temporal ordering of local feature embeddings, which is otherwise lost in Eqn. 1. We combine them via layer normalization,
51
+
52
+ $$
53
+ \begin{array} { r } { \mathbf { u } _ { t } ^ { v } = \mathrm { L a y e r N o r m } ( \mathbf { x } _ { t } ^ { v } + \mathbf { p } _ { t } ^ { v } ) , \quad \mathbf { u } _ { t } ^ { a } = \mathrm { L a y e r N o r m } ( \mathbf { x } _ { t } ^ { a } + \mathbf { p } _ { t } ^ { a } ) , \quad \forall t \in [ 0 , T ] } \end{array}
54
+ $$
55
+
56
+ We initialize $\{ \mathbf { x } _ { 0 } ^ { v } , \mathbf { x } _ { 0 } ^ { a } , \mathbf { p } _ { 0 : T } ^ { v } , \mathbf { p } _ { 0 : T } ^ { a } \}$ to the normal distribution and train them with the rest of the model.
57
+
58
+ We feed the augmented visual embeddings into the visual Transformer $g _ { V }$ and obtain ${ \bf y } _ { 0 : T } ^ { v } =$ $g _ { V } \big ( \mathbf { u } _ { 0 : T } ^ { v } \big )$ , and similarly obtain ${ \bf y } _ { 0 : T } ^ { a } = g _ { A } ( { \bf u } _ { 0 : T } ^ { a } )$ . The embeddings at each time step has a direct access to the entire input sequence regardless of their position (it has a one-step signal path during forward and backward inference). Multiple layers of such feature transformation thus allow the resulting embedding to be deeply contextualized in the time dimension. We denote the output embeddings corresponding to the BOS positions by ${ \sf B O S } _ { g } ^ { v } = { \bf y } _ { 0 } ^ { v }$ and $\mathbf { B } 0 \mathbf { S } _ { g } ^ { a } = \mathbf { y } _ { 0 } ^ { a }$ , and designate them as the summary embeddings representing the sequence of each modality.
59
+
60
+ Multimodal Contextualized Embedding. The unimodal embeddings capture long-term temporal context but miss out on cross-modal information. The final step in forward inference is to use a multimodal Transformer $h _ { A V }$ to obtain embeddings contextualized in the audio-visual space.
61
+
62
+ We first augment the embeddings $\mathbf { y } _ { 0 : T } ^ { v }$ and ${ \bf y } _ { 0 : T } ^ { a }$ with modality and time embeddings. The modality embeddings $\mathbf { m } ^ { v }$ and $\mathbf { m } ^ { a }$ are vectors of the same dimension as $\mathbf { y } _ { t } ^ { v }$ and $\mathbf { y } _ { t } ^ { a }$ , respectively. We share $\mathbf { m } ^ { v }$ (and $\mathbf { m } ^ { a }$ ) across all the unimodal embeddings $\mathbf { y } _ { 0 : T } ^ { v }$ (and ${ \bf y } _ { 0 : T } ^ { a } )$ ; thus, they add modality-discriminative information to the Transformer. We also add time embeddings $\mathbf { p } _ { 0 : T }$ as before; however, unlike in the previous step, we share the same $\mathbf { p } _ { 0 : T }$ between embeddings from the two modalities to correctly indicate the time indices. We augment the modality and time embeddings via layer normalization,
63
+
64
+ $$
65
+ \mathbf { w } _ { t } ^ { v } = \mathrm { L a y e r N o r m } ( \mathbf { y } _ { t } ^ { v } + \mathbf { p } _ { t } + \mathbf { m } ^ { v } ) , \mathbf { w } _ { t } ^ { a } = \mathrm { L a y e r N o r m } ( \mathbf { y } _ { t } ^ { a } + \mathbf { p } _ { t } + \mathbf { m } ^ { a } ) , \forall t \in [ 0 , T ]
66
+ $$
67
+
68
+ We feed the augmented visual embeddings $\mathbf { w } _ { 0 : T } ^ { v }$ and audio embeddings $\mathbf { w } _ { 0 : T } ^ { a }$ to the multimodal Transformer $h _ { A V }$ , one after another, and obtain $\mathbf { \bar { z } } _ { 0 : ( 2 T + 1 ) } = h _ { A V } \big ( \bigl [ \mathbf { w } _ { 0 : T } ^ { v } ; \mathbf { w } _ { 0 : T } ^ { a } \bigr ] \big )$ . We again denote the output embeddings corresponding to the BOS positions by ${ \tt B O S } _ { h } ^ { v } = { \bf z } _ { 0 } ^ { v } ( = { \bf z } _ { 0 } )$ and ${ \tt B O S } _ { h } ^ { a } = { \bf z } _ { 0 } ^ { a } ( =$ ${ \bf z } _ { T + 1 } ,$ ), and use them as summary embeddings encoding multimodal context.
69
+
70
+ We emphasize the importance of feeding $\mathbf { w } _ { 0 : T } ^ { v }$ and ${ \bf w } _ { 0 : T } ^ { a }$ one after another. An alternative would be concatenating them before feeding them to $h _ { A V }$ and obtaining an output $\mathbf { z } _ { 0 : T }$ (instead of $\mathbf { z } _ { 0 : ( 2 T + 1 ) } )$ . However, this restricts the Transformer to access audio-visual embeddings only from the same time slices, which could be problematic when there is a temporally asynchronous relationship between the two modalities (e.g., a visual clip matches with sound captured a few times steps before) (Kazakos et al., 2019; Morgado et al., 2020). By arranging the two sequences one after the other, the Transformer can mix-and-match appropriate audio-visual embeddings in an asynchronous manner. Another practical concern with the alternative approach is that it significantly increases the model size; the weight matrices $W _ { q } , W _ { k } , W _ { v }$ grow quadratically with the input feature dimension $D$ . Serializing the input resolves both issues.
71
+
72
+ # 2.1 SELF-SUPERVISED PRETRAINING OBJECTIVES
73
+
74
+ Task 1: Masked Embedding Prediction (MEP). BERT (Devlin et al., 2019) is trained using the masked language model (MLM) task, which randomly selects input tokens and replaces them with a mask token. The model is then trained to predict the original (unmasked) tokens by solving a classification task with a cross-entropy loss. However, inputs to our model are real-valued audiovisual signals (rather than discrete tokens),2 so applying the MLM task requires input discretization, which causes information loss (Lu et al., 2019; Sun et al., 2019a). We instead train our model to identify the correct visual clip or audio stream compared to a set of negative samples in a contrastive manner, which does not require input discretization.
75
+
76
+ We formulate our MEP task using InfoNCE (Oord et al., 2018), which is the softmax version of the noise contrastive estimation (NCE) (Gutmann & Hyvärinen, 2010). Let $\tilde { \bf { o } } _ { t }$ be the $t$ -th output of any of the three Transformers obtained by masking the $t$ -th input $\mathbf { x } _ { t }$ . Our InfoNCE loss is then defined as
77
+
78
+ $$
79
+ \mathcal { L } _ { \mathrm { N C E } } ( \mathbf { x } , \tilde { \mathbf { o } } ) = - \mathbb { E } _ { \mathbf { x } } \left[ \sum _ { t } \log \frac { \mathrm { I } ( \mathbf { x } _ { t } , \tilde { \mathbf { o } } _ { t } ) } { \mathrm { I } ( \mathbf { x } _ { t } , \tilde { \mathbf { o } } _ { t } ) + \sum _ { j \in \mathrm { n e g } ( t ) } \mathrm { I } ( \mathbf { x } _ { j } , \tilde { \mathbf { o } } _ { t } ) } \right] ,
80
+ $$
81
+
82
+ where $\mathrm { n e g } ( t )$ are negative sample indices and the compatibility function $\mathbf { I } ( \mathbf { x } _ { t } , \tilde { \mathbf { o } } _ { t } )$ is,
83
+
84
+ $$
85
+ \begin{array} { r } { \operatorname { I } ( \mathbf { x } _ { t } , \tilde { \mathbf { o } } _ { t } ) = \exp \left( \mathrm { F F N } ^ { \top } ( \tilde { \mathbf { o } } _ { t } ) W _ { I } \mathbf { x } _ { t } \right) , } \end{array}
86
+ $$
87
+
88
+ where $W _ { I } \in \mathbb { R } ^ { P \times D }$ $P = 2 5 6 )$ and FFN is a two-layer feed-forward network. The use of a non-linear prediction head has shown to improve the quality of the representations learned in a contrastive learning setup (Chen et al., 2020); following the recent work in Transformers (Devlin et al., 2019; Liu et al., 2019; Lan et al., 2020), we use a GELU non-linear activation function (Hendrycks & Gimpel, 2016) in FFN. Optimizing Eqn. 4 enforces $\mathbf { I } ( \mathbf { x } _ { t } , \tilde { \mathbf { o } } _ { t } )$ to approximate the density ratio $\frac { p ( \mathbf { x } _ { t } | \tilde { \mathbf { o } } _ { t } ) } { p ( \mathbf { x } _ { t } ) }$ ; this can be seen as maximizing the mutual information between $\mathbf { x } _ { t }$ and $\tilde { \bf { o } } _ { t }$ (Oord et al., 2018). Intuitively, this encourages the Transformer to capture the underlying dynamics of $\mathbf { x }$ from each modality without explicitly learning a generative model $p ( \mathbf { x } _ { t } | \tilde { \mathbf { o } } _ { t } )$ .
89
+
90
+ Negative sampling. We find that a good negative sampling strategy is essential for the model’s convergence. Existing approaches either use all but $\mathbf { x } _ { t }$ (positive) within a mini-batch as negative samples or limit it to the current sequence only. However, both these methods ignore the data content and thus can miss useful negatives. Oord et al. (2018) showed that leveraging prior knowledge about data can improve the negative sample quality (e.g., by sampling negatives from the same speaker as the positive). Unfortunately, such prior knowledge is often not available in unlabeled videos.
91
+
92
+ ![](images/fe1bde5984ac8e8c111139ad98e20af0644e624550ba140705e6f9d6c8566b8b.jpg)
93
+ Figure 2: Comparison of parameter sharing schemes. Ours combines (b) and (c) but decomposes weights in each layer into private and shared parts so only the latter is shared across Transformers.
94
+
95
+ We propose a content-aware negative sampling strategy that favors negatives sufficiently similar to a positive instance in the CNN embedding space; we call our approach CANS-Similar. Our approach is inspired by Ulyanov et al. (2018) who showed that randomly initialized CNNs provide a strong prior over natural images due to the inductive bias already built into the design of the CNNs. This suggests that our local feature embeddings $\mathbf { x } ^ { v }$ (and $\mathbf { x } ^ { a }$ ) can capture the underlying statistical regularities in video clips (and audio streams) right from the beginning, which can be sufficient to assess the similarity/dissimilarity between clips. Therefore, the distance measured on them can approximate content dissimilarity well (and this will improve as the training progresses).
96
+
97
+ Motivated by this, we sample the negatives based on local feature embeddings $\mathbf { x } ^ { v }$ (and $\mathbf { x } ^ { a }$ ). Specifically, we compute a pairwise $\ell _ { 2 }$ distance between $\mathbf { x } _ { t }$ (positive) and all other instances within a mini-batch, and normalize them to the [0, 1] interval. To remove samples that are either too similar or too different from the positive sample, we discard instances that fall outside the $9 5 \%$ confidence interval in the normalized distance space. We then sample the negatives from the remainder using the normalized distance as sampling probability. This makes instances similar to the positive instance have more chance to become negatives. We emphasize the importance of sampling, instead of deterministically taking top most similar samples; the stochasticity allows our model to be robust to potentially inaccurate distance estimates because samples with low probabilities will still have a chance to be selected as negatives.
98
+
99
+ Finally, our MEP loss is the InfoNCE loss computed on all three Transformers,
100
+
101
+ $$
102
+ \mathcal { L } _ { \mathrm { M E P } } = \mathcal { L } _ { \mathrm { N C E } } ( \mathbf { x } ^ { a } , \tilde { \mathbf { y } } ^ { a } ) + \mathcal { L } _ { \mathrm { N C E } } ( \mathbf { x } ^ { v } , \tilde { \mathbf { y } } ^ { v } ) + \mathcal { L } _ { \mathrm { N C E } } ( [ \mathbf { x } ^ { a } ; \mathbf { x } ^ { v } ] , \tilde { \mathbf { z } } )
103
+ $$
104
+
105
+ Task 2: Correct Pair Prediction (CPP). The MEP task encourages our model to learn the underlying dynamics within each modality. To help our model learn cross-modal dynamics, we design a task that predicts whether a pair of audio-visual embeddings is from the same video. Specifically, we define two binary classifiers, one for the two unimodal Transformers and another for the multimodal Transformer. Each classifier takes as input either $\mathbf { s } _ { g } = [ \mathbf { y } _ { 0 } ^ { v } ; \mathbf { y } _ { 0 } ^ { a } ]$ (and $[ \mathbf { z } _ { 0 } ^ { v } ; \mathbf { z } _ { 0 } ^ { a } ] )$ , a pair of audio-visual “summary” embeddings corresponding to the BOS positions, or $\mathbf { s } _ { h } = [ \mathbf { y } _ { t } ^ { v } ; \mathbf { y } _ { t } ^ { a } ]$ (or $[ \mathbf { z } _ { t } ^ { v } ; \mathbf { z } _ { t } ^ { a } ] )$ , the output embeddings sampled at random positions (we take two random positions $t \in [ 1 , T ] )$ . The classifier predicts $p ( c | \mathbf { s } )$ indicating whether the pair is from the same video $\overset { \cdot } { c } = 1$ ) or from different videos $c = 0$ ). We train the classifiers with a binary cross-entropy loss,
106
+
107
+ $$
108
+ \begin{array} { r } { \mathcal { L } _ { C P P } = - \mathbb { E } _ { \mathbf { x } , \mathbf { y } } \left[ c \cdot \log p ( c | \mathbf { s } _ { g } ) + c \cdot \log p ( c | \mathbf { s } _ { h } ) \right] } \end{array}
109
+ $$
110
+
111
+ where $\ast$ is the inner product. We generate a random derangement of the input mini-batch so that the number of positive and negative pairs are guaranteed to be the same.
112
+
113
+ Overall Pretraining Objective. We train our model end-to-end from scratch by optimizing $\mathcal { L } _ { M E P } +$ $\alpha \mathcal { L } _ { C P P }$ with a balancing term $\alpha$ . We find our model is insensitive to this term, so we set $\alpha = 1 . 0$ .
114
+
115
+ # 2.2 PARAMETER REDUCTION
116
+
117
+ Optimizing our model is challenging due to the large memory requirement. The most expensive part is the Transformers, which take up $82 \%$ of model parameters. One could reduce the model size by making the Transformers shallower, but the depth of Transformers has shown to be crucial to get good performance (Devlin et al., 2019). We propose to reduce the model size by aggressively sharing parts of weights across Transformers as well as layers within each Transformer (see Figure 2 (d)).
118
+
119
+ Sharing across Transformers. We first consider sharing weights across Transformers. Each Transformer encodes data coming from different distributions: $g _ { V }$ encodes $\mathbf { x } ^ { v }$ , $g _ { A }$ encodes $\mathbf { x } ^ { a }$ , and $h _ { A V }$ encodes $\left( \mathbf { y } ^ { v } , \mathbf { y } ^ { a } \right)$ . These input distributions may each exhibit different dynamics, yet together share certain regularities because they all come from the same videos. Motivated by this, we decompose Transformer weights into shared and private parts so that different patterns can be learned in a parameter-efficient manner. Recall that each layer of a Transformer contains weights $\{ W ^ { q } , W ^ { k } , \dot { W } ^ { v } , W ^ { b } , W ^ { c } , W ^ { d } \}$ . We decompose each of these weights into $W = U \Sigma V ^ { \top }$ , where $\begin{array} { r } { \dot { W } \in \mathbb { R } ^ { M \times N } , U \in \mathbb { R } ^ { M \times O } , \Sigma \in \mathbb { R } ^ { O \times O } , V \in \mathbb { R } ^ { N \times O } } \end{array}$ . We perform low-rank approximation of $W$ by setting the rank $O \ll M , N$ , and share $U$ across Transformers while keeping $\Sigma$ and $V$ private to each Transformer. This helps reduce parameters because $M O + 3 ( O ^ { 2 } + N O ) { \mathrm { ' } } \ll 3 M N$ . We experimented with different matrix ranks $O$ but the differences were small; we set $O = 1 2 8$ $( M , N = 7 6 8$ or 3072).
120
+
121
+ The decomposition converts a linear projection of input $W \mathbf { x }$ into a series of (unconstrained) linear projections $U \Sigma V ^ { \top } { \bf x }$ . However, this can cause numerical instability during optimization (Nocedal & Wright, 2006). We could perform the Singular Value Decomposition (SVD) over $W$ so that it performs rotation $( V ^ { \top } )$ , stretch $\left( \Sigma \right)$ , and rotation $( U )$ with orthogonal basis vectors in $U$ and $V$ Unfortunately, solving the full SVD has a computational complexity of $\mathcal { O } ( \operatorname* { m a x } ( M , N ) ^ { 2 } )$ (Golub & Van Loan, 2012). Here, we put an orthogonality constraint only on $\Sigma$ and perform projection $( V ^ { \top } )$ , rotation $\left( \Sigma \right)$ , and projection $( U )$ of input $\mathbf { x }$ . In addition, we put $V ^ { \top } { \bf x }$ in a unit sphere (via $\ell _ { 2 }$ - normalization) before rotating it with $\Sigma$ . This not only improves numerical stability, but also removes magnitude information in $V ^ { \top } { \bf x }$ and keeps angular information only, which has been shown to provide sample discriminative information (Chen et al., 2019a). To impose the orthogonality constraint on $\Sigma$ , we use the Padé approximation with a scale-squaring trick of Lezcano-Casado $\&$ Martínez-Rubio (2019). Intuitively, we linearly project $\mathbf { x }$ onto a unit sphere $( V ^ { \top } { \bf x } )$ and rotate it $( \Sigma V ^ { \top } { \bf x } )$ in each Transformer so that it captures the dynamics of each input distribution independently. We then project it to the shared space via $U$ , capturing shared regularities across all three Transformers.
122
+
123
+ Sharing across Layers. Recently, Bai et al. (2019a) showed that sharing parameters across layers in deep neural networks does not hurt the representational power of the network. Furthermore, (Lan et al., 2020) demonstrated that cross-layer parameter sharing in the Transformer leads to a lighter and faster-to-train model without sacrificing the performance on various language understanding benchmarks. Motivated by this, we let each Transformer share parameters across different layers.
124
+
125
+ # 3 EXPERIMENTS
126
+
127
+ We pretrain our model on Kinetics-700 (Carreira et al., 2019) or AudioSet (Gemmeke et al., 2017) and finetune it on various downstream tasks. The official release of Kinetics-700 contains 10-second clips only, so we download 410K original videos from YouTube and take 30-second clips from each video. For fair comparison with prior work, we use 10-second clips from the official release of AudioSet (we used 1.8M clips). We pretrain our model on 64 NVIDIA Tesla V100 GPUs with a batch size of 256 for 220K iterations. For downstream tasks, we evaluate on short-video/audio classification using UCF-101 (Soomro et al., 2012) (13K clips from 101 classes; 7.2 seconds on average) and ESC50 (Gemmeke et al., 2017) (2K clips from 50 classes; 5 seconds), and on long-video classification using Kinetics-Sounds (Arandjelovic & Zisserman, 2017) (23K videos from 32 classes; 10 seconds on average) and Charades (Sigurdsson et al., 2016) (10K videos from 157 classes; 30 seconds on average). We describe various details about experimental setup in Appendix.
128
+
129
+ # 3.1 RESULTS AND DISCUSSION
130
+
131
+ Multimodal Fusion Methods. To evaluate different fusion methods on the quality of learned representation, we test the following settings: (i) Early uses a single multimodal Transformer with $2 \times L$ layers, (ii) Mid is our approach described in Figure 1, (iii) Late uses two unimodal Transformers each with $2 \times L$ layers. All the methods are pretrained on audio-visual data using CPP and MEP losses, except for (iv) $\mathtt { L a t e - w / o - C P P }$ where we use only the MEP loss. We finetune the pretrained models on audio-visual, audio-only, and visual-only scenarios. For fair comparisons across different fusion methods, we do not perform parameter sharing in this ablation setting.
132
+
133
+ Table 1 (a) shows that Early and Mid outperform Late on the audio-visual scenario. This suggests the importance of encoding cross-modal information. Note that Late-w/-CPP gets cross-modal self-supervision, which gives marginal performance improvement over Late-w/o-CPP; however, both methods miss the opportunity to encode any cross-modal relationship, leading to inferior results.
134
+
135
+ Table 1: Ablation study on Kinetics-Sounds comparing: (a; top-left) multimodal fusion methods, (b; top-right) negative sampling strategies, and (c & d; bottom) parameter sharing schemes. X.-L: Cross-layer, X.-T: Cross-Transformer sharing. We report top-1 and top-5 accuracy $\hat { ( \% ) }$ . †: Ours.
136
+
137
+ <table><tr><td colspan="2">a) Fusion Method</td><td>Audio-Visual</td><td colspan="2">Audio-only -/</td><td colspan="2">Visual-only</td><td colspan="2">b) Sampling Method</td><td colspan="2">top-5</td><td colspan="2">89.8</td></tr><tr><td>Early Late-w/-CPP</td><td colspan="2"></td><td colspan="2">64.9/89.8 61.0/88.7</td><td colspan="2">-/-</td><td colspan="2">Current-Sequence</td><td colspan="2">Current-MiniBatch</td><td colspan="2">top-1 64.6 65.5 66.2</td></tr><tr><td>Late-w/o-CPP</td><td></td><td>60.6 /87.6</td><td colspan="2">52.3/80.8 50.5/79.9</td><td colspan="2">41.0 /71.3 40.7/71.7</td><td colspan="2">CANS-Dissimilar</td><td colspan="2"></td><td colspan="2">90.8</td></tr><tr><td>Midt</td><td></td><td>65.7 /89.9</td><td>53.5 /82.7</td><td colspan="2"></td><td colspan="2">42.5 /73.2</td><td colspan="2">CANS-Similart</td><td colspan="2">67.5</td><td>91.1 92.3</td></tr><tr><td></td><td></td><td>X.-T</td><td></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td></td></tr><tr><td>c)Model</td><td>X.-L X</td><td>X</td><td>Params</td><td colspan="2">top-1/5</td><td colspan="2">d) Model</td><td colspan="2">X.-L X.-T</td><td colspan="2">Params</td><td>top-1/5</td></tr><tr><td>Multi-2 Multi-6</td><td></td><td>X</td><td>7M 21M</td><td colspan="2">60.3/88.9 65.7 /89.9</td><td colspan="2">Vis-2 Vis-2</td><td colspan="2">X X X</td><td colspan="2">14M 7M</td><td>41.4/71.0 41.2 /72.9</td></tr><tr><td>Multi-6</td><td></td><td>√(Al1)</td><td colspan="2">7M 67.1/92.3</td><td colspan="2">Vis-6</td><td colspan="2">√ X X</td><td colspan="2">43M</td><td colspan="2">43.8/74.2</td></tr><tr><td>Multi-6</td><td>√ √</td><td>(Partt)</td><td colspan="2">4M 67.5 /92.3</td><td colspan="2">Vis-6</td><td colspan="2">√</td><td colspan="2">7M</td><td colspan="2">43.5 /73.7</td></tr></table>
138
+
139
+ While both Early and Late perform similarly in the audio-visual scenario, only Late can be used in unimodal downstream scenarios (c.f., Early requires the presence of both modalities). This has practical implications: Mid and Late can effectively handle missing modalities, i.e., once pretrained on audio-visual data, we can use it on any of audio-visual, audio-only, and visual-only scenarios. Our Mid fusion approach enjoys both the advantages, i.e., learning cross-modal relationship and being robust to missing modalities, achieving overall the best performance.
140
+
141
+ Negative Sampling Strategies. We compare four strategies: (i) Current-Sequence takes all but the positive instance from the same sequence as negatives, (ii) Current-MiniBatch takes all but the positive instance in the mini-batch as negatives; this subsumes Current-Sequence, (iii) CANS-Dissimilar stochastically samples negatives using a modified version of our contentaware negative sampling (CANS) that favors dissimilar samples, and (iv) CANS-Similar is our proposed CANS approach that favors negatives that are similar to the positive instance.
142
+
143
+ Table 1 (b) shows Current-Sequence is the least effective: It makes MEP too difficult because negatives are (sometimes too much) similar to positives. As a result, the training dynamics is dominated by CPP, which is relatively easier, leading to inferior performance. We make quite the contrary observations from Current-MiniBatch: the inclusion of negatives from different videos makes MEP easier and thus makes it dominate the training dynamics. Our CANS approach solves both these issues by eliminating negatives that are either almost identical to or trivial to distinguish from the positives, based on the $9 5 \%$ CI over the CNN embedding distances. It also samples negatives in a stochastic manner so a wide variety of samples can be included as negatives. Our proposed CANS-Similar can be considered as a “softened” version of Current-Sequence; it samples negatives that are similar to positives with a high probability (this can be considered as online hard negative mining), but it also takes instances from different videos with a lower probability. This balances out hard and easy negatives, making the MEP task effective.
144
+
145
+ Parameter Sharing Schemes. Our parameter reduction scheme reduces the number of parameters from 128M to 4M (by $9 7 \%$ ) (Table 1 (c)). We reduce the model size by sharing weights across Transformers and across layers. We validate these ideas in two sets of experiments. Table 1 (c) compares cross-Transformer weight sharing schemes. We use $\mathrm { M u l t i } - 6$ that uses all three Transformers with 6 layers each, and compare four methods that correspond to Figure 2 (a)-(d). Note that No sharing is too large to fit in a Tesla V100 GPU (16GB) even with 2 samples, so we define Multi-2 that uses three Transformers with 2 layers each, and with the reduced number of attention heads $A$ to 5, the feature dimension $D$ to 320 and the intermediate dimension $E$ to 1280. We see that our proposed approach, Part, achieves the best performance with the least number of parameters. One might ask how Part leads to a smaller model when All shares all the weights across Transformers: We decompose weights $W = U \Sigma V ^ { \top }$ with low-rank approximation and share only $U$ across Transformers, while the $\bar { \Sigma } V ^ { \top }$ part learns modality-specific dynamics. Table 1 (d) compares cross-layer weight sharing schemes using the visual Transformer with either 2 $\left( \mathrm { \nabla } \mathrm { i } \mathrm { \mathbf { s } } - 2 \right)$ or $6 \left( \mathrm { V i } \thinspace \mathrm { s } - 6 \right)$ layers. The results show that sharing weights across layers does not hurt the performance, confirming the observations by Lan et al. (2020) in the audio-visual setting.
146
+
147
+ Pretraining Objectives. To evaluate the importance of MEP and CPP tasks, we test two settings: (i) $\mathsf { M i d - w / o - C P P }$ and (ii) Mid-w/o-MEP. On Kinetics-Sounds, these achieve $6 5 . 9 \%$ and $6 4 . 6 \%$ respectively; ours achieve $6 7 . 5 \%$ (top-1 accuracy). The result show that the MEP task plays an important role during pretraining, confirming the findings from Sun et al. (2019a) that the InfoNCE
148
+
149
+ <table><tr><td>a) Model</td><td>Net</td><td>Data</td><td>UCF</td><td>b) Model</td><td>Net</td><td>Data</td><td>ESC</td><td>c)Model</td><td>Charades</td><td>KS</td></tr><tr><td>ST-Puzzle</td><td>3D-R18</td><td>K400</td><td>65.8</td><td>SVM</td><td>MLP</td><td>-</td><td>39.6</td><td>Random</td><td>5.9</td><td>-/-</td></tr><tr><td>ClipOrder</td><td>R(2+1)D</td><td>UCF</td><td>72.4</td><td>ConvAE</td><td>CNN-4</td><td></td><td>39.9</td><td>ATF</td><td>18.3</td><td>-/-</td></tr><tr><td>DPC</td><td>3D-R34</td><td>K400</td><td>75.7</td><td>RF</td><td>MLP</td><td>=</td><td>44.3</td><td>ATF (OF)</td><td>22.4</td><td>-/-</td></tr><tr><td>CBT</td><td>S3D</td><td>K600</td><td>79.5</td><td>ConvNet</td><td>CNN-4</td><td>=</td><td>64.5</td><td>V-CNN</td><td>18.7</td><td>45.8/73.3</td></tr><tr><td>MultiSens</td><td>3D-R18</td><td>AS</td><td>82.1</td><td>SoundNet</td><td>CNN-8</td><td>FS</td><td>74.2</td><td>A-CNN</td><td>18.9</td><td>49.4 /76.9</td></tr><tr><td>AVTS</td><td>MC3-18</td><td>K400</td><td>85.8</td><td>L-Net</td><td>CNN-8</td><td>FS</td><td>79.3</td><td>M-CNN</td><td>23.1</td><td>59.4/83.6</td></tr><tr><td>AVTS</td><td>MC3-18</td><td>AS</td><td>89.0</td><td>DMC</td><td>VGG-ish</td><td>FS</td><td>79.8</td><td>V-BERT</td><td>26.0</td><td>49.5/78.9</td></tr><tr><td>V-CNN↑</td><td>SlowFast</td><td>K700</td><td>85.2</td><td>AVTS</td><td>VGG-M</td><td>AS</td><td>80.6</td><td>A-BERT</td><td>27.4</td><td>58.9 /85.7</td></tr><tr><td>V-CNNt</td><td>SlowFast</td><td>AS</td><td>86.1</td><td>A-CNN</td><td>R50</td><td>AS</td><td>81.5</td><td>M-BERT+</td><td>29.5</td><td>75.6 /94.6</td></tr></table>
150
+
151
+ Datasets. K: Kinetics, AS: AudioSet, FS: Flicker-SoundNet, KS: Kinetics-Sounds. Baselines. ST-Puzzle (Kim et al., 2019), ClipOrder (Xu et al., 2019), DPC (Han et al., 2019), CBT (Sun et al., 2019a), MultiSens (Owens & Efros, 2018), AVTS (Korbar et al., 2018), AE (Aytar et al., 2016), SVM (Piczak, 2015a), RF (Piczak, 2015a), ConvNet (Piczak, 2015b), SoundNet (Aytar et al., 2016), $L ^ { 3 }$ -Net (Arandjelovic & Zisserman, 2017), DMC (Hu et al., 2019), ATF (Sigurdsson et al., 2017)
152
+
153
+ Table 2: (a; left): Short video classification results on UCF101 (mean accuracy $( \% )$ ). (b; center): Short audio classification results on ESC-50 (mean accuracy $( \% )$ ). (c; right): Long video classification results on Charades (mAP) and Kinetics-Sounds (KS; top-1/5 accuracy $( \% )$ ). †: Ours.
154
+
155
+ loss, as deployed in CBT, is effective in the cross-modal setting. The result also shows that augmenting MEP with CPP provides further performance improvement by learning cross-modal correspondence.
156
+
157
+ Downstream Evaluation. We pretrain our model with Mid fusion using MEP and CPP tasks (with CANS-Similar), and employ Part weight sharing. We use either Kinetics-700 or AudioSet for fair comparisons with prior work. Table 2 (a)/(b) shows short-video/audio classification results on UCF-101/ESC-50. For fair comparisons to the baselines, we use only the visual/audio CNN (no Transformers); we finetune a linear classifier on top of the visual CNN end-to-end for UCF-101, and train a multi-class one-vs-all linear SVM on top of the fixed audio CNN for ESC-50. Although our model is pretrained on long video clips with no direct supervision to the CNN layers (gradients must flow through Transformers), it outperforms most of the baselines (except for AVTS on UCF-101) that received direct supervision from short video clips. We note that, similar to ours, CBT (Su et al., 2020) is a multimodal Transformer pretrained on long video clips and thus is the most meaningful comparison to ours; ours outperform CBT on UCF-101 by $5 . 7 \%$ . For sound classification, our approach outperform all existing published results.
158
+
159
+ Table 2 (c) shows long-video classification results on Charades and Kinetics-Sounds (KS) when pretrained on Kinetics-700. We test Visual-only (V), Audio-only (A), and Multimodal (M) settings to verify the benefit of multimodal learning. Because there is no published selfsupervised learning results on these datasets, we demonstrate long-term representations by comparing CNNs (CNN; short-term) to Transformers (BERT; long-term) on KS that contains 10-second clips. Since CNNs process 1-second clips, we feed 10 non-overlapping clips to CNNs and average the prediction output. In all settings, we add a 2-layer MLP with softmax classifier on top. The results show that Transformers outperform CNNs on Kinetics-Sounds, suggesting the superiority of long-term representations. We also see that combining audio-visual information performs the best. We notice that audio representations are generally stronger than visual representations; we believe that learning discriminative visual representations is generally more challenging, especially when the CNNs receive (self-)supervision signals only indirectly through Transformers. We believe that providing (self-)supervision directly to CNNs, e.g., by first pretraining CNNs on 3D rotation prediction (Jing et al., 2018) and then jointly training the whole model (as was done in CBT (Sun et al., 2019a)), could further improve performance. Incorporating contrastive learning (Chen et al., 2020) over the CNN embeddings and training the whole model end-to-end is another promising direction for future work.
160
+
161
+ # 4 RELATED WORK
162
+
163
+ Multimodal BERT. Extending BERT (Devlin et al., 2019) to vision-and-language has been actively studied. Existing work typically adopt early fusion (Li et al., 2019; Alberti et al., 2019; Sun et al., 2019b; Li et al., 2020; Zhou et al., 2020; Su et al., 2020; Chen et al., 2019b; Zhu & Yang, 2020) or mid fusion (Tan & Bansal, 2019; Lu et al., 2019; Sun et al., 2019a; Luo et al., 2020) without thorough validation, and they train only visual components while relying on a language-pretrained BERT. Although there have been some efforts to leverage the Transformer architecture (Vaswani et al., 2017) for audio and visual inputs (Boes & Van hamme, 2019; Tian et al., 2020), our approach is the first to demonstrate multimodal audio-visual BERT trained from scratch in an end-to-end manner. This is enabled by our novel parameter reduction technique, which is one of our main technical contributions.
164
+
165
+ Audio-Visual Learning. Early work in audio-visual learning focused on speech signals, improving audio-visual speech recognition than unimodal approaches (Ngiam et al., 2011; Srivastava & Salakhutdinov, 2012). Recent approaches leverage unlabeled videos from specific domains (Owens et al., 2016; Gao & Grauman, 2019; Zhao et al., 2018; Ephrat et al., 2018; Alwassel et al., 2019; Miech et al., 2020; Piergiovanni et al., 2020) and often demonstrate on audio-visual source separation, localization, and co-segmentation. However, these approaches rely on short-term audio-visual correspondence and thus may not generalize to long-term video recognition that requires global context (as was suggested in (Hjelm et al., 2019)), which this work focuses on.
166
+
167
+ Parameter Reduction. Network pruning (Reed, 1993; Caron et al., 2020) trains a large model and then reduces its size while maintaining performance. Reducing the size of CNNs for mobile applications is an active research area (Rastegari et al., 2016; Howard et al., 2017; 2019; Zhang et al., 2018; Iandola et al., 2016). Our work is closely related to the work that shares parameters across layers in deep neural networks. Trellis network (Bai et al., 2019b) is a temporal convolutional architecture with weight-tying across time and depth. Similar to ours, Universal Transformer (Dehghani et al., 2019), RSNMT (Dabre & Fujita, 2019), DEQ (Bai et al., 2019a), ALBERT (Lan et al., 2020) share weights across layers in Transformers. We combine this idea with our novel cross-Transformer weight sharing, which decomposes weight matrices with low-rank approximation.
168
+
169
+ Negative Sampling. Hard negative mining has been shown to be crucial for contrastive learning (Arandjelovic & Zisserman, 2017; Owens & Efros, 2018; Korbar et al., 2018; Schroff et al., 2015; Zhuang et al., 2019; Morgado et al., 2020; Wu et al., 2020). Korbar et al. (2018) use the time difference between clips to approximate clip similarity (i.e., clips that are further apart are deemed more different). However, such an assumption may not hold for real-world videos, e.g., periodic actions such as push-ups. Unlike this line of approaches, we directly use the feature embeddings learned by our model. Several apparoaches adapted a similar idea (Schroff et al., 2015; Zhuang et al., 2019; Morgado et al., 2020; Wu et al., 2020). Different from prior work, we bring the stochasticity to the sampling procedure by using the content similarity as the sampling probability; this helps reduce potential errors especially during the early stage of training.
170
+
171
+ # 5 CONCLUSION
172
+
173
+ We introduced a multimodal bidirectional Transformer architecture for self-supervised learning of contextualized audio-visual representation from unlabeled videos. Our main technical contributions include: (1) we propose a parameter efficient multimodal Transformers based on matrix decomposition with low-rank approximation; (2) we propose a novel content-aware negative sampling technique for contrastive learning. We demonstrate a successful end-to-end training of multimodal Transformers for audio-visual learning (which is, to the best of our knowledge, the first time in the literature). We also report comprehensive evaluation of various design decisions in multimodal learning.
174
+
175
+ Acknowledgements. This work was partially supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No.2017-0-01772, Video Turing Test, No.2019-0-01082, SW StarLab) and the international cooperation program by the NRF of Korea (NRF-2018K2A9A2A11080927).
176
+
177
+ # REFERENCES
178
+
179
+ Chris Alberti, Jeffrey Ling, Michael Collins, and David Reitter. Fusion of Detected Objects in Text for Visual Question Answering. In EMNLP-IJCNLP, 2019.
180
+
181
+ Humam Alwassel, Dhruv Mahajan, Lorenzo Torresani, Bernard Ghanem, and Du Tran. SelfSupervised Learning by Cross-Modal Audio-Video Clustering. arXiv preprint arXiv:1911.12667, 2019.
182
+
183
+ Relja Arandjelovic and Andrew Zisserman. Look, Listen and Learn. In ICCV, 2017.
184
+
185
+ Relja Arandjelovic and Andrew Zisserman. Objects that Sound. In ECCV, 2018.
186
+
187
+ Yusuf Aytar, Carl Vondrick, and Antonio Torralba. SoundNet: Learning Sound Representations from Unlabeled Video. In NeurIPS, 2016.
188
+
189
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer Normalization. In NeurIPS Deep Learning Symposium, 2016.
190
+
191
+ Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep Equilibrium Models. In NeurIPS, 2019a.
192
+
193
+ Shaojie Bai, J Zico Kolter, and Vladlen Koltun. Trellis Networks for Sequence Modeling. In ICLR, 2019b.
194
+
195
+ Tadas Baltrušaitis, Chaitanya Ahuja, and Louis-Philippe Morency. Multimodal Machine Learning: A Survey and Taxonomy. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(2): 423–443, 2018.
196
+
197
+ Wim Boes and Hugo Van hamme. Audiovisual Transformer Architectures for Large-Scale Classification and Synchronization of Weakly Labeled Audio Events. In ACM MM, 2019.
198
+
199
+ Mathilde Caron, Ari Morcos, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Pruning Convolutional Neural Networks with Self-Supervision. arXiv preprint arXiv:2001.03554, 2020.
200
+
201
+ Joao Carreira, Eric Noland, Chloe Hillier, and Andrew Zisserman. A Short Note on the Kinetics-700 Human Action Dataset. arXiv preprint arXiv:1907.06987, 2019.
202
+
203
+ Beidi Chen, Weiyang Liu Animesh Garg, Zhiding Yu, Anshumali Shrivastava, Jan Kautz, and Anima Anandkumar. Angular Visual Hardness. In ICML Workshop on Identifying and Understanding Deep Learning Phenomena, 2019a.
204
+
205
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A Simple Framework for Contrastive Learning of Visual Representations. arXiv preprint arXiv:2002.05709, 2020.
206
+
207
+ Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. UNITER: UNiversal Image-TExt Representation Learning. arXiv preprint arXiv:1909.11740, 2019b.
208
+
209
+ 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.
210
+
211
+ Raj Dabre and Atsushi Fujita. Recurrent Stacking of Layers for Compact Neural Machine Translation Models. In AAAI, 2019.
212
+
213
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal Transformers. In ICLR, 2019.
214
+
215
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In NAACL-HLT, 2019.
216
+
217
+ Ariel Ephrat, Inbar Mosseri, Oran Lang, Tali Dekel, Kevin Wilson, Avinatan Hassidim, William T Freeman, and Michael Rubinstein. Looking to Listen at the Cocktail Party: A Speaker-Independent Audio-Visual Model for Speech Separation. ACM Transactions on Graphics, 37(4), 2018.
218
+
219
+ Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. SlowFast Networks for Video Recognition. In ICCV, 2019.
220
+
221
+ Ruohan Gao and Kristen Grauman. 2.5D Visual Sound. In CVPR, 2019.
222
+
223
+ Jort F. Gemmeke, Daniel P. W. Ellis, Dylan Freedman, Aren Jansen, Wade Lawrence, R. Channing Moore, Manoj Plakal, and Marvin Ritter. Audio Set: An Ontology and Human-Labeled Dataset for Audio Events. In ICASSP, 2017.
224
+
225
+ Gene H Golub and Charles F Van Loan. Matrix Computations, volume 3. JHU press, 2012.
226
+
227
+ Chunhui Gu, Chen Sun, David A Ross, Carl Vondrick, Caroline Pantofaru, Yeqing Li, Sudheendra Vijayanarasimhan, George Toderici, Susanna Ricco, Rahul Sukthankar, et al. AVA: A Video Dataset of Spatio-temporally Localized Atomic Visual Actions. In CVPR, 2018.
228
+
229
+ Michael Gutmann and Aapo Hyvärinen. Noise-Contrastive Estimation: A New Estimation Principle for Unnormalized Statistical Models. In AISTATS, 2010.
230
+
231
+ Tengda Han, Weidi Xie, and Andrew Zisserman. Video Representation Learning by Dense Predictive Coding. In ICCV Workshop on Large Scale Holistic Video Understanding, 2019.
232
+
233
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In CVPR, 2016.
234
+
235
+ Dan Hendrycks and Kevin Gimpel. Gaussian Error Linear Units (GELUs). arXiv preprint arXiv:1606.08415, 2016.
236
+
237
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019.
238
+
239
+ Sepp Hochreiter and Jürgen Schmidhuber. Long Short-Term Memory. Neural computation, 9(8): 1735–1780, 1997.
240
+
241
+ Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, et al. Searching for MobileNetV3. In ICCV, 2019.
242
+
243
+ 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.
244
+
245
+ Jeremy Howard and Sebastian Ruder. Universal Language Model Fine-tuning for Text Classification. In ACL, 2018.
246
+
247
+ Di Hu, Feiping Nie, and Xuelong Li. Deep Multimodal Clustering for Unsupervised Audiovisual Learning. In CVPR, 2019.
248
+
249
+ Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and ${ < } 0 . 5 \mathrm { M B }$ model size. arXiv preprint arXiv:1602.07360, 2016.
250
+
251
+ Longlong Jing, Xiaodong Yang, Jingen Liu, and Yingli Tian. Self-Supervised Spatiotemporal Feature Learning via Video Rotation Prediction. arXiv preprint arXiv:1811.11387, 2018.
252
+
253
+ 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.
254
+
255
+ Evangelos Kazakos, Arsha Nagrani, Andrew Zisserman, and Dima Damen. EPIC-Fusion: AudioVisual Temporal Binding for Egocentric Action Recognition. In ICCV, 2019.
256
+
257
+ Dahun Kim, Donghyeon Cho, and In So Kweon. Self-Supervised Video Representation Learning with Space-Time Cubic Puzzles. In AAAI, 2019.
258
+
259
+ Bruno Korbar, Du Tran, and Lorenzo Torresani. Cooperative Learning of Audio and Video Models from Self-Supervised Synchronization. In NeurIPS, 2018.
260
+
261
+ Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. In ICLR, 2020.
262
+
263
+ Mario Lezcano-Casado and David Martínez-Rubio. Cheap Orthogonal Constraints in Neural Networks: A Simple Parametrization of the Orthogonal and Unitary Group. In ICML, 2019.
264
+
265
+ Gen Li, Nan Duan, Yuejian Fang, Min Gong, Daxin Jiang, and Ming Zhou. Unicoder-VL: A Universal Encoder for Vision and Language by Cross-modal Pre-training. In AAAI, 2020.
266
+
267
+ Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. VisualBERT: A Simple and Performant Baseline for Vision and Language. arXiv preprint arXiv:1908.03557, 2019.
268
+
269
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv preprint arXiv:1907.11692, 2019.
270
+
271
+ Ilya Loshchilov and Frank Hutter. Decoupled Weight Decay Regularization. In ICLR, 2019.
272
+
273
+ Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks. In NeurIPS, 2019.
274
+
275
+ Huaishao Luo, Lei Ji, Botian Shi, Haoyang Huang, Nan Duan, Tianrui Li, Xilin Chen, and Ming Zhou. UniViLM: A Unified Video and Language Pre-Training Model for Multimodal Understanding and Generation. arXiv preprint arXiv:2002.06353, 2020.
276
+
277
+ Antoine Miech, Jean-Baptiste Alayrac, Lucas Smaira, Ivan Laptev, Josef Sivic, and Andrew Zisserman. End-to-End Learning of Visual Representations from Uncurated Instructional Videos. In CVPR, 2020.
278
+
279
+ Pedro Morgado, Nuno Vasconcelos, and Ishan Misra. Audio-Visual Instance Discrimination with Cross-Modal Agreement. arXiv preprint arXiv:2004.12943, 2020.
280
+
281
+ Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew Y Ng. Multimodal Deep Learning. In ICML, 2011.
282
+
283
+ Jorge Nocedal and Stephen Wright. Numerical Optimization. Springer Science & Business Media, 2006.
284
+
285
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation Learning with Contrastive Predictive Coding. arXiv preprint arXiv:1807.03748, 2018.
286
+
287
+ Andrew Owens and Alexei A Efros. Audio-Visual Scene Analysis with Self-Supervised Multisensory Features. In ECCV, 2018.
288
+
289
+ Andrew Owens, Phillip Isola, Josh McDermott, Antonio Torralba, Edward H Adelson, and William T Freeman. Visually Indicated Sounds. In CVPR, 2016.
290
+
291
+ Andrew Owens, Jiajun Wu, Josh H McDermott, William T Freeman, and Antonio Torralba. Learning Sight from Sound: Ambient Sound Provides Supervision for Visual Learning. International Journal of Computer Vision, 126(10):1120–1137, 2018.
292
+
293
+ Daniel S Park, William Chan, Yu Zhang, Chung-Cheng Chiu, Barret Zoph, Ekin D Cubuk, and Quoc V Le. SpecAugment: A Simple Data Augmentation Method for Automatic Speech Recognition. In INTERSPEECH, 2019.
294
+
295
+ Mandela Patrick, Yuki M Asano, Ruth Fong, João F Henriques, Geoffrey Zweig, and Andrea Vedaldi. Multi-modal Self-Supervision from Generalized Data Transformations. arXiv preprint arXiv:2003.04298, 2020.
296
+
297
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep Contextualized Word Representations. In NAACL-HLT, 2018.
298
+
299
+ Karol J. Piczak. ESC: Dataset for Environmental Sound Classification. In ACM-MM, 2015a.
300
+
301
+ Karol J. Piczak. Environmental Sound Classification with Convolutional Neural Networks. In MLSP, 2015b.
302
+
303
+ AJ Piergiovanni, Anelia Angelova, and Michael S Ryoo. Evolving Losses for Unsupervised Video Representation Learning. In CVPR, 2020.
304
+
305
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving Language Understanding by Generative Pre-Training. Techincal Report, OpenAI, 2018.
306
+
307
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. OpenAI Blog, 1(8), 2019.
308
+
309
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks. In ECCV, 2016.
310
+
311
+ Sashank J Reddi, Satyen Kale, and Sanjiv Kumar. On the Convergence of Adam and Beyond. In ICLR, 2018.
312
+
313
+ Russell Reed. Pruning Algorithms-A Survey. IEEE Transactions on Neural Networks, 4(5):740–747, 1993.
314
+
315
+ Florian Schroff, Dmitry Kalenichenko, and James Philbin. FaceNet: A Unified Embedding for Face Recognition and Clustering. In CVPR, 2015.
316
+
317
+ Gunnar A Sigurdsson, Gül Varol, Xiaolong Wang, Ali Farhadi, Ivan Laptev, and Abhinav Gupta. Hollywood in Homes: Crowdsourcing Data Collection for Activity Understanding. In ECCV, 2016.
318
+
319
+ Gunnar A Sigurdsson, Santosh Divvala, Ali Farhadi, and Abhinav Gupta. Asynchronous Temporal Fields for Action Recognition. In CVPR, 2017.
320
+
321
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. UCF101: A Dataset of 101 Human Action Classes From Videos in The Wild. CRCV-TR-12-01, 2012.
322
+
323
+ Nitish Srivastava and Russ R Salakhutdinov. Multimodal Learning with Deep Boltzmann Machines. In NeurIPS, 2012.
324
+
325
+ Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. VL-BERT: Pre-training of Generic Visual-Linguistic Representations. In ICLR, 2020.
326
+
327
+ Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. Learning Video Representations using Contrastive Bidirectional Transformer. arXiv preprint arXiv:1906.05743, 2019a.
328
+
329
+ Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. VideoBERT: A Joint Model for Video and Language Representation Learning. In ICCV, 2019b.
330
+
331
+ Hao Tan and Mohit Bansal. LXMERT: Learning Cross-Modality Encoder Representations from Transformers. In EMNLP-IJCNLP, 2019.
332
+
333
+ Yapeng Tian, Dingzeyu Li, and Chenliang Xu. Unified Multisensory Perception: Weakly-Supervised Audio-Visual Video Parsing. In ECCV, 2020.
334
+
335
+ Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Deep Image Prior. In CVPR, 2018.
336
+
337
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. In NeurIPS, 2017.
338
+
339
+ Mike Wu, Chengxu Zhuang, Milan Mosse, Daniel Yamins, and Noah Goodman. On Mutual Information in Contrastive Learning for Visual Representations. arXiv preprint arXiv:2005.13149, 2020.
340
+
341
+ Dejing Xu, Jun Xiao, Zhou Zhao, Jian Shao, Di Xie, and Yueting Zhuang. Self-supervised Spatiotemporal Learning via Video Clip Order Prediction. In CVPR, 2019.
342
+
343
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. XLNet: Generalized Autoregressive Pretraining for Language Understanding. In NeurIPS, 2019.
344
+
345
+ Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices. In CVPR, 2018.
346
+
347
+ Hang Zhao, Chuang Gan, Andrew Rouditchenko, Carl Vondrick, Josh McDermott, and Antonio Torralba. The Sound of Pixels. In ECCV, 2018.
348
+
349
+ Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason J Corso, and Jianfeng Gao. Unified Vision-Language Pre-Training for Image Captioning and VQA. In AAAI, 2020.
350
+
351
+ Linchao Zhu and Yi Yang. ActBERT: Learning Global-Local Video-Text Representations. In CVPR, 2020.
352
+
353
+ Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local Aggregation for Unsupervised Learning of Visual Embeddings. In ICCV, 2019.
354
+
355
+ # A IMPLEMENTATION DETAILS
356
+
357
+ # A.1 ARCHITECTURES OF VISUAL/AUDIO CNNS
358
+
359
+ Table 3 shows the architectures of visual and audio CNNs we use for our model. For the visual CNN, we use the SlowFast network (Feichtenhofer et al., 2019) with a ResNet-50 backbone (He et al., 2016). We use the speed ratio $\alpha = 8$ and the channel ratio $\beta = 1 / 8$ for the SlowFast architecture, so $T _ { f } = 8 \times T _ { s }$ . We use different values of $T _ { s }$ and $T _ { f }$ for different tasks. During pretraining, we set $\dot { T } _ { s } = 4$ and $T _ { f } = 3 2$ . During finetuning, we use $\mathrm { { \dot { } } } T _ { s } = 8$ and $T _ { f } = 6 4$ for short-video action classification on UCF101 (Soomro et al., 2012) while we use $T _ { s } = 4$ and $T _ { f } = 3 2$ for long-video action classification on Charades (Sigurdsson et al., 2016) and Kinetics-Sounds (Arandjelovic & Zisserman, 2017). For the audio CNN, we use a ResNet-50 without the downsampling layer $\mathsf { p o o l } _ { 1 }$ to preserve information along both frequency and time axis in early stages. We use different values of $T _ { a }$ for different training phases. We set $T _ { a } = 2 2 0$ for one-second clip during pretraining while we use $T _ { a } = 4 4 0$ for two-second clip during finetuning.
360
+
361
+ Table 3: The architectures of visual and audio CNNs. For the visual CNN, the input dimensions are denoted by {channel size, temporal size, spatial $s i z e ^ { 2 } \}$ , kernels are denoted by {temporal size, spatial $s i z e ^ { 2 }$ , channel size} and strides are denoted by {temporal stride, spatial stride $\mathrm { ~ \bar { ~ } { ~ } ~ } ^ { 2 } \}$ . For the audio CNN, the input dimensions are denoted by {frequency size, temporal size}, kernels are denoted by {frequency size, time size, channel size} and strides are denoted by {frequency stride, temporal stride}.
362
+
363
+ <table><tr><td rowspan=2 colspan=1> Stage</td><td rowspan=1 colspan=6>Visual CNN</td><td rowspan=2 colspan=2>Audio CNN</td></tr><tr><td rowspan=1 colspan=3>Slow pathway</td><td rowspan=1 colspan=3>Fast pathway</td></tr><tr><td rowspan=1 colspan=1>raw clip</td><td rowspan=1 colspan=3>3×Ts×112²</td><td rowspan=1 colspan=3>3×Tf × 112²</td><td rowspan=1 colspan=2>128×Ta</td></tr><tr><td rowspan=1 colspan=1>conV1</td><td rowspan=1 colspan=3>1 × 7²,64stride 1,2</td><td rowspan=1 colspan=3>5×7²,8stride 1, 22</td><td rowspan=1 colspan=2>9×9,32stride 1, 1</td></tr><tr><td rowspan=1 colspan=1>pool</td><td rowspan=1 colspan=3>1 ×3²,maxstride 1, 2²</td><td rowspan=1 colspan=3>1 × 3²,maxstride 1,22</td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>res2</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1²,641×3²,641 ×1²,256</td><td rowspan=1 colspan=1>x3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3×1²,81×3²,81 × 1²,32</td><td rowspan=1 colspan=1>×3</td><td rowspan=1 colspan=2>[1×1,32]3×3,32×3[1 × 1,128]</td></tr><tr><td rowspan=1 colspan=1>res3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1 ×1²,1281 ×3²,128[1 × 1²,512</td><td rowspan=1 colspan=1>×4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3×1²,161×3²,161 × 1²,64</td><td rowspan=1 colspan=1>×4</td><td rowspan=1 colspan=2>[1×1,64]3×3,64×4[1 × 1,256]</td></tr><tr><td rowspan=1 colspan=1>res4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3 ×1²,2561 × 3²,2561 × 1²,1024</td><td rowspan=1 colspan=1>×6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3×1²,321×3²,321 × 1²,128</td><td rowspan=1 colspan=1>×6</td><td rowspan=1 colspan=1>[1 ×1,128]3×3,128[1 × 1,512]</td><td rowspan=1 colspan=1>×6</td></tr><tr><td rowspan=1 colspan=1>res5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3 × 1²,5121× 3²,5121 ×1²,2048</td><td rowspan=1 colspan=1>×3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3×1²,641× 3²,641 ×1²,256</td><td rowspan=1 colspan=1>×3</td><td rowspan=1 colspan=2>[1×1,256]3×3,256×3[1×1,1024]</td></tr></table>
364
+
365
+ # A.2 DATA PREPROCESSING
366
+
367
+ We preprocess the data by dividing $T$ -second clips into $T$ non-overlapping parts ( $T = 3 0$ for Kinetics700 (Carreira et al., 2019) and $T = 1 0$ for AudioSet (Gemmeke et al., 2017)) and sampling 16 frames from each. For audio stream, we take waveform sampled at $4 4 . 1 \mathrm { k H z }$ and convert it to log-mel-scaled spectrogram. We augment audio data with random frequency/time masking using SpecAugment (Park et al., 2019), and visual data with color normalization, random resizing, random horizontal flip, and random cropping to obtain $1 1 2 \times 1 1 2$ pixel frames; for test data, we resize videos to 128 pixels on the shorter side and take three equidistant crops of $1 2 8 \times 1 2 8$ pixels to cover the entire region. We also apply audio-visual synchronized temporal jittering (Patrick et al., 2020).
368
+
369
+ ![](images/a884a15853da6aa7603f4f7a16f94798b41470b09c1b8ca6795f0b06f3ce69c6.jpg)
370
+ Figure 3: Loss curves during pretraining under different ablative settings. (a) compares ContentAware Negative Sampling (CANS) that favors negatives that are dissimilar vs. similar to the positive instance. (b) compares different cross-Transformer weight sharing schemes; see the text for details.
371
+
372
+ # A.3 DOWNSTREAM EVALUATION
373
+
374
+ For evaluation on UCF101, we follow the test protocol of (Feichtenhofer et al., 2019): We sample 10 clips from each test video at a uniform time interval, and for each sampled clip, we take three equidistant spatial crops, resulting in a total of 30 views. We use each of the 30 views as input to our visual CNN and average the prediction scores from all 30 views to obtain the final prediction result. For evaluation on ESC-50 (Piczak, 2015a), we extract 10 equally spaced 2-second clips from each test audio sample. We use each of 10 clips as input to our audio CNN and average the prediction scores to obtain the final prediction result. For evaluation on Charades and Kinetics-Sounds, we use three audio-visual sequences with different spatial crops from a test video and max-pool/average the prediction scores from each sequence, respectively.
375
+
376
+ # A.4 OPTIMIZATION
377
+
378
+ In all experiments, we use the AMSGrad (Reddi et al., 2018) variant of AdamW (Loshchilov & Hutter, 2019) optimizer with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 8$ , L2 weight decay of 1e-4. We use a learning rate warm-up for the first $6 \%$ of iterations followed by a linear decay of learning rate.
379
+
380
+ From the observations of Lezcano-Casado and Martínez-Rubio (Lezcano-Casado & Martínez-Rubio, 2019), we have 10 times less learning rate for the orthogonal parameters than that for the nonorthogonal parameters: we use 1e-5 for the former and 1e-4 for the latter.
381
+
382
+ We pretrain our model on Kinetics-700 (Carreira et al., 2019) with a batch size 256 for 220K iterations and AudioSet (Gemmeke et al., 2017) with a batch size 300 for 220K iterations in the main experiments; for the ablation study, we use a much smaller batch size of 4 and pretrain our model on Kinetics-700 for 80K iterations.
383
+
384
+ For finetuning on UCF101, we train our model for 40K iterations with a batch size of 64 and learning rate of 0.02. For evaluation on ESC-50, we train a multi-class one-vs-all linear SVM on top of our fixed audio CNN for 38K iterations with a batch size of 128 and learning rate of 0.003. For finetuning on Charades, we train for 40K iterations with a batch size of 8, with learning rate of 0.001 for the classifier and CNN parameters, 1e-5 for the orthogonal parameters and 1e-4 for the rest parameters. For finetuning on Kinetics-Sounds, we train for 24K iterations with a batch size of 32, with learning rate of 0.005 for the classifier and CNN parameters, 1e-4 for the orthogonal parameters and 1e-3 for the rest parameters.
385
+
386
+ # B EXTRA RESULTS FROM THE ABLATION STUDY
387
+
388
+ # B.1 NEGATIVE SAMPLING STRATEGIES
389
+
390
+ We proposed the content-aware negative sampling strategy (CANS) using pairwise $l _ { 2 }$ distances between CNN embeddings. We introduced two variants of CANS: CANS-Dissimilar that favors negatives that are dissimilar to the positive instance and CANS-Similar that favors negatives that are similar to the positive instance. We chose to use CANS-Similar based on the results from our ablation study presented in the main paper, Table 1 (b).
391
+
392
+ Figure 3 (a) in this appendix provides additional evidence that supports our decision. We see that the loss of CANS-Disimilar initially drops rapidly but starts increasing around iteration 7K and continues to increase until around 15K; this is mainly caused by the visual MEP loss shown in Figure 3 (a-2). One explanation for this might that CANS-Disimilar is easier to solve than CANS-Similar, which causes the loss landscape of CANS-Disimilar to contain too many shallow local minima compared to that of CANS-Similar. Recall that we use a learning rate warm-up for the first $6 \%$ of iterations during pretraining; this roughly equals to the first 13K (out of 220K) iterations. Given this, we speculate that the model got out of a local minima around iteration 7K (most likely due to the increasing learning rate), and then eventually settled in another (bad) local minima after the warm-up period ended. Compared to this, we observe much milder learning dynamics with CANS-Similar: the loss decreases relatively slowly but steadily, and eventually leaps around 35K to go below the loss of CANS-Disimilar. We, again, believe that this is because CANS-Similar is more difficult to solve than CANS-Disimilar (as shown by the slower decrease in loss values), which caused the resulting loss landscape to contain steeper local minima. Our model eventually found one of those after round 40K of iterations, resulting in a better performing model in the downstream tasks shown in Table 1 (b) of the main paper (the loss kept slowly decreasing after iteration 50K).
393
+
394
+ # B.2 PARAMETER SHARING SCHEMES
395
+
396
+ We proposed a cross-Transformer weight sharing technique, which decomposes weight matrices with low-rank approximation. Recall that each layer of a Transformer contains the multi-head attention layer weights $\{ W ^ { q } , W ^ { k } , W ^ { v } , W ^ { b } \}$ and the feed-forward layer weights $\{ W ^ { c } , W ^ { d } \}$ . We chose to share all six weight matrices across Transformers, though we could have shared any combination of them. To justify this design choice, we empirically compared three variants: (i) $\mathrm { M u l t i } - 6$ that do not share parameters across Transformers, (ii) Multi-6-Part_Att that shares only $\{ W ^ { q } , W ^ { k } , W ^ { v } , W ^ { b } \}$ (but not $\{ W ^ { c } , W ^ { d } \} _ { \ r }$ ) and (iii) $\mathtt { M u l t i - 6 - P a r t }$ that shares all six weight matrices. Figure 3 (b) shows that there is not much difference between all the variants in terms of the loss curves; we chose to use Multi-6-Part that requires the least number of parameters. We showed that our approach outperforms Multi-6 in the ablation study (Table 1 (c-left) in the main paper).
397
+
398
+ # B.3 JUSTIFICATION FOR THE MEP LOSS FORMULATION
399
+
400
+ Since the multimodal Transformer $h _ { A V }$ has access to both visual and audio inputs, one might think that the model could “leak” information about visual input into $\mathbf { z } ^ { a }$ and information about audio input into $\mathbf { z } ^ { v }$ , which could make MEP trivial to solve. Here we show that this is not the case. By construction, we mask the same positions in audio and visual streams when designing the MEP task, so the model has no access to the masked input even in a cross-modal manner. Empirically, removing the third term in Eq. 6 $( \mathcal { L } _ { \mathrm { N C E } } \big ( \big [ \mathbf { x } ^ { a } ; \mathbf { x } ^ { v } \big ] , \tilde { \mathbf { z } } \big ) )$ leads to performance degradation in Kinetics-Sounds, i.e., top-1 accuracy $6 6 . 7 \%$ vs. ours $6 7 . 5 \%$ (see Table 1), which suggests that solving the MEP task in the multimodal Transformer is beneficial to our model.
401
+
402
+ # B.4 JUSTIFICATION FOR THE CPP LOSS FORMULATION
403
+
404
+ Recall that our CPP loss has two terms; the first term uses the summary embeddings ${ \bf s } _ { g }$ and the second term uses output embeddings ${ \mathbf { s } } _ { h }$ sampled at random positions; see Eq. 7. One could argue that the two terms are redundant as bidirectional Transformers have “one-step” access to all the input embeddings, and thus solving CPP only with the summary embeddings (the first term) would be enough. This is not the case. We encode ${ \bf s } _ { h }$ with position-specific information through the time embeddings $\mathbf { p } _ { t }$ , which makes every ${ \mathbf { s } } _ { h }$ different compared to ${ \bf s } _ { g }$ . Empirically, we find that removing the second term of Eqn. 7 $\left( \mathbf { s } _ { h } \right)$ in our CPP loss leads to an inferior accuracy $6 6 . 9 \%$ vs. ours $67 . 5 \%$ on Kinetics-Sounds, suggesting its importance in learning.
405
+
406
+ # B.5 USE OF MODALITY EMBEDDINGS IN THE MULTIMODAL TRANSFORMER
407
+
408
+ We use modality embeddings $\mathbf { m } ^ { v }$ and $\mathbf { m } ^ { a }$ as part of input to the multimodal Transformer in order to distinguish embeddings coming from visual and audio Transformers. They are learnable weights trained end-to-end with other parameters. Conceptually, incorporating modality-discriminative embeddings is crucial because of our aggressive weight sharing scheme. Without them, the multimodal Transformer will see the output from audio/visual Transformers $\boldsymbol y ^ { a }$ and $y ^ { v }$ ) as if they are coming from the same distribution because the two Transformers share a large part of weights. Using modality embeddings encourages our model to preserve modality-specific information in the final output, and this empirically leads to performance improvements: ours $6 7 . 5 \%$ vs. without modality embeddings $6 7 . 1 \%$ on Kinetics-Sounds.
409
+
410
+ # B.6 ON THE IMPORTANCE OF END-TO-END PRETRAINING
411
+
412
+ Previous work in multimodal visual-and-language tasks (Tan & Bansal, 2019; Lu et al., 2019) point out that using partially fixed Transformers of different modalities is detrimental to multimodal representation learning (c.f., Sun et al. (2019a;b)). We make the same observation in our audiovisual learning scenario. We compare two variants of Multi-6 Part in Table 1 (c), each of which pretrains only the audio (or visual) CNN/Transformer in the first half of pretraining stage and then continues pretraining the remaining weights while fixing the weights of the audio (or visual) CNN/Transformer in the second half. This leads to inferior performance (audio-fixed $6 2 . 8 \%$ and visual-fixed $6 3 . 1 \%$ vs. ours $6 7 . 5 \%$ ), which is consistent with the results reported in Tan & Bansal (2019); Lu et al. (2019).
md/train/AuVKs6JmBtY/AuVKs6JmBtY.md ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Towards Robust and Reliable Algorithmic Recourse
2
+
3
+ Sohini Upadhyay∗ Harvard University supadhyay@g.harvard.edu
4
+
5
+ Shalmali Joshi∗ Harvard University shalmali@seas.harvard.edu
6
+
7
+ Himabindu Lakkaraju Harvard University hlakkaraju@hbs.harvard.edu
8
+
9
+ # Abstract
10
+
11
+ As predictive models are increasingly being deployed in high-stakes decision making (e.g., loan approvals), there has been growing interest in post-hoc techniques which provide recourse to affected individuals. These techniques generate recourses under the assumption that the underlying predictive model does not change. However, in practice, models are often regularly updated for a variety of reasons (e.g., dataset shifts), thereby rendering previously prescribed recourses ineffective. To address this problem, we propose a novel framework, RObust Algorithmic Recourse (ROAR), that leverages adversarial training for finding recourses that are robust to model shifts. To the best of our knowledge, this work proposes the first ever solution to this critical problem. We also carry out theoretical analysis which underscores the importance of constructing recourses that are robust to model shifts: 1) We quantify the probability of invalidation for recourses generated without accounting for model shifts. 2) We prove that the additional cost incurred due to the robust recourses output by our framework is bounded. Experimental evaluation on multiple synthetic and real-world datasets demonstrates the efficacy of the proposed framework.
12
+
13
+ # 1 Introduction
14
+
15
+ Over the past decade, machine learning (ML) models are increasingly being deployed to make a variety of highly consequential decisions ranging from bail and hiring decisions to loan approvals. Consequently, there is growing emphasis on designing tools and techniques which can provide recourse to individuals who have been adversely impacted by predicted outcomes [30]. For example, when an individual is denied a loan by a predictive model deployed by a bank, they should be provided with reasons for this decision, and also informed about what can be done to reverse it. When providing a recourse to an affected individual, it is absolutely critical to ensure that the corresponding decision making entity (e.g., bank) is able to honor that recourse and approve any re-application that fully implements the recommendations outlined in the prescribed recourse Wachter et al. [31].
16
+
17
+ Several approaches in recent literature tackled the problem of providing recourses by generating local (instance level) counterfactual explanations 2 [31, 26, 12, 21, 18]. For instance, Wachter et al. [31] proposed a gradient based approach which finds the closest modification (counterfactual) that can result in the desired prediction. Ustun et al. [26] proposed an efficient integer programming based approach to obtain actionable recourses in the context of linear classifiers. There has also been some recent research that sheds light on the spuriousness of the recourses generated by counterfactual/contrastive explanation techniques [31, 26] and advocates for causal approaches [3, 14, 15].
18
+
19
+ All the aforementioned approaches generate recourses under the assumption that the underlying predictive models do not change. This assumption, however, may not hold in practice. Real world settings are typically rife with different kinds of distribution shifts (e.g, temporal shifts) [22]. In order to ensure that the deployed models are accurate despite such shifts, these models are periodically retrained and updated. Such model updates, however, pose severe challenges to the validity of recourses because previously prescribed recourses (generated by existing algorithms) may no longer be valid once the model is updated. Recent work by Rawal et al. [24] has, in fact, demonstrated empirically that recourses generated by state-of-the-algorithms are readily invalidated in the face of model shifts resulting from different kinds of dataset shifts (e.g., temporal, geospatial, and data correction shifts). Their work underscores the importance of generating recourses that are robust to changes in models i.e., model shifts, particularly those resulting from dataset shifts. However, none of the existing approaches address this problem.
20
+
21
+ In this work, we propose a novel algorithmic framework, RObust Algorithmic Recourse (ROAR) for generating instance level recourses (counterfactual explanations) that are robust to changes in the underlying predictive model. To the best of our knowledge, this work makes the first attempt at generating recourses that are robust to model shifts. To this end, we propose a novel minimax objective that can be used to construct robust actionable recourses while minimizing the recourse costs. Second, we propose a set of model shifts that captures our intuition about the kinds of changes in the models to which recourses should be robust. Next, we outline an algorithm inspired by adversarial training to optimize the proposed objective. We also carry out theoretical analysis to establish the following results: i) we quantify the probability of invalidation for recourses generated without accounting for model shifts, and ii) we derive an upper bound on the relative increase in the costs incurred due to robust recourses (proposed by our framework) to the costs incurred by recourses generated from existing algorithms. Our theoretical results further establish the need for approaches like ours that generate actionable recourses that are robust to model shifts.
22
+
23
+ We evaluated our approach ROAR on real world data from financial lending and education domains, focusing on model shifts induced by the following kinds of distribution shifts – data correction shift, temporal shift, and geospatial shift. We also experimented with synthetic data to analyze how the degree of data distribution shifts and consequent model shifts affect the robustness and validity of the recourses output by our framework as well as the baselines. Our results demonstrate that the recourses constructed using our framework, ROAR, are substantially more robust $( 6 7 - 1 0 0 \% )$ to changes in the underlying predictive models compared to those generated using state-of-the-art recourse finding technqiues. We also find that our framework achieves such a high degree of robustness without sacrificing the validity of the recourses w.r.t. the original predictive model or substantially increasing the costs associated with realizing the recourses.
24
+
25
+ # 2 Related Work
26
+
27
+ Our work lies at the intersection of algorithmic recourse and adversarial robustness. Below, we discuss related work pertaining to each of these topics.
28
+
29
+ Algorithmic recourse As discussed in Section 1, several approaches have been proposed to construct algorithmic recourse for predictive models [31, 26, 12, 21, 18, 3, 14, 15, 7]. These approaches can be broadly characterized along the following dimensions [29]: the level of access they require to the underlying predictive model (black box vs. gradients), if and how they enforce sparsity (only a small number of features should be changed) in counterfactuals, if counterfactuals are required to lie on the data manifold or not, if underlying causal relationships should be accounted for when generating counterfactuals or not, whether the output should be multiple diverse counterfactuals or just a single counterfactual. While the aforementioned approaches have focused on generating instance level counterfactuals, there has also been some recent work on generating global summaries of model recourses which can be leveraged to audit ML methods [23]. More recently, Rawal et al. [24] demonstrated that recourses generated by state-of-the-art algorithms are readily invalidated due to model shifts resulting from different kinds of dataset shifts. They argued that model updation is very common place in the real world, and it is important to ensure that recourses provided to affected individuals are robust to such updates. Similar arguments have been echoed in several other recent works [28, 13, 20]. While there has been some recent work that explores the construction of other kinds of explanations (feature attribution and rule based explanations) that are robust to dataset shifts [16], our work makes the first attempt at tackling the problem of constructing recourses that are robust to model shifts.
30
+
31
+ Adversarial Robustness The techniques that we leverage in this work are inspired by the adversarial robustness literature. Wachter et al. were the first to remark on similarities between counterfactual generation and adversarial attacks, but did not leverage this connection to develop robust recourse [31]. It is now well established that ML models are vulnerable to adversarial attacks [10, 4, 2]. The adversarial training procedure was recently proposed as a defense against such attacks [19, 1, 32]. This procedure optimizes a minimax objective that captures the worst-case loss over a given set of perturbations to the input data. At a high level, it is based on gradient descent; at each gradient step, it solves an optimization problem to find the worst-case perturbation, and then computes the gradient at this perturbation. In contrast, our training procedure optimizes a minimax objective that captures the worst-case over a given set of model perturbations (thereby simulating model shift) and generates recourses that are valid under the corresponding model shifts. This training procedure is novel and possibly of independent interest.
32
+
33
+ # 3 Our Framework: RObust Algorithmic Recourse
34
+
35
+ In this section, we detail our framework, RObust Algorithmic Recourse (ROAR). First, we introduce some notation and discuss preliminary details about the algorithmic recourse problem setting. We then introduce our objective function, and discuss how to operationalize and optimize it efficiently.
36
+
37
+ # 3.1 Preliminaries
38
+
39
+ Let us assume we are given a predictive model $\mathcal { M } : \mathcal { X } \xrightarrow { } \mathcal { Y }$ , where $\mathcal { X } \subseteq \mathbb { R } ^ { d }$ is the feature space, and $\mathcal { V }$ is the space of outcomes. Let $\mathcal { V } = \{ 0 , 1 \}$ where 0 and 1 denote an unfavorable outcome (e.g., loan denied) and a favorable outcome (e.g., loan approved) respectively. Let $x \in \mathcal { X }$ be an instance which received a negative outcome i.e., $\mathcal { M } ( x ) = 0$ . The goal here is to find a recourse for this instance $x$ i.e., to determine a set of changes $\epsilon$ that can be made to $x$ in order to reverse the negative outcome. The problem of finding a recourse for $x$ involves finding a counterfactual $x ^ { \prime } = x + \epsilon$ for which the black box outputs a positive outcome i.e., $\mathcal { M } ( x ^ { \prime } ) = \mathcal { M } \bar { ( } x + \epsilon ) = 1$ .
40
+
41
+ There are, however, a few important considerations when finding the counterfactual $x ^ { \prime } = x + \epsilon$ . First, it is desirable to minimize the cost (or effort) required to change $x$ to $x ^ { \prime }$ . To formalize this, let us consider a cost function $c : \mathcal { X } \times \mathcal { X } \to \mathbb { R } _ { + }$ . $c ( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } )$ denotes the cost (or effort) incurred in changing an instance $x$ to $x ^ { \prime }$ . In practice, some of the commonly used cost functions are $\ell _ { 1 }$ or $\ell _ { 2 }$ distance [31], log-percentile shift [26], and costs learned from pairwise feature comparisons input by end users [23]. Furthermore, since recommendations to change features such as gender or race would be unactionable, it is important to restrict the search for counterfactuals in such a way that only actionable changes are allowed. Let $\mathcal { A }$ denote the set of plausible or actionable counterfactuals.
42
+
43
+ Putting it all together, the problem of finding a recourse for instance $x$ for which $\mathcal { M } ( x ) = 0$ can be formalized as:
44
+
45
+ $$
46
+ x ^ { \prime } = \underset { x ^ { \prime } \in \mathcal { A } } { \arg \operatorname* { m i n } } c ( x , x ^ { \prime } ) \quad \mathrm { s . t } \quad \mathcal { M } ( x ^ { \prime } ) = 1
47
+ $$
48
+
49
+ Eqn. 1 captures the generic formulation leveraged by several of the state-of-the-art recourse finding algorithms. Typically, most approaches optimize the unconstrained and differentiable relaxation of Eqn. 1 which is given below:
50
+
51
+ $$
52
+ \boldsymbol { x } ^ { \prime } = \underset { \boldsymbol { x } ^ { \prime } \in \mathcal { A } } { \arg \operatorname* { m i n } } \ell ( \boldsymbol { \mathcal { M } } ( \boldsymbol { x } ^ { \prime } ) , 1 ) + \lambda \boldsymbol { c } ( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } )
53
+ $$
54
+
55
+ where $\ell : \mathcal { V } \times \mathcal { V } \to \mathbb { R } _ { + }$ denotes a differentiable loss function (e.g., binary cross entropy) which ensures that gap between $\mathcal { M } ( \boldsymbol { x } ^ { \prime } )$ and favorable outcome 1 is minimized, and $\lambda > 0$ is a trade-off parameter.
56
+
57
+ # 3.2 Formulating Our Objective
58
+
59
+ As can be seen from Eqn. 2, state-of-the-art recourse finding algorithms rely heavily on the assumption that the underlying predictive model $\mathcal { M }$ does not change. However, predictive models deployed in the real world often get updated. This implies that individuals who have acted upon previously prescribed recourses are no longer guaranteed a favorable outcome once the model is updated. To address this critical challenge, we propose a novel minimax objective function which generates counterfactuals that minimize the worst-case loss over plausible model shifts. We arrived at this approach after considering the following alternatives: (a) Update the predictive model as desired but ensure that individuals who were previously prescribed recourse will still be guaranteed a favorable outcome. (b)
60
+
61
+ Update the predictive model while including constraints to ensure that previously offered recourses are still valid. Note that both of these scenarios would potentially incur huge monetary losses to relevant stakeholders (e.g, banks), hurting the adoption of these approaches. In case (a), banks may be required to guarantee credit to customers that are potentially not creditworthy under the new model and thereby risk losing money. In case (b), access to model training is assumed. Furthermore, training a predictive model under these constraints may be suboptimal and not reflective of the current data distribution, thereby accruing larger errors under the shifted population. There are no incentives for stakeholders such as banks to adopt such practices which could potentially lead to huge monetary losses. While the optimal approach may vary on a case by case basis, we propose our method to avoid the aforementioned pitfalls outlined in cases (a) and (b).
62
+
63
+ To formalize our proposed approach, let $\Delta$ denote the set of plausible model shifts and let $\mathcal { M } _ { \delta }$ denote a shifted model where $\delta \in \Delta$ . Our objective function for generating robust recourse $x ^ { \prime \prime }$ for a given instance $x$ can be written as:
64
+
65
+ $$
66
+ \boldsymbol { x } ^ { \prime \prime } = \underset { \boldsymbol { x } ^ { \prime \prime } \in \mathcal { A } } { \arg \operatorname* { m i n } } \ \underset { \delta \in \Delta } { \operatorname* { m a x } } \ell ( \boldsymbol { \mathcal { M } } _ { \delta } ( \boldsymbol { x } ^ { \prime \prime } ) , 1 ) + \lambda c ( \boldsymbol { x } , \boldsymbol { x } ^ { \prime \prime } )
67
+ $$
68
+
69
+ where cost function $c$ and loss function $l$ are as defined in Section 3.1.
70
+
71
+ Choice of $\Delta$ Predictive models deployed in the real world are often updated regularly to handle data distribution shifts [22]. Since these models are updated regularly, it is likely that they undergo small (and not drastic) shifts each time they are updated. To capture this intuition, we consider the following two choices for the set of plausible model shifts $\Delta$ :
72
+
73
+ $$
74
+ \begin{array} { r l } & { \Delta = \{ \delta \in \mathbb { R } ^ { n } \mid \delta _ { m i n } \leq \delta _ { i } \leq \delta _ { m a x } \forall i \in \{ 1 \cdots n \} \} . } \\ & { \Delta = \{ \delta \in \mathbb { R } ^ { n } \mid \| \delta \| _ { p } \leq \delta _ { m a x } \} } \end{array}
75
+ $$
76
+
77
+ where $p \geq 1$ . Note that perturbations $\delta \in \Delta$ can be considered as operations either on the parameter space or on the gradient space of $\mathcal { M }$ . While the first choice of $\Delta$ presented above allows us to restrict model shifts within a small range, the second choice allows us to restrict model shifts within a norm-ball. Alternate formulations of the first include incorporating domain knowledge to set $\delta _ { m i n }$ and $\delta _ { m a x }$ per feature. These kinds of shifts can effectively capture small changes to both parameters (e.g., weights of linear models) as well as gradients. Next, we describe how to optimize the objective in Eqn. 3 and construct robust recourses.
78
+
79
+ # 3.3 Optimizing Our Objective
80
+
81
+ While our objective function, the choice of $\Delta$ , and the perturbations $\delta \in \Delta$ we introduce in Section 3.2 are generic enough to handle shifts to both parameter space as well as the gradient space of any class of predictive models $\mathcal { M }$ , we solve our objective for a linear approximation $f$ of $\mathcal { M }$ . The procedure that we outline here remains generalizable even for non-linear models because local behavior of a given non-linear model can be approximated well by fitting a local linear model [25]. Note that such approximations have already been explored by existing algorithmic recourse methods [26, 23]. Let the linear approximation, which we denote by $f$ be parameterized by $w \in \mathcal { W }$ . We make this parametrization explicit by using a subscript notation: $f _ { w }$ . We consider model shifts represented by perturbations to the model parameters $w \in \mathcal { W }$ . In the case of linear models, these can be operationalized as additive perturbations $\delta \in \Delta$ to $w$ . We will represent the resulting shifted classifier by $f _ { w + \delta }$ . Our objective function (Eqn. 3) can now be written in terms of this linear approximation $f$ as:
82
+
83
+ $$
84
+ x ^ { \prime \prime } = \underset { x ^ { \prime \prime } \in \mathcal { A } } { \arg \operatorname* { m i n } } \underset { \delta \in \Delta } { \operatorname* { m a x } } \ell ( f _ { w + \delta } ( x ^ { \prime \prime } ) , 1 ) + \lambda c ( x , x ^ { \prime \prime } )
85
+ $$
86
+
87
+ Notice that the objective function defined in Equation 4 is similar to that of adversarial training [19]. However, in our framework, the perturbations are applied to model parameters as opposed to data samples. These parallels help motivate the optimization procedure for constructing recourses that are robust to model shifts. We outline the optimization procedure that we leverage to optimize our minimax objective (Eqn. 4) in Algorithm 1.
88
+
89
+ Algorithm 1 proceeds in an iterative manner where we first find a perturbation $\hat { \delta } \in \Delta$ that maximizes the chance of invalidating the current estimate of the recourse $x ^ { \prime \prime }$ , and then we take appropriate gradient steps on $x ^ { \prime \prime }$ to generate a valid recourse. This procedure is executed iteratively until the objective function value (Eqn. 4) converges.
90
+
91
+ # Algorithm 1 Our Optimization Procedure
92
+
93
+ <table><tr><td>Input:x s.t. fω(x)=O,fw,λ&gt;O,△,learning rate α &gt;0. Initialize x&quot; =x,g =0</td></tr><tr><td>repeat = arg maxs∈△ l(fw+8(x&quot;),1)</td></tr><tr><td>g =∀[e(fw+8(x&quot;),1)+ λc(x&quot;,x)]</td></tr><tr><td>x&quot; -=ag</td></tr><tr><td>until convergence</td></tr><tr><td>Return x&quot;</td></tr></table>
94
+
95
+ # 4 Theoretical Analysis
96
+
97
+ Here we carry out theoretical analysis to shed light on the benefits of our framework ROAR. More specifically: 1) We quantify the probability that recourses generated without accounting for model shifts are likely to be invalidated. 2) We prove that the additional cost incurred due to the robust recourses output by our framework is bounded.
98
+
99
+ We first characterize how recourses that do not account for model shifts (i.e., recourses output by state-of-the-art algorithms) fare when true model shifts can be characterized as additive shifts to model parameters. Specifically, we quantify the likelihood that recourses generated without accounting for model shifts will be invalidated (even if they lie on the original data manifold), under certain conditions.
100
+
101
+ Theorem 1. For a given instance $x \sim { \mathcal { N } } ( \mu , \Sigma )$ , let $x ^ { \prime }$ be the recourse that lies on the original data manifold (conditioned on the event that $\mathcal { M } ( x ^ { \prime } ) > 0 . 5 )$ and is obtained without accounting for model shifts. Let $\Sigma = U D U ^ { T }$ . Then, for some true model shift $\delta$ , such that, $\begin{array} { r } { \frac { w ^ { T } \mu } { ( w + \delta ) ^ { T } \mu } \geq \frac { \| \sqrt { D } U w \| } { \| \sqrt { D } U ( w + \delta ) \| } } \end{array}$ , and $\begin{array} { r } { \sqrt { \frac { 2 e } { \pi } } \frac { \sqrt { \beta - 1 } } { \beta } \exp ^ { - \beta \frac { ( w ^ { T } \mu ) ^ { 2 } } { 4 \| \sqrt { D } U w \| ^ { 2 } } } \geq e r f c \bigl ( - \frac { ( w + \delta ) ^ { T } \mu } { \sqrt { 2 } \| w + \delta \| } \bigr ) . } \end{array}$ , for $\beta \geq 1$ , the probability that $x ^ { \prime }$ is invalidated on $f _ { w + \delta }$ is at least: $\begin{array} { r } { \frac { 1 } { 2 } \sqrt { \frac { 2 e } { \pi } } \frac { \sqrt { \beta - 1 } } { \beta } \exp ^ { - \beta \frac { ( w ^ { T } \mu ) ^ { 2 } } { 4 \| \sqrt { D } U w \| ^ { 2 } } } - \frac { 1 } { 2 } e r f c \big ( { - \frac { ( w + \delta ) ^ { T } \mu } { \sqrt { 2 } \| w + \delta \| } } \big ) } \end{array}$ where erfc is the complementary gaussian error function.
102
+
103
+ Proof Sketch. Under the assumption that $x ^ { \prime } \sim { \mathcal { N } } ( { \boldsymbol { \mu } } , { \boldsymbol { \Sigma } } )$ , a recourse is invalid under a model shift if it is valid under the original model and invalid under the shifted model. This allows us to define the region where $x ^ { \prime }$ can be invalidated:
104
+
105
+ $$
106
+ \Omega = \{ x ^ { \prime } \colon w ^ { T } x ^ { \prime } > 0 \cap ( w + \delta ) ^ { T } x ^ { \prime } \leq 0 \}
107
+ $$
108
+
109
+ The probability that $x ^ { \prime }$ is invalidated can be obtained by integrating over $\Omega$ under the PDF of $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ .
110
+
111
+ We can then transform $x ^ { \prime }$ and correspondingly $\Omega$ , to simplify this integration over a 1-dimensional Gaussian random variable. That is,
112
+
113
+ $$
114
+ P ( x { \mathrm { ~ i s ~ i n v a l i d a t e d } } ) = { \frac { 1 } { \sqrt { ( 2 \pi ) } } } \int _ { c _ { 1 } } ^ { c _ { 2 } } \exp { \bigg ( } - { \frac { 1 } { 2 } } s ^ { 2 } { \bigg ) } d s
115
+ $$
116
+
117
+ The above quantity can be represented as a difference in the Gaussian error function allowing us to exactly quantify the invalidation probability under our assumptions. Using the lower bounds on the complementary gaussian error function [9] from Chang et al. [5], we obtain our lower bound. To derive the lower bound, we add an extra condition that $\begin{array} { r } { \sqrt { \frac { 2 e } { \pi } } \frac { \sqrt { \beta - 1 } } { \beta } \exp ^ { - \beta \frac { ( w ^ { T } \mu ) ^ { 2 } } { 4 \| \sqrt { D } U w \| ^ { 2 } } } \geq \mathrm { e r f c } ( - \frac { ( w + \delta ) ^ { T } \mu } { \sqrt { 2 } \| w + \delta \| } ) } \end{array}$ , mainly to confirm that the lower bound on the first term still dominates the second term. Both conditions restricts the types of shift for which the bound can be derived. Note that $\beta$ can be optimized away to improve the lower bound. Detailed proof is provided in the Appendix. Discussion about other distributions (e.g., Bernoulli, Uniform, Categorical) is included in the Appendix. □
118
+
119
+ Next we characterize how much more costly recourses can be when they are trained to be robust to model perturbations or model shifts. In the following theorem, we show that the cost of robust recourses is bounded relative to the cost of recourses that do not account for model shifts.
120
+
121
+ Theorem 2. Let $x \in \mathcal { X }$ , and $x \sim \nu$ where $\nu$ is a distribution such that $\mathbb { E } _ { \nu } [ x ] = \mu < \infty ,$ , where $\mathcal { X }$ is a metric space $( \mathcal { X } , d ( \cdot , \cdot ) )$ and $d : \mathcal { X } \times \mathcal { X } \to \mathbb { R } _ { + }$ . Let $d \triangleq \ell _ { 2 }$ and assume that $( \mathcal { X } , d )$ has bounded diameter $D = \operatorname* { s u p } _ { x , x ^ { \prime } \in \mathcal { X } } d ( x , x ^ { \prime } )$ . Let recourses obtained without accounting for model shifts and constrained to the manifold be denoted by $x ^ { \prime } \sim \nu$ , and robust recourses be denoted by $x ^ { \prime \prime }$ . Let $\delta > 0$ be the shift that maximizes Eq. 3 for sample $x$ corresponding to $x ^ { \prime \prime }$ . Further assume that the ROAR objective (Equation 3) is convex in $x ^ { \prime \prime }$ for a fixed $\delta$ . For $\ell \triangleq \ell _ { l o g }$ (the cross-entropy loss), some $0 < \eta ^ { \prime } \ll 1$ , w.h.p. $( 1 - \eta ^ { \prime } )$ , we have that:
122
+
123
+ $$
124
+ c ( x ^ { \prime \prime } , x ) - c ( x ^ { \prime } , x ) \leq \frac { 1 } { \lambda } \frac { 1 } { \| w + \delta \| } \mathbb { E } _ { \nu } [ \exp { - \phi ( w + \delta ) ^ { T } x ^ { \prime } } ] + \sqrt { \frac { D ^ { 2 } } { 2 } \log { ( \frac { 1 } { \eta ^ { \prime } } ) } } \Bigg )
125
+ $$
126
+
127
+ Proof Sketch. By definition, any recourse $x ^ { \prime }$ generated without accounting for model shifts will have a higher loss for Equation 3 compared to the robust recourse $x ^ { \prime \prime }$ (note that finding the global minimizer is not guaranteed by Algorithm 1).
128
+
129
+ Using this insight, and convexity in $x ^ { \prime }$ for fixed $\delta$ , we can bound the cost difference between the robust and non-robust recourse by a 1-Lipschitz function (i.e. the logistic function):
130
+
131
+ $$
132
+ c ( x ^ { \prime \prime } , x ) - c ( x ^ { \prime } , x ) \leq \frac { 1 } { \lambda \| w + \delta \| } \log \left\{ 1 + \exp - ( w + \delta ) ^ { T } x ^ { \prime } \right\}
133
+ $$
134
+
135
+ Assuming a bounded metric on $\mathcal { X }$ , we can upper bound the RHS using Lemma 2 from van Handel [27] which gives us our bound. Detailed proof including special cases when $\nu$ is Gaussian, is provided in the Appendix. □
136
+
137
+ This result suggests that the additional cost of recourse is bounded by the amount of shift admissible in Equation 3. Note that Theorem 2 applies for general distributions so long as the mean is finite, which is the case for most commonplace distributions like Gaussian, Bernoulli, Multinomial etc. While Theorem 1 demonstrates the probability that a recourse will be invalidated for Gaussian distributions, we refer the reader to the Appendix B.1 for a discussion of other distributions, e.g. Bernoulli, Uniform, Categorical.
138
+
139
+ # 5 Experiments
140
+
141
+ Here we discuss the detailed experimental evaluation of our framework, ROAR. First, we evaluate how robust the recourses generated by our framework are to model shifts caused by real world data distribution shifts. We also assess the validity of the recourses generated by our framework w.r.t. the original model, and further analyze the average cost of these recourses. Next, using synthetic data, we analyze how varying the degree (magnitude) of data distribution shift impacts the robustness and validity of the recourses output by our framework and other baselines.
142
+
143
+ # 5.1 Experimental Setup
144
+
145
+ Real world data We evaluate our framework on model shifts induced by real world data distribution shifts. To this end, we leverage three real world datasets which capture different kinds of data distribution shifts, namely, temporal shift, geospatial shift, and data correction shift [24]. Our first dataset is the widely used and publicly available German credit dataset [8] from the UCI repository. This dataset captures demographic (age, gender), personal (marital status), and financial (income, credit duration) details of about 1000 loan applicants. Each applicant is labeled as either a good customer or a bad customer depending on their credit risk. Two versions of this dataset have been released, with the second version incorporating corrections to coding errors in the first dataset [11]. Accordingly, this dataset captures the data correction shift. Our second dataset is the Small Business Administration (SBA) case dataset [17]. This dataset contains information pertaining to 2102 small business loans approved by the state of California during the years of $1 9 8 9 - 2 0 1 2$ , and captures temporal shifts in the data. It comprises of about 24 features capturing various details of the small businesses including zip codes, business category (real estate vs. rental vs. leasing), number of jobs created, and financial status of the business. It also contains information about whether a business has defaulted on a loan or not which we consider as the class label. Our last dataset contains student performance records of 649 students from two Portuguese secondary schools, Gabriel Pereira (GP) and Mousinho da Silveira (MS) [8, 6], and captures geospatial shift. It comprises of information about the academic background (grades, absences, access to internet, failures etc.) of each student along with other demographic attributes (age, gender). Each student is assigned a class label of above average or not depending on their final grade.
146
+
147
+ Synthetic data We generate a synthetic dataset with 1K samples and two dimensions to analyze how the degree (magnitude) of data distribution shifts impacts the robustness and validity of the recourses output by our framework and other baselines. Each instance $x$ is generated as follows: First, we randomly sample the class label $y \in \{ 0 , 1 \}$ corresponding to the instance $x$ . Conditioned upon the value of $y$ , we then sample the instance $x$ as: $x \sim \mathrm { \bar { \mathcal { N } } } ( \mu _ { y } , \mathrm { \bar { \Sigma } } _ { y } )$ . We choose $\mu _ { 0 } = [ - 2 , - 2 ] ^ { T }$ and $\mu _ { 1 } = [ + 2 , + 2 ] ^ { T }$ , and $\Sigma _ { 0 } = \Sigma _ { 1 } = 0 . 5 \mathbf { I }$ where $\mu _ { 0 }$ , $\Sigma _ { 0 }$ and $\mu _ { 1 }$ , $\Sigma _ { 1 }$ denote the means and covariance of the Gaussian distributions from which instances in class 0 and class 1 are sampled respectively. A scatter plot of the samples resulting from this generative process and the decision boundary of a logistic regression model fit to this data are shown in Figure 1a. In our experimental evaluation, we consider different kinds of shifts to this synthetic data:
148
+
149
+ ![](images/98bb3ff9b091767a7781023e340217b6fd8251f08031fdf85213a639fc47f523.jpg)
150
+ Figure 1: Synthetic data and examples of model shift. From left to right we have (a) original synthetic dataset, (b) shifted data and decision boundary after mean shift, (c) shifted data and decision boundary after variance shift, and (d) shifted data and decision boundary after mean and variance shift
151
+
152
+ (i) Mean shift: To generated shifted data, we leverage the same approach as above but shift the mean of the Gaussian distribution associated with class 0 i.e., $x \sim \mathcal { N } ( \mu _ { y } ^ { \prime } , \Sigma _ { y } )$ where $\mu _ { 0 } ^ { \prime } = \mu _ { 0 } + [ \alpha , 0 ] ^ { T }$ and $\mu _ { 1 } ^ { \prime } = \mu _ { 1 }$ . Note that we only shift the mean of one of the features of class 0 so that the slope of the decision boundary of a linear model we fit to this shifted data changes (relative to the linear model fit on the original data), while the intercept remains the same. Figure 1b shows shifted data with $\alpha = 1 . 5$ .
153
+
154
+ (ii) Variance shift: Here, we leverage the same generative process as above, but instead of shifting the mean, we shift the variance of the Gaussian distribution associated with class 0 i.e., i.e., $x \sim$ $\mathcal { N } ( \mu _ { y } , \Sigma _ { y } ^ { \prime } )$ where $\Sigma _ { 0 } ^ { \prime } = ( 1 + \beta ) \Sigma _ { 0 }$ and $\Sigma _ { 1 } ^ { \prime } = \Sigma _ { 1 } ^ { \prime }$ for some increment $\beta \in \mathbb { R }$ . The net result here is that the intercept of the decision boundary of a linear model we fit to this shifted data changes (relative to the linear model fit on the original data), while the slope remains unchanged. Figure 1c shows shifted data with $\beta = 3$ .
155
+
156
+ (ii) Mean and variance shift: Here, we change both the mean and variance of the Gaussian distribution associated with class 0 simultaneously (Figure 1d). It can be seen that there are noticeable changes to both the slope and intercept of the decision boundary compared to Figure 1a.
157
+
158
+ Predictive models We generate recourses for a variety of linear and non-linear models: deep neural networks (DNNs), SVMs, and logistic regression (LR). Here, we present results for a 3-layer DNN and LR; remaining results are included in the Appendix. Results presented here are representative of those for other model families.
159
+
160
+ Baselines We compare our framework, ROAR, to the following state-of-the-art baselines: (i) counterfactual explanations (CFE) framework outlined by Wachter et al. [31], (ii) actionable recourse (AR) in linear classification [26], and (iii) causal recourse framework (MINT) proposed by Karimi et al. [14]. While CFE leverages gradient computations to find counterfactuals, AR employs a mixed integer programming based approach to find counterfactuals that are actionable. The MINT framework operates on top of existing approaches for finding nearby counterfactuals. We use the MINT framework on top of CFE and ROAR and refer to these two approaches as MINT and ROARMINT respectively. As the MINT framework requires access to the underlying causal graph, we experiment with MINT and ROAR-MINT only on the German credit dataset for which such a causal graph is available.
161
+
162
+ Cost functions Our framework, ROAR, and all the other baselines we use rely on a cost function $c$ that measures the cost (or effort) required to act upon the prescribed recourse. Furthermore, our approach as well as several other baselines require the cost function to be differentiable. So, we consider two cost functions in our experimentation: $\ell _ { 1 }$ distance between the original instance and the counterfactual, and a cost function learned from pairwise feature comparison inputs (PFC) [13, 26, 23]. PFC uses the Bradley-Terry model to map pairwise feature comparison inputs provided by end users to the cost required to act upon the prescribed recourse for any given instance $x$ . For more details on this cost function, please refer to Rawal and Lakkaraju [23]. In our experiments, we follow the same procedure as Rawal and Lakkaraju [23] and simulate the pairwise feature comparison inputs.
163
+
164
+ Setting and implementation details We partition each of our synthetic and real world datasets into two parts: initial data $( D _ { 1 } )$ and shifted data $( D _ { 2 } )$ . In the case of real world datasets, $D _ { 1 }$ and $D _ { 2 }$ can be logically inferred from the data itself – e.g., in case of the German credit dataset, we consider the initial version of the dataset as $D _ { 1 }$ and the corrected version of the dataset as $D _ { 2 }$ . In the case of synthetic datasets, we generate $D _ { 1 }$ and $D _ { 2 }$ as described earlier where $D _ { 2 }$ is generated by shifting $D _ { 1 }$ (See "Synthetic data" in Section 5.1).
165
+
166
+ We use 5-fold cross validation throughout our real world and synthetic experiments. On $D _ { 1 }$ , we use 4 folds to train predictive models and the remaining fold to generate and evaluate recourses. We repeat this process 5 times and report averaged values of our evaluation metrics. We leverage $D _ { 2 }$ only to train the shifted models $\mathcal { M } _ { 2 }$ . More details about the data splits, model training, and performance of the predictive models are included in the Appendix.
167
+
168
+ We use binary cross entropy loss and the Adam optimizer to operationalize our framework, ROAR. Our framework, ROAR, has the following parameters: the set of acceptable perturbations $\Delta$ (defined in practice by $\delta _ { m a x . }$ ) and the tradeoff parameter $\lambda$ . In our experiments on evaluating robustness to real world shifts, we choose $\delta _ { m a x } = 0 . 1$ given that continuous features are scaled to zero mean and unit variance. Furthermore, in each setting, we choose the $\lambda$ that maximizes the recourse validity of $\mathcal { M } _ { 1 }$ (more details in Section 5.1 "Metrics" and Appendix). In case of our synthetic experiments where we assess the impact of the degree (magnitude) of data distribution shift, features are not normalized, so we do a grid search for both $\delta _ { m a x }$ and $\lambda$ . First, we choose the largest $\delta _ { m a x }$ that maximizes the recourse validity of $\mathcal { M } _ { 1 }$ and then set $\lambda$ in a similar fashion (more details in Appendix). We set the parameters of the baselines using techniques discussed in the original works [31, 14, 26] and employ a similar grid search approach if unspecified.
169
+
170
+ Following the precedents set forth in [26] and [23], we adapt AR and ROAR to non-linear models by first generating local linear approximations of these models using LIME [25]. We refer to these variants as AR-LIME and ROAR-LIME respectively.
171
+
172
+ Metrics. We consider two metrics in our evaluation: 1) Avg Cost is defined as the average cost incurred to act upon the prescribed recourses where the average is computed over all the instances for which a given algorithm provides recourse. Recall that we consider two notions of cost in our experiments – $\ell _ { 1 }$ distance between the original instance and the counterfactual, costs learned from pairwise feature comparisons (PFC) (See "Cost Functions" in Section 5.1). 2) Validity is defined as the fraction of instances for which acting upon the prescribed recourse results in the desired prediction. Note that validity is computed w.r.t. a given model.
173
+
174
+ # 5.2 Robustness to real world shifts
175
+
176
+ Here, we evaluate the robustness of the recourses output by our framework, ROAR, as well as the baselines. A recourse finding algorithm can be considered robust if the recourses output by the algorithm remain valid even if the underlying model has changed. To evaluate this, we first leverage our approach and other baselines to find recourses of instances in our test sets w.r.t. the initial model $\mathcal { M } _ { 1 }$ . We then compute the validity of these recourses w.r.t. the shifted model $\mathcal { M } _ { 2 }$ which has been trained on the shifted data. Let us refer to this as $\mathcal { M } _ { 2 }$ validity. The higher the value of $\mathcal { M } _ { 2 }$ validity, the more robust the recourse finding method. Table 1 shows the $\mathcal { M } _ { 2 }$ validity metric computed for different algorithms across different real world datasets.
177
+
178
+ It can be seen that recourse methods that use our framework, ROAR and ROAR-MINT, achieve the highest $\mathcal { M } _ { 2 }$ validity across all datasets. In fact, methods that use our framework do almost twice as
179
+
180
+ <table><tr><td colspan="2"></td><td></td><td colspan="2">Correction Shift</td><td></td><td colspan="3">Temporal Shift</td><td colspan="3">Geospatial Shift</td></tr><tr><td colspan="2">Model Cost</td><td>Recourse CFE</td><td>AvgCost 1.02 ± 0.18</td><td>MValidity 1.00±0.00</td><td>MValidity 0.54± 0.27</td><td>AvgCost 3.57 ± 1.14</td><td>MValidity 1.00±0.00</td><td>MValidity 0.31±0.09</td><td>Avg Cost 8.37±0.73</td><td>MValidity 0.98±0.03</td><td>MValidity 0.29±0.09</td></tr><tr><td rowspan="10">LR</td><td>L1</td><td></td><td>0.85 ± 0.14</td><td>1.00 ± 0.00</td><td>0.53 ± 0.21</td><td>1.50± 0.28</td><td>1.00 ± 0.00</td><td>0.16 ± 0.06</td><td>5.29 ± 0.28</td><td>1.00 ± 0.00</td><td>0.43 ± 0.14</td></tr><tr><td></td><td>AR</td><td></td><td></td><td></td><td>3.14 ± 0.25</td><td>0.99 ± 0.01</td><td>0.98 ±0.02</td><td>10.88 ± 1.67</td><td>1.00 ± 0.00</td><td>0.67 ± 0.19</td></tr><tr><td></td><td>ROAR</td><td>3.13 ± 0.32</td><td>1.00 ± 0.00</td><td>0.94 ± 0.08 0.93 ± 0.07</td><td></td><td></td><td></td><td></td><td></td><td>NA</td></tr><tr><td></td><td>MINT</td><td>4.73 ± 1.56</td><td>1.00 ± 0.00</td><td></td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td></td></tr><tr><td></td><td>ROAR-MINT</td><td>6.77 ± 0.35</td><td>1.00 ± 0.00</td><td>1.00 ± 0.00</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td></tr><tr><td></td><td>CFE</td><td>0.03±0.02</td><td>1.00 ±0.00</td><td>0.56±0.33</td><td>0.24±0.09</td><td>1.00 ± 0.00</td><td>0.26± 0.11</td><td>0.34± 0.04</td><td>1.00±0.00</td><td>0.18 ±0.10</td></tr><tr><td>PFC</td><td>AR</td><td>0.09 ± 0.02</td><td>1.00 ± 0.00</td><td>0.54 ± 0.27</td><td>0.11 ± 0.02</td><td>1.00 ± 0.00</td><td>0.09 ± 0.05</td><td>0.32 ±0.03</td><td>1.00 ±0.00</td><td>0.24 ± 0.11</td></tr><tr><td></td><td>ROAR MINT</td><td>0.36±0.08</td><td>1.00 ± 0.00</td><td>1.00 ± 0.00</td><td>0.44 ± 0.12</td><td>0.99 ± 0.01</td><td>0.98 ± 0.01</td><td>1.20 ± 0.10</td><td>1.00 ± 0.00</td><td>0.91± 0.07</td></tr><tr><td></td><td>ROAR-MINT</td><td>1.00 ± 1.15</td><td>1.00 ± 0.00 1.00 ± 0.00</td><td>0.95±0.08 1.00 ± 0.00</td><td>NA</td><td>NA NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td></tr><tr><td rowspan="3">L1</td><td>CFE</td><td>1.23 ± 0.05 0.55 ±0.10</td><td>1.00± 0.00</td><td>0.47±0.06</td><td>NA 3.78±0.68</td><td>1.00 ± 0.00</td><td>NA 0.52±0.09</td><td>NA</td><td>NA</td><td>NA</td></tr><tr><td>AR-LIME</td><td>0.38 ± 0.15</td><td>0.16 ±0.10</td><td>0.31 ± 0.06</td><td>1.39 ± 0.13</td><td>0.59 ± 0.11</td><td>0.65 ± 0.17</td><td>10.09± 0.71 9.02 ±1.57</td><td>1.00 ± 0.00</td><td>0.48±0.09 0.83 ±0.10</td></tr><tr><td>ROAR-LIME</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>0.76± 0.06</td><td></td></tr><tr><td rowspan="7">NN</td><td></td><td>1.83 ± 0.19</td><td>0.78 ±0.06</td><td>0.72 ± 0.10</td><td>4.90±0.24</td><td>0.98 ±0.02</td><td>0.97 ±0.02</td><td>21.05 ± 3.58</td><td>1.00 ± 0.00</td><td>0.97 ±0.03</td></tr><tr><td>MINT</td><td>2.24 ± 1.25</td><td>0.81 ± 0.02</td><td>0.63 ± 0.11</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td></tr><tr><td>ROAR-MINT</td><td>8.59 ± 1.70</td><td>0.90 ±0.03</td><td>0.84 ± 0.04</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td></tr><tr><td>CFE</td><td>0.06±0.02</td><td>1.00± 0.00</td><td>0.51 ± 0.12</td><td>0.19±0.06</td><td>1.00±0.00</td><td>0.50± 0.13</td><td>0.48± 0.06</td><td>1.00±0.00</td><td>0.30±0.14</td></tr><tr><td>AR-LIME</td><td>0.06± 0.03</td><td>0.49 ± 0.11</td><td>0.56± 0.15</td><td>0.11 ± 0.01</td><td>0.54 ± 0.08</td><td>0.62 ± 0.12</td><td>0.78 ± 0.15</td><td>0.84 ± 0.06</td><td>0.82 ± 0.11</td></tr><tr><td>PFC ROAR-LIME</td><td>0.64 ± 0.08</td><td>0.85 ± 0.07</td><td>0.82 ± 0.05</td><td>0.37 ±0.07</td><td>0.99 ± 0.01</td><td>0.99 ±0.0</td><td>1.66 ± 0.21</td><td>1.00 ±0.00</td><td>0.97 ± 0.04</td></tr><tr><td></td><td>0.60 ± 0.16</td><td>0.82 ±0.07</td><td>0.64 ± 0.15</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td></td></tr><tr><td></td><td>MINT ROAR-MINT</td><td>0.60 ±0.07</td><td>0.91± 0.04</td><td>0.81 ± 0.04</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA</td><td>NA NA</td></tr></table>
181
+
182
+ Table 1: Avg Cost, $\mathcal { M } _ { 1 }$ (original) validity, and $\mathcal { M } _ { 2 }$ (shifted model) validity of recourses across different real world datasets. Recourses that leverage our framework ROAR are more robust (higher $\mathcal { M } _ { 2 }$ validity) compared to those generated by existing baselines.
183
+
184
+ good compared to other baselines on this metric, indicating that ROAR based recourse methods are quite robust. After ROAR, MINT is the next best performing baseline with respect $\mathcal { M } _ { 2 }$ validity. This may be explained by the fact that MINT accounts for the underlying causal graphs when generating recourses.
185
+
186
+ We also assess if the robustness achieved by our framework is coming at a cost i.e., by sacrificing validity on the original model or by increasing avg cost. Table 1 shows the results for the same. It can be seen that ROAR based recourses achieve higher than $9 5 \%$ $\mathcal { M } _ { 1 }$ validity in all but two settings. We compute the avg cost of the recourses output by all the algorithms on various datasets and find that ROAR typically has a higher avg cost (both under $\ell _ { 1 }$ and PFC cost functions) compared to CFE and AR baselines. As demonstrated through additional experiments in the Appendix, these relatively higher costs are expected given our Theorem 2 upper bound on ROAR cost. However, overall, MINT and ROAR-MINT seem to exhibit the highest avg costs and are the worst performing algorithms according to this metric. Since non-causal recourse methods assume independent features, and do not have to adhere to the underlying causal structure when finding counterfactuals, they can generate relatively lower cost counterfactuals even if those counterfactuals may not correspond to realistic data instances. This is likely one of the key reasons why we observe higher average costs in the causal recourse methods.
187
+
188
+ ![](images/79b7233b461f75eae4a6c8dc52c9a20153a7b4b770aa53c7911b559afe6ec4db.jpg)
189
+ 5.3 Impact of the degree of data distribution shift on recourses
190
+ Figure 2: Impact of the degree of data distribution shift on validity of recourse: DNN classifier with $\ell _ { 1 }$ cost function (top row), DNN classifier with PFC cost function (bottom row); Validity of the recourses generated by all methods drops as degree (magnitude) of the shift increases; The drop in the validity is much smaller for our method ROAR-LIME compared to other baselines.
191
+
192
+ Here, we assess how different kinds of distribution shifts and the magnitude of these shifts impact the robustness of recourses output by our framework and other baselines. To this end, we leverage our synthetic datasets and introduce mean shifts, variance shifts, and combination shifts (both mean and variance shifts) of different magnitudes by varying $\alpha$ and $\beta$ (See "Synthetic data" in Section 5.1). We then leverage these different kinds of shifted datasets to construct shifted models and then assess the validity of the recourses output by our framework and other baselines w.r.t. the shifted models.
193
+
194
+ We generate recourses using our framework and baselines CFE and AR for different predictive models (LR, DNN) and cost functions ( $\ell _ { 1 }$ distance, PFC). Figure 2 captures the results of this experiment for DNN model both with $\ell _ { 1 }$ distance and PFC cost functions. Results with other models are included in the Appendix. It can be seen that the $\mathbf { X }$ -axis of each of these plots captures the magnitude of the dataset shift, and the y-axis captures the validity of the recourses w.r.t. the corresponding shifted model. Standard error bars obtained by averaging the results over 5 runs are also shown.
195
+
196
+ It can be seen that as the magnitude of the distribution shift increases, validity of the recourses generated by all the methods starts dropping. This trend prevailed across mean, variance, and combination (mean and variance) shifts. It can also be seen that the rate at which validity of the recourses generated by our method, ROAR-LIME, drops is much smaller compared to that of other baselines CFE and AR-LIME. Furthermore, our method exhibits the highest validity compared to the baselines as the magnitude of the distribution shift increases. CFE seems to be the worst performing baseline and the validity of the recourses generated by CFE drops very sharply even at small magnitudes of distribution shifts.
197
+
198
+ # 6 Conclusions & Future Work
199
+
200
+ We proposed a novel framework, RObust Algorithmic Recourse (ROAR), to address the critical but under-explored issue of recourse robustness to model updates. To this end, we introduced a novel minimax objective to generate recourses that are robust to model shifts, and leveraged adversarial training to optimize this objective. We also presented novel theoretical results which demonstrate that recourses without accounting for model shifts are likely to be invalidated, underscoring the necessity of ROAR. Furthermore, we also showed that the additional cost incurred by robust recourses generated by ROAR are bounded. Extensive experimentation with real world and synthetic datasets demonstrated that recourses using ROAR are highly robust to model shifts induced by a range of data distribution shifts. Our work also paves the way for further research into techniques for generating robust recourses. For instance, it would be valuable to further analyze the tradeoff between recourse robustness and cost to better understand the impacts to affected individuals. Other interesting future directions include non-linear extensions that leverage novel local linear approximation methods that improve on LIME [33].
201
+
202
+ # Acknowledgements
203
+
204
+ We would like to thank the anonymous reviewers for their insightful feedback. This work is supported in part by the NSF awards #IIS-2008461 and #IIS-2040989, and research awards from the Harvard Data Science Institute, Amazon, Bayer, and Google. SJ would like to acknowledge the support of the Center for Research on Computation and Society (CRCS) at the Harvard John A. Paulson School of Engineering and Applied Sciences. The views expressed are those of the authors and do not reflect the official policy or position of the funding agencies.
205
+
206
+ # References
207
+
208
+ [1] Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning, pages 274–283. PMLR, 2018.
209
+ [2] Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. In International conference on machine learning, pages 284–293. PMLR, 2018.
210
+ [3] Solon Barocas, Andrew D. Selbst, and Manish Raghavan. The hidden assumptions behind counterfactual explanations and principal reasons. Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency, Jan 2020. doi: 10.1145/3351095.3372830. URL http://dx.doi.org/10.1145/3351095.3372830.
211
+ [4] Anirban Chakraborty, Manaar Alam, Vishal Dey, Anupam Chattopadhyay, and Debdeep Mukhopadhyay. Adversarial attacks and defences: A survey. arXiv preprint arXiv:1810.00069, 2018.
212
+ [5] Seok-Ho Chang, Pamela C Cosman, and Laurence B Milstein. Chernoff-type bounds for the gaussian error function. IEEE Transactions on Communications, 2011.
213
+ [6] P. Cortez and A. Silva. Using data mining to predict secondary school student performance. A. Brito and J. Teixeira Eds., Proceedings of 5th FUture BUsiness TEChnology Conference, 2008.
214
+ [7] Amit Dhurandhar, Tejaswini Pedapati, Avinash Balakrishnan, Pin-Yu Chen, Karthikeyan Shanmugam, and Ruchir Puri. Model agnostic contrastive explanations for structured data, 2019.
215
+ [8] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
216
+ [9] JWL Glaisher. Liv. on a class of definite integrals.—part ii. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 1871.
217
+ [10] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
218
+ [11] U Grömping. South german credit data: Correcting a widely used data set. Reports in Mathematics, Physics and Chemistry, Department II, Beuth University of Applied Sciences Berlin, 2019.
219
+ [12] Amir-Hossein Karimi, Gilles Barthe, Borja Balle, and Isabel Valera. Model-agnostic counterfactual explanations for consequential decisions, 2019.
220
+ [13] Amir-Hossein Karimi, Gilles Barthe, Bernhard Schölkopf, and Isabel Valera. A survey of algorithmic recourse: definitions, formulations, solutions, and prospects. arXiv preprint arXiv:2010.04050, 2020.
221
+ [14] Amir-Hossein Karimi, Bernhard Schölkopf, and Isabel Valera. Algorithmic recourse: from counterfactual explanations to interventions. arXiv preprint arXiv:2002.06278, 2020.
222
+ [15] Amir-Hossein Karimi, Julius von Kügelgen, Bernhard Schölkopf, and Isabel Valera. Algorithmic recourse under imperfect causal knowledge: a probabilistic approach. arXiv preprint arXiv:2006.06831, 2020.
223
+ [16] Himabindu Lakkaraju, Nino Arsov, and Osbert Bastani. Robust and stable black box explanations, 2020.
224
+ [17] Min Li, Amy Mickel, and Stanley Taylor. “should this loan be approved or denied?”: A large dataset with class assignment guidelines. Journal of Statistics Education, 26(1):55–66, 2018. doi: 10.1080/10691898.2018.1434342. URL https://doi.org/10.1080/10691898.2018.1434342.
225
+ [18] Arnaud Van Looveren and Janis Klaise. Interpretable counterfactual explanations guided by prototypes, 2019.
226
+ [19] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=rJzIBfZAb.
227
+ [20] Martin Pawelczyk, Klaus Broelemann, and Gjergji Kasneci. On counterfactual explanations under predictive multiplicity, 2020.
228
+ [21] Rafael Poyiadzi, Kacper Sokol, Raul Santos-Rodriguez, Tijl De Bie, and Peter Flach. Face: Feasible and actionable counterfactual explanations. In Proceedings of the AAAI/ACM Conference on AI, Ethics, and Society, AIES ’20, page 344–350, New York, NY, USA, 2020. Association for Computing Machinery. ISBN 9781450371100. doi: 10.1145/3375627.3375850. URL https://doi.org/10.1145/3375627.3375850.
229
+ [22] Stephan Rabanser, Stephan Günnemann, and Zachary Lipton. Failing loudly: An empirical study of methods for detecting dataset shift. In Advances in Neural Information Processing Systems, pages 1396–1408, 2019.
230
+ [23] Kaivalya Rawal and Himabindu Lakkaraju. Beyond individualized recourse: Interpretable and interactive summaries of actionable recourses. Advances in Neural Information Processing Systems, 33, 2020.
231
+ [24] Kaivalya Rawal, Ece Kamar, and Himabindu Lakkaraju. Can i still trust you?: Understanding the impact of distribution shifts on algorithmic recourses. arXiv preprint arXiv:2012.11788, 2020.
232
+ [25] 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, pages 1135–1144, 2016.
233
+ [26] Berk Ustun, Alexander Spangher, and Yang Liu. Actionable recourse in linear classification. Proceedings of the Conference on Fairness, Accountability, and Transparency - FAT\* ’19, 2019. doi: 10.1145/3287560.3287566. URL http://dx.doi.org/10.1145/3287560.3287566.
234
+ [27] Ramon van Handel. Probability in high dimension. Technical report, PRINCETON UNIV NJ, 2014.
235
+ [28] Suresh Venkatasubramanian and Mark Alfano. The philosophical basis of algorithmic recourse. In Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency, pages 284–293, 2020.
236
+ [29] Sahil Verma, John Dickerson, and Keegan Hines. Counterfactual explanations for machine learning: A review. arXiv preprint arXiv:2010.10596, 2020.
237
+ [30] Paul Voigt and Axel Von dem Bussche. The eu general data protection regulation (gdpr). A Practical Guide, 1st Ed., Cham: Springer International Publishing, 10:3152676, 2017.
238
+ [31] Sandra Wachter, Brent D. Mittelstadt, and Chris Russell. Counterfactual explanations without opening the black box: Automated decisions and the GDPR. CoRR, abs/1711.00399, 2017. URL http://arxiv.org/abs/1711.00399.
239
+ [32] Eric Wong and Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning, pages 5286–5295. PMLR, 2018.
240
+ [33] Xingyu Zhao, Xiaowei Huang, V. Robu, and D. Flynn. Baylime: Bayesian local interpretable model-agnostic explanations. UAI, abs/2012.03058, 2021.
md/train/B1e9Y2NYvS/B1e9Y2NYvS.md ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON ROBUSTNESS OF NEURAL ORDINARY DIFFERENTIAL EQUATIONS
2
+
3
+ Hanshu YAN\*, Jiawei DU\*, Vincent Y. F. TAN & Jiashi FENG
4
+
5
+ Department of Electrical and Computer Engineering
6
+ National University of Singapore
7
+ {hanshu.yan, dujiawei}@u.nus.edu, {vtan, elefjia}@nus.edu.sg
8
+
9
+ # ABSTRACT
10
+
11
+ Neural ordinary differential equations (ODEs) have been attracting increasing attention in various research domains recently. There have been some works studying optimization issues and approximation capabilities of neural ODEs, but their robustness is still yet unclear. In this work, we fill this important gap by exploring robustness properties of neural ODEs both empirically and theoretically. We first present an empirical study on the robustness of the neural ODE-based networks (ODENets) by exposing them to inputs with various types of perturbations and subsequently investigating the changes of the corresponding outputs. In contrast to conventional convolutional neural networks (CNNs), we find that the ODENets are more robust against both random Gaussian perturbations and adversarial attack examples. We then provide an insightful understanding of this phenomenon by exploiting a certain desirable property of the flow of a continuous-time ODE, namely that integral curves are non-intersecting. Our work suggests that, due to their intrinsic robustness, it is promising to use neural ODEs as a basic block for building robust deep network models. To further enhance the robustness of vanilla neural ODEs, we propose the time-invariant steady neural ODE (TisODE), which regularizes the flow on perturbed data via the time-invariant property and the imposition of a steady-state constraint. We show that the TisODE method outperforms vanilla neural ODEs and also can work in conjunction with other state-of-the-art architectural methods to build more robust deep networks.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Neural ordinary differential equations (Chen et al., 2018) form a family of models that approximate nonlinear mappings by using continuous-time ODEs. Due to their desirable properties, such as invertibility and parameter efficiency, neural ODEs have attracted increasing attention recently (Dupont et al., 2019; Liu et al., 2019). For example, Grathwohl et al. (2018) proposed a neural ODE-based generative model—the FFJORD—to solve inverse problems; Quaglino et al. (2019) used a higher-order approximation of the states in a neural ODE, and proposed the SNet to accelerate computation. Along with the wider deployment of neural ODEs, robustness issues come to the fore. However, the robustness of neural ODEs is still yet unclear. In particular, it is unclear how robust neural ODEs are in comparison to the widely-used CNNs. Robustness properties of CNNs have been studied extensively. In this work, we present the first systematic study on exploring the robustness properties of neural ODEs.
16
+
17
+ To do so, we consider the task of image classification. We expect that results would be similar for other machine learning tasks such as regression. Neural ODEs are dimension-preserving mappings, but a classification model transforms a high-dimensional input—such as an image—into an output whose dimension is equal to the number of classes. Thus, we consider the neural ODE-based classification network (ODENet) whose architecture is shown in Figure 1. An ODENet consists of three components: the feature extractor (FE) consists of convolutional layers which maps an input datum to a multi-channel feature map, a neural ODE that serves as the nonlinear representation mapping (RM), and the fully-connected classifier (FCC) that generates a prediction vector based on the output of the RM.
18
+
19
+ The robustness of a classification model can be evaluated through the lens of its performance on perturbed images. To comprehensively investigate the robustness of neural ODEs, we perturb original images with commonly-used perturbations, namely, random Gaussian noise (Szegedy et al., 2013) and harmful adversarial examples (Goodfellow et al., 2014; Madry et al., 2017). We conduct experiments in two common settings—training the model only on authentic non-perturbed images and training the model on authentic images as well as the Gaussian perturbed ones. We observe that ODENets are more robust compared to CNN models against all types of perturbations in both settings. We then provide an insightful understanding of such intriguing robustness of neural ODEs by exploiting a certain property of the flow (Dupont et al., 2019), namely that integral curves that start at distinct initial states are nonintersecting. The flow of a continuous-time ODE is defined as the family of solutions/paths traversed by the state, starting from different initial points, and an integral curve is a specific solution for a given initial point. The non-intersecting property indicates that an integral curve starting from some point is constrained by the integral curves starting from that point’s neighborhood. Thus, in an ODENet, if a correctly classified datum is slightly perturbed, the integral curve associated to its perturbed version would not change too much from the original one. Consequently, the perturbed datum could still be correctly classified. Thus, there exists intrinsic robustness regularization in ODENets, which is absent from CNNs.
20
+
21
+ ![](images/6e9bd948731c27f7167c50dec38ca4fa802294fd3834ad917ec0b4023c814c57.jpg)
22
+ Figure 1: The architecture of an ODENet. The neural ODE block serves as a dimension-preserving nonlinear mapping.
23
+
24
+ Motivated by this property of the neural ODE flow, we attempt to explore a more robust neural ODE architecture by introducing stronger regularization on the flow. We thus propose a Time-Invariant Steady neural ODE (TisODE). The TisODE removes the time dependence of the dynamics in an ODE and imposes a steady-state constraint on the integral curves. Removing the time dependence of the derivative results in the time-invariant property of the ODE. To wit, given a solution ${ \bf z } _ { 1 } ( t )$ , another solution $\widetilde { \mathbf { z } } _ { 1 } ( t )$ , with an initial state $\tilde { { \bf z } } _ { 1 } ( 0 ) \bar { { \bf \phi } } = { \bf \bar { z } } _ { 1 } ( T ^ { \prime } )$ for some $T ^ { \prime } > 0$ , can be regarded as the $- T ^ { \prime }$ - shift version of ${ \bf z } _ { 1 } ( t )$ . Such a time-invariant property would make bounding the difference between output states convenient. To elaborate, let the output of a neural ODE correspond to states at time $T > 0$ . By the time-invariant property, the difference between outputs, $\| \widetilde { \mathbf z } _ { 1 } ( \bar { T } ) - \mathbf z _ { 1 } ( T ) \|$ , equals to $\| { \bf z } _ { 1 } ( T + T ^ { \prime } ) - { \bf z } _ { 1 } ( T ) \|$ . To control this distance, a steady-state regularization term is introduced to the overall objective to constrain the change of a state after time exceeds $T$ . With the time-invariant property and the steady-state term, we show that TisODE even is more robust. We do so by evaluating the robustness of TisODE-based classifiers against various types of perturbations and observe that such models are more robust than vanilla ODE-based models.
25
+
26
+ In addition, some other effective architectural solutions have also been recently proposed to improve the robustness of CNNs. For example, Xie et al. (2017) randomly resizes or pads zeros into test images to destroy the specific structure of adversarial perturbations. Besides, the model proposed by Xie et al. (2019) contains feature denoising filters to remove the feature-level patterns of adversarial examples. We conduct experiments to show that our proposed TisODE can work seamlessly and in conjunction with these methods to further boost the robustness of deep models. Thus, the proposed TisODE can be used as a generally applicable and effective component for improving the robustness of deep models.
27
+
28
+ In summary, our contributions are as follows. Firstly, we are the first to provide a systematic empirical study on the robustness of neural ODEs and find that the neural ODE-based models are more robust compared to conventional CNN models. This finding inspires new applications of neural ODEs in improving robustness of deep models, a problem that concerns many deep learning theorists and practitioners alike. Secondly, we propose the TisODE method, which is simple yet effective in significantly boosting the robustness of neural ODEs. Moreover, the proposed TisODE can also be used in conjunction with other state-of-the-art robust architectures. Thus, TisODE can serve as a drop-in module to improve the robustness of deep models effectively.
29
+
30
+ # 2 PRELIMINARIES ON NEURAL ODE
31
+
32
+ It has been shown that a residual block (He et al., 2016) can be interpreted as the discrete approximation of an ODE by setting the discretization step to be one. When the discretization step approaches zero, it yields a family of neural networks, which are called neural ODEs (Chen et al., 2018). Formally, in a neural ODE, the relation between input and output is characterized by the following set of equations:
33
+
34
+ $$
35
+ \frac { \mathrm { d } { \mathbf z } ( t ) } { \mathrm { d } t } = f _ { \boldsymbol \theta } ( { \mathbf z } ( t ) , t ) , \quad { \mathbf z } ( 0 ) = { \mathbf z } _ { \mathrm { i n } } , \quad { \mathbf z } _ { \mathrm { o u t } } = { \mathbf z } ( T ) ,
36
+ $$
37
+
38
+ where $f _ { \theta } : \mathbb { R } ^ { d } \times [ 0 , \infty ) \mathbb { R } ^ { d }$ denotes the trainable layers that are parameterized by weights $\theta$ and $\mathbf { z } : [ 0 , \infty ) \mathbb { R } ^ { d }$ represents the $d$ -dimensional state of the neural ODE. We assume that $f _ { \theta }$ is continuous in $t$ and globally Lipschitz continuous in $\mathbf { z }$ . In this case, the input $\mathbf { z } _ { \mathrm { i n } }$ of the neural ODE corresponds to the state at $t = 0$ , and the output $\mathbf { z } _ { \mathrm { o u t } }$ is associated to the state at some $T \in ( 0 , \infty )$ . Because $f _ { \theta }$ governs how the state changes with respect to time $t$ , we also use $f _ { \theta }$ to denote the dynamics of the neural ODE.
39
+
40
+ Given input $\mathbf { z } _ { \mathrm { i n } }$ , the output $\mathbf { z } _ { \mathrm { o u t } }$ can be computed by solving the ODE in (1). If $T$ is fixed, the output $\mathbf { z } _ { \mathrm { o u t } }$ only depends on the input $\mathbf { z } _ { \mathrm { i n } }$ and the dynamics $f _ { \theta }$ , which also corresponds to the weighted layers in the neural ODE. Therefore, the neural ODE can be represented as the $d$ -dimensional function $\phi _ { T } ( \cdot , \cdot )$ of the input $\mathbf { z } _ { \mathrm { i n } }$ and the dynamics $f _ { \theta }$ , i.e.,
41
+
42
+ $$
43
+ \mathbf { z } _ { \mathrm { o u t } } = \mathbf { z } ( T ) = \mathbf { z } ( 0 ) + \int _ { 0 } ^ { T } f _ { \theta } ( \mathbf { z } ( t ) , t ) \mathrm { d } t = \phi _ { T } ( \mathbf { z } _ { \mathrm { i n } } , f _ { \theta } ) .
44
+ $$
45
+
46
+ The terminal time $T$ of the output state ${ \mathbf z } ( T )$ is set to be 1 in practice. Several methods have been proposed for training neural ODEs, such as the adjoint sensitivity method (Chen et al., 2018), SNet (Quaglino et al., 2019), and the auto-differentiation technique (Paszke et al., 2017). In this work, we use the most straightforward technique, i.e., updating the weights $\theta$ with the autodifferentiation technique in the PyTorch framework.
47
+
48
+ # 3 AN EMPIRICAL STUDY ON THE ROBUSTNESS OF ODENETS
49
+
50
+ Robustness of deep models has gained increased attention, as it is imperative that deep models employed in critical applications, such as healthcare, are robust. The robustness of a model is measured by the sensitivity of the prediction with respect to small perturbations on the inputs. In this study, we consider three commonly-used perturbation schemes, namely random Gaussian perturbations, FGSM (Goodfellow et al., 2014) adversarial examples, and PGD (Madry et al., 2017) adversarial examples. These perturbation schemes reflect noise and adversarial robustness properties of the investigated models respectively. We evaluate the robustness via the classification accuracies on perturbed images, in which the original non-perturbed versions of these images are all correctly classified.
51
+
52
+ For a fair comparison with conventional CNN models, we made sure that the number of parameters of an ODENet is close to that of its counterpart CNN model. Specifically, the ODENet shares the same network architecture with the CNN model for the FE and FCC parts. The only difference is that, for the RM part, the input of the ODE-based RM is concatenated with one more channel which represents the time $t$ , while the RM in a CNN model has a skip connection and serves as a residual block. During the training phase, all the hyperparameters are kept the same, including training epochs, learning rate schedules, and weight decay coefficients. Each model is trained three times with different random seeds, and we report the average performance (classification accuracy) together with the standard deviation.
53
+
54
+ # 3.1 EXPERIMENTAL SETTINGS
55
+
56
+ Dataset: We conduct experiments to compare the robustness of ODENets with CNN models on three datasets, i.e., the MNIST (LeCun et al., 1998), the SVHN (Netzer et al., 2011), and a subset of the ImageNet datset (Deng et al., 2009). We call the subset ImgNet10 since it is collected from 10 synsets of ImageNet: dog, bird, car, fish, monkey, turtle, lizard, bridge, cow, and crab. We selected 3,000 training images and 300 test images from each synset and resized all images to $1 2 8 \times 1 2 8$ .
57
+
58
+ Architectures: On the MNIST dataset, both the ODENet and the CNN model consists of four convolutional layers and one fully-connected layer. The total number of parameters of the two models is around $1 4 0 \mathrm { k }$ . On the SVHN dataset, the networks are similar to those for the MNIST; we only changed the input channels of the first convolutional layer to three. On the ImgNet10 dataset, there are nine convolutional layers and one fully-connected layer for both the ODENet and the CNN model. The numbers of parameters is approximately $2 8 0 \mathrm { k }$ . In practice, the neural ODE can be solved with different numerical solvers such as the Euler method and the Runge-Kutta methods (Chen et al., 2018). Here, we use the easily-implemented Euler method in the experiments. To balance the computation and the continuity of the flow, we solve the ODE initial value problem in equation (1) by the Euler method with step size 0.1. Our implementation builds on the open-source neural ODE codes. 1 Details on the network architectures are included in the Appendix.
59
+
60
+ Training: The experiments are conducted using two settings on each dataset—training models only with original non-perturbed images and training models on original images together with their perturbed versions. In both settings, we added a weight decay term into the training objective to regularize the norm of the weights, since this can help control the model’s representation capacity and improve the robustness of a neural network (Sokolic´ et al., 2017). In the second setting, images perturbed with random Gaussian noise are used to fine-tune the models, because augmenting the dataset with small perturbations can possibly improve the robustness of models and synthesizing Gaussian noise does not incur excessive computation time.
61
+
62
+ # 3.2 ROBUSTNESS OF ODENETS TRAINED ONLY ON NON-PERTURBED IMAGES
63
+
64
+ The first question we are interested in is how robust ODENets are against perturbations if the model is only trained on original non-perturbed images. We train CNNs and ODEnets to perform classification on three datasets and set the weight decay parameters for all models to be 0.0005. We make sure that both the well-trained ODENets and CNN models have satisfactory performances on original non-perturbed images, i.e., around $9 9 . 5 \%$ for MNIST, $9 5 . 0 \%$ for the SVHN, and $8 0 . 0 \%$ for ImgNet10.
65
+
66
+ Since Gaussian noise is ubiquitous in modeling image degradation, we first evaluated the robustness of the models in the presence of zero-mean random Gaussian perturbations. It has also been shown that a deep model is vulnerable to harmful adversarial examples, such as the FGSM (Goodfellow et al., 2014). We are also interested in how robust ODENets are in the presence of adversarial examples. The standard deviation $\sigma$ of Gaussian noise and the $l _ { \infty }$ -norm $\epsilon$ of the FGSM attack for each dataset are shown in Table 1.
67
+
68
+ Table 1: Robustness comparison of different models. We report their mean classification accuracies $( \% )$ and standard deviations (mean $\pm$ std) on perturbed images from the MNIST, the SVHN, and the ImgNet10 datasets. Two types of perturbations are used—zero-mean Gaussian noise and FGSM adversarial attack. The results show that ODENets are much more robust in comparison to CNN models.
69
+
70
+ <table><tr><td></td><td colspan="3">Gaussian noise</td><td colspan="3">Adversarial attack</td></tr><tr><td>MNIST</td><td>σ=50</td><td>σ=75</td><td>σ=100</td><td>FGSM-0.15</td><td>FGSM-0.3</td><td>FGSM-0.5</td></tr><tr><td>CNN</td><td>98.1±0.7</td><td>85.8±4.3</td><td>56.4±5.6</td><td>63.4±2.3</td><td>24.0±8.9</td><td>8.3±3.2</td></tr><tr><td>ODENet</td><td>98.7±0.6</td><td>90.6±5.4</td><td>73.2±8.6</td><td>83.5±0.9</td><td>42.1±2.4</td><td>14.3±2.1</td></tr><tr><td>SVHN</td><td>g=15</td><td>g=25</td><td>σ=35</td><td>FGSM-3/255</td><td>FGSM-5/255</td><td>FGSM-8/255</td></tr><tr><td>CNN</td><td>90.0±1.2</td><td>76.3±2.7</td><td>60.9±3.9</td><td>29.2±2.9</td><td>13.7±1.9</td><td>5.4±1.5</td></tr><tr><td>ODENet</td><td>95.7±0.7</td><td>88.1±1.5</td><td>78.2±2.1</td><td>58.2±2.3</td><td>43.0±1.3</td><td>30.9±1.4</td></tr><tr><td>ImgNet10</td><td>σ=10</td><td>σ=15</td><td>σ = 25</td><td>FGSM-5/255</td><td>FGSM-8/255</td><td>FGSM-16/255</td></tr><tr><td>CNN</td><td>80.1±1.8</td><td>63.3±2.0</td><td>40.8±2.7</td><td>28.5±0.5</td><td>18.1±0.7</td><td>9.4±1.2</td></tr><tr><td>ODENet</td><td>81.9±2.0</td><td>67.5±2.0</td><td>48.7±2.6</td><td>36.2±1.0</td><td>27.2±1.1</td><td>14.4±1.7</td></tr></table>
71
+
72
+ From the results in Table 1, we observe that the ODENets demonstrate superior robustness compared to CNNs for all types of perturbations. On the MNIST dataset, in the presence of Gaussian perturbations with a large $\sigma$ of 100, the ODENet produces much higher accuracy on perturbed images compared to the CNN model ( $7 3 . 2 \%$ vs. $5 6 . 4 \%$ ). For the FGSM-0.3 adversarial examples, the accuracy of ONEnet is around twice as high as that of the CNN model. On the SVHN dataset, ODENets significantly outperform CNN models, e.g., for the FGSM-5/255 examples, the accuracy of the ODENet is $4 3 . 0 \%$ , which is much higher than that of the CNN model $( 1 3 . 7 \% )$ . On the ImgNet10, for both cases of $\sigma = 2 5$ and FGSM-8/255, ODENet outperforms CNNs by a large margin of around $9 \%$ .
73
+
74
+ # 3.3 ROBUSTNESS OF ODENETS TRAINED ON ORIGINAL IMAGES TOGETHER WITH GAUSSIAN PERTURBATIONS
75
+
76
+ Training a model on original images together with their perturbed versions can improve the robustness of the model. As mentioned previously, Gaussian noise is commonly assumed to be present in real-world images. Synthesizing Gaussian noise is also fast and easy. Thus, we add random Gaussian noise into the original images to generate their perturbed versions. ODENets and CNN models are both trained on original images together with their perturbed versions. The standard deviation of the added Gaussian noise is randomly chosen from $\bar { \{ 5 0 , 7 5 , 1 0 0 \} }$ on the MNIST dataset, $\{ 1 5 , 2 5 , 3 5 \}$ on the SVHN dataset, and $\{ 1 0 , 1 5 , 2 5 \}$ on the ImgNet10. All other hyperparameters are kept the same as above.
77
+
78
+ Table 2: Robustness comparison of different models. We report their mean classification accuracies $( \% )$ and standard deviations (mean $\pm$ std) on perturbed images from the MNIST, the SVHN, and the ImgNet10 datsets. Three types of perturbations are used—zero-mean Gaussian noise, FGSM adversarial attack, and PGD adversarial attack. The results show that ODENets are more robust compared to CNN models.
79
+
80
+ <table><tr><td></td><td>Gaussian noise</td><td colspan="4">Adversarial attack</td></tr><tr><td>MNIST</td><td>σ=100</td><td>FGSM-0.3</td><td>FGSM-0.5</td><td>PGD-0.2</td><td>PGD-0.3</td></tr><tr><td>CNN</td><td>98.7±0.1</td><td>54.2±1.1</td><td>15.8±1.3</td><td>32.9±3.7</td><td>0.0±0.0</td></tr><tr><td>ODENet</td><td>99.4±0.1</td><td>71.5±1.1</td><td>19.9±1.2</td><td>64.7±1.8</td><td>13.0±0.2</td></tr><tr><td>SVHN</td><td>σ=35</td><td>FGSM-5/255</td><td>FGSM-8/255</td><td>PGD-3/255</td><td>PGD-5/255</td></tr><tr><td>CNN</td><td>90.6±0.2</td><td>25.3±0.6</td><td>12.3±0.7</td><td>32.4±0.4</td><td>14.0±0.5</td></tr><tr><td>ODENet</td><td>95.1±0.1</td><td>49.4±1.0</td><td>34.7±0.5</td><td>50.9±1.3</td><td>27.2±1.4</td></tr><tr><td>ImgNet10</td><td>σ= 25</td><td>FGSM-5/255</td><td>FGSM-8/255</td><td>PGD-3/255</td><td>PGD-5/255</td></tr><tr><td>CNN</td><td>92.6±0.6</td><td>40.9±1.8</td><td>26.7±1.7</td><td>28.6±1.5</td><td>11.2±1.2</td></tr><tr><td>ODENet</td><td>92.6±0.5</td><td>42.0±0.4</td><td>29.0±1.0</td><td>29.8±0.4</td><td>12.3±0.6</td></tr></table>
81
+
82
+ The robustness of the models is evaluated under Gaussian perturbations, FGSM adversarial examples, and PGD (Madry et al., 2017) adversarial examples. The latter is a stronger attacker compared to the FGSM. The $l _ { \infty }$ -norm $\epsilon$ of the PGD attack for each dataset is shown in Table 2. Based on the results, we observe that ODENets consistently outperform CNN models on both two datasets. On the MNIST dataset, the ODENet outperforms the CNN against all types of perturbations. In particular, for the PGD-0.2 adversarial examples, the accuracy of the ODENet $( 6 4 . 7 \% )$ is much higher than that of the CNN $( 3 2 . 9 \% )$ . Besides, for the PGD-0.3 attack, the CNN is completely misled by the adversarial examples, but the ODENet can still classify perturbed images with an accuracy of $1 3 . 0 \%$ . On the SVHN dataset, ODENets also show superior robustness in comparison to CNN models. For all the adversarial examples, ODENets outperform CNN models by a margin of at least 10 percentage points. On the ImgNet10 dataset, the ODENet also performs better than CNN models against all forms of adversarial examples.
83
+
84
+ # 3.4 INSIGHTS ON THE ROBUSTNESS OF ODENETS
85
+
86
+ From the results in Sections 3.2 and 3.3, we find ODENets are more robust compared to CNN models. Here, we attempt to provide an intuitive understanding of the robustness of the neural ODE. In an ODENet, given some datum, the FE extracts an informative feature map from the datum. The neural ODE, serving as the RM, takes as input the feature map and performs a nonlinear mapping. In practice, we use the weight decay technique during training which regularizes the norm of weights in the FE part, so that the change of feature map in terms of a small perturbation on the input can be controlled. We aim to show that, in the neural ODE, a small change on the feature map will not lead to a large deviation from the original output associated with the feature map.
87
+
88
+ Theorem 1 (ODE integral curves do not intersect (Coddington & Levinson, 1955; Younes, 2010; Dupont et al., 2019)). Let ${ \bf z } _ { 1 } ( t )$ and ${ \bf z } _ { 2 } ( t )$ be two solutions of the ODE in (1) with different initial conditions, i.e. ${ \bf z } _ { 1 } ( 0 ) \neq { \bf z } _ { 2 } ( 0 )$ . In (1), $f _ { \theta }$ is continuous in t and globally Lipschitz continuous in z. Then, it holds that ${ \bf z } _ { 1 } ( t ) \neq { \bf z } _ { 2 } ( t )$ for all $t \in [ 0 , \infty )$ .
89
+
90
+ To illustrate this theorem, considering a simple 1- dimensional system in which the state is a scalar. As shown in Figure 2, equation (1) has a solution $z _ { 1 } ( t )$ starting from $\bar { A _ { 1 } } = ( 0 , \bar { z _ { 1 } } ( 0 ) )$ , where $z _ { 1 } ( 0 )$ is the feature of some datum. Equation (1) also has another two solutions $z _ { 2 } ( t )$ and $z _ { 3 } ( t )$ , whose starting points $A _ { 2 } = ( 0 , z _ { 2 } ( 0 ) )$ and $A _ { 3 } ~ = ~ ( 0 , z _ { 3 } ( 0 ) )$ , both of which are close to $A _ { 1 }$ . Suppose $A _ { 1 }$ is between $A _ { 2 }$ and $A _ { 3 }$ . By Theorem 1, we know that the integral curve $z _ { 1 } ( t )$ is always sandwiched between the integral curves $z _ { 2 } ( t )$ and $z _ { 3 } ( t )$ .
91
+
92
+ Now, let $\epsilon < \operatorname* { m i n } \{ | z _ { 2 } ( 0 ) - z _ { 1 } ( 0 ) | , | z _ { 3 } ( 0 ) - z _ { 1 } ( 0 ) | \} .$ . Consider a solution $\widetilde { z } _ { 1 } ( t )$ of equation (1). The integral curve $\widetilde { z } _ { 1 } ( t )$ starts from a point $\widetilde { A } _ { 1 } = ( 0 , \widetilde { z } _ { 1 } ( 0 ) )$ . The point $\widetilde { A } _ { 1 }$ is !in the $\epsilon$ -neighborhood of $A _ { 1 }$ with $| \widetilde z _ { 1 } ( 0 ) - z _ { 1 } ( 0 ) | < \epsilon .$ . By Theorem 1, we know that $| \tilde { z } _ { 1 } ( T ) - z _ { 1 } ( T ) | \leq | z _ { 3 } ( T ) -$ $z _ { 2 } ( T ) |$ !. In other words, if any perturbation smaller than $\epsilon$ is added to the scalar $z _ { 1 } ( 0 )$ in $A _ { 1 }$ , the deviation from the original output $z _ { 1 } ( T )$ is bounded by the distance between $z _ { 2 } ( T )$ and $z _ { 3 } ( T )$ . In contrast, in a CNN model, there is no such bound on the deviation from the original output. Thus, we opine that due to this non-intersecting property, ODENets are intrinsically robust.
93
+
94
+ ![](images/901235eac73c549d6bdb2646bd2f84cf3a82d0581b3c2860c0361d6a9e2870e9.jpg)
95
+ Figure 2: No integral curves intersect. The integral curve starting from $\widetilde { A _ { 1 } }$ is always sandwiched between two integral curves starting from $A _ { 1 }$ and $A _ { 3 }$ .
96
+
97
+ # 4 TISODE: BOOSTING THE ROBUSTNESS OF NEURAL ODES
98
+
99
+ In the previous section, we presented an empirical study on the robustness of ODENets and observed that ODENets are more robust compared to CNN models. In this section, we explore how to boost the robustness of the vanilla neural ODE model further. This motivates the proposal of time-invariant steady neural ODEs (TisODEs).
100
+
101
+ # 4.1 TIME-INVARIANT STEADY NEURAL ODES
102
+
103
+ From the discussion in Section 3.4, the key to improving the robustness of neural ODEs is to control the difference between neighboring integral curves. By Grownall’s inequality (Howard, 1998) (see Theorem 2 in the Appendix), we know that the difference between two terminal states is bounded by the difference between initial states multiplied by the exponential of the dynamics’ Lipschitz constant. However, it is very difficult to bound the Lipschitz constant of the dynamics directly. Alternatively, we propose to achieve the goal of controlling the output deviation by following two steps: (i) removing the time dependence of the dynamics and (ii) imposing a certain steady-state constraint.
104
+
105
+ ![](images/b7cae751cc80ff17df6fe622bceb23becc612933d297ca2ae9a8307363b3a95d.jpg)
106
+ Figure 3: An illustration of the timeinvariant property of ODEs. We can see that the curve $\widetilde { \mathbf { z } } _ { 1 } ( t )$ is exactly the horizontal translation of ${ \bf z } _ { 1 } ( t )$ on the interval $[ T ^ { \prime } , \infty )$ .
107
+
108
+ In the neural ODE characterized by equation (1), the dynamics $f _ { \theta } ( \mathbf { z } ( t ) , t )$ depends on both the state ${ \bf z } ( t )$ at time $t$ and the time $t$ itself. In contrast, if the neural ODE is modified to be time-invariant, the time dependence of the dynamics is removed. Consequently, the dynamics depends only on the state z. So, we can rewrite the dynamics function as $f _ { \boldsymbol { \theta } } ( \mathbf { z } )$ , and the neural ODE is characterized as
109
+
110
+ $$
111
+ \left\{ \begin{array} { l l } { \displaystyle \frac { \mathrm { d } \mathbf { z } ( t ) } { \mathrm { d } t } = f _ { \boldsymbol { \theta } } ( \mathbf { z } ( t ) ) ; } \\ { \mathbf { z } ( 0 ) = \mathbf { z } _ { \mathrm { i n } } ; } \\ { \mathbf { z } _ { \mathrm { o u t } } = \mathbf { z } ( T ) . } \end{array} \right.
112
+ $$
113
+
114
+ Let ${ \bf z } _ { 1 } ( t )$ be a solution of (2) on $[ 0 , \infty )$ and $\epsilon > 0$ be a small positive value. We define the set $\mathbb { M } _ { 1 } = \{ ( \mathbf { z } _ { 1 } ( t ) , t ) | t \in [ 0 , T ]$ , " $\| \mathbf { z } _ { 1 } ( t ) - \mathbf { z } _ { 1 } ( 0 ) \| \leq \epsilon \}$ . This set contains all points on the curve of ${ \bf z } _ { 1 } ( t )$ during $[ 0 , T ]$ that are also inside the $\epsilon$ -neighborhood of ${ \bf z } _ { 1 } ( 0 )$ . For some element $( { \bf z } _ { 1 } ( T ^ { \prime } ) , T ^ { \prime } ) \in \mathbb { M } _ { 1 }$ , let $\widetilde { \mathbf { z } } _ { 1 } ( t )$ be the solution of (2) which starts from $\widetilde { \mathbf z } _ { 1 } ( 0 ) = \mathbf z _ { 1 } ( T ^ { \prime } )$ . Then we have
115
+
116
+ $$
117
+ \widetilde { { \mathbf z } } _ { 1 } ( t ) = { \mathbf z } _ { 1 } ( t + T ^ { \prime } )
118
+ $$
119
+
120
+ for all $t$ in $[ 0 , \infty )$ . The property shown in equation (3) is known as the time-invariant property. It indicates that the integral curve $\widetilde { \mathbf { z } } _ { 1 } ( t )$ is the $- T ^ { \prime }$ shift of ${ \bf z } _ { 1 } ( t )$ (Figure 3).
121
+
122
+ We can regard $\widetilde { \mathbf { z } } _ { 1 } ( 0 )$ as a slightly perturbed version of ${ \bf z } _ { 1 } ( 0 )$ , and we are interested in how large the difference between $\widetilde { \mathbf z } _ { 1 } ( T )$ and ${ \bf z } _ { 1 } ( T )$ is. In a robust model, the difference should be small. By equation (3), we have $\| \mathbf { \tilde { z } } _ { 1 } ( T ) - \mathbf { z } _ { 1 } ( T ) \| = \| \mathbf { z } _ { 1 } ( T + T ^ { \prime } ) - \mathbf { z } _ { 1 } ( T ) \|$ . Since $T ^ { \prime } \in [ 0 , T ]$ , the difference between ${ \bf z } _ { 1 } ( T )$ and $\widetilde { \mathbf z } _ { 1 } ( T )$ can be bounded as follows,
123
+
124
+ $$
125
+ \| \widetilde { \mathbf z } _ { 1 } ( T ) - \mathbf z _ { 1 } ( T ) \| = \left\| \int _ { T } ^ { T + T ^ { \prime } } f _ { \theta } ( \mathbf z _ { 1 } ( t ) ) \mathrm { d } t \right\| \leq \left\| \int _ { T } ^ { T + T ^ { \prime } } | f _ { \theta } ( \mathbf z _ { 1 } ( t ) ) | \mathrm { d } t \right\| \leq \left\| \int _ { T } ^ { 2 T } | f _ { \theta } ( \mathbf z _ { 1 } ( t ) ) | \mathrm { d } t \right\| ,
126
+ $$
127
+
128
+ where all norms are $\ell _ { 2 }$ norms and $| f _ { \theta } |$ denotes the element-wise absolute operation of a vectorvalued function $f _ { \theta }$ . That is to say, the difference between $\widetilde { \mathbf z } _ { 1 } ( T )$ and ${ \bf z } _ { 1 } ( T )$ can be bounded by only using the information of the curve ${ \bf z } _ { 1 } ( t )$ . For any $t ^ { \prime } \in [ 0 , T ]$ and element $( { \bf z } _ { 1 } ( t ^ { \prime } ) , t ^ { \prime } ) \in \mathbb { M } _ { 1 }$ , consider the integral curve that starts from ${ \bf z } _ { 1 } ( t ^ { \prime } )$ . The difference between the output state of this curve and ${ \bf z } _ { 1 } ( T )$ satisfies inequality (4).
129
+
130
+ Therefore, we propose to add an additional term $L _ { \mathrm { s s } }$ to the loss function when training the timeinvariant neural ODE:
131
+
132
+ $$
133
+ L _ { \mathrm { s s } } = \sum _ { i = 1 } ^ { N } \left\| \int _ { T } ^ { 2 T } | f _ { \theta } ( \mathbf { z } _ { i } ( t ) ) | \mathrm { d } t \right\| ,
134
+ $$
135
+
136
+ where $N$ is the number of samples in the training set and ${ \bf z } _ { i } ( t )$ is the solution whose initial state equals to the feature of the $i ^ { \mathrm { t h } }$ sample. The regularization term $L _ { \mathrm { s s } }$ is termed as the steady-state loss. This terminology “steady state” is borrowed from the dynamical systems literature. In a stable dynamical system, the states stabilize around a fixed point, known as the steady-state, as time tends to infinity. If we can ensure that $L _ { \mathrm { s s } }$ is small, for each sample, the outputs of all the points in $\mathbb { M } _ { i }$ will stabilize around ${ \bf z } _ { i } ( T )$ . Consequently, the model is robust. This modification of the neural ODE is dubbed Time-invariant steady neural $O D E$ .
137
+
138
+ # 4.2 EVALUATING ROBUSTNESS OF TISODE-BASED CLASSIFIERS
139
+
140
+ Here, we conduct experiments to evaluate the robustness of our proposed TisODE, and compare TisODE-based models with the vanilla ODENets. We train all models with original non-perturbed images together with their Gaussian perturbed versions. The regularization parameter for the steadystate loss $L _ { \mathrm { s s } }$ is set to be 0.1. All other hyperparameters are exactly the same as those in Section 3.3.
141
+
142
+ From the results in Table 3, we can see that our proposed TisODE-based models are clearly more robust compared to vanilla ODENets. On the MNIST dataset, when combating FGSM-0.3 attacks, the TisODE-based models outperform vanilla ODENets by more than 4 percentage points. For the FGSM-0.5 adversarial examples, the accuracy of the TisODE-based model is 6 percentage points better. On the SVHN dataset, the TisODE-based models perform better in terms of all forms of adversarial examples. On the ImgNet10 dataset, the TisODE-based models also outperform vanilla ODE-based models on all types of perturbations. In the presence of FGSM and PGD-5/255 examples, the accuracies are enhanced by more than 2 percentage points.
143
+
144
+ Table 3: Classification accuracy (mean $\pm$ std in $\%$ ) on perturbed images from MNIST, SVHN and ImgNet10. To evaluate the robustness of classifiers, we use three types of perturbations, namely zero-mean Gaussian noise with standard deviation $\sigma$ , FGSM attack and PGD attack. From the results, the proposed TisODE effectively improve the robustness of the vanilla neural ODE.
145
+
146
+ <table><tr><td></td><td>Gaussian noise</td><td colspan="4">Adversarial attack</td></tr><tr><td>MNIST</td><td>σ=100</td><td>FGSM-0.3</td><td>FGSM-0.5</td><td>PGD-0.2</td><td>PGD-0.3</td></tr><tr><td>CNN</td><td>98.7±0.1</td><td>54.2±1.1</td><td>15.8±1.3</td><td>32.9±3.7</td><td>0.0±0.0</td></tr><tr><td>ODENet</td><td>99.4±0.1</td><td>71.5±1.1</td><td>19.9±1.2</td><td>64.7±1.8</td><td>13.0±0.2</td></tr><tr><td>TisODE</td><td>99.6±0.0</td><td>75.7±1.4</td><td>26.5±3.8</td><td>67.4±1.5</td><td>13.2±1.0</td></tr><tr><td>SVHN</td><td>σ=35</td><td>FGSM-5/255</td><td>FGSM-8/255</td><td>PGD-3/255</td><td>PGD-5/255</td></tr><tr><td>CNN</td><td>90.6±0.2</td><td>25.3±0.6</td><td>12.3±0.7</td><td>32.4±0.4</td><td>14.0±0.5</td></tr><tr><td>ODENet</td><td>95.1±0.1</td><td>49.4±1.0</td><td>34.7±0.5</td><td>50.9±1.3</td><td>27.2±1.4</td></tr><tr><td>TisODE</td><td>94.9±0.1</td><td>51.6±1.2</td><td>38.2±1.9</td><td>52.0±0.9</td><td>28.2±0.3</td></tr><tr><td>ImgNet10</td><td>g=25</td><td>FGSM-5/255</td><td>FGSM-8/255</td><td>PGD-3/255</td><td>PGD-5/255</td></tr><tr><td>CNN</td><td>92.6±0.6</td><td>40.9±1.8</td><td>26.7±1.7</td><td>28.6±1.5</td><td>11.2±1.2</td></tr><tr><td>ODENet</td><td>92.6±0.5</td><td>42.0±0.4</td><td>29.0±1.0</td><td>29.8±0.4</td><td>12.3±0.6</td></tr><tr><td>TisODE</td><td>92.8±0.4</td><td>44.3±0.7</td><td>31.4±1.1</td><td>31.1±1.2</td><td>14.5±1.1</td></tr></table>
147
+
148
+ 4.3 TISODE - A GENERALLY APPLICABLE DROP-IN TECHNIQUE FOR IMPROVING THE ROBUSTNESS OF DEEP NETWORKS
149
+
150
+ In view of the excellent robustness of the TisODE, we claim that the proposed TisODE can be used as a general drop-in module for improving the robustness of deep networks. We support this claim by showing the TisODE can work in conjunction with other state-of-the-art techniques and further boost the models’ robustness. These techniques include the feature denoising (FDn) method (Xie et al., 2019) and the input randomization (IR) method (Xie et al., 2017). We conduct experiments on the MNIST and SVHN datasets. All models are trained with original non-perturbed images together with their Gaussian perturbed versions. We show that models using the FDn/IRd technique becomes much more robust when equipped with the TisODE. In the FDn experiments, the dot-product nonlocal denoising layer (Xie et al., 2019) is added to the head of the fully-connected classifier.
151
+
152
+ Table 4: Classification accuracy (mean $\pm$ std in $\%$ ) on perturbed images from MNIST and SVHN. We evaluate against three types of perturbations, namely zero-mean Gaussian noise with standard deviation $\sigma$ , FGSM attack and PGD attack. From the results, upon the CNNs modified with FDn and IRd, using TisODE can further improve the robustness.
153
+
154
+ <table><tr><td></td><td>Gaussian noise</td><td colspan="4">Adversarial attack</td></tr><tr><td>MNIST</td><td>σ= 100</td><td>FGSM-0.3</td><td>FGSM-0.5</td><td>PGD-0.2</td><td>PGD-0.3</td></tr><tr><td>CNN</td><td>98.7±0.1</td><td>54.2±1.1</td><td>15.8±1.3</td><td>32.9±3.7</td><td>0.0±0.0</td></tr><tr><td>CNN-FDn TisODE-FDn</td><td>99.0±0.1</td><td>74.0±4.1</td><td>32.6±5.3</td><td>58.9±4.0</td><td>8.2±2.6</td></tr><tr><td>CNN-IRd</td><td>99.4±0.0 95.3±0.9</td><td>80.6±2.3 78.1±2.2</td><td>40.4±5.7 36.7±2.1</td><td>72.6±2.4 79.6±1.9</td><td>28.2±3.6 55.5±2.9</td></tr><tr><td>TisODE-IRd</td><td>97.6±0.1</td><td>86.8±2.3</td><td>49.1±0.2</td><td>88.8±0.9</td><td>66.0±0.9</td></tr><tr><td>SVHN</td><td>σ=35</td><td>FGSM-5/255</td><td>FGSM-8/255</td><td>PGD-3/255</td><td>PGD-5/255</td></tr><tr><td>CNN</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>90.6±0.2</td><td>25.3±0.6</td><td>12.3±0.7</td><td>32.4±0.4</td><td>14.0±0.5</td></tr><tr><td>CNN-FDn</td><td>92.4±0.1</td><td>43.8±1.4</td><td>31.5±3.0</td><td>40.0±2.6</td><td>19.6±3.4</td></tr><tr><td>TisODE-FDn</td><td>95.2±0.1</td><td>57.8±1.7</td><td>48.2±2.0</td><td>53.4±2.9</td><td>32.3±1.0</td></tr><tr><td>CNN-IRd</td><td>84.9±1.2</td><td>65.8±0.4</td><td>54.7±1.2</td><td>74.0±0.5</td><td>64.5±0.8</td></tr><tr><td>TisODE-IRd</td><td>91.7±0.5</td><td>74.4±1.2</td><td>61.9±1.8</td><td>81.6±0.8</td><td>71.0±0.5</td></tr></table>
155
+
156
+ From Table 4, we observe that both FDn and IRd can effectively improve the adversarial robustness of vanilla CNN models (CNN-FDn, CNN-IRd). Furthermore, combining our proposed TisODE with FDn or IRd (TisODE-FDn, TisODE-IRd), the adversarial robustness of the resultant model is significantly enhanced. For example, on the MNIST dataset, the additional use of our TisODE increases the accuracies on the PGD-0.3 examples by at least 10 percentage points for both FDn $8 . 2 \%$ to $2 8 . 2 \% )$ and IRd $5 5 . 5 \%$ to $6 6 . 0 \%$ ). However, on both MNIST and SVHN datasets, the IRd technique improves the robustness against adversarial examples, but its performance is worse on random Gaussian noise. With the help of the TisODE, the degradation in the robustness against random Gaussian noise can be effectively ameliorated.
157
+
158
+ # 5 RELATED WORKS
159
+
160
+ In this section, we briefly review related works on the neural ODE and works concerning improving the robustness of deep neural networks.
161
+
162
+ Neural ODE: The neural ODE (Chen et al., 2018) method models the input and output as two states of a continuous-time dynamical system by approximating the dynamics of this system with trainable layers. Before the proposal of neural ODE, the idea of modeling nonlinear mappings using continuous-time dynamical systems was proposed in Weinan (2017). Lu et al. (2017) also showed that several popular network architectures could be interpreted as the discretization of a continuoustime ODE. For example, the ResNet (He et al., 2016) and PolyNet (Zhang et al., 2017) are associated with the Euler scheme and the FractalNet (Larsson et al., 2016) is related to the Runge-Kutta scheme. In contrast to these discretization models, neural ODEs are endowed with an intrinsic invertibility property, which yields a family of invertible models for solving inverse problems (Ardizzone et al., 2018), such as the FFJORD (Grathwohl et al., 2018).
163
+
164
+ Recently, many researchers have conducted studies on neural ODEs from the perspectives of optimization techniques, approximation capabilities, and generalization. Concerning the optimization of neural ODEs, the auto-differentiation techniques can effectively train ODENets, but the training procedure is computationally and memory inefficient. To address this problem, Chen et al. (2018) proposed to compute gradients using the adjoint sensitivity method (Pontryagin, 2018), in which there is no need to store any intermediate quantities of the forward pass. Also in Quaglino et al. (2019), the authors proposed the SNet which accelerates the neural ODEs by expressing their dynamics as truncated series of Legendre polynomials. Concerning the approximation capability, Dupont et al. (2019) pointed out the limitations in approximation capabilities of neural ODEs because of the preserving of input topology. The authors proposed an augmented neural ODE which increases the dimension of states by concatenating zeros so that complex mappings can be learned with simple flow. The most relevant work to ours concerns strategies to improve the generalization of neural ODEs. In Liu et al. (2019), the authors proposed the neural stochastic differential equation (SDE) by injecting random noise to the dynamics function and showed that the generalization and robustness of vanilla neural ODEs could be improved. However, our improvement on the neural ODEs is explored from a different perspective by introducing constraints on the flow. We empirically found that our proposal and the neural SDE can work in tandem to further boost the robustness of neural ODEs.
165
+
166
+ Robust Improvement: A straightforward way of improving the robustness of a model is to smooth the loss surface by controlling the spectral norm of the Jacobian matrix of the loss function (Sokolic´ et al., 2017). In terms of adversarial examples (Carlini & Wagner, 2017; Chen et al., 2017), researchers have proposed adversarial training strategies (Madry et al., 2017; Elsayed et al., 2018; Trame\`r et al., 2017) in which the model is fine-tuned with adversarial examples generated in realtime. However, generating adversarial examples is not computationally efficient, and there exists a trade-off between the adversarial robustness and the performance on original non-perturbed images (Yan et al., 2018; Tsipras et al., 2018). In Wang et al. (2018a), the authors model the ResNet as a transport equation, in which the adversarial vulnerability can be interpreted as the irregularity of the decision boundary. Consequently, a diffusion term is introduced to enhance the robustness of the neural nets. Besides, there are also some works that propose novel architectural defense mechanisms against adversarial examples. For example, Xie et al. (2017) utilized random resizing and random padding to destroy the specific structure of adversarial perturbations; Wang et al. (2018b) and Wang et al. (2018c) improved the robustness of neural networks by replacing the output layers with novel interpolating functions; In Xie et al. (2019), the authors designed a feature denoising filter that can remove the perturbation’s pattern from feature maps. In this work, we explore the intrinsic robustness of a specific novel architecture (neural ODE), and show that the proposed TisODE can improve the robustness of deep networks and can also work in tandem with these state-of-the-art methods Xie et al. (2017; 2019) to achieve further improvements.
167
+
168
+ # 6 CONCLUSION
169
+
170
+ In this paper, we first empirically study the robustness of neural ODEs. Our studies reveal that neural ODE-based models are superior in terms of robustness compared to CNN models. We then explore how to further boost the robustness of vanilla neural ODEs and propose the TisODE. Finally, we show that the proposed TisODE outperforms the vanilla neural ODE and also can work in conjunction with other state-of-the-art techniques to further improve the robustness of deep networks. Thus, the TisODE method is an effective drop-in module for building robust deep models.
171
+
172
+ # ACKNOWLEDGEMENT
173
+
174
+ This work is funded by a Singapore National Research Foundation (NRF) Fellowship (R-263-000- D02-281).
175
+
176
+ Jiashi Feng was partially supported by NUS IDS R-263-000-C67-646, ECRA R-263-000-C87-133, MOE Tier-II R-263-000-D17-112 and AI.SG R-263-000-D97-490
177
+
178
+ # REFERENCES
179
+
180
+ Lynton Ardizzone, Jakob Kruse, Sebastian Wirkert, Daniel Rahner, Eric W Pellegrini, Ralf S Klessen, Lena Maier-Hein, Carsten Rother, and Ullrich Ko¨the. Analyzing inverse problems with invertible neural networks. arXiv preprint arXiv:1808.04730, 2018.
181
+
182
+ 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.
183
+
184
+ Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 15–26. ACM, 2017.
185
+
186
+ Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems, pp. 6571–6583, 2018.
187
+
188
+ Earl A Coddington and Norman Levinson. Theory of ordinary differential equations. Tata McGrawHill Education, 1955.
189
+
190
+ 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.
191
+
192
+ Emilien Dupont, Arnaud Doucet, and Yee Whye Teh. Augmented neural odes. arXiv preprint arXiv:1904.01681, 2019.
193
+
194
+ Gamaleldin F Elsayed, Shreya Shankar, Brian Cheung, Nicolas Papernot, Alex Kurakin, Ian Goodfellow, and Jascha Sohl-Dickstein. Adversarial examples that fool both human and computer vision. arXiv preprint arXiv:1802.08195, 10, 2018.
195
+
196
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
197
+
198
+ Will Grathwohl, Ricky TQ Chen, Jesse Betterncourt, Ilya Sutskever, and David Duvenaud. Ffjord: Free-form continuous dynamics for scalable reversible generative models. arXiv preprint arXiv:1810.01367, 2018.
199
+
200
+ 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.
201
+
202
+ Ralph Howard. The gronwall inequality. lecture notes, 1998.
203
+
204
+ Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. arXiv preprint arXiv:1605.07648, 2016.
205
+
206
+ Yann LeCun, Le´on Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
207
+
208
+ Xuanqing Liu, Si Si, Qin Cao, Sanjiv Kumar, and Cho-Jui Hsieh. Neural sde: Stabilizing neural ode networks with stochastic noise. arXiv preprint arXiv:1906.02355, 2019.
209
+
210
+ Yiping Lu, Aoxiao Zhong, Quanzheng Li, and Bin Dong. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. arXiv preprint arXiv:1710.10121, 2017.
211
+
212
+ 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.
213
+
214
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
215
+
216
+ 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.
217
+
218
+ Lev Semenovich Pontryagin. Mathematical theory of optimal processes. Routledge, 2018.
219
+
220
+ Alessio Quaglino, Marco Gallieri, Jonathan Masci, and Jan Koutn´ık. Accelerating neural odes with spectral elements. arXiv preprint arXiv:1906.07038, 2019.
221
+
222
+ Jure Sokolic´, Raja Giryes, Guillermo Sapiro, and Miguel RD Rodrigues. Robust large margin deep neural networks. IEEE Transactions on Signal Processing, 65(16):4265–4280, 2017.
223
+
224
+ 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.
225
+
226
+ Florian Trame\`r, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017.
227
+
228
+ Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. arXiv preprint arXiv:1805.12152, 2018.
229
+
230
+ B. Wang, B. Yuan, Z. Shi, and S. Osher. ResNets Ensemble via the Feynman-Kac Formalism to Improve Natural and Robust Accuracies. arXiv e-prints, art. arXiv:1811.10745, Nov 2018a.
231
+
232
+ Bao Wang, Alex T Lin, Zuoqiang Shi, Wei Zhu, Penghang Yin, Andrea L Bertozzi, and Stanley J Osher. Adversarial defense via data dependent activation function and total variation minimization. arXiv preprint arXiv:1809.08516, 2018b.
233
+
234
+ Bao Wang, Xiyang Luo, Zhen Li, Wei Zhu, Zuoqiang Shi, and Stanley Osher. Deep neural nets with interpolating function as output activation. In Advances in Neural Information Processing Systems, pp. 743–753, 2018c.
235
+
236
+ E Weinan. A proposal on machine learning via dynamical systems. Communications in Mathematics and Statistics, 5(1):1–11, 2017.
237
+
238
+ Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. arXiv preprint arXiv:1711.01991, 2017.
239
+
240
+ Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan L Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 501–509, 2019.
241
+
242
+ Ziang Yan, Yiwen Guo, and Changshui Zhang. Deep defense: Training dnns with improved adversarial robustness. In Advances in Neural Information Processing Systems, pp. 419–428, 2018.
243
+
244
+ Laurent Younes. Shapes and diffeomorphisms, volume 171. Springer, 2010.
245
+
246
+ Xingcheng Zhang, Zhizhong Li, Chen Change Loy, and Dahua Lin. Polynet: A pursuit of structural diversity in very deep networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 718–726, 2017.
247
+
248
+ # 7 APPENDIX
249
+
250
+ 7.1 NETWORKS USED ON THE MNIST, THE SVHN, AND THE IMGNET10 DATASETS
251
+
252
+ Table 5: The architectures of the ODENets on different datasets.
253
+
254
+ <table><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>Repetition</td><td rowspan=1 colspan=1>Layer</td></tr><tr><td rowspan=1 colspan=1>FE</td><td rowspan=1 colspan=1>×1×1</td><td rowspan=1 colspan=1>Conv(1,64,3,1) +GroupNorm+ReLUConv(64,64,4,2) + GroupNorm + ReLU</td></tr><tr><td rowspan=1 colspan=1>RM</td><td rowspan=1 colspan=1>×2</td><td rowspan=1 colspan=1>Conv(64,64,3,1) + GroupNorm + ReLU</td></tr><tr><td rowspan=1 colspan=1>FCC</td><td rowspan=1 colspan=1>×1</td><td rowspan=1 colspan=1>AdaptiveAvgPool2d + Linear(64,10)</td></tr></table>
255
+
256
+ <table><tr><td rowspan=1 colspan=1>SVHN</td><td rowspan=1 colspan=1>Repetition</td><td rowspan=1 colspan=1>Layer</td></tr><tr><td rowspan=1 colspan=1>FE</td><td rowspan=1 colspan=1>×1×1</td><td rowspan=1 colspan=1>Conv(3,64,3,1) + GroupNorm+ReLUConv(64,64,4,2) + GroupNorm + ReLU</td></tr><tr><td rowspan=1 colspan=1>RM</td><td rowspan=1 colspan=1>×2</td><td rowspan=1 colspan=1>Conv(64,64,3,1) + GroupNorm + ReLU</td></tr><tr><td rowspan=1 colspan=1>FCC</td><td rowspan=1 colspan=1>×1</td><td rowspan=1 colspan=1>AdaptiveAvgPool2d + Linear(64,10)</td></tr></table>
257
+
258
+ <table><tr><td>ImgNet10</td><td>Repetition</td><td>Layer</td></tr><tr><td rowspan="4">FE</td><td>×1</td><td>Conv(3,32,5,2)+GroupNorm</td></tr><tr><td>×1</td><td>MaxPooling(2)</td></tr><tr><td>×1</td><td>BaiscBlock(32, 64,2)</td></tr><tr><td>×1</td><td>MaxPooling(2)</td></tr><tr><td>RM</td><td>×3</td><td>BaiscBlock(64,64,1)</td></tr><tr><td>FCC</td><td>×1</td><td>AdaptiveAvgPool2d + Linear(64,10)</td></tr></table>
259
+
260
+ In Table 5, the four arguments of the Conv layer represent the input channel, output channel, kernel size, and the stride. The two arguments of the Linear layer represents the input dimension and the output dimension of this fully-connected layer. In the network on the ImgNet10, the BasicBlock refers to the standard architecture in (He et al., 2016), the three arguments of the BasicBlock represent the input channel, output channel and the stride of the Conv layers inside the block. Note that we replace the BatchNorm layers in BasicBlocks as the GroupNorm to guarantee that the dynamics of each datum is independent of other data in the same mini-batch.
261
+
262
+ # 7.2 THE CONSTRUCTION OF IMGNET10 DATASET
263
+
264
+ Table 6: The corresponding indexes to each class in the original ImageNet dataset
265
+
266
+ <table><tr><td rowspan=1 colspan=1>Class</td><td rowspan=1 colspan=3>Indexing</td></tr><tr><td rowspan=1 colspan=1>dog</td><td rowspan=1 colspan=3>n02090721, n02091032, n02088094</td></tr><tr><td rowspan=1 colspan=1>bird</td><td rowspan=1 colspan=3>n01532829, n01558993, n01534433</td></tr><tr><td rowspan=1 colspan=1>car</td><td rowspan=1 colspan=3>n02814533, n03930630, n03100240</td></tr><tr><td rowspan=1 colspan=1>fish</td><td rowspan=1 colspan=1>n01484850,</td><td rowspan=1 colspan=2>n01491361, n01494475</td></tr><tr><td rowspan=1 colspan=1>monkey</td><td rowspan=1 colspan=1>n02483708,</td><td rowspan=1 colspan=2>n02484975, n02486261</td></tr><tr><td rowspan=1 colspan=1>turtle</td><td rowspan=1 colspan=1>n01664065,</td><td rowspan=1 colspan=2>n01665541, n01667114</td></tr><tr><td rowspan=1 colspan=1>lizard</td><td rowspan=1 colspan=1>n01677366,</td><td rowspan=1 colspan=1>n01682714,</td><td rowspan=1 colspan=1>n01685808</td></tr><tr><td rowspan=1 colspan=1>bridge</td><td rowspan=1 colspan=1>n03933933,</td><td rowspan=1 colspan=1>n04366367,</td><td rowspan=1 colspan=1>n04311004</td></tr><tr><td rowspan=1 colspan=1>cow</td><td rowspan=1 colspan=1>n02403003,</td><td rowspan=1 colspan=1>n02408429,</td><td rowspan=1 colspan=1>n02410509</td></tr><tr><td rowspan=1 colspan=1>crab</td><td rowspan=1 colspan=1>n01980166,</td><td rowspan=1 colspan=1>n01978455,</td><td rowspan=1 colspan=1>n01981276</td></tr></table>
267
+
268
+ # 7.3 GRONWALL’S INEQUALITY
269
+
270
+ We formally state the Gronwall’s Inequality here, following the version in (Howard, 1998).
271
+
272
+ Theorem 2. Let $U \subset \mathbb { R } ^ { d }$ be an open set. Let $f : U \times [ 0 , T ] \to \mathbb { R } ^ { d }$ be a continuous function and let $\mathbf { z } _ { 1 }$ , $\mathbf { z } _ { 2 }$ : $[ 0 , T ] \to U$ satisfy the initial value problems:
273
+
274
+ $$
275
+ \begin{array} { r l } & { \frac { \mathrm { d } { \mathbf z } _ { 1 } ( t ) } { \mathrm { d } t } = f ( { \mathbf z } _ { 1 } ( t ) , t ) , \quad { \mathbf z } _ { 1 } ( t ) = { \mathbf x } _ { 1 } } \\ & { \frac { \mathrm { d } { \mathbf z } _ { 2 } ( t ) } { \mathrm { d } t } = f ( { \mathbf z } _ { 2 } ( t ) , t ) , \quad { \mathbf z } _ { 2 } ( t ) = { \mathbf x } _ { 2 } } \end{array}
276
+ $$
277
+
278
+ Assume there is a constant $C \geq 0$ such that, for all $t \in [ 0 , T ]$ ,
279
+
280
+ $$
281
+ \| f ( \mathbf { z } _ { 2 } ( t ) , t ) - f ( \mathbf { z } _ { 1 } ( t ) , t ) ) \| \leq C \| \mathbf { z } _ { 2 } ( t ) - \mathbf { z } _ { 1 } ( t ) \|
282
+ $$
283
+
284
+ Then, for any $t \in [ 0 , T ]$ ,
285
+
286
+ $$
287
+ \begin{array} { r } { \| \mathbf { z } _ { 1 } ( t ) - \mathbf { z } _ { 2 } ( t ) \| \leq \| \mathbf { x } _ { 2 } - \mathbf { x } _ { 1 } \| \cdot e ^ { C t } . } \end{array}
288
+ $$
289
+
290
+ # 7.4 MORE EXPERIMENTAL RESULTS
291
+
292
+ # 7.4.1 COMPARISON IN THE SETTING OF ADVERSARIAL TRAINING
293
+
294
+ We implement the adversarial training of the models on the MNIST dataset, and the adversarial examples for training are generated in real-time via the FGSM method (epsilon $_ { 1 = 0 . 3 }$ ) during each epoch (Madry et al., 2017). The results of the adversarially trained models are shown in Table 7. We can observe that the neural ODE-based models are consistently more robust than CNN models. The proposed TisODE also outperforms the vanilla neural ODE.
295
+
296
+ Table 7: Classification accuracy $( \% )$ on perturbed images from MNIST. To evaluate the robustness of classifiers, we use three types of perturbations, namely zero-mean Gaussian noise with standard deviation $\sigma$ , FGSM attack and PGD attack.
297
+
298
+ <table><tr><td></td><td>Gaussian noise</td><td colspan="3">Adversarial attack</td></tr><tr><td>MNIST</td><td>σ=100</td><td>FGSM-0.3</td><td>FGSM-0.5</td><td>PGD-0.3</td></tr><tr><td>CNN</td><td>58.0</td><td>98.4</td><td>21.1</td><td>5.3</td></tr><tr><td>ODENet</td><td>84.2</td><td>99.1</td><td>36.0</td><td>12.3</td></tr><tr><td>TisODE</td><td>87.9</td><td>99.1</td><td>66.5</td><td>78.9</td></tr></table>
299
+
300
+ # 7.4.2 EXPERIMENTS ON THE CIFAR10 DATASET
301
+
302
+ We conduct experiments on CIFAR10 to compare the robustness of CNN and neural ODE-based models. We train all the models only with original non-perturbed images and evaluate the robustness of models against random Gaussian noise and FGSM adversarial attacks. The results are shown in Table 8. We can observe that the ONENet is more robust than the CNN model in terms of both the random noise and the FGSM attack. Besides, our proposal, TisODE, can improve the robustness of the vanilla neural ODE.
303
+
304
+ Table 8: Classification accuracy $( \% )$ on perturbed images from CIFAR10. To evaluate the robustness of classifiers, we use two types of perturbations, namely zero-mean Gaussian noise with standard deviation $\sigma$ and FGSM attack.
305
+
306
+ <table><tr><td></td><td colspan="2">Gaussian noise</td><td colspan="2">Adversarial attack</td></tr><tr><td>CIFAR10</td><td>σ=15</td><td>σ=20</td><td>FGSM-8/255</td><td>FGSM-10/255</td></tr><tr><td>CNN</td><td>70.2</td><td>57.6</td><td>24.3</td><td>18.4</td></tr><tr><td>ODENet</td><td>72.6</td><td>60.6</td><td>31.2</td><td>26.0</td></tr><tr><td>TisODE</td><td>74.3</td><td>62.0</td><td>33.6</td><td>26.8</td></tr></table>
307
+
308
+ Here, we control the number of parameters to be the same for all kinds of models. We use a small network, which consists of five convolutional layers and one linear layer.
309
+
310
+ Table 9: The architecture of the ODENet on CIFAR10.
311
+
312
+ <table><tr><td></td><td>Repetition</td><td>Layer</td></tr><tr><td rowspan="3">FE</td><td>×1</td><td>Conv(3,16,3,1)+GroupNorm+ReLU</td></tr><tr><td>×1</td><td>Conv(16,32,3,2) + GroupNorm+ReLU</td></tr><tr><td>×1</td><td>Conv(32,64,3,2) + GroupNorm + ReLU</td></tr><tr><td>RM</td><td>×2</td><td>Conv(64,64,3,1) + GroupNorm + ReLU</td></tr><tr><td>FCC</td><td>×1</td><td>AdaptiveAvgPool2d + Linear(64,10)</td></tr></table>
313
+
314
+ # 7.4.3 AN EXTENSION ON THE COMPARISON BETWEEN CNNS AND ODENETS
315
+
316
+ Here, we compare CNN and neural ODE-based models by controlling both the number of parameters and the number of function evaluations. We conduct experiments on the MNIST dataset, and all the models are trained only with original non-perturbed images.
317
+
318
+ For the neural ODE-based models, the time range is set from 0 to 1. We use the Euler method, and the step size is set to be 0.05. Thus the number of evaluations is $1 / 0 . 0 5 = 2 0 $ . For the CNN models (specifically ResNet), we repeatedly concatenate the residual block for 20 times, and these 20 blocks share the same weights. Our experiments show that, in this condition, the neural ODE-based models still outperform the CNN models (FGSM-0.15: $8 7 . 5 \%$ vs. $8 1 . 9 \%$ , FGSM-0.3: $5 3 . 4 \%$ vs. $4 9 . 7 \%$ , PGD-0.2: $1 1 . 8 \%$ vs. $4 . 8 \%$ ).
md/train/B1lKS2AqtX/B1lKS2AqtX.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EIDETIC 3D LSTM: A MODEL FOR VIDEO PREDICTION AND BEYOND
2
+
3
+ Yunbo Wang1∗, Lu Jiang2, Ming-Hsuan Yang2,3, Li-Jia $\mathbf { L i } ^ { 4 }$ , Mingsheng Long1, Li Fei-Fei4 1Tsinghua University, 2Google AI, 3University of California, Merced, 4Stanford University
4
+
5
+ # ABSTRACT
6
+
7
+ Spatiotemporal predictive learning, though long considered to be a promising selfsupervised feature learning method, seldom shows its effectiveness beyond future video prediction. The reason is that it is difficult to learn good representations for both short-term frame dependency and long-term high-level relations. We present a new model, Eidetic 3D LSTM (E3D-LSTM), that integrates 3D convolutions into RNNs. The encapsulated 3D-Conv makes local perceptrons of RNNs motion-aware and enables the memory cell to store better short-term features. For long-term relations, we make the present memory state interact with its historical records via a gate-controlled self-attention module. We describe this memory transition mechanism eidetic as it is able to effectively recall the stored memories across multiple time stamps even after long periods of disturbance. We first evaluate the E3D-LSTM network on widely-used future video prediction datasets and achieve the state-of-the-art performance. Then we show that the E3D-LSTM network also performs well on the early activity recognition to infer what is happening or what will happen after observing only limited frames of video. This task aligns well with video prediction in modeling action intentions and tendency.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A fundamental problem in spatiotemporal predictive learning is how to effectively learn good representations for video inference or reasoning. Currently, recurrent neural networks (RNNs) remain to be the most promising models in this field, and have achieved state-of-the-art results on a number of future video prediction benchmarks (Wang et al., 2018b; Oliu et al., 2018). However, beyond frames prediction, RNN based models are less effective in learning high-level video representations or capturing long-term relations. On the other hand, recent studies demonstrate that 3D Convolutional Neural networks (3D-CNNs) surpass RNNs in learning better representations for action classification (Carreira & Zisserman, 2017; Tran et al., 2015). For instance, variants of 3D-CNNs, such as Inflated 3D-CNNs, have significantly increased action classification accuracy over the UCF 101 and Kinetics datasets. These 3D-CNN architectures have no recurrent structures but instead employ 3D convolution (3D-Conv) and 3D pooling operations to preserve temporal information of the input sequences which would be otherwise discarded in classical 2D convolution operations.
12
+
13
+ Motivated by the recent success of 3D-CNNs, in this paper we propose a new model for spatiotemporal predictive learning based on both recurrent modeling (for temporal dependency) and feedforward 3D-Conv modeling (for local dynamics). A plausible approach, of course, is to simply stack 3D-Convs and each RNN unit in a feed-forward way using 3D-Convs for either perceiving fine-grained features from raw videos or combining high-level representations. However, as shown in our experiments, these straightforward extensions may not outperform the baseline RNN model. We attribute these findings to that RNNs and 3D-CNNs represent two very different mechanisms for the same purpose of spatiotemporal modeling, and connecting them directly fails to exploit their complementary advantages. Therefore, it remains challenging and requires principled approaches to design an effective spatiotemporal network.
14
+
15
+ To this end, we propose a new model called Eidetic 3D LSTM (E3D-LSTM) for spatiotemporal predictive learning. We introduce an eidetic 3D memory to: a) memorize local appearance and motion in a short spatiotemporal volume, and b) recall the long-range historical context by learning to attend to previous memory states. Regarding the short-term dependency, in many cases, spatiotemporal predictive modeling mainly depends on temporally nearby appearances and on-going short-term motions. All the information is encapsulated into the eidetic 3D memory cell with a short time convolution window, and used in recurrent transitions. Our experimental results show that integrating 3D-Conv deep into RNNs is effective for modeling local representations in a consecutive manner. On the other hand, for long-term interactions, which is important for predicting non-stationary or periodical videos as well as learning high-level video representations, we exploit a self-attention mechanism controlled by revised recurrent gates to recall temporally distant memory. The current memory state of E3D-LSTM is learned to attend to all previous relevant moments. Our experimental results verify that this attention mechanism is beneficial for long-term memorization. We describe this memory transition mechanism eidetic as it is able to effectively recall the stored memories across multiple time stamps even after long periods of disturbance.
16
+
17
+ To the best of our knowledge, the proposed E3D-LSTM model is among the first approaches that leverage 3D-Conv in RNNs. We empirically validate it on standard spatiotemporal predictive tasks and an early activity recognition task over four benchmarks: a) on future video prediction, it achieves the best-published accuracy on three classical benchmarks; b) on early activity recognition, it outperforms the state-of-the-art action recognition methods. In addition, we show that self-supervised learning can further improve the performance of early activity recognition. We present ablation studies to verify the effectiveness of all modules in the proposed E3D-LSTM model.
18
+
19
+ # 2 RELATED WORK AND PROBLEM CONTEXT
20
+
21
+ Spatiotemporal Predictive Learning Models. In recent years, RNNs have been extensively used in sequence prediction and future frame prediction. Srivastava et al. (2015) extended the LSTMbased sequence to sequence model (Sutskever et al., 2014) for language modeling to learning video representations. Shi et al. (2015) proposed the convolutional LSTM by integrating convolutions into recurrent state transitions for high-dimensional sequence prediction. The convolutional LSTM model is extended by Finn et al. (2016) to predict future states of robotic environments. Villegas et al. (2017) leveraged optical flow to help capture short-term video dynamics for video prediction. Xu et al. (2018) proposed a two-stream RNN that deals with structural video content in separate streams. Kalchbrenner et al. (2017) introduced a sophisticated model that extends recurrent structures to estimate local dependencies between adjacent pixels. While this video pixel network (VPN) model is able to describe image sequences, the computational load is prohibitively high.
22
+
23
+ The above-mentioned recurrent models predict future frame mainly based on sequentially updated memory states. When the memory cell is refreshed, older memories will be discarded immediately. In contrast, the proposed E3D-LSTM model maintains a list of historical memory records and revokes them when necessary, thereby facilitating long-range video reasoning. While in spirit this idea is similar to the self-attention module in feed-forward networks (Vaswani et al., 2017; Wang et al., 2018a), we exploit it to correlate long-term and short-term video representations in this work.
24
+
25
+ Another significant difference between the above-mentioned prior work and the proposed model is that we use 3D-Convs as basic operations inside the E3D-LSTM instead of fully-connected or 2D convolution operations. We show using 3D-Convs to model recurrent state-to-state transitions can significantly improve prediction performance. This idea is motivated by recent advances in video classification (a high-level representation learning task) (Ji et al., 2013; Tran et al., 2015; Carreira & Zisserman, 2017). We note that Vondrick et al. (2016) and Tulyakov et al. (2018) also introduced 3D-CNNs for spatiotemporal predictive learning. However, these networks are feed-forward and do not capture temporal consistency effectively.
26
+
27
+ Future prediction errors of an imperfect model can be categorized by two factors: a) the “systematic errors” caused by a lack of modeling ability to the deterministic variations; b) the stochastic, inherent uncertainty of the future. We aim to minimize the first factor in this work. For the second factor, numerous methods have applied adversarial training or variational auto-encoders to video prediction, for example (Mathieu et al., 2016; Vondrick et al., 2016; Denton & Fergus, 2018; Bhattacharjee & Das, 2017; Tulyakov et al., 2018; Lu et al., 2017; Wichers et al., 2018).
28
+
29
+ Convolutional Recurrent Networks. Our model is closely related to convolutional recurrent networks. In the ConvLSTM network (Shi et al., 2015), all state transitions are implemented with 2D convolutions. As such, the transition function is no longer permutation invariant and able to better perceive relations in a spatiotemporal neighborhood. The spatiotemporal LSTM (ST-LSTM) is characterized by delivering two memory states separately (Wang et al., 2017): memory $\mathcal { M }$ in a zigzag direction and memory $\mathcal { C }$ being passed horizontally (see Appendix A for details). In this model, $\mathcal { M }$ provides greater capability to model short-term motions, and $\mathcal { C }$ is adopted from fully-connected LSTMs (Hochreiter & Schmidhuber, 1997) to ease the vanishing gradient problem. Although the ST-LSTM performs well on video prediction benchmarks, it does not capture long-term video relations effectively. The forget gates of memory $\mathcal { C }$ tend to respond strongly to short-term features, thereby easily falling into a saturated zone (with values between 0 and 0.1) and interrupting longrange information flows. We adopt the zigzag updating route of memory $\mathcal { M }$ from the ST-LSTM, while improving the forgetting mechanism in updating the temporal memory $\mathcal { C }$ . We also increase the dimensions of memory states and take 3D-Convs as the basic operators for state transitions.
30
+
31
+ ![](images/299a5e3b87a1b0eb569a94f56cb3cd52fca6f4a79109947cd0b9f83db0b77962.jpg)
32
+ Figure 1: Three approaches to integrate 3D-Convs into recurrent networks. Blue arrows indicate data transition paths with 3D-Convs (for feed-forward features or recurrent hidden states). The diagrams are simplified for illustration, with fewer layers and RNN states than what are actually used in our experiments. The classifiers are removed when being trained for future video prediction.
33
+
34
+ # 3 EIDETIC 3D LSTM
35
+
36
+ This section first presents the Eidetic 3D LSTM for perceiving and memorizing both short-term and long-term representations in videos. We then discuss a scheduled multi-task learning strategy that uses predictive learning as an auxiliary self-supervised task for activity recognition.
37
+
38
+ # 3.1 3D CONVOLUTIONS IN RECURRENT NETWORK
39
+
40
+ An ideal predictive model relies on effective learning of video representations. RNNs and 3D-CNNs are network architectures of different mechanisms for modeling spatiotemporal data. In this work, we aim to leverage the strength of each one in a unified architecture and start the discussion with two plausible extensions of stacking 3D-Convs and RNN units. Figure 1(a) and 1(b) illustrate two hybrid baseline networks which add 3D-CNNs before or after stacked spatiotemporal LSTMs.
41
+
42
+ However, we find that integrating the 3D-Convs outside the LSTM unit performs noticeably worse than the baseline RNN model. To this end, we propose a “deeper” integration of 3D-Convs inside the LSTM unit in order to incorporate the convolutional features into the recurrent state transition over time. Figure 1(c) shows the overall encoder-decoder architecture. In this model, a consecutive of $T$ input frames are first encoded by a few layers of 3D-Convs to obtain high-dimension feature maps. The 3D-Conv feature maps are directly fed into a novel E3D-LSTM to model the longterm spatiotemporal interaction. Finally, the E3D-LSTM hidden states are decoded by a number of stacked 3D-Conv layers to get the predicted video frames. For classification tasks, the hidden states can be directly used as the learned video representation.
43
+
44
+ # 3.2 EIDETIC MEMORY TRANSITION
45
+
46
+ The architecture of the proposed Eidetic 3D LSTM is illustrated in Figure 2, where the red arrows indicate short-term information flow and the blue arrows denote long-term information flow. There are 4 inputs: $\mathcal { X } _ { t }$ , the 3D-Conv feature maps from encoders or hidden states from the previous E3D
47
+
48
+ ![](images/924cf68bdd48840e3b363ec3c0c9bc6abeab5aaa00eac072e9b283bd4a42e9c3.jpg)
49
+ Figure 2: Comparison of (a) the standard memory transition approach in the Spatiotemporal LSTM and (b) the attentive memory transition approach in the Eidetic 3D LSTM. Red arrows indicate the short-term information flow. Blue arrows are the attentive memory flow, which potentially enables our model to capture the long-term relations. Cubes denote higher-dimensional hidden states and memory states. Cylinders denote higher-dimensional gates. $\odot$ is the Hadamard product. $\otimes$ is the matrix product after reshaping matrices into appropriate 2-dimensional forms.
50
+
51
+ LSTM layer; $\mathcal { H } _ { t - 1 } ^ { k }$ , the hidden states from previous time stamp; $\mathcal { C } _ { t - 1 } ^ { k }$ , the memory states from previous time stamp; and $\mathcal { M } _ { t } ^ { k - 1 }$ , the previous spatiotemporal memory states described earlier.
52
+
53
+ We use recurrent 3D-Convs as motion-aware perceptrons to extract short-term appearance and local motions in continuous space-time fields and store them in a small spatiotemporal volume. As such, video appearance and short-term motions can be encoded in $\mathbb { R } ^ { T \times \mathbf { \dot { H } } \times W \times C }$ tensors, in which each dimension indicates temporal depth, spatial size, and the number of feature map channels, respectively. By inflating the memory state along the time dimension, we found that the proposed E3D-LSTM becomes more capable of characterizing and memorizing local or short-term motions.
54
+
55
+ To capture the long-term frame interactions, we improve the recurrent transition function of the memory states by proposing a new memory RECALL mechanism:
56
+
57
+ $$
58
+ \begin{array} { r l } & { \mathcal { R } _ { t } = \sigma \big ( W _ { x r } * \mathcal { X } _ { t } + W _ { h r } * \mathcal { H } _ { t - 1 } ^ { k } + b _ { r } \big ) } \\ & { \mathcal { Z } _ { t } = \sigma \big ( W _ { x i } * \mathcal { X } _ { t } + W _ { h i } * \mathcal { H } _ { t - 1 } ^ { k } + b _ { i } \big ) } \\ & { \mathcal { G } _ { t } = \mathrm { t a n h } \big ( W _ { x g } * \mathcal { X } _ { t } + W _ { h g } * \mathcal { H } _ { t - 1 } ^ { k } + b _ { g } \big ) } \\ & { \mathrm { R E C A L L } \big ( \mathcal { R } _ { t } , \mathcal { C } _ { t - \tau : t - 1 } ^ { k } \big ) = \mathrm { s o f t m a x } \big ( \mathcal { R } _ { t } \cdot \big ( \mathcal { C } _ { t - \tau : t - 1 } ^ { k } \big ) ^ { \sf T } \big ) \cdot \mathcal { C } _ { t - \tau : t - 1 } ^ { k } } \\ & { \mathcal { C } _ { t } ^ { k } = \mathcal { T } _ { t } \odot \mathcal { G } _ { t } + \mathrm { L a y e r N o r m } ( \mathcal { C } _ { t - 1 } ^ { k } + \mathrm { R E C A L L } \big ( \mathcal { R } _ { t } , \mathcal { C } _ { t - \tau : t - 1 } ^ { k } \big ) \big ) , } \end{array}
59
+ $$
60
+
61
+ where $\sigma$ is the sigmoid function, $^ *$ is the 3D-Conv operation, $\odot$ is the Hadamard product, · is the matrix product after reshaping the recall gate $\mathcal { R } _ { t }$ and memory states $ { \mathcal { C } } _ { t - \tau : t - 1 } ^ { k }$ into $\mathbb { R } ^ { T H W \times C }$ and $\mathbb { R } ^ { \tau T H W \times C }$ matrices, respectively, and $\tau$ is the number of memory states that are concatenated along the temporal dimension. Three terms are involved in computing $\mathcal { C } _ { t } ^ { k }$ . The first one $\mathcal { T } _ { t } \odot \mathcal { G } _ { t }$ encodes local video appearance and motions, where $\mathcal { T } _ { t }$ is the input gate and $\mathcal { G } _ { t }$ is the input modulation gate like standard LSTMs. The second one $\mathcal { C } _ { t - 1 } ^ { k }$ can be viewed as a short-cut connection from the previous memory state, which captures short-term changes between adjacent time stamps. In this process, the accessible memory field is fixed and limited. Therefore, we introduce the third term of memory transition function, modeling long-term video relations according to local motion and appearance (as encoded in $\mathcal { X } _ { t }$ and $\mathcal { H } _ { t - 1 } ^ { k }$ ). The RECALL function is implemented as an attentive module to compute the relationship between the encoded local patterns and the whole memory space. A set of parameterized gates $\mathcal { R } _ { t }$ , acting as memory access instructions, control where and what to attend in historical memory records. These two terms are respectively designed for shortterm and long-term video modeling. We integrate them in a unified network by applying layer normalization (Ba et al., 2016) to their element-wise sum, in order to mitigate the covariant shift and stabilize the training process, as it has been commonly used in RNNs. The hyper-parameter $\tau$ in $\mathcal { C } _ { t - \tau : t - 1 } ^ { k }$ decides how many historical memory states are attended by the recall gate $\mathcal { R } _ { t }$ . To involve more long-term relations, in most experiments, we take as the inputs of the RECALL function and do not fix $\tau$ . Whereas in particular, we enable online recognition by setting $\tau$ to 5.
62
+
63
+ Unlike the conventional memory transition function, the RECALL function learns the size of temporal interactions. For longer sequences, this allows attending to distant states containing salient information. Our work is partially motivated by self-attention mechanisms (Lin et al., 2017; Vaswani et al., 2017). However, in our model, the attention mechanism is not applied over the output states but during the memory transitions. It is used to evoke past memories from distant time stamps for memorizing and distilling useful information from what has been perceived. We show that learning attention over previous memory states is beneficial in recalling the long-range historical context. The memory tensor $\mathcal { C } _ { t } ^ { k }$ is named eidetic $3 D$ memory and the entire unit is called E3D-LSTM. We also exploit the same RECALL method to correlate $\dot { \mathcal { M } } _ { t } ^ { 1 : k }$ along the vertical memory transition flow, but it turns out to be less helpful. With the updated memory state $\mathcal { C } _ { t } ^ { k }$ , the output hidden states are:
64
+
65
+ $$
66
+ \begin{array} { r l } & { \mathcal { Z } _ { t } ^ { \prime } = \sigma ( W _ { x t } ^ { \prime } \ast \mathcal { X } _ { t } + W _ { m i } \ast \mathcal { M } _ { t } ^ { k - 1 } + b _ { i } ^ { \prime } ) } \\ & { \mathcal { G } _ { t } ^ { \prime } = \operatorname { t a n h } ( W _ { x g } ^ { \prime } \ast \mathcal { X } _ { t } + W _ { m g } \ast \mathcal { M } _ { t } ^ { k - 1 } + b _ { g } ^ { \prime } ) } \\ & { \mathcal { F } _ { t } ^ { \prime } = \sigma ( W _ { x f } ^ { \prime } \ast \mathcal { X } _ { t } + W _ { m f } \ast \mathcal { M } _ { t } ^ { k - 1 } + b _ { f } ^ { \prime } ) } \\ & { \mathcal { M } _ { t } ^ { k } = \mathcal { Z } _ { t } ^ { \prime } \odot \mathcal { G } _ { t } ^ { \prime } + \mathcal { F } _ { t } ^ { \prime } \odot \mathcal { M } _ { t } ^ { k - 1 } } \\ & { \mathcal { O } _ { t } = \sigma ( W _ { x o } \ast \mathcal { X } _ { t } + W _ { h o } \ast \mathcal { H } _ { t - 1 } ^ { k } + W _ { c o } \ast \mathcal { C } _ { t } ^ { k } + W _ { m o } \ast \mathcal { M } _ { t } ^ { k } + b _ { o } ) } \\ & { \mathcal { H } _ { t } ^ { k } = \mathcal { O } _ { t } \odot \operatorname { t a n h } ( W _ { 1 \times 1 \times 1 } \ast [ \mathcal { C } _ { t } ^ { k } , \mathcal { M } _ { t } ^ { k } ] ) , } \end{array}
67
+ $$
68
+
69
+ where $W _ { 1 \times 1 \times 1 }$ is the $1 \times 1 \times 1$ convolutions for the transformation of the channel number. $\mathcal { T } _ { t } ^ { \prime } , \mathcal { G } _ { t } ^ { \prime }$ , and $\mathcal { F } _ { t } ^ { \prime }$ are gate structures of the spatiotemporal memory. ${ \mathcal { O } } _ { t }$ is the output gate.
70
+
71
+ # 3.3 SELF-SUPERVISED AUXILIARY LEARNING
72
+
73
+ For many supervised tasks such as video action recognition, there are often not enough supervisions or annotations over time for training a satisfactory RNN. As an auxiliary measure to this problem, future video prediction is considered as a promising representation learning approach that is more densely supervised over time and might extract useful features to assist video understanding.
74
+
75
+ We consider two tasks: the pixel-level future frames prediction and another video-level classification task (early activity recognition in our case). For frames prediction, the objective function is:
76
+
77
+ $$
78
+ \mathcal { L } _ { \mathrm { p r e d i c t i o n } } = \left. \mathcal { X } - \widehat { \mathcal { X } } \right. _ { F } ^ { 2 } + \left. \mathcal { X } - \widehat { \mathcal { X } } \right. _ { 1 } ,
79
+ $$
80
+
81
+ where $\widehat { \mathcal X }$ and $\mathcal { X }$ are respectively predicted and ground truth future frames. $\| \cdot \| _ { F }$ is the Frobenius norm. For early activity recognition, we make the models for these two tasks share the same network backbone in the end-to-end training using a multi-task learning objective:
82
+
83
+ $$
84
+ \mathcal { L } _ { \mathrm { r e c o g n i t i o n } } = \lambda \| \mathcal { X } - \widehat { \mathcal { X } } \| _ { F } ^ { 2 } + \mathcal { L } _ { \mathrm { c e } } ( \mathcal { Y } , \widehat { \mathcal { Y } } ) ,
85
+ $$
86
+
87
+ where $\widehat { \mathcal { V } }$ and $\mathcal { V }$ are high-level predictions and corresponding ground truth classes. $\mathcal { L } _ { \mathrm { c e } }$ is the crossentropy loss for classification, and $\lambda$ is the weight factor.
88
+
89
+ Although improving both tasks requires proper long short-term contextual representations, there is no guarantee that features learned with pixel-level supervisions will fully align with any highlevel objectives. We thus introduce a scheduled learning strategy where the objective function is gradually inclined from one task to the other in a curriculum learning manner (Bengio et al., 2009). Specifically, we apply a linear decay to $\lambda$ over the number of iterations $i$ :
90
+
91
+ $$
92
+ \lambda ( i ) = \operatorname* { m a x } ( \eta , \lambda ( 0 ) - \epsilon \cdot i ) ,
93
+ $$
94
+
95
+ where $\lambda ( 0 )$ and $\eta$ are respectively maximum and minimum values of $\lambda ( i )$ , $\epsilon$ controls the decreasing speed of the role of the auxiliary task. We call this approach the Self-supervised Auxiliary Learning.
96
+
97
+ # 4 EXPERIMENTS
98
+
99
+ We evaluate the proposed E3D-LSTM model on two tasks: future video prediction and early activity recognition. These two tasks are of great importance with numerous applications that require effective spatiotemporal predictive models. We demonstrate that the E3D-LSTM model performs favorably against the state-of-the-art models on four challenging datasets. The source code and trained models will be made available to the public.
100
+
101
+ ![](images/75fe0e2cd497e4e80eecc0ec9f0adce2a5a55b83ce417f48d788ca7b2d8cfb24.jpg)
102
+ Figure 3: Video prediction examples on the Moving MNIST dataset.
103
+
104
+ Table 1: Results on the Moving MNIST dataset. All models, except DFN and VPN, are trained with a comparable number of parameters. Higher SSIM or lower MSE scores indicate better results.
105
+
106
+ <table><tr><td rowspan="2">MODEL</td><td colspan="2">10→10</td><td colspan="2">COPY</td></tr><tr><td>SSIM</td><td>MSE</td><td>SSIM</td><td>MSE</td></tr><tr><td>CONVLSTM (SHI ET AL., 2015)</td><td>0.713</td><td>96.5</td><td>0.539</td><td>143.2</td></tr><tr><td>DFN (DE BRABANDERE ET AL., 2016)</td><td>0.726</td><td>89.0</td><td>0.598</td><td>153.9</td></tr><tr><td>CDNA (FINN ET AL., 2016)</td><td>0.728</td><td>84.2</td><td>0.671</td><td>127.1</td></tr><tr><td>FRNN (OLIU ET AL., 2018)</td><td>0.819</td><td>68.4</td><td>0.694</td><td>110.5</td></tr><tr><td>VPN BASELINE (KALCHBRENNER ET AL., 2017)</td><td>0.870</td><td>64.1</td><td>0.736</td><td>78.0</td></tr><tr><td>PREDRNN(WANG ET AL., 2017)</td><td>0.869</td><td>56.5</td><td>0.745</td><td>80.3</td></tr><tr><td>PREDRNN++(WANG ET AL.,2018B)</td><td>0.885</td><td>46.3</td><td>0.807</td><td>69.9</td></tr><tr><td>E3D-LSTM</td><td>0.910</td><td>41.3</td><td>0.852</td><td>56.8</td></tr></table>
107
+
108
+ # 4.1 FUTURE VIDEO PREDICTION: MOVING MNIST
109
+
110
+ We first evaluate the E3D-LSTM model against the state-of-the-art video prediction models on a commonly used synthetic benchmark dataset with moving digits. All experiments are conducted using TensorFlow (Abadi et al., 2016) and trained with the ADAM optimizer (Kingma & Ba, 2015) to minimize the $l _ { 1 } + l _ { 2 }$ loss over every pixel in the frame. For fair comparisons, we ensure all models to have comparable numbers of parameters, and apply the same scheduled sampling strategy (Bengio et al., 2015) in order to reduce the difficulty of training recurrent models.
111
+
112
+ Dataset and Setup. The moving MNIST dataset is constructed by randomly sampling two digits from the original MNIST dataset and making them float and bounce at boundaries with a constant velocity and angle inside a black canvas of $6 4 \times 6 4$ pixels. The whole dataset has a fixed number of entries, 10, 000 sequences for training, $3 , 0 0 0$ for validation and 5, 000 for test.
113
+
114
+ We stack 4 E3D-LSTMs in the architecture illustrated in Figure 1(c), leaving out 3D-CNN encoders for this task. To retain the shape of hidden states over time, the integrated 3D-Conv operators are composed of a $2 \times 5 \times 5$ (time $\times$ height $\times$ width) convolutions and a corresponding transposed convolution with the same filter size. The number of hidden state channels of each E3D-LSTM is 64. The temporal stride is set to 1 and there is one overlapping frame over consecutive time stamps. A single 3D-Conv layer is used as the decoder to map motion-aware hidden states to output frames.
115
+
116
+ The E3D-LSTM model is evaluated against the state-of-the-art methods including the ConvLSTM network (Shi et al., 2015), DFN (De Brabandere et al., 2016), CDNA (Finn et al., 2016), VPN baseline model with CNN decoders (Kalchbrenner et al., 2017), PredRNN (Wang et al., 2017), PredRNN $^ { + + }$ (Wang et al., 2018b) and FRNN (Oliu et al., 2018).
117
+
118
+ Main Results. Table 1 shows the performance of the evaluated models using a common setting in the literature: generating 10 future frames given the previous 10 observations (denoted as $1 0 1 0$ ). We use the per-frame structural similarity index measure (SSIM) (Wang et al., 2004) and per-frame mean squared error (MSE) for evaluation. The SSIM ranges between $- 1$ and 1, representing the similarity between the generated image and the ground truth. As shown in the second column $1 0 1 0$ ) of Table 1, our model performs well against the state-of-the-art methods in both metrics. The results show that the E3D-LSTM network is effective in modeling spatiotemporal data for video prediction. Figure 3(a) shows the qualitative comparisons in which our model predicts future frames from entangled digits better than other methods.
119
+
120
+ Table 2: Ablation study on the Moving MNIST dataset $( 1 0 1 0 )$ ).
121
+
122
+ <table><tr><td>MODEL</td><td>SSIM</td><td>MSE</td></tr><tr><td>BASELINE 1: 3D-CNN AT BOTTOM (FIGURE 1(A))</td><td>0.859</td><td>50.6</td></tr><tr><td>BASELINE 2: 3D-CNN ON TOP(FIGURE 1(B))</td><td>0.862</td><td>53.4</td></tr><tr><td>BASELINE 3: :OURS (W/O 3D CONVOLUTIONS)</td><td>0.894</td><td>44.2</td></tr><tr><td>BASELINE 4: OURS (W/O MEMORY ATTENTION)</td><td>0.880</td><td>45.7</td></tr><tr><td>E3D-LSTM</td><td>0.910</td><td>41.3</td></tr></table>
123
+
124
+ Copy Test. We evaluate the proposed model using the Copy Test setting where the task is to memorize useful information in a longer input sequence when the recurrent disturbance is present. The input clip consists of three sub-sequences, as illustrated in Figure 3(b). Seq 1 and Seq 2 are completely irrelevant, and ahead of them, another sub-sequence called prior context is given as the input, which is exactly the same as Seq 2. Frames marked by black arrows are inputs and those marked by red arrows are expected outputs. There are two training objective: a) to predict 10 future frames of Seq 1; and b) to predict 10 future frames of Seq 2. At the test time, we only evaluate the prediction result of Seq 2. The copy test evaluates the modeling capability of long-range video frame relations. A well-designed model should make precise predictions regarding Seq 2, as it has seen all frames of this sequence before. However, this task is difficult for previous LSTM networks. Because Seq 1 is completely irrelevant, the attempt of making predictions of Seq 1 can erase its memory of Seq 2.
125
+
126
+ The results are presented in the third column (Copy) of Table 1. All baseline models suffer from the influence brought by irrelevant frames in Seq 2 and tend to gradually forget the salient information in the prior context. However, thanks to the eidetic 3D memory, our E3D-LSTM model captures the long-term video frame interactions and performs well in both metrics. A careful inspection of the attention weight shows that the E3D-LSTM model can better attend to useful historical representations across multiple time stamps. The copy test suggests that the E3D-LSTM network is capable of modeling long-range periodical motions effectively.
127
+
128
+ Ablation Study. We conduct a series of ablation studies and summarize the results in Table 2. First, on the first two rows, we show two alternative 3D-LSTM models with 3D-Convs outside the recurrent unit, including 3D-CNN at Bottom (Figure 1(a)) and 3D-CNN on Top (Figure 1(b)). The performance drop validates the integration of 3D-Convs and RNN units via the eidetic 3D memory. Second, the third baseline method is a special case where all 3D convolutional filters in our model are reduced to 2D. The results demonstrate the effect of capturing local spatiotemporal patterns by the 3D memory within an individual recurrent state. Furthermore, the contribution of the memory attention mechanism can be isolated in the fourth baseline method. Note that all evaluated models are trained with a similar number of parameters for fair comparisons, and the performance gain comes from design options rather than increased model parameters.
129
+
130
+ # 4.2 FUTURE VIDEO PREDICTION: KTH ACTION
131
+
132
+ We evaluate the proposed E3D-LSTM model on video prediction of real-world datasets.
133
+
134
+ Dataset and Setup. The KTH action dataset (Schuldt et al., 2004) contains 25 individuals performing 6 types of actions, including walking, jogging, running, boxing, hand waving and hand clapping. On average, each video clip lasts 4 seconds. We follow the experimental setup in (Villegas et al., 2017) by using person 1-16 for training and 17-25 for testing. Each frame is resized to $1 2 8 \times 1 2 8$ pixels. We employ the same E3D-LSTM network architecture detailed in Section 4.1. Models are trained to predict next 10 frames from the previous 10 observations. The prediction horizon at the test time is extended to 20 or 40 time stamps.
135
+
136
+ Results. Table 3 shows quantitative results of the proposed model and state-of-the-art methods. Same as prior work, we use SSIM and PSNR as metrics. Consistent with the observations on the moving MNIST dataset, the E3D-LSTM model performs favorably against the state-of-the-art methods across three settings of predicting future 10 frames, 20 frames, and copy test. These empirical results demonstrate the effectiveness of the E3D-LSTM model for modeling spatiotemporal data.
137
+
138
+ Figure 4 compares representative generated frames. We select video sequences with relatively complicated spatiotemporal variations (in both moving trajectories and human figure sizes). In the top half (predicting the next 40 frames based on 10 previous frames), E3D-LSTM predicts more accurate motion trajectories into the future, whereas $\mathrm { P r e d R N N + + }$ and ConvLSTM incorrectly predict the person moving out of the scenes. The lower half shows the copy test providing the expected outputs as prior inputs. We directly apply models, which are trained under the first setting, to this test. Without the prior context, it would be difficult to predict human motions for some cases. With prior inputs, E3D-LSTM benefits the most from its memories and responds well to rapid appearance change. In contrast, PredR $\mathrm { N N } { + } { + }$ and ConvLSTM are not able to capture useful spatiotemporal patterns from distant observations due to the lack of modeling long-term data relations.
139
+
140
+ ![](images/98c7186a972f6792a079875d57cc48e443d0a0c3c46eb79688381a3a07a6d3dc.jpg)
141
+ Figure 4: Comparisons of the generated frames on KTH. (Top) predictions of next 40 frames based on 10 previous observations. (Bottom) the copy test that requires to reproducing prior inputs.
142
+
143
+ Table 3: Quantitative evaluation of different methods on the KTH human action test set. The metrics are averaged over the predicted frames. Higher scores indicate better prediction results.
144
+
145
+ <table><tr><td rowspan="2">MODEL</td><td colspan="2">10→20</td><td colspan="2">10→40</td><td colspan="2">COPY(→40)</td></tr><tr><td>PSNR</td><td>SSIM</td><td>PSNR</td><td>SSIM</td><td>PSNR</td><td>SSIM</td></tr><tr><td>CONVLSTM(SHI ET AL.,2015)</td><td>23.58</td><td>0.712</td><td>22.85</td><td>0.639</td><td>23.49</td><td>0.670</td></tr><tr><td>DFN (DE BRABANDERE ET AL., 2016)</td><td>27.26</td><td>0.794</td><td>23.01</td><td>0.652</td><td>23.37</td><td>0.664</td></tr><tr><td>MCNET(VILLEGAS ET AL.,2017)</td><td>25.95</td><td>0.804</td><td>-</td><td>-</td><td>-</td><td>1</td></tr><tr><td>FRNN(OLIU ET AL., 2018)</td><td>26.12</td><td>0.771</td><td>23.77</td><td>0.678</td><td>24.00</td><td>0.685</td></tr><tr><td>PREDRNN(WANG ET AL., 2017)</td><td>27.55</td><td>0.839</td><td>24.16</td><td>0.703</td><td>24.45</td><td>0.711</td></tr><tr><td>PREDRNN++(WANG ET AL., 2018B)</td><td>28.47</td><td>0.865</td><td>25.21</td><td>0.741</td><td>25.90</td><td>0.759</td></tr><tr><td>E3D-LSTM</td><td>29.31</td><td>0.879</td><td>27.24</td><td>0.810</td><td>30.59</td><td>0.874</td></tr></table>
146
+
147
+ # 4.3 A REAL VIDEO PREDICTION APPLICATION: TRAFFIC FLOW PREDICTION
148
+
149
+ We further evaluate our method on the TaxiBJ dataset, which contains real-world traffic flow data in consecutive heat maps. Predicting urban traffic conditions is a complex setting, as the heat maps are very noisy and we do not have any underlying or additional information that can facilitate this task.
150
+
151
+ Table 4: Experimental results on the TaxiBJ dataset. We report MSE at every time stamp.
152
+
153
+ <table><tr><td>MODEL</td><td>FRAME1</td><td>FRAME 2</td><td>FRAME 3</td><td>FRAME 4</td></tr><tr><td>ST-RESNET (ZHANG ET AL., 2017)</td><td>0.688</td><td>0.939</td><td>1.130</td><td>1.288</td></tr><tr><td>VPN(KALCHBRENNER ET AL., 2017)</td><td>0.744</td><td>1.031</td><td>1.251</td><td>1.444</td></tr><tr><td>FRNN(OLIU ET AL., 2018)</td><td>0.682</td><td>0.823</td><td>0.989</td><td>1.183</td></tr><tr><td>PREDRNN(WANG ET AL.,2017)</td><td>0.634</td><td>0.934</td><td>1.047</td><td>1.263</td></tr><tr><td>PREDRNN++(WANG ET AL., 2018B)</td><td>0.641</td><td>0.855</td><td>0.979</td><td>1.158</td></tr><tr><td>E3D-LSTM</td><td>0.620</td><td>0.773</td><td>0.888</td><td>0.984</td></tr></table>
154
+
155
+ Dataset and Setup. The TaxiBJ dataset is collected from the chaotic real-world environment using GPS monitors of taxicabs Beijing. Each frame is a $3 2 \times 3 2 \times 2$ heat map. The last dimension denotes the entering and leaving traffic flow intensities at the same area. We split the whole dataset into a training set and a test set as described in (Zhang et al., 2017). We train the networks to predict 4 frames (the next 2 hours) from 4 observations. We use the same network architecture and training setups as the one on Moving MNIST and KTH datasets.
156
+
157
+ ![](images/1d1f26e3ee7b1adcf8951a828d333cd1d19a35b5578e98204d3503dab5694b12.jpg)
158
+ Figure 5: Prediction results on the TaxiBJ traffic flow dataset. For ease of comparison, we visualize the differences between the generated heat maps and their corresponding ground truth heat maps.
159
+
160
+ Results. We report MSE at every time stamp in Table 4 where lower scores indicate better prediction results. We also show a prediction example in Figure 5. Furthermore, we visualize the differences between the generated heat maps and the ground truth heat maps. Overall, the E3D-LSTM model outperforms the other methods, with the lowest differences intensities in most areas.
161
+
162
+ # 4.4 EARLY ACTIVITY RECOGNITION: SOMETHING-SOMETHING
163
+
164
+ To validate that the E3D-LSTM model can learn high-level video representations effectively, we carry out experiments on early activity recognition. The task is to predict an activity category in a video after only observing a fraction of frames. We choose not to evaluate on the full-length video for the activity recognition task, because when a model sees the full-length video, it may make decisions solely based on the scene information, e.g. seeing only the last frame is enough to recognize many actions. As a result, the full-length video task may not align well with our previous video prediction tasks, in which the sequential tendency and causality are important.
165
+
166
+ Dataset and Setup. The something-something dataset (Goyal et al., 2017) is a recent benchmark for activity/action recognition (https://20bn.com/datasets/something-something). We use the standard and official subset which contains 56, 769 short videos for the training set and 7, 503 videos for the validation set on 41 action categories. The video length ranges between 2 and 6 seconds with 24 fps. We adopt the early activity recognition setting (Ma et al., 2016; Zeng et al., 2017; Zhou et al., 2018), where a model predicts an action type after observing the first $2 5 \%$ or $50 \%$ frames of each video. As these actions appear in diverse scenes and involve interaction with different objects, it is challenging to predict actions even for humans (See Figure 6). There are only subtle differences between some actions in this dataset, such as “Poking a stack of [Something] so that the stack collapses” versus “Poking a stack of [Something] without the stack collapsing”, or “Pouring [Something] into [Something]” versus “Trying to pour [Something] into [Something], but missing so it spills next to it”. To make a correct prediction, a model needs to exploit spatiotemporal cues to understand the subtle differences between actions. Namely, one can evaluate the model effectiveness for high-level video tasks. Recognizing early action accurately requires predictions into future frames, which can only be achieved using an effective model based on historical observations.
167
+
168
+ Hyper-parameters and Baselines. We use the architecture illustrated in Figure 1(c) as our model, which consists of 2 layers of 3D-CNN encoders, 4 layers of E3D-LSTMs, and 2 layers of 3D-CNN decoders. The 3D-CNN encoders take 4 consecutive $2 2 4 \times 2 2 4$ raw frames, encode them into $2 \times 5 6 \times 5 6 \times 6 4$ feature maps at each time stamp, and then feed them into E3D-LSTM. Each encoder layer has 64 filters (the filter dimensions are $2 \times 5 \times 5 )$ . We use the same hyper-parameters for E3D-LSTMs as for video prediction. The decoder layers map the output of E3D-LSTMs back to RGB space, which is an $1 \times 3$ matrix, predicting the next frame following the inputs. We train the network to predict the next 10 frames using the front $2 5 \%$ or $5 0 \%$ frames of the video. Note that we do not extend any predictive states into the future at the test time. For both training and testing, we concatenate hidden representations of the top recurrent units with respect to the last 16 input time stamps (considering the first $2 5 \%$ video snippets usually have about 20 to 30 frames), and feed them into the classifier for activity recognition. The classifier contains 2 layers of 3D-Convs with 128 filters (filter dimensions: $2 \times 3 \times 3$ , filter strides: $2 \times 2 \times 2$ ) followed by a $2 \times 2 \times 2$ pooling layer. They transform the concatenated recurrent features from $1 6 \times 5 6 \times 5 6 \times 6 4$ to $1 \times 7 \times 7 \times 1 2 8$ , then pass them to a 512-channel fully-connected layer followed by a 41-way classification. We also exploit the self-supervised auxiliary learning approach and train the model with an objective function in Equation 4. We set $\lambda ( i )$ in Equation 5 to 10 in the beginning $( i = 0$ ), and decrease it with a speed of $2 \times 1 0 ^ { - 5 }$ per iteration, lower bounded by $\eta = 0 . 1$ .
169
+
170
+ ![](images/35208ce44d8e892975f7b7f7278d7cae6d8d5d530e0543611b9a676083f43948.jpg)
171
+ Figure 6: Early activity recognition results given the first $2 5 \%$ and $5 0 \%$ frames of videos on the Something-Something validation set. The blue bars indicate making correct classifications and the red bars are incorrect results. The length of the bar denotes the confidence of the result.
172
+
173
+ Table 5: Early activity recognition accuracy on the 41-category subset of Something-Something.
174
+
175
+ <table><tr><td>MODEL</td><td>FRONT 25%</td><td>FRONT 50%</td></tr><tr><td>3D-CNN</td><td>9.11</td><td>10.30</td></tr><tr><td>SEPARABLE-CNN:SEPARABLE-CONV AT BOTTOM</td><td>8.94</td><td>9.62</td></tr><tr><td>(2+1)D-CNN:SEPARABLE-CONV ON TOP</td><td>9.08</td><td>10.17</td></tr><tr><td>E(2+1)D-LSTM: SEPARABLE INSIDE UNITS</td><td>12.45</td><td>19.86</td></tr><tr><td>E3D-LSTM</td><td>14.59</td><td>22.73</td></tr></table>
176
+
177
+ We evaluate the E3D-LSTM model against the state-of-the-art feed-forward 3D-Conv architectures including C3D/I3D (Diba et al., 2016; Carreira & Zisserman, 2017), Separable 3D-CNN (Xie et al., 2018; Qiu et al., 2017) and (2+1)D-CNN (Tran et al., 2018). These networks achieve the stateof-the-art results on the UCF-101 and Kinetics benchmark datasets for action recognition. For fair comparisons, we train these baseline models using similar backbones to the E3D-LSTM network.
178
+
179
+ Results. Table 5 shows the classification accuracy of the E3D-LSTM network against the stateof-the-art feed-forward 3D-CNNs. The E3D-LSTM model performs favorably against the other methods in two settings of using the first $2 5 \%$ and $5 0 \%$ frames, showing its effectiveness in learning high-level spatiotemporal representations. Figure 6 shows two pairs of video activities that are easy to confuse, especially with such limited observations. For instance, our model correctly forecasts the collapse of books, while only a tendency of it has been shown explicitly within the first $2 5 \%$ frames. This reasoning ability comes from the integrated design of our model to capture both shortterm motions and long-term dependencies. On the other hand, as the feed-forward 3D-CNN models long-term relations by sampling and assembling, it does not perform well in finding the temporal dependencies between cause and effect. We note that Zhou et al. (2018) introduced a feed-forward CNN model and also reported early recognition results on the same dataset. It is not meaningful to compare these two methods in terms of accuracy as our model is trained only using $2 5 \% { - } 5 0 \%$ frames of a video instead of the entire video in (Zhou et al., 2018). Moreover, the two methods are trained using different backbone networks and different splits of datasets.
180
+
181
+ Table 6: Ablation study of early activity recognition on the Something-Something dataset.
182
+
183
+ <table><tr><td>MODEL</td><td>FRONT 25%</td><td>FRONT 50%</td></tr><tr><td>BASELINE 1: 3D-CNN AT BOTTOM (FIGURE 1(A))</td><td>10.28</td><td>16.05</td></tr><tr><td>BASELINE 2: 3D-CNN ON TOP (FIGURE 1(B))</td><td>9.63</td><td>14.82</td></tr><tr><td>BASELINE 3:OURS W/O 3D CONVOLUTIONS</td><td>9.58</td><td>13.92</td></tr><tr><td>BASELINE 4: OURS W/O MEMORY ATTENTION</td><td>11.39</td><td>18.84</td></tr><tr><td>E3D-LSTM</td><td>14.59</td><td>22.73</td></tr></table>
184
+
185
+ Table 7: Accuracy comparisons of different training strategies on the Something-Something dataset.
186
+
187
+ <table><tr><td>MODEL</td><td>FRONT 25%</td><td>FRONT 50%</td></tr><tr><td>TRAINED ONLY ON THE PRIMARY CLASSIFICATION TASK</td><td>13.78</td><td>20.91</td></tr><tr><td>PRE-TRAINED ON THE AUXILIARY TASK</td><td>14.00</td><td>22.15</td></tr><tr><td>TRAINED ON BOTH TASKS WITH A FIXED LOSS RATIO</td><td>13.57</td><td>20.46</td></tr><tr><td>E3D-LSTM(WITH SELF-SUPERVISED AUXILIARY LEARNING)</td><td>14.59</td><td>22.73</td></tr></table>
188
+
189
+ A number of recent studies show that separating temporal and spatial convolution operations in a 3D-CNN model leads to better results (Xie et al., 2018; Qiu et al., 2017; Tran et al., 2018). This observation is validated by our results shown in Table 5. However, it seems counter-intuitive since such separation leads to a pseudo-3D convolution, in which spatial and temporal filters are independent. Interestingly, such separation in our model leads to performance loss, suggesting the 3D convolution in the E3D-LSTM jointly captures the temporal and spatial information.
190
+
191
+ Ablation Study. We conduct similar ablation studies as in Section 4.1 and summarize the results in Table 6. The results from the first two rows show that our deeper integration of 3D-Convs inside RNNs is helpful not only for pixel-level video prediction, but also for high-level activity recognition. The results on rows 3 and 4 show the contribution of the two important components in the proposed Eidetic 3D LSTM: a) 3D convolution features, and b) memory attention mechanism. Both components are useful and important for modeling spatiotemporal data effectively. Table 7 shows applying self-supervised training in different settings. The proposed self-supervised auxiliary learning approach performs better than other alternatives, including using video prediction models as network initialization, or training the model under these two tasks with a fixed objective function ratio.
192
+
193
+ We enable online early activity recognition by making the classifier only depend on a concatenation of the last 5 recurrent output states. Using Equation 1, we fix the length of the attended memory states by setting $\tau$ to 5. Such settings are applied to both training and testing. Table 8 shows the experimental results. Despite the slight decrease of accuracy, it enables an online prediction.
194
+
195
+ Table 8: Online early recognition accuracy: the classifier is built on the last 5 recurrent output states.
196
+
197
+ <table><tr><td>MODEL</td><td>FRONT 25%</td><td>FRONT 50%</td></tr><tr><td>TRAINED ONLY ON THE PRIMARY CLASSIFICATION TASK</td><td>13.49</td><td>18.94</td></tr><tr><td>E3D-LSTM(WITH SELF-SUPERVISED AUXILIARY LEARNING)</td><td>14.30</td><td>20.85</td></tr></table>
198
+
199
+ # 5 CONCLUSION
200
+
201
+ Spatiotemporal predictive learning has shown significant improvements in a variety of applications, such as weather forecasting, traffic flow prediction, and physical interaction simulation. Although considered to be a promising self-supervised feature learning paradigm, it seldom shows its effectiveness beyond video prediction. In this paper, we presented the E3D-LSTM model based on 3D convolutional recurrent units for this task. In this model, we integrated 3D-Convs into state transitions to perceive short-term motions and designed a memory attentive module controlled by recurrent gates to capture the long-term video frame interaction. Experimental results demonstrate that the E3D-LSTM model performs favorably against the state-of-the-art methods on video prediction and early activity recognition tasks.
202
+
203
+ # ACKNOWLEDGMENTS
204
+
205
+ We would like to thank anonymous reviewers for useful comments. Mingsheng Long was supported by National Natural Science Foundation of China (61772299, 71690231).
206
+
207
+ # REFERENCES
208
+
209
+ Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv preprint arXiv:1603.04467, 2016.
210
+
211
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
212
+
213
+ Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In NIPS, 2015.
214
+
215
+ Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML, 2009.
216
+
217
+ Prateep Bhattacharjee and Sukhendu Das. Temporal coherency based criteria for predicting video frames using deep multi-stage generative adversarial networks. In NIPS, 2017.
218
+
219
+ Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017.
220
+
221
+ Bert De Brabandere, Xu Jia, Tinne Tuytelaars, and Luc Van Gool. Dynamic filter networks. In NIPS, 2016.
222
+
223
+ Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, 2018.
224
+
225
+ Ali Diba, Ali Mohammad Pazandeh, and Luc Van Gool. Efficient two-stream motion and appearance 3d cnns for video classification. In ECCV Workshop, 2016.
226
+
227
+ Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NIPS, 2016.
228
+
229
+ 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, 2017.
230
+
231
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computaiton, 9(8): 1735–1780, 1997.
232
+
233
+ Shuiwang Ji, Wei Xu, Ming Yang, and Kai Yu. 3d convolutional neural networks for human action recognition. TPAMI, 35(1):221–231, 2013.
234
+
235
+ Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. In ICML, 2017.
236
+
237
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
238
+
239
+ Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. ICLR, 2017.
240
+
241
+ Chaochao Lu, Michael Hirsch, and Bernhard Schölkopf. Flexible spatio-temporal networks for video prediction. In CVPR, 2017.
242
+
243
+ Shugao Ma, Leonid Sigal, and Stan Sclaroff. Learning activity progression in lstms for activity detection and early detection. In CVPR, 2016.
244
+
245
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. In ICLR, 2016.
246
+
247
+ Marc Oliu, Javier Selva, and Sergio Escalera. Folded recurrent neural networks for future video prediction. In ECCV, 2018.
248
+
249
+ Zhaofan Qiu, Ting Yao, and Tao Mei. Learning spatio-temporal representation with pseudo-3d residual networks. In ICCV, 2017.
250
+
251
+ Christian Schuldt, Ivan Laptev, and Barbara Caputo. Recognizing human actions: a local svm approach. In ICPR, 2004.
252
+
253
+ Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In NIPS, 2015.
254
+
255
+ Nitish Srivastava, Elman Mansimov, and Ruslan Salakhutdinov. Unsupervised learning of video representations using lstms. In ICML, 2015.
256
+
257
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
258
+
259
+ Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In ICCV, 2015.
260
+
261
+ Du Tran, Heng Wang, Lorenzo Torresani, Jamie Ray, Yann LeCun, and Manohar Paluri. A closer look at spatiotemporal convolutions for action recognition. In CVPR, 2018.
262
+
263
+ Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In CVPR, 2018.
264
+
265
+ 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.
266
+
267
+ Ruben Villegas, Jimei Yang, Seunghoon Hong, Xunyu Lin, and Honglak Lee. Decomposing motion and content for natural video sequence prediction. In ICLR, 2017.
268
+
269
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NIPS, 2016.
270
+
271
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018a.
272
+
273
+ Yunbo Wang, Mingsheng Long, Jianmin Wang, Zhifeng Gao, and S Yu Philip. Predrnn: Recurrent neural networks for predictive learning using spatiotemporal lstms. In NIPS, 2017.
274
+
275
+ Yunbo Wang, Zhifeng Gao, Mingsheng Long, Jianmin Wang, and Philip S Yu. Predrnn $^ { + + }$ : Towards a resolution of the deep-in-time dilemma in spatiotemporal predictive learning. In ICML, 2018b.
276
+
277
+ Zhou Wang, A. C Bovik, H. R Sheikh, and E. P Simoncelli. Image quality assessment: from error visibility to structural similarity. TIP, 13(4):600, 2004.
278
+
279
+ Nevan Wichers, Ruben Villegas, Dumitru Erhan, and Honglak Lee. Hierarchical long-term video prediction without supervision. In ICML, 2018.
280
+
281
+ Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. Rethinking spatiotemporal feature learning for video understanding. In ECCV, 2018.
282
+
283
+ Jingwei Xu, Bingbing Ni, Zefan Li, Shuo Cheng, and Xiaokang Yang. Structure preserving video prediction. In CVPR, 2018.
284
+
285
+ Kuo-Hao Zeng, William B Shen, De-An Huang, Min Sun, and Juan Carlos Niebles. Visual forecasting by imitating dynamics in natural sequences. In ICCV, 2017.
286
+
287
+ Junbo Zhang, Yu Zheng, and Dekang Qi. Deep spatio-temporal residual networks for citywide crowd flows prediction. In AAAI, 2017.
288
+
289
+ Bolei Zhou, Alex Andonian, and Antonio Torralba. Temporal relational reasoning in videos. In ECCV, 2018.
290
+
291
+ # A KEY EQUATIONS OF SPATIOTEMPORAL LSTM
292
+
293
+ Operations inside a Spatiotemporal LSTM unit at time stamp $t$ and layer $k$ are shown as follows:
294
+
295
+ $$
296
+ \begin{array} { r l } & { i _ { t } = \sigma ( W _ { r s ^ { t } } + { \bar { X } } _ { t } + { \bar { W } } _ { i h } + { \bar { \mathcal { H } } } _ { i - 1 } ^ { k } + b _ { i } ) } \\ & { g _ { t } = \operatorname { t a n h } ( W _ { r s ^ { t } } + { \bar { X } } _ { t } + W _ { h , p } + { \bar { \mathcal { H } } } _ { i - 1 } ^ { k } + b _ { p } ) } \\ & { f _ { t } = \sigma ( W _ { s ^ { t } } + { \bar { X } } _ { t } + W _ { h , p } + { \bar { \mathcal { H } } } _ { i - 1 } ^ { k } + b _ { f } ) } \\ & { i _ { t } ^ { * } = \sigma ( W _ { r s ^ { t } } ^ { - 1 } + { \bar { X } } _ { t } + W _ { m + 1 } + { \bar { X } } _ { t } ^ { k - 1 } + b _ { i } ) } \\ & { i _ { t } ^ { * } = \operatorname { t a n h } ( W _ { r s ^ { t } } ^ { - 1 } + { \bar { X } } _ { t } + W _ { m + 1 } + { \bar { \mathcal { H } } } _ { i } ^ { k - 1 } + b _ { i } ^ { * } ) } \\ & { f _ { t } ^ { * } = \operatorname { t a n h } ( W _ { r s ^ { t } } ^ { - 1 } + { \bar { X } } _ { t } + W _ { m + 1 } + { \bar { \mathcal { H } } } _ { t } ^ { k - 1 } + b _ { f } ^ { * } ) } \\ & { c _ { t } ^ { * } = \sigma ( W _ { r s ^ { t } } ^ { - 1 } + { \bar { X } } _ { t } + W _ { m + 1 } + { \bar { \mathcal { H } } } _ { t } ^ { k - 1 } + b _ { f } ^ { * } ) } \\ & { M _ { t } ^ { * } = i _ { t } \odot g _ { t } + f _ { t } \odot { \bar { C } } _ { t - 1 } ^ { k } } \\ & { \boldsymbol { M } _ { t } ^ { * } = i _ { t } ^ { * } \odot g _ { t } ^ { * } + f _ { t } ^ { * } \odot { \bar { M } } _ { t } ^ { k - 1 } } \\ & o _ { s } = \sigma ( W _ { r s ^ { t } } + { \bar { X } } _ { t } + W _ { i s ^ { t } } + { \bar { M } } _ { t - 1 } ^ { k } + W _ { i s ^ { t } } + \bar \end{array}
297
+ $$
298
+
299
+ where $\sigma$ is the sigmoid function, $^ *$ is the convolution operator, and $\odot$ denotes the Hadamard product. There are four inputs: $\mathcal { X } _ { t }$ , the raw frame or hidden states from the previous layer; $\mathbf { \mathcal { M } } _ { t } ^ { k - 1 }$ , the previous spatiotemporal memory; $\mathcal { H } _ { t - 1 } ^ { k }$ and $\mathcal { C } _ { t - 1 } ^ { k }$ , the previous hidden states and memory states. Two sets of gate structures, including input gate $i _ { t }$ and $i _ { t } ^ { \prime }$ , forget gate $f _ { t }$ and $f _ { t } ^ { \prime }$ , as well as the output gate $o _ { t }$ , control the information flow in space-time domain. All of them can be presented by $\mathbb { R } ^ { H \times W \times C }$ dimensional tensors, where the first two dimensions are the width and height of feature maps, and the last one is the number of feature map channels.
md/train/BklSv34KvB/BklSv34KvB.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CARPE DIEM, SEIZE THE SAMPLES UNCERTAIN “AT THE MOMENT” FOR ADAPTIVE BATCH SELECTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The performance of deep neural networks is significantly affected by how well mini-batches are constructed. In this paper, we propose a novel adaptive batch selection algorithm called Recency Bias that exploits the uncertain samples predicted inconsistently in recent iterations. The historical label predictions of each sample are used to evaluate its predictive uncertainty within a sliding window. By taking advantage of this design, Recency Bias not only accelerates the training step but also achieves a more accurate network. We demonstrate the superiority of Recency Bias by extensive evaluation on two independent tasks. Compared with existing batch selection methods, the results showed that Recency Bias reduced the test error by up to $2 0 . 5 \%$ in a fixed wall-clock training time. At the same time, it improved the training time by up to $5 9 . 3 \%$ to reach the same test error.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Stochastic gradient descent (SGD) for randomly selected mini-batch samples is commonly used to train deep neural networks (DNNs). However, many recent studies have pointed out that the performance of DNNs is heavily dependent on how well the mini-batch samples are selected (Shrivastava et al., 2016; Chang et al., 2017; Katharopoulos & Fleuret, 2018). In earlier approaches, a sample’s difficulty is employed to identify proper mini-batch samples, and these approaches achieve a more accurate and robust network (Han et al., 2018) or expedite the training convergence of SGD (Loshchilov & Hutter, 2016). However, the two opposing difficulty-based strategies, i.e., preferring easy samples (Kumar et al., 2010; Han et al., 2018) versus hard samples (Loshchilov & Hutter, 2016; Shrivastava et al., 2016), work well in different situations. Thus, for practical reasons to cover more diverse situations, recent approaches begin to exploit a sample’s uncertainty that indicates the consistency of previous predictions (Chang et al., 2017; Song et al., 2019).
12
+
13
+ An important question here is how to evaluate the sample’s uncertainty based on its historical predictions during the training process. Intuitively, because a series of historical predictions can be seen as a series of data indexed in chronological order, the uncertainty can be measured based on two forms of handling time-series observations: (i) a growing window (Figure 1(a)) that consistently increases the size of a window to use all available observations and (ii) a sliding window (Figure 1(b)) that maintains a window of a fixed size on the most recent observations by deleting outdated ones. While the state-of-the-art algorithm, Active Bias (Chang et al., 2017), adopts the growing window, we propose to use the sliding window in this paper.
14
+
15
+ ![](images/e458d1497252151139443c48c27d2f144812ed6aab1303be2da2f6cc76f75502.jpg)
16
+ Figure 1: Two forms of handling the time-series observations.
17
+
18
+ In more detail, Active Bias recognizes uncertain samples based on the inconsistency of the predictions in the entire history of past SGD iterations. Then, it emphasizes such uncertain samples by choosing them with high probability for the next mini-batch. However, according to our experiments presented in Section 5.2, such uncertain samples slowed down the convergence speed of training, though they ultimately reduced the generalization error. This weakness is attributed to the inherent limitation of the growing window, where older observations could be too outdated (Torgo, 2011). In other words, the outdated predictions no longer represent a network’s current behavior. As illustrated in Figure 2, when the label predictions of two samples were inconsistent for a long time, Active Bias invariably regards them as highly uncertain, although their recent label predictions become consistent along with the network’s training progress. This characteristic evidently entails the risk of emphasizing uninformative samples that are too easy or too hard at the current moment, thereby slowing down the convergence speed of training.
19
+
20
+ ![](images/bd841fdf12d106ed752fcde7b904650e1cbef63ebc12b70c914592c068d00dbd.jpg)
21
+ Figure 2: The difference in sample uncertainty estimated by Active Bias and Recency Bias.
22
+
23
+ Therefore, we propose a simple but effective batch selection method, called Recency Bias, that takes advantage of the sliding window to evaluate the uncertainty in fresher observations. As opposed to Active Bias, Recency Bias excludes the outdated predictions by managing a sliding window of a fixed size and picks up the samples predicted inconsistently within the sliding window. Thus, as shown in Figure 2, the two samples uninformative at the moment are no longer selected by Recency Bias simply because their recent predictions are consistent. Consequently, since informative samples are effectively selected throughout the training process, this strategy not only accelerates the training speed but also leads to a more accurate network.
24
+
25
+ To validate the superiority of Recency Bias, two popular convolutional neural networks (CNNs) were trained for two independent tasks: image classification and fine tuning. We compared Recency Bias with not only random batch selection (baseline) but also two state-of-the-art batch selection strategies. Compared with three batch selection strategies, Recency Bias provided a relative reduction of test error by $1 . 8 1 \% - 2 0 . 5 \%$ in a fixed wall-clock training time. At the same time, it significantly reduced the execution time by $2 4 . 6 \% { - } 5 9 . 3 \%$ to reach the same test error.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ Let $\mathcal { D } = \{ ( x _ { i } , y _ { i } ) | 1 \leq i \leq N \}$ be the entire training dataset composed of a sample $x _ { i }$ with its true label $y _ { i }$ , where $N$ is the total number of training samples. Then, a straightforward strategy to construct a mini-batch $\mathcal { M } = \{ ( x _ { i } , y _ { i } ) | 1 \leq i \leq b \}$ is to select $b$ samples uniformly at random (i.e., $P ( x _ { i } | D ) = 1 / N )$ from the training dataset $\mathcal { D }$ .
30
+
31
+ Because not all samples have an equal impact on training, many research efforts have been devoted to develop advanced sampling schemes. Bengio et al. (2009) first took easy samples and then gradually increased the difficulty of samples using heuristic rules. Kumar et al. (2010) determined the easiness of the samples using their prediction errors. Recently, Tsvetkov et al. (2016) used Bayesian optimization to learn an optimal curriculum for training dense, distributed word representations. Sachan & Xing (2016) emphasized that the right curriculum must introduce a small number of the samples dissimilar to those previously seen. Fan et al. (2017) proposed a neural data filter based on reinforcement learning to select training samples adaptively. However, it is common for deep learning to emphasize hard samples because of the plethora of easy ones (Katharopoulos & Fleuret, 2018).
32
+
33
+ Loshchilov & Hutter (2016) proposed a difficulty-based sampling scheme, called Online Batch, that uses the rank of the loss computed from previous epochs. Online Batch sorts the previously computed losses of samples in descending order and exponentially decays the sampling probability of a sample according to its rank $r$ . Then, the $r$ -th ranked sample $x ( r )$ is selected with the probability dropping by a factor of exp $\left( \log ( s _ { e } ) / N \right)$ , where $s _ { e }$ is the selection pressure parameter that affects the probability gap between the most and the least important samples. When normalized to sum to 1.0, the probability $P ( x ( r ) | \mathcal { D } ; s _ { e } )$ is defined by Eq. (1). It has been reported that Online Batch accelerates the convergence of training but deteriorates the generalization error because of the overfitting to hard training samples (Loshchilov & Hutter, 2016).
34
+
35
+ $$
36
+ P ( x ( r ) | \mathcal { D } ; s _ { e } ) = \frac { 1 / \exp \left( \log ( s _ { e } ) / N \right) ^ { r } } { \sum _ { j = 1 } ^ { N } 1 / \exp \left( \log ( s _ { e } ) / N \right) ^ { j } }
37
+ $$
38
+
39
+ Most close to our work, Chang et al. (2017) devised an uncertainty-based sampling scheme, called Active Bias, that chooses uncertain samples with high probability for the next batch. Active Bias maintains the history $\mathcal { H } _ { i } ^ { t - 1 }$ that stores all $h ( y _ { i } | x _ { i } )$ before the current iteration $t$ (i.e., growing window), where $h ( y _ { i } | x _ { i } )$ is the softmax probability of a given sample $x _ { i }$ for its true label $y _ { i }$ . Then, it measures the uncertainty of the sample $x _ { i }$ by computing the variance over all $h ( y _ { i } | x _ { i } )$ in $\mathcal { H } _ { i } ^ { t - 1 }$ and draws the next mini-batch samples based on the normalized probability $P ( x _ { i } | \mathcal { D } , \mathcal { H } _ { i } ^ { t - 1 } ; \epsilon )$ in Eq. (2), where $\epsilon$ is the smoothness constant to prevent the low variance samples from never being selected again. As mentioned earlier in Section 1, Active Bias slows down the training process because the oldest part in the history $\mathcal { H } _ { i } ^ { t - 1 }$ no longer represents the current behavior of the network.
40
+
41
+ $$
42
+ P ( x _ { i } | \mathcal { D } , \mathcal { H } _ { i } ^ { t - 1 } ; \epsilon ) = \frac { \hat { s t d } ( \mathcal { H } _ { i } ^ { t - 1 } ) + \epsilon } { \sum _ { j = 1 } ^ { N } \left( s \hat { t } d ( \mathcal { H } _ { j } ^ { t - 1 } ) + \epsilon \right) } , s \hat { t } d ( \mathcal { H } _ { i } ^ { t - 1 } ) = \sqrt { v a r \big ( h ( y _ { i } | x _ { i } ) \big ) + \frac { v a r \big ( h ( y _ { i } | x _ { i } ) \big ) ^ { 2 } } { | \mathcal { H } _ { i } ^ { t - 1 } | } }
43
+ $$
44
+
45
+ For the completeness of the survey, we include the recent studies on submodular batch selection. Joseph et al. (2019) and Wang et al. (2019) designed their own submodular objectives that cover diverse aspects, such as sample redundancy and sample representativeness, for more effective batch selection. Differently from their work, we explore the issue of truly uncertain samples in an orthogonal perspective. Our uncertainty measure can be easily injected into their submodular optimization framework as a measure of sample informativeness.
46
+
47
+ In Section 5, we will confirm that Recency Bias outperforms Online Batch and Active Bias, which are regarded as two state-of-the-art adaptive batch selection methods for deep learning.
48
+
49
+ # 3 Recency Bias COMPONENTS
50
+
51
+ # 3.1 CRITERION OF AN UNCERTAIN SAMPLE
52
+
53
+ The main challenge of Recency Bias is to identify the samples whose recent label predictions are highly inconsistent, which are neither too easy nor too hard at the moment. Thus, we adopt the predictive uncertainty (Song et al., 2019) in Definition 3.1 that uses the information entropy (Chandler, 1987) to measure the inconsistency of recent label predictions. Here, the sample with high predictive uncertainty is regarded as uncertain and selected with high probability for the next mini-batch.
54
+
55
+ Definition 3.1. (Predictive Uncertainty) Let $\hat { y } _ { i t } = \Phi ( x _ { i } , \theta _ { t } )$ be the predicted label of a sample $x _ { i }$ at time $t$ and $\mathcal { H } _ { x _ { i } } ( q ) = \{ \hat { y } _ { t _ { 1 } } , \hat { y } _ { t _ { 2 } } , . . . , \hat { y } _ { t _ { q } } \}$ be the label history of the sample $x _ { i }$ that stores the predicted labels at the previous $q$ times, where $\Phi$ is a neural network. The label history $\mathcal { H } _ { x _ { i } } ( q )$ corresponds to the sliding window of size $q$ to compute the uncertainty of the sample $x _ { i }$ . Next, $p ( \boldsymbol { y } _ { i } | \boldsymbol { x } _ { i } ; \boldsymbol { q } )$ is formulated such that it provides the probability of the label $y _ { i } \in \{ 1 , 2 , . . . , k \}$ estimated as the label of the sample $x _ { i }$ based on $\mathcal { H } _ { x _ { i } } ( q )$ as in Eq. (3), where $[ \cdot ]$ is the Iverson bracket1.
56
+
57
+ $$
58
+ p ( y _ { i } | x _ { i } ; q ) = \frac { \sum _ { \hat { y _ { i } } \in \mathcal { H } _ { x _ { i } } ( q ) } [ \hat { y _ { i } } = y _ { i } ] } { | \mathcal { H } _ { x _ { i } } ( q ) | }
59
+ $$
60
+
61
+ Then, to quantify the uncertainty of the sample $x _ { i }$ , the predictive uncertainty $F ( x _ { i } ; q )$ is defined using the empirical entropy as in Eq. (4). Because the uncertainty is bounded, we add the standardization term $\delta$ to normalize the value to $[ 0 , 1 ]$ . For $k$ classes, $\delta$ is the maximum entropy when $\forall _ { j } p ( j | x _ { i } ; q ) = 1 / k$ .
62
+
63
+ $$
64
+ \begin{array} { c } { F ( x _ { i } ; q ) = - ( 1 / \delta ) \displaystyle \sum _ { j = 1 } ^ { k } p ( j | x _ { i } ; q ) \log p ( j | x _ { i } ; q ) } \\ { \delta = - \log \left( 1 / k \right) \displaystyle \bigcup } \end{array}
65
+ $$
66
+
67
+ # 3.2 SAMPLING PROBABILITY FOR MINI-BATCH CONSTRUCTION
68
+
69
+ To construct next mini-batch samples, we assign the sampling probability according to the predictive uncertainty in Definition 3.1. Motivated by Loshchilov & Hutter (2016), the sampling probability of a given sample $x _ { i }$ is exponentially decayed with its predictive uncertainty $F ( x _ { i } ; q )$ . In detail, we adopt the quantization method (Chen & Wornell, 2001) and use the quantization index to decay the sampling probability. The index is obtained by the simple quantizer $Q$ in Eq. (5), where $\Delta$ is the quantization step size. Compared with the rank-based index (Loshchilov & Hutter, 2016), the quantization index is known to well reflect the difference in actual values (Widrow et al., 1996).
70
+
71
+ $$
72
+ Q \big ( F ( x _ { i } ; q ) \big ) = \lceil \big ( 1 - F ( x _ { i } ; q ) \big ) / \Delta \rceil , 0 \leq F ( x _ { i } ; q ) \leq 1
73
+ $$
74
+
75
+ In Eq. (5), we set $\Delta$ to be $1 / N$ such that the index is bounded to $N$ (the total number of samples). Then, the sampling probability $P ( x _ { i } | \mathcal { D } ; s _ { e } )$ is defined as in Eq. (6). The higher the predictive uncertainty, the smaller the quantization index. Therefore, a higher sampling probability is assigned for uncertain samples in Eq. (6).
76
+
77
+ $$
78
+ P ( x _ { i } | \mathcal { D } ; s _ { e } ) = \frac { 1 / \exp \left( \log ( s _ { e } ) / N \right) ^ { Q ( F ( x _ { i } ; q ) ) } } { \sum _ { j = 1 } ^ { N } 1 / \exp \left( \log ( s _ { e } ) / N \right) ^ { Q ( F ( x _ { j } ; q ) ) } }
79
+ $$
80
+
81
+ Meanwhile, it is known that using only some part of training data exacerbates the overfitting problem at a late stage of training (Loshchilov & Hutter, 2016; Zhou & Bilmes, 2018). Thus, to alleviate the problem, we include more training samples as the training progresses by exponentially decaying the selection pressure $s _ { e }$ as in Eq. (7). At each epoch $e$ from $e _ { 0 }$ to $e _ { e n d }$ , the selection pressure $s _ { e }$ exponentially decreases from $s _ { e _ { 0 } }$ to 1. Because this technique gradually reduces the sampling probability gap between the most and the least uncertain samples, more diverse samples are selected for the next mini-batch at a later epoch. When the selection pressure $s _ { e }$ becomes 1, the mini-batch samples are randomly chosen from the entire dataset.
82
+
83
+ $$
84
+ s _ { e } = s _ { e _ { 0 } } \Big ( \exp \big ( \log \big ( 1 / s _ { e _ { 0 } } \big ) / ( e _ { e n d } - e _ { 0 } ) \big ) \Big ) ^ { e - e _ { 0 } }
85
+ $$
86
+
87
+ # 4 Recency Bias ALGORITHM
88
+
89
+ # Algorithm 1 Recency Bias Algorithm
90
+
91
+ INPUT: $\mathcal { D }$ : data, epochs, b: batch size, $q$ : window size, $s _ { e _ { 0 } }$ : initial selection pressure, $\gamma$ : warm-u
92
+ OUTPUT: $\theta _ { t }$ : model parameter
93
+ 1: $t \gets 1$ ;
94
+ 2: ${ \theta _ { t } } \gets$ Initialize the model parameter;
95
+ 3: for $i = 1$ to epochs do
96
+ 4: $/ { ^ * }$ Sampling Probability Derivation $^ { * }$
97
+ 5: if $i > \gamma$ then
98
+ 6: $s _ { e } \gets$ Decay_Selection_Pressure $( s _ { e _ { 0 } } , i )$ ; $/ { * }$ Decaying $s _ { e }$ by Eq. (7) \*/
99
+ 7: for $m = 1$ to $N$ do $/ { } ^ { * }$ Updating the index and the sampling probability in a batch $^ { * }$
100
+ 8: $q _ { - } d i c t [ x _ { m } ] = Q \bigl ( F ( x _ { m } ; q ) \bigr )$ ; $/ { } ^ { * }$ By Eq. (5) $^ { * }$
101
+ 9: $p \_ t a b l e \mathrm { C o } \mathrm { _ { } }$ mpute_Prob(q_dict, $s _ { e . }$ ); $/ { } ^ { * }$ By Eq. (6) $^ { * }$
102
+ 10: /\* Network Training $^ { * }$
103
+ 11: for $j = 1$ to $N / b$ do $/ { * }$ Mini-batch $^ { * }$
104
+ 12: if $i \leq \gamma$ then $/ { * }$ Warm-up $^ { * }$
105
+ 13: $\{ ( x _ { 1 } , y _ { 1 } ) , \dotsc , ( x _ { b } , y _ { b } ) \} $ Randomly select next mini-batch samples;
106
+ 14: else $/ { * }$ Adaptive batch selection $^ { * }$
107
+ 15: $\{ ( x _ { 1 } , y _ { 1 } ) , \dotsc , ( x _ { b } , y _ { b } ) \} $ Select next mini-batch samples based on $p \_ t a b l e$ ;
108
+ 16: losses, ${ l a b e l s }$ Inference_Step $\cdot ( \{ ( x _ { 1 } , y _ { 1 } ) , \dots , ( x _ { b } , y _ { b } ) \} , \theta _ { t } )$ ; $/ { } ^ { * }$ Forward $^ { * }$
109
+ 17: $\theta _ { t + 1 } \gets \mathrm { S G D } \_ { \mathrm { S t e p } } ( l o s s e s , \theta _ { t } )$ ; $/ { * }$ Backward $^ { * }$
110
+ 18: Update_Label_History(labels); $/ { * }$ By Definition $3 . 1 ~ ^ { * } /$
111
+ 19: $t \gets t + 1$ ;
112
+ 20: return $\theta _ { t }$ ;
113
+
114
+ Algorithm 1 describes the overall procedure of Recency Bias. The algorithm requires a warm-up period of $\gamma$ epochs because the quantization index for each sample is not confirmed yet. During the warm-up period, which should be at least $q$ epochs $( \gamma \geq q )$ to obtain the label history of size $q$ , randomly selected mini-batch samples are used for the network update (Lines 12–13). After the warm-up period, the algorithm decays the selection pressure $s _ { e }$ and updates not only the quantization index but also the sampling probability in a batch at the beginning of each epoch (Lines 4–9). Subsequently, the uncertain samples are selected for the next mini-batch according to the updated sampling probability (Line 14–15), and then the label history is updated along with the network update (Lines 16–19).
115
+
116
+ Overall, the key technical novelty of Recency Bias is to incorporate the notion of a sliding window (Line 8) rather than a growing window into adaptive batch selection, thereby improving both training speed and generalization error.
117
+
118
+ Time Complexity: The main “additional” cost of Recency Bias is the derivation of the sampling probability for each sample (Lines 4–9). Because only simple mathematical operations are needed per sample, its time complexity is linear to the number of samples (i.e., $O ( N ) )$ ), which is negligible compared with that of the forward and backward steps of a complex network (Lines 16–17). Therefore, we contend that Recency Bias does not add the complexity of an underlying optimization algorithm.
119
+
120
+ # 5 EVALUATION
121
+
122
+ We empirically show the improvement of Recency Bias over not only Random Batch (baseline) but also Online Batch (Loshchilov & Hutter, 2016) and Active Bias (Chang et al., 2017), which are two stateof-the-art adaptive batch selections. In particular, we elaborate on the effect of the sliding window approach (Recency Bias) compared with the growing window approach (Active Bias). Random Batch selects next mini-batch samples uniformly at random from the entire dataset. Online Batch selects hard samples based on the rank of the loss computed from previous epochs. Active Bias selects uncertain samples with high variance of true label probabilities in the growing window. All the algorithms were implemented using TensorFlow 1.8.0 and executed using a single NVIDIA Titan Volta GPU. For reproducibility, we provide the source code at https://github.com/anonymized.
123
+
124
+ Image classification and fine-tuning tasks were performed to validate the superiority of Recency Bias. Because fine-tuning is used to quickly adapt to a new dataset, it is suitable to reap the benefit of fast training speed. In support of reliable evaluation, we repeated every task thrice and reported the average and standard error of the best test errors. The best test error in a given time has been widely used for the studies on fast and accurate training (Katharopoulos & Fleuret, 2018; Loshchilov & Hutter, 2016).
125
+
126
+ # 5.1 ANALYSIS ON SELECTED MINI-BATCH SAMPLES
127
+
128
+ For an in-depth analysis on selected samples, we plot the loss distribution of mini-batch samples selected from CIFAR-10 by four different strategies in Figure 3. (i) The distribution of Online Batch is the most skewed toward high loss by the design principle of selecting hard samples. (ii) Active Bias emphasizes moderately hard samples at an early training stage in considering that its loss distribution lies between those of Random Batch and Online Batch. However, owing to the outdated predictions caused by the growing window, the proportion of easy samples with low loss increases at a late training stage. These easy samples, which are misclassified as uncertain at that stage, tend to make the convergence of training slow down. (iii) In contrast to Active Bias, by virtue of the sliding window, the distribution of Recency Bias lies between those of Random Batch and Online Batch regardless of the training stage. Consequently, Recency Bias continues to highlight the moderately hard samples, which are likely to be informative, during the training process.
129
+
130
+ ![](images/8c8739f16ea42064903ff3fcdc18e71d24f92a506e69384e924af6d9a72dfa55.jpg)
131
+ Figure 3: The loss distribution of mini-batch samples selected by four batch selection strategies: (a) and (b) show the loss distribution at the $3 0 \%$ and $7 0 \%$ of total training epochs, respectively.
132
+
133
+ # 5.2 TASK I: IMAGE CLASSIFICATION
134
+
135
+ Experiment Setting: We trained DenseNet $\mathrm { L } { = } 4 0$ , $_ { \mathrm { k = } 1 2 }$ ) and ResNet $\mathrm { L } { = } 5 0 _ { , }$ ) with a momentum optimizer and an SGD optimizer on three benchmark datasets: MNIST (10 classes)2, classification of handwritten digits (LeCun, 1998), and CIFAR-10 (10 classes)3 and CIFAR-100 (100 classes)3, classification of a subset of 80 million categorical images (Krizhevsky et al., 2014). Specifically, we used data augmentation, batch normalization, a momentum of 0.9, and a batch size of 128. As for the algorithm parameters, we fixed the window size $q = 1 0$ and the initial selection pressure $s _ { e _ { 0 } } = 1 0 0$ , 4 which were the best values found by the grid search (see Appendix A for details). The warm-up epoch $\gamma$ was set to be 15. To reduce the performance variance caused by randomly initialized model parameters, all parameters were shared by all algorithms during the warm-up period. Regarding the training schedule, we trained the network for 40, 000 iterations and used an initial learning rate of 0.1, which was divided by 10 at $5 0 \%$ and $7 5 \%$ of the total number of training iterations.
136
+
137
+ Results: Figure 4 shows the convergence curves of training loss and test error for four batch selection strategies using DenseNet and a momentum optimizer. In order to highlight the improvement of Recency Bias over the baseline (Random Batch), their lines are dark colored. The best test errors in Figures 4(b), 4(d), and 4(f) are summarized on the left side of Table 1.
138
+
139
+ In general, Recency Bias achieved the most accurate network while accelerating the training process on all datasets. The training loss of Recency Bias converged faster (Figures 4(a), 4(c), and 4(e)) without the increase in the generalization error, thereby achieving the lower test error (Figures 4(b), 4(d), and 4(f)). In contrast, the test error of Online Batch was not the best even if its training loss converged the fastest among all strategies. As the training difficulty increased from CIFAR-10 to CIFAR-100, the test error of Online Batch became even worse than that of Random Batch. That is, emphasizing hard samples accelerated the training step but made the network overfit to hard samples. Meanwhile, Active Bias was prone to make the network better generalized on test data. In CIFAR-10, despite its highest training loss, the test error of Active Bias was better than that of Random Batch. However, Active Bias slowed down the training process because of the limitation of growing windows, as discussed in Section 5.1. We note that, although both Recency Bias and Active Bias exploited uncertain samples, only Recency Bias based on sliding windows succeeded to not only speed up the training process but also reduce the generalization error.
140
+
141
+ The results of the best test error for ResNet or an SGD optimizer are summarized in Tables 1 and 2 (see Appendix C for more details). Regardless of a neural network and an optimizer, Recency Bias achieved the lowest test error except in MNIST with an SGD optimizer. The improvement of Recency Bias over the others was higher with an SGD optimizer than with a momentum optimizer.
142
+
143
+ Table 1: The best test errors $( \% )$ of four batch selection strategies using DenseNet.
144
+
145
+ <table><tr><td rowspan=1 colspan=1>Optimizer</td><td rowspan=1 colspan=3>Momentumin Figure 4</td><td rowspan=1 colspan=3>SGD in Figure 9(Appendix C.1)</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-100</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-100</td></tr><tr><td rowspan=1 colspan=1>RandomBatch</td><td rowspan=1 colspan=1>0.527± 0.03</td><td rowspan=1 colspan=1>7.33± 0.09</td><td rowspan=1 colspan=1>28.0±0.16</td><td rowspan=1 colspan=1>1.23± 0.03</td><td rowspan=1 colspan=1>14.9 ± 0.09</td><td rowspan=1 colspan=1>40.2 ± 0.06</td></tr><tr><td rowspan=1 colspan=1>OnlineBatch</td><td rowspan=1 colspan=1>0.514± 0.01</td><td rowspan=1 colspan=1>7.00±0.10</td><td rowspan=1 colspan=1>28.4± 0.25</td><td rowspan=1 colspan=1>0.765± 0.02</td><td rowspan=1 colspan=1>13.5± 0.02</td><td rowspan=1 colspan=1>40.7 ± 0.12</td></tr><tr><td rowspan=1 colspan=1>Active Bias</td><td rowspan=1 colspan=1>0.616±0.03</td><td rowspan=1 colspan=1>7.07 ± 0.04</td><td rowspan=1 colspan=1>27.9 ± 0.11</td><td rowspan=1 colspan=1>0.679±0.02</td><td rowspan=1 colspan=1>14.2 ± 0.25</td><td rowspan=1 colspan=1>42.9 ± 0.05</td></tr><tr><td rowspan=1 colspan=1>Recency Bias</td><td rowspan=1 colspan=1>0.490± 0.02</td><td rowspan=1 colspan=1>6.60 ± 0.02</td><td rowspan=1 colspan=1>27.1 ± 0.19</td><td rowspan=1 colspan=1>0.986±0.06</td><td rowspan=1 colspan=1>13.2 ± 0.11</td><td rowspan=1 colspan=1>38.7 ± 0.11</td></tr></table>
146
+
147
+ Table 2: The best test errors $( \% )$ of four batch selection strategies using ResNet.
148
+
149
+ <table><tr><td rowspan=1 colspan=1>Optimizer</td><td rowspan=1 colspan=3>Momentum in Figure 10(Appendix C.2)</td><td rowspan=1 colspan=3>SGD in Figure 11 (Appendix C.3)</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-100</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-100</td></tr><tr><td rowspan=1 colspan=1>RandomBatch</td><td rowspan=1 colspan=1>0.636 ± 0.04</td><td rowspan=1 colspan=1>10.2 ± 0.12</td><td rowspan=1 colspan=1>33.2 ± 0.07</td><td rowspan=1 colspan=1>1.16 ± 0.03</td><td rowspan=1 colspan=1>12.7 ± 0.09</td><td rowspan=1 colspan=1>40.1 ± 0.16</td></tr><tr><td rowspan=1 colspan=1>OnlineBatch</td><td rowspan=1 colspan=1>0.666 ± 0.05</td><td rowspan=1 colspan=1>10.1± 0.05</td><td rowspan=1 colspan=1>33.4 ± 0.01</td><td rowspan=1 colspan=1>0.890± 0.03</td><td rowspan=1 colspan=1>12.2 ± 0.08</td><td rowspan=1 colspan=1>40.7 ± 0.09</td></tr><tr><td rowspan=1 colspan=1>Active Bias</td><td rowspan=1 colspan=1>0.613 ± 0.04</td><td rowspan=1 colspan=1>10.6±0.08</td><td rowspan=1 colspan=1>34.2 ± 0.07</td><td rowspan=1 colspan=1>0.804± 0.01</td><td rowspan=1 colspan=1>13.5 ± 0.07</td><td rowspan=1 colspan=1>45.6 ± 0.07</td></tr><tr><td rowspan=1 colspan=1>Recency Bias</td><td rowspan=1 colspan=1>0.607 ± 0.01</td><td rowspan=1 colspan=1>9.79 ± 0.04</td><td rowspan=1 colspan=1>32.4 ± 0.04</td><td rowspan=1 colspan=1>0.972 ± 0.03</td><td rowspan=1 colspan=1>11.6 ± 0.09</td><td rowspan=1 colspan=1>38.9 ± 0.14</td></tr></table>
150
+
151
+ ![](images/6b3815178b0ace16a53891bf390cb06795f2f8f94e51f5cb6b880c9de0b7be0f.jpg)
152
+ Figure 4: Convergence curves of four batch selection strategies using DenseNet with momentum.
153
+
154
+ # 5.3 TASK II: FINE-TUNING
155
+
156
+ Experiment Setting: We prepared DenseNet $_ { \mathrm { L } = 1 2 1 }$ , $\mathbf { k } = 3 2$ ) previously trained on ImageNet (Deng et al., 2009) and then fine-tuned the network on two benchmark datasets: MIT-67 (67 classes)5, classification of indoor scenes (Quattoni & Torralba, 2009), and Food-100 (100 classes)6, classification of popular foods in Japan (Kawano & Yanai, 2014). After replacing the last classification layer, the network was trained end-to-end for 50 epochs with a batch size 32 and a constant learning rate $2 \times 1 0 ^ { - 4 }$ . Data augmentation was not applied here. The other configurations were the same as those in Section 5.2.
157
+
158
+ Results on Test Error: Figure 5 shows the convergence curves of training loss and test error for the fine-tuning task on MIT-67 and Food-100. Overall, all convergence curves showed similar trends to those of the classification task in Figure 4. Only Recency Bias converged faster than Random Batch in both training loss and test error. Online Batch converged the fastest in training loss, but its test error was rather higher than Random Batch owing to the overfitting. Active Bias converged the slowest in both training loss and test error. Quantitatively, compared with Random Batch, Recency Bias reduced the test error by $2 . 8 8 \%$ and $1 . 8 1 \%$ in MIT-67 and Food-100, respectively.
159
+
160
+ ![](images/4b10c356bdce14d65c703f0a0a5ba9e51549ccb62e4258dcdcc64892bc7d3fc1.jpg)
161
+ Figure 5: Convergence curves for fine-tuning on two benchmark datasets.
162
+
163
+ Table 3: Recency Bias’s reduction in training time over other batch selection strategies.
164
+
165
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>MIT-67</td><td rowspan=1 colspan=1>FOOD-100</td></tr><tr><td rowspan=1 colspan=1>RandomBatch</td><td rowspan=1 colspan=1>(5,218-3,936)/5,218 × 100= 24.6%</td><td rowspan=1 colspan=1>(7,263-5,365)/7,263 × 100= 26.1%</td></tr><tr><td rowspan=1 colspan=1>OnlineBatch</td><td rowspan=1 colspan=1>(6,079- 3,823)/6,079 × 100 = 37.1%</td><td rowspan=1 colspan=1>(8,333-3,685)/8,333 × 100= 55.8%</td></tr><tr><td rowspan=1 colspan=1>Active Bias</td><td rowspan=1 colspan=1>(5,738-3,032)/5,738×100=47.2%</td><td rowspan=1 colspan=1>(7,933-3,227)/7,933× 100= 59.3%</td></tr></table>
166
+
167
+ Results on Training Time: Moreover, to assess the performance gain in training time, we computed the reduction in the training time taken to reach the same error. For example, in Figure 5(b), the best test error of $2 8 . 8 \%$ achieved in 5, 218 seconds by Random Batch could be achieved only in 3, 936 seconds by Recency Bias; thus, Recency Bias improved the training time by $2 4 . 6 \%$ . Table 3 summarizes the reduction in the training time of Recency Bias over three other batch selection strategies. Notably, Recency Bias improved the training time by $2 4 . 6 \% { - 4 7 . 2 \% }$ and $2 6 . 1 \% { - 5 9 . 3 \% }$ in fine-tuning MIT-67 and FOOD-100 datasets, respectively.
168
+
169
+ # 5.4 ABLATION STUDY ON SELECTION PRESSURE
170
+
171
+ For an ablation study on the selection pressure, we trained DenseNet $( \mathrm { L } { = } 4 0 , \mathrm { k } { = } 1 2 )$ on two benchmark datasets using Recency Bias with four different decaying strategies: $s _ { e } : 1 0 \to 1 0$ , $s _ { e } : 1 0 0 \to 1 0 0$ , $s _ { e } : 1 0 \to 1$ , and $s _ { e } : 1 0 0 \to 1$ . The first two strategies used different initial selection pressures without decaying, but the remaining strategies exponentially decayed their initial selection pressures to 1. We used a momentum optimizer and the other experimental configurations were the same as those in Section 5.2.
172
+
173
+ Figure 6 shows the convergence curves of Recency Bias using the different decaying strategies along with that of Random Batch. Generally, the two strategies without decaying (i.e., $s _ { e } : 1 0 \to 1 0$ , $s _ { e } : 1 0 0 \to 1 0 0 )$ showed much faster convergence speed in training loss compared with those with decaying (i.e., $s _ { e } : 1 0 \to 1$ , $s _ { e } : 1 0 0 \to 1 $ ). However, as mentioned earlier in Section 3.2, the two strategies without decaying exacerbated the overfitting problem because they only used the training samples classified as highly uncertain. Accordingly, their test errors were rather higher than that of Random Batch in CIFAR-100 dataset. On the other hand, the two strategies with decaying converged faster than Random Batch in both training loss and test error in all datasets because they exploited more diverse training samples by exponentially decaying the selection pressure. Thus, these observations empirically prove that decaying the selection pressure is an effective way to alleviate the overfitting problem at the later stage of training.
174
+
175
+ ![](images/79dff39f85eae7d3803dde22a0110a284299728a2929b4bad6b3e974ac003979.jpg)
176
+ 0 80 10Figure 6: Ablation study on the effect of the selection pressure.
177
+
178
+ # 6 CONCLUSION
179
+
180
+ In this paper, we presented a novel adaptive batch selection algorithm called Recency Bias that emphasizes predictively uncertain samples for accelerating the training of neural networks. Toward this goal, the predictive uncertainty of each sample is evaluated using its recent label predictions managed by a sliding window of a fixed size. Then, uncertain samples at the moment are selected with high probability for the next mini-batch. We conducted extensive experiments on both classification and fine-tuning tasks. The results showed that Recency Bias is effective in reducing the training time as well as the best test error. It was worthwhile to note that using all historical observations to estimate the uncertainty has the side effect of slowing down the training process. Overall, a merger of uncertain samples and sliding windows greatly improves the power of adaptive batch selection.
181
+
182
+ # REFERENCES
183
+
184
+ Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML, pp. 41–48, 2009.
185
+
186
+ David Chandler. Introduction to modern statistical mechanics. Oxford University Press, 1987.
187
+
188
+ Haw-Shiuan Chang, Erik Learned-Miller, and Andrew McCallum. Active Bias: Training more accurate neural networks by emphasizing high variance samples. In NeurIPS, pp. 1002–1012, 2017.
189
+
190
+ Brian Chen and Gregory W Wornell. Quantization index modulation: A class of provably good methods for digital watermarking and information embedding. IEEE Trans. on Information Theory, 47(4):1423–1443, 2001.
191
+
192
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248–255, 2009.
193
+
194
+ Yang Fan, Fei Tian, Tao Qin, and Tie-Yan Liu. Neural data filter for bootstrapping stochastic gradient descent. In ICLR, 2017.
195
+
196
+ Bo Han, Quanming Yao, Xingrui Yu, Gang Niu, Miao Xu, Weihua Hu, Ivor Tsang, and Masashi Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, pp. 8527–8537, 2018.
197
+
198
+ KJ Joseph, Krishnakant Singh, Vineeth N Balasubramanian, et al. Submodular batch selection for training deep neural networks. In IJCAI, pp. 2677–3683, 2019.
199
+
200
+ Angelos Katharopoulos and François Fleuret. Not all samples are created equal: Deep learning with importance sampling. In ICML, pp. 2525–2534, 2018.
201
+
202
+ Y. Kawano and K. Yanai. Food image recognition with deep convolutional features. In UbiComp, 2014.
203
+
204
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet classification with deep convolutional neural networks. In NeurIPS, pp. 1097–1105, 2012.
205
+
206
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. CIFAR-10 and CIFAR-100 datasets, 2014. https://www.cs.toronto.edu/\~kriz/cifar.html.
207
+
208
+ M Pawan Kumar, Benjamin Packer, and Daphne Koller. Self-paced learning for latent variable models. In NeurIPS, pp. 1189–1197, 2010.
209
+
210
+ Yann LeCun. The MNIST database of handwritten digits, 1998. http://yann.lecun.com/ exdb/mnist.
211
+
212
+ Ilya Loshchilov and Frank Hutter. Online batch selection for faster training of neural networks. In ICLR, 2016.
213
+
214
+ Ariadna Quattoni and Antonio Torralba. Recognizing indoor scenes. In CVPR, pp. 413–420, 2009.
215
+
216
+ Mrinmaya Sachan and Eric Xing. Easy questions first? A case study on curriculum learning for question answering. In ACL, pp. 453–463, 2016.
217
+
218
+ Abhinav Shrivastava, Abhinav Gupta, and Ross Girshick. Training region-based object detectors with online hard example mining. In CVPR, pp. 761–769, 2016.
219
+
220
+ Hwanjun Song, Minseok Kim, and Jae-Gil Lee. SELFIE: Refurbishing unclean samples for robust deep learning. In ICML, pp. 5907–5915, 2019.
221
+
222
+ Luis Torgo. Data mining with R: learning with case studies. Chapman and Hall/CRC, 2011.
223
+
224
+ Yulia Tsvetkov, Manaal Faruqui, Wang Ling, Brian MacWhinney, and Chris Dyer. Learning the curriculum with bayesian optimization for task-specific word representation learning. In ACL, pp. 130–139, 2016.
225
+
226
+ Shengjie Wang, Wenruo Bai, Chandrashekhar Lavania, and Jeff Bilmes. Fixing mini-batch sequences with hierarchical robust partitioning. In AISTATS, pp. 3352–3361, 2019.
227
+
228
+ Bernard Widrow, Istvan Kollar, and Ming-Chang Liu. Statistical theory of quantization. IEEE Transactions on instrumentation and measurement, 45(2):353–361, 1996.
229
+
230
+ Tianyi Zhou and Jeff Bilmes. Minimax curriculum learning: Machine teaching with desirable difficulties and scheduled diversity. In ICLR, 2018.
231
+
232
+ # A HYPERPARAMETER SELECTION
233
+
234
+ Recency Bias receives the two hyperparameters: $( i )$ the initial selection pressure $s _ { e _ { 0 } }$ that determines the sampling probability gap between the most and the least uncertain samples and $( i i )$ the window size $q$ that determines how many recent label predictions are involved in predicting the uncertainty. To decide the best hyperparameters, we trained ResNet $( \mathrm { L } { = } 5 0 )$ ) on CIFAR-10 and CIFAR-100 with a momentum optimizer. For hyperparameters selection, the two hyperparameters were chosen in a grid $s _ { e _ { 0 } } \in \{ 1 , 1 0 , \mathsf { \bar { 1 0 0 } } , 1 0 0 0 \}$ and $\mathsf { \bar { q } } \in \{ 5 , 1 0 , 1 5 \}$ .
235
+
236
+ ![](images/53618c6fcbdac2807406a8e3fde6e99b9b68913788a6e1b1e27d2915609b591c.jpg)
237
+ Figure 7: Grid search on CIFAR-10 and CIFAR-100 datasets using ResNet.
238
+
239
+ Figure 7 shows the test errors of Recency Bias obtained by the grid search on the two datasets. Regarding the initial selection pressure $s _ { e _ { 0 } }$ , the lowest test error was typically achieved when the $s _ { e _ { 0 } }$ value was 100. As for the window size $q$ , the test error was almost always the lowest when the $q$ value was 10. Similar trends were observed for the other combinations of a neural network and an optimizer. Therefore, in all experiments, we set $s _ { e _ { 0 } }$ to be 100 and $q$ to be 10.
240
+
241
+ # B EXPERIMENT USING TINY-IMAGENET DATASET
242
+
243
+ For a larger-scale experiment, we repeated the image classification task on Tiny-ImageNet (200 classes), a subset of ImageNet (Krizhevsky et al., 2012), with 100, 000 training and $1 0 , 0 0 0$ validation images. Because no test set exists, we used the validation set as the test data. For Tiny-ImageNet dataset, we trained the network for 80, 000 iterations and used an initial learning rate of 0.1, which was divided by 10 at $5 0 \%$ and $7 5 \%$ of the total number of training iterations. The remaining experimental configurations were the same as those in Section 5.2.
244
+
245
+ ![](images/a0eb70a7d351e780640a2e722bd4687c2db5edac63d5d35b4a532322ce1bc99e.jpg)
246
+ 1 20 40 60 80 10Figure 8: Convergence curves of four batch selection strategies using DenseNet with momentum.
247
+
248
+ Table 4: The best test errors $( \% )$ of four batch selection strategies using DenseNet.
249
+
250
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Random Batch</td><td rowspan=1 colspan=1>Online Batch</td><td rowspan=1 colspan=1>ActiveBias</td><td rowspan=1 colspan=1>RecencyBias</td></tr><tr><td rowspan=1 colspan=1>Tiny-ImageNet</td><td rowspan=1 colspan=1>51.6 ± 0.26</td><td rowspan=1 colspan=1>52.5 ± 0.19</td><td rowspan=1 colspan=1>52.2± 0.52</td><td rowspan=1 colspan=1>51.0± 0.34</td></tr></table>
251
+
252
+ Figure 8 shows the convergence curves of training loss and test error using four batch selection strategies on Tiny-ImageNet, where the best test errors are detailed in Table 4. Again, only Recency Bias converged faster than Random Batch in both training loss and test error. On the other hand, although Online Batch showed the fastest convergence in training loss, its test error was worse than that of Random Batch because of the overfitting to hard training samples. Similarly, the test error of Active Bias was also worse than that of Random Batch because of the side effect of slowing down the convergence speed of training. In summary, Recency Bias achieved the test error relatively lower by $1 . 1 6 \%$ than Random Batch, $\bar { 2 . 8 6 \% }$ than Online Batch, and $2 . 3 0 \%$ than Active Bias.
253
+
254
+ # C GENERALIZATION OF Recency Bias
255
+
256
+ # C.1 CONVERGENCE CURVES USING DENSENET WITH SGD
257
+
258
+ Figure 9 shows the convergence curves of training loss and test error for four batch selection strategies using DenseNet and an SGD optimizer, which corresponds to the right side of Table 1.
259
+
260
+ ![](images/32e305ef129f849ef76894fc807af1fec09da6e472faa0f50ac6fdcecea3e289.jpg)
261
+ Figure 9: Convergence curves of four batch selection strategies using DenseNet with SGD.
262
+
263
+ # C.2 CONVERGENCE CURVES USING RESNET WITH MOMENTUM
264
+
265
+ Figure 10 shows the convergence curves of training loss and test error for four batch selection strategies using ResNet and a momentum optimizer, which corresponds to the left side of Table 2.
266
+
267
+ ![](images/859e6d9d9092bded29cb986dc8ac0591e6b7b2151db8e195070b18f50914df01.jpg)
268
+ Figure 10: Convergence curves of four batch selection strategies using ResNet with momentum.
269
+
270
+ # C.3 CONVERGENCE CURVES USING RESNET WITH SGD
271
+
272
+ Figure 11 shows the convergence curves of training loss and test error for four batch selection strategies using ResNet and an SGD optimizer, which corresponds to the right side of Table 2.
273
+
274
+ ![](images/9cdd13b1ed5dfb72b5ff3cffb7c31970c326a62bbae008f231ee97515d954596.jpg)
275
+ Figure 11: Convergence curves of four batch selection strategies using ResNet with SGD.
md/train/BydrOIcle/BydrOIcle.md ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNROLLED GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ Luke Metz∗
4
+ Google Brain
5
+ lmetz@google.com
6
+ Ben Poole†
7
+ Stanford University
8
+ poole@cs.stanford.edu
9
+
10
+ David Pfau Google DeepMind pfau@google.com
11
+
12
+ Jascha Sohl-Dickstein Google Brain jaschasd@google.com
13
+
14
+ # ABSTRACT
15
+
16
+ We introduce a method to stabilize Generative Adversarial Networks (GANs) by defining the generator objective with respect to an unrolled optimization of the discriminator. This allows training to be adjusted between using the optimal discriminator in the generator’s objective, which is ideal but infeasible in practice, and using the current value of the discriminator, which is often unstable and leads to poor solutions. We show how this technique solves the common problem of mode collapse, stabilizes training of GANs with complex recurrent generators, and increases diversity and coverage of the data distribution by the generator.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ The use of deep neural networks as generative models for complex data has made great advances in recent years. This success has been achieved through a surprising diversity of training losses and model architectures, including denoising autoencoders (Vincent et al., 2010), variational autoencoders (Kingma & Welling, 2013; Rezende et al., 2014; Gregor et al., 2015; Kulkarni et al., 2015; Burda et al., 2015; Kingma et al., 2016), generative stochastic networks (Alain et al., 2015), diffusion probabilistic models (Sohl-Dickstein et al., 2015), autoregressive models (Theis & Bethge, 2015; van den Oord et al., 2016a;b), real non-volume preserving transformations (Dinh et al., 2014; 2016), Helmholtz machines (Dayan et al., 1995; Bornschein et al., 2015), and Generative Adversarial Networks (GANs) (Goodfellow et al., 2014).
21
+
22
+ # 1.1 GENERATIVE ADVERSARIAL NETWORKS
23
+
24
+ While most deep generative models are trained by maximizing log likelihood or a lower bound on log likelihood, GANs take a radically different approach that does not require inference or explicit calculation of the data likelihood. Instead, two models are used to solve a minimax game: a generator which samples data, and a discriminator which classifies the data as real or generated. In theory these models are capable of modeling an arbitrarily complex probability distribution. When using the optimal discriminator for a given class of generators, the original GAN proposed by Goodfellow et al. minimizes the Jensen-Shannon divergence between the data distribution and the generator, and extensions generalize this to a wider class of divergences (Nowozin et al., 2016; Sonderby et al., 2016; Poole et al., 2016).
25
+
26
+ The ability to train extremely flexible generating functions, without explicitly computing likelihoods or performing inference, and while targeting more mode-seeking divergences as made GANs extremely successful in image generation (Odena et al., 2016; Salimans et al., 2016; Radford et al., 2015), and image super resolution (Ledig et al., 2016). The flexibility of the GAN framework has also enabled a number of successful extensions of the technique, for instance for structured prediction (Reed et al., 2016a;b; Odena et al., 2016), training energy based models (Zhao et al., 2016), and combining the GAN loss with a mutual information loss (Chen et al., 2016).
27
+
28
+ In practice, however, GANs suffer from many issues, particularly during training. One common failure mode involves the generator collapsing to produce only a single sample or a small family of very similar samples. Another involves the generator and discriminator oscillating during training, rather than converging to a fixed point. In addition, if one agent becomes much more powerful than the other, the learning signal to the other agent becomes useless, and the system does not learn. To train GANs many tricks must be employed, such as careful selection of architectures (Radford et al., 2015), minibatch discrimination (Salimans et al., 2016), and noise injection (Salimans et al., 2016; Sonderby et al., 2016). Even with these tricks the set of hyperparameters for which training is successful is generally very small in practice.
29
+
30
+ Once converged, the generative models produced by the GAN training procedure normally do not cover the whole distribution (Dumoulin et al., 2016; Che et al., 2016), even when targeting a modecovering divergence such as KL. Additionally, because it is intractable to compute the GAN training loss, and because approximate measures of performance such as Parzen window estimates suffer from major flaws (Theis et al., 2016), evaluation of GAN performance is challenging. Currently, human judgement of sample quality is one of the leading metrics for evaluating GANs. In practice this metric does not take into account mode dropping if the number of modes is greater than the number of samples one is visualizing. In fact, the mode dropping problem generally helps visual sample quality as the model can choose to focus on only the most common modes. These common modes correspond, by definition, to more typical samples. Additionally, the generative model is able to allocate more expressive power to the modes it does cover than it would if it attempted to cover all modes.
31
+
32
+ # 1.2 DIFFERENTIATING THROUGH OPTIMIZATION
33
+
34
+ Many optimization schemes, including SGD, RMSProp (Tieleman & Hinton, 2012), and Adam (Kingma & Ba, 2014), consist of a sequence of differentiable updates to parameters. Gradients can be backpropagated through unrolled optimization updates in a similar fashion to backpropagation through a recurrent neural network. The parameters output by the optimizer can thus be included, in a differentiable way, in another objective (Maclaurin et al., 2015). This idea was first suggested for minimax problems in (Pearlmutter & Siskind, 2008), while (Zhang & Lesser, 2010) provided a theoretical analysis and experimental results on differentiating through a single step of gradient ascent for simple matrix games. Differentiating through unrolled optimization was first scaled to deep networks in (Maclaurin et al., 2015), where it was used for hyperparameter optimization. More recently, (Belanger & McCallum, 2015; Han et al., 2016; Andrychowicz et al., 2016) backpropagate through optimization procedures in contexts unrelated to GANs or minimax games.
35
+
36
+ In this work we address the challenges of unstable optimization and mode collapse in GANs by unrolling optimization of the discriminator objective during training.
37
+
38
+ # 2 METHOD
39
+
40
+ # 2.1 GENERATIVE ADVERSARIAL NETWORKS
41
+
42
+ The GAN learning problem is to find the optimal parameters $\theta _ { G } ^ { * }$ for a generator function $G \left( z ; \theta _ { G } \right)$ in a minimax objective,
43
+
44
+ $$
45
+ \begin{array} { c } { { \theta _ { G } ^ { * } = \underset { \theta _ { G } } { \mathrm { a r g m i n } } \underset { \theta _ { D } } { \mathrm { m a x } } f \left( \theta _ { G } , \theta _ { D } \right) } } \\ { { \ \mathrm { ~ } } } \\ { { \displaystyle \qquad = \underset { \theta _ { G } } { \mathrm { a r g m i n } } f \left( \theta _ { G } , \theta _ { D } ^ { * } \left( \theta _ { G } \right) \right) } } \\ { { \theta _ { D } ^ { * } \left( \theta _ { G } \right) = \underset { \theta _ { D } } { \mathrm { a r g m a x } } f \left( \theta _ { G } , \theta _ { D } \right) , } } \end{array}
46
+ $$
47
+
48
+ where $f$ is commonly chosen to be
49
+
50
+ $$
51
+ f \left( \theta _ { G } , \theta _ { D } \right) = \mathbb { E } _ { x \sim p _ { d a t a } } \left[ \log \left( D \left( x ; \theta _ { D } \right) \right) \right] + \mathbb { E } _ { z \sim N ( 0 , I ) } \left[ \log \left( 1 - D \left( G \left( z ; \theta _ { G } \right) ; \theta _ { D } \right) \right) \right] .
52
+ $$
53
+
54
+ Here $x \in \mathcal { X }$ is the data variable, $z \in { \mathcal { Z } }$ is the latent variable, $p _ { d a t a }$ is the data distribution, the discriminator $D ( \cdot ; \theta _ { D } ) : \mathcal { X } [ 0 , 1 ]$ outputs the estimated probability that a sample $x$ comes from the data distribution, $\theta _ { D }$ and $\theta _ { G }$ are the discriminator and generator parameters, and the generator function $G ( \cdot ; \theta _ { G } ) : \mathcal { Z } \mathcal { X }$ transforms a sample in the latent space into a sample in the data space.
55
+
56
+ For the minimax loss in Eq. 4, the optimal discriminator $D ^ { \ast } \left( x \right)$ is a known smooth function of the generator probability $p _ { G } \left( x \right)$ (Goodfellow et al., 2014),
57
+
58
+ $$
59
+ D ^ { * } \left( x \right) = \frac { p _ { d a t a } \left( x \right) } { p _ { d a t a } \left( x \right) + p _ { G } \left( x \right) } .
60
+ $$
61
+
62
+ When the generator loss in Eq. 2 is rewritten directly in terms of $p _ { G } \left( x \right)$ and Eq. 5 rather than $\theta _ { G }$ and $\theta _ { D } ^ { * } \left( \theta _ { G } ^ { - } \right)$ , then it is similarly a smooth function of $p _ { G } \left( x \right)$ . These smoothness guarantees are typically lost when $D \left( x ; \theta _ { D } \right)$ and $G \left( z ; \theta _ { G } \right)$ are drawn from parametric families. They nonetheless suggest that the true generator objective in Eq. 2 will often be well behaved, and is a desirable target for direct optimization.
63
+
64
+ Explicitly solving for the optimal discriminator parameters $\theta _ { D } ^ { * } \left( \theta _ { G } \right) $ for every update step of the generator $G$ is computationally infeasible for discriminators based on neural networks. Therefore this minimax optimization problem is typically solved by alternating gradient descent on $\theta _ { G }$ and ascent on $\theta _ { D }$ .
65
+
66
+ The optimal solution $\theta ^ { * } = \{ \theta _ { G } ^ { * } , \theta _ { D } ^ { * } \}$ is a fixed point of these iterative learning dynamics. Additionally, if $f \left( { \theta } _ { G } , { \theta } _ { D } \right)$ is convex in $\theta _ { G }$ and concave in $\theta _ { D }$ , then alternating gradient descent (ascent) trust region updates are guaranteed to converge to the fixed point, under certain additional weak assumptions (Juditsky et al., 2011). However in practice $f \left( { \theta } _ { G } , { \theta } _ { D } \right)$ is typically very far from convex in $\theta _ { G }$ and concave in $\theta _ { D }$ , and updates are not constrained in an appropriate way. As a result GAN training suffers from mode collapse, undamped oscillations, and other problems detailed in Section 1.1. In order to address these difficulties, we will introduce a surrogate objective function $f _ { K } \left( \theta _ { G } , \theta _ { D } \right)$ for training the generator which more closely resembles the true generator objective $f \left( \theta _ { G } , \theta _ { D } ^ { * } \left( \theta _ { G } \right) \right)$ .
67
+
68
+ # 2.2 UNROLLING GANS
69
+
70
+ A local optimum of the discriminator parameters $\theta _ { D } ^ { * }$ can be expressed as the fixed point of an iterative optimization procedure,
71
+
72
+ $$
73
+ \begin{array} { c } { { \theta _ { D } ^ { 0 } = \theta _ { D } } } \\ { { \displaystyle } } \\ { { \theta _ { D } ^ { k + 1 } = \theta _ { D } ^ { k } + \eta ^ { k } \displaystyle \frac { \mathrm { d } f ( \theta _ { G } , \theta _ { D } ^ { k } ) } { \mathrm { d } \theta _ { D } ^ { k } } } } \\ { { \displaystyle } } \\ { { \theta _ { D } ^ { * } ( \theta _ { G } ) = \displaystyle \operatorname* { l i m } _ { k \infty } \theta _ { D } ^ { k } , } } \end{array}
74
+ $$
75
+
76
+ where $\eta ^ { k }$ is the learning rate schedule. For clarity, we have expressed Eq. 7 as a full batch steepest gradient ascent equation. More sophisticated optimizers can be similarly unrolled. In our experiments we unroll Adam (Kingma & Ba, 2014).
77
+
78
+ By unrolling for $K$ steps, we create a surrogate objective for the update of the generator,
79
+
80
+ $$
81
+ f _ { K } \left( \theta _ { G } , \theta _ { D } \right) = f \left( \theta _ { G } , \theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) \right) .
82
+ $$
83
+
84
+ When $K = 0$ this objective corresponds exactly to the standard GAN objective, while as $K \infty$ it corresponds to the true generator objective function $f \left( \theta _ { G } , \theta _ { D } ^ { * } \left( G \right) \right)$ . By adjusting the number of unrolling steps $K$ , we are thus able to interpolate between standard GAN training dynamics with their associated pathologies, and more costly gradient descent on the true generator loss.
85
+
86
+ # 2.3 PARAMETER UPDATES
87
+
88
+ The generator and discriminator parameter updates using this surrogate loss are
89
+
90
+ $$
91
+ \begin{array} { r l } & { \theta _ { G } \theta _ { G } - \eta \frac { \mathrm { d } f _ { K } ( \theta _ { G } , \theta _ { D } ) } { \mathrm { d } \theta _ { G } } } \\ & { \theta _ { D } \theta _ { D } + \eta \frac { \mathrm { d } f ( \theta _ { G } , \theta _ { D } ) } { \mathrm { d } \theta _ { D } } . } \end{array}
92
+ $$
93
+
94
+ For clarity we use full batch steepest gradient descent (ascent) with stepsize $\eta$ above, while in experiments we instead use minibatch Adam for both updates. The gradient in Eq. 10 requires backpropagating through the optimization process in Eq. 7. A clear description of differentiation through gradient descent is given as Algorithm 2 in (Maclaurin et al., 2015), though in practice the use of an automatic differentiation package means this step does not need to be programmed explicitly. A pictorial representation of these updates is provided in Figure 1.
95
+
96
+ ![](images/b8d41d44f95393092b08110ba25482b02bb1bcb0a2930f383731e4e370791ca3.jpg)
97
+ Figure 1: An illustration of the computation graph for an unrolled GAN with 3 unrolling steps. The generator update in Equation 10 involves backpropagating the generator gradient (blue arrows) through the unrolled optimization. Each step $k$ in the unrolled optimization uses the gradients of $f _ { k }$ with respect to $\theta _ { D } ^ { k }$ , as described in Equation 7 and indicated by the green arrows. The discriminator update in Equation 11 does not depend on the unrolled optimization (red arrow).
98
+
99
+ It is important to distinguish this from an approach suggested in (Goodfellow et al., 2014), that several update steps of the discriminator parameters should be run before each single update step for the generator. In that approach, the update steps for both models are still gradient descent (ascent) with respect to fixed values of the other model parameters, rather than the surrogate loss we describe in Eq. 9. Performing $K$ steps of discriminator update between each single step of generator update corresponds to updating the generator parameters $\theta _ { G }$ using only the first term in Eq. 12 below.
100
+
101
+ # 2.4 THE MISSING GRADIENT TERM
102
+
103
+ To better understand the behavior of the surrogate loss $f _ { K } \left( \theta _ { G } , \theta _ { D } \right)$ , we examine its gradient with respect to the generator parameters $\theta _ { G }$ ,
104
+
105
+ $$
106
+ \frac { \mathrm { d } f _ { K } \left( \theta _ { G } , \theta _ { D } \right) } { \mathrm { d } \theta _ { G } } = \frac { \partial f \left( \theta _ { G } , \theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) \right) } { \partial \theta _ { G } } + \frac { \partial f \left( \theta _ { G } , \theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) \right) } { \partial \theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) } \frac { \mathrm { d } \theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) } { \mathrm { d } \theta _ { G } } .
107
+ $$
108
+
109
+ Standard GAN training corresponds exactly to updating the generator parameters using only the first term in this gradient, with $\theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) $ being the parameters resulting from the discriminator update step. An optimal generator for any fixed discriminator is a delta function at the $x$ to which the discriminator assigns highest data probability. Therefore, in standard GAN training, each generator update step is a partial collapse towards a delta function.
110
+
111
+ The second term captures how the discriminator would react to a change in the generator. It reduces the tendency of the generator to engage in mode collapse. For instance, the second term reflects that as the generator collapses towards a delta function, the discriminator reacts and assigns lower probability to that state, increasing the generator loss. It therefore discourages the generator from collapsing, and may improve stability.
112
+
113
+ As $K \infty$ , $\theta _ { D } ^ { K }$ goes to a local optimum of $f$ , where $\frac { \partial f } { \partial \theta _ { D } ^ { K } } = 0$ , and therefore the second term in Eq. 12 goes to 0 (Danskin, 1967). The gradient of the unrolled surrogate loss $f _ { K } \left( \theta _ { G } , \theta _ { D } \right)$ with respect to $\theta _ { G }$ is thus identical to the gradient of the standard GAN loss $f \bar { ( \theta _ { G } , \theta _ { D } ) }$ both when $K = 0$ and when $K \infty$ , where we take $K \infty$ to imply that in the standard GAN the discriminator is also fully optimized between each generator update. Between these two extremes, $f _ { K } \left( \theta _ { G } , \theta _ { D } \right)$ captures additional information about the response of the discriminator to changes in the generator.
114
+
115
+ # 2.5 CONSEQUENCES OF THE SURROGATE LOSS
116
+
117
+ GANs can be thought of as a game between the discriminator $( D )$ and the generator $( G )$ . The agents take turns taking actions and updating their parameters until a Nash equilibrium is reached. The optimal action for $D$ is to evaluate the probability ratio $\frac { p _ { d a t a } ( x ) } { p _ { G } ( x ) + p _ { d a t a } ( x ) }$ for the generator’s move $x$ (Eq. 5). The optimal generator action is to move its mass to maximize this ratio.
118
+
119
+ The initial move for $G$ will be to move as much mass as its parametric family and update step permits to the single point that maximizes the ratio of probability densities. The action $D$ will then take is quite simple. It will track that point, and to the extent allowed by its own parametric family and update step assign low data probability to it, and uniform probability everywhere else. This cycle of $G$ moving and $D$ following will repeat forever or converge depending on the rate of change of the two agents. This is similar to the situation in simple matrix games like rock-paper-scissors and matching pennies, where alternating gradient descent (ascent) with a fixed learning rate is known not to converge (Singh et al., 2000; Bowling & Veloso, 2002).
120
+
121
+ In the unrolled case, however, this undesirable behavior no longer occurs. Now $G$ ’s actions take into account how $D$ will respond. In particular, $G$ will try to make steps that $D$ will have a hard time responding to. This extra information helps the generator spread its mass to make the next $D$ step less effective instead of collapsing to a point.
122
+
123
+ In principle, a surrogate loss function could be used for both $D$ and $G$ . In the case of 1-step unrolled optimization this is known to lead to convergence for games in which gradient descent (ascent) fails (Zhang & Lesser, 2010). However, the motivation for using the surrogate generator loss in Section 2.2, of unrolling the inner of two nested min and max functions, does not apply to using a surrogate discriminator loss. Additionally, it is more common for the discriminator to overpower the generator than vice-versa when training a GAN. Giving more information to $G$ by allowing it to ‘see into the future’ may thus help the two models be more balanced.
124
+
125
+ # 3 EXPERIMENTS
126
+
127
+ In this section we demonstrate improved mode coverage and stability by applying this technique to five datasets of increasing complexity. Evaluation of generative models is a notoriously hard problem (Theis et al., 2016). As such the de facto standard in GAN literature has become sample quality as evaluated by a human and/or evaluated by a heuristic (Inception score for example, (Salimans et al., 2016)). While these evaluation metrics do a reasonable job capturing sample quality, they fail to capture sample diversity. In our first 2 experiments diversity is easily evaluated via visual inspection. In our later experiments this is not the case, and we will use a variety of methods to quantify coverage of samples. Our measures are individually strongly suggestive of unrolling reducing mode-collapse and improving stability, but none of them alone are conclusive. We believe that taken together however, they provide extremely compelling evidence for the advantages of unrolling.
128
+
129
+ When doing stochastic optimization, we must choose which minibatches to use in the unrolling updates in Eq. 7. We experimented with both a fixed minibatch and re-sampled minibatches for each unrolling step, and found it did not significantly impact the result. We use fixed minibatches for all experiments in this section.
130
+
131
+ We provide a reference implementation of this technique at github.com/poolio/unrolled gan.
132
+
133
+ # 3.1 MIXTURE OF GAUSSIANS DATASET
134
+
135
+ To illustrate the impact of discriminator unrolling, we train a simple GAN architecture on a 2D mixture of 8 Gaussians arranged in a circle. For a detailed list of architecture and hyperparameters see Appendix A. Figure 2 shows the dynamics of this model through time. Without unrolling the generator rotates around the valid modes of the data distribution but is never able to spread out mass. When adding in unrolling steps $\mathbf { G }$ quickly learns to spread probability mass and the system converges to the data distribution.
136
+
137
+ In Appendix B we perform further experiments on this toy dataset. We explore how unrolling compares to historical averaging, and compares to using the unrolled discriminator to update the generator, but without backpropagating through the generator. In both cases we find that the unrolled objective performs better.
138
+
139
+ ![](images/a4459b06fa7e9fcdf667d911bf408b5c5ccfe73af1d14e29428d98326008c54a.jpg)
140
+ Figure 2: Unrolling the discriminator stabilizes GAN training on a toy 2D mixture of Gaussians dataset. Columns show a heatmap of the generator distribution after increasing numbers of training steps. The final column shows the data distribution. The top row shows training for a GAN with 10 unrolling steps. Its generator quickly spreads out and converges to the target distribution. The bottom row shows standard GAN training. The generator rotates through the modes of the data distribution. It never converges to a fixed distribution, and only ever assigns significant probability mass to a single data mode at once.
141
+
142
+ ![](images/ff67f1c079a9b83431ee462581bfb81893ea4eadc9da332a9fff1968becf8c08.jpg)
143
+ Figure 3: Unrolled GAN training increases stability for an RNN generator and convolutional discriminator trained on MNIST. The top row was run with 20 unrolling steps. The bottom row is a standard GAN, with 0 unrolling steps. Images are samples from the generator after the indicated number of training steps.
144
+
145
+ # 3.2 PATHOLOGICAL MODEL WITH MISMATCHED GENERATOR AND DISCRIMINATOR
146
+
147
+ To evaluate the ability of this approach to improve trainability, we look to a traditionally challenging family of models to train – recurrent neural networks (RNNs). In this experiment we try to generate MNIST samples using an LSTM (Hochreiter & Schmidhuber, 1997). MNIST digits are $2 8 \mathbf { x } 2 8$ pixel images. At each timestep of the generator LSTM, it outputs one column of this image, so that after 28 timesteps it has output the entire sample. We use a convolutional neural network as the discriminator. See Appendix C for the full model and training details. Unlike in all previously successful GAN models, there is no symmetry between the generator and the discriminator in this task, resulting in a more complex power balance. Results can be seen in Figure 3. Once again, without unrolling the model quickly collapses, and rotates through a sequence of single modes. Instead of rotating spatially, it cycles through proto-digit like blobs. When running with unrolling steps the generator disperses and appears to cover the whole data distribution, as in the 2D example.
148
+
149
+ <table><tr><td rowspan=1 colspan=1>Discriminator Size</td><td rowspan=1 colspan=1>Unrolling steps</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>1/4 size of D compared to G</td><td rowspan=1 colspan=1>Modes generated</td><td rowspan=1 colspan=1>30.6± 20.73</td><td rowspan=1 colspan=1>65.4 ± 34.75</td><td rowspan=1 colspan=1>236.4 ± 63.30</td><td rowspan=1 colspan=1>327.2 ± 74.67</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>KL(model||data)</td><td rowspan=1 colspan=1>5.99± 0.42</td><td rowspan=1 colspan=1>5.911 ± 0.14</td><td rowspan=1 colspan=1>4.67 ± 0.43</td><td rowspan=1 colspan=1>4.66 ± 0.46</td></tr><tr><td rowspan=1 colspan=1>1/2 size of D compared to G</td><td rowspan=1 colspan=1>Modes generated</td><td rowspan=1 colspan=1>628.0± 140.9</td><td rowspan=1 colspan=1>523.6± 55.768</td><td rowspan=1 colspan=1>732.0± 44.98</td><td rowspan=1 colspan=1>817.4 ± 37.91</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>KL(model||data)</td><td rowspan=1 colspan=1>2.58 ±0.751</td><td rowspan=1 colspan=1>2.44 ±0.26</td><td rowspan=1 colspan=1>1.66 ± 0.090</td><td rowspan=1 colspan=1>1.43 ± 0.12</td></tr></table>
150
+
151
+ Table 1: Unrolled GANs cover more discrete modes when modeling a dataset with 1,000 data modes, corresponding to all combinations of three MNIST digits $[ 1 0 ^ { 3 }$ digit combinations). The number of modes covered is given for different numbers of unrolling steps, and for two different architectures. The reverse KL divergence between model and data is also given. Standard error is provided for both measures.
152
+
153
+ # 3.3 MODE AND MANIFOLD COLLAPSE USING AUGMENTED MNIST
154
+
155
+ GANs suffer from two different types of model collapse – collapse to a subset of data modes, and collapse to a sub-manifold within the data distribution. In these experiments we isolate both effects using artificially constructed datasets, and demonstrate that unrolling can largely rescue both types of collapse.
156
+
157
+ # 3.3.1 DISCRETE MODE COLLAPSE
158
+
159
+ To explore the degree to which GANs drop discrete modes in a dataset, we use a technique similar to one from (Che et al., 2016). We construct a dataset by stacking three randomly chosen MNIST digits, so as to construct an RGB image with a different MNIST digit in each color channel. This new dataset has 1,000 distinct modes, corresponding to each combination of the ten MNIST classes in the three channels.
160
+
161
+ We train a GAN on this dataset, and generate samples from the trained model (25,600 samples for all experiments). We then compute the predicted class label of each color channel using a pre-trained MNIST classifier. To evaluate performance, we use two metrics: the number of modes for which the generator produced at least one sample, and the KL divergence between the model and the expected data distribution. Within this discrete label space, a KL divergence can be estimated tractably between the generated samples and the data distribution over classes, where the data distribution is a uniform distribution over all 1,000 classes.
162
+
163
+ As presented in Table 1, as the number of unrolling steps is increased, both mode coverage and reverse KL divergence improve. Contrary to (Che et al., 2016), we found that reasonably sized models (such as the one used in Section 3.4) covered all 1,000 modes even without unrolling. As such we use smaller convolutional GAN models. Details on the models used are provided in Appendix E.
164
+
165
+ We observe an additional interesting effect in this experiment. The benefits of unrolling increase as the discriminator size is reduced. We believe unrolling effectively increases the capacity of the discriminator. The unrolled discriminator can better react to any specific way in which the generator is producing non-data-like samples. When the discriminator is weak, the positive impact of unrolling is thus larger.
166
+
167
+ # 3.3.2 MANIFOLD COLLAPSE
168
+
169
+ In addition to discrete modes, we examine the effect of unrolling when modeling continuous manifolds. To get at this quantity, we constructed a dataset consisting of colored MNIST digits. Unlike in the previous experiment, a single MNIST digit was chosen, and then assigned a single monochromatic color. With a perfect generator, one should be able to recover the distribution of colors used to generate the digits. We use colored MNIST digits so that the generator also has to model the digits, which makes the task sufficiently complex that the generator is unable to perfectly solve it. The color of each digit is sampled from a 3D normal distribution. Details of this dataset are provided in Appendix F. We will examine the distribution of colors in the samples generated by the trained GAN. As will also be true in the CIFAR10 example in Section 3.4, the lack of diversity in generated colors is almost invisible using only visual inspection of the samples. Samples can be found in Appendix F.
170
+
171
+ Table 2: Unrolled GANs better model a continuous distribution. GANs are trained to model randomly colored MNIST digits, where the color is drawn from a Gaussian distribution. The JS divergence between the data and model distributions over digit colors is then reported, along with standard error in the JS divergence. More unrolling steps, and larger models, lead to better JS divergence.
172
+
173
+ <table><tr><td rowspan=1 colspan=1>Unrolling steps</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>JS divergence with 1/4 layer size</td><td rowspan=1 colspan=1>0.073 ± 0.0058</td><td rowspan=1 colspan=1>0.142 ± 0.028</td><td rowspan=1 colspan=1>0.049 ± 0.0021</td><td rowspan=1 colspan=1>0.075 ± 0.012</td></tr><tr><td rowspan=1 colspan=1>JS divergence with 1/2 layer size</td><td rowspan=1 colspan=1>0.095 ± 0.011</td><td rowspan=1 colspan=1>0.119 ± 0.010</td><td rowspan=1 colspan=1>0.055 ± 0.0049</td><td rowspan=1 colspan=1>0.074± 0.016</td></tr><tr><td rowspan=1 colspan=1>JS divergence with 1/1 layer size</td><td rowspan=1 colspan=1>0.034 ± 0.0034</td><td rowspan=1 colspan=1>0.050± 0.0026</td><td rowspan=1 colspan=1>0.027 ± 0.0028</td><td rowspan=1 colspan=1>0.025 ± 0.00076</td></tr></table>
174
+
175
+ ![](images/3c9a4f15816f9475e20e64fe6d880999dbc71b9039d3a86102ace92afbbde1f2.jpg)
176
+ Figure 4: Visual perception of sample quality and diversity is very similar for models trained with different numbers of unrolling steps. Actual sample diversity is higher with more unrolling steps. Each pane shows samples generated after training a model on CIFAR10 with 0, 1, 5, and 10 steps of unrolling.
177
+
178
+ In order to recover the color the GAN assigned to the digit, we used k-means with 2 clusters, to pick out the foreground color from the background. We then performed this transformation for both the training data and the generated images. Next we fit a Gaussian kernel density estimator to both distributions over digit colors. Finally, we computed the JS divergence between the model and data distributions over colors. Results can be found in Table 2 for several model sizes. Details of the models are provided in Appendix F.
179
+
180
+ In general, the best performing models are unrolled for 5-10 steps, and larger models perform better than smaller models. Counter-intuitively, taking 1 unrolling step seems to hurt this measure of diversity. We suspect that this is due to it introducing oscillatory dynamics into training. Taking more unrolling steps however leads to improved performance with unrolling.
181
+
182
+ # 3.4 IMAGE MODELING OF CIFAR10
183
+
184
+ Here we test our technique on a more traditional convolutional GAN architecture and task, similar to those used in (Radford et al., 2015; Salimans et al., 2016). In the previous experiments we tested models where the standard GAN training algorithm would not converge. In this section we improve a standard model by reducing its tendency to engage in mode collapse. We ran 4 configurations of this model, varying the number of unrolling steps to be 0, 1, 5, or 10. Each configuration was run 5 times with different random seeds. For full training details see Appendix D. Samples from each of the 4 configurations can be found in Figure 4. There is no obvious difference in visual quality across these model configurations. Visual inspection however provides only a poor measure of sample diversity.
185
+
186
+ By training with an unrolled discriminator, we expect to generate more diverse samples which more closely resemble the underlying data distribution. We introduce two techniques to examine sample diversity: inference via optimization, and pairwise distance distributions.
187
+
188
+ <table><tr><td rowspan=1 colspan=1>Unrolling Steps</td><td rowspan=1 colspan=1>0 steps</td><td rowspan=1 colspan=1>1 step</td><td rowspan=1 colspan=1>5 steps</td><td rowspan=1 colspan=1>10 steps</td></tr><tr><td rowspan=1 colspan=1>Average MSE</td><td rowspan=1 colspan=1>0.0231± 0.0024</td><td rowspan=1 colspan=1>0.0195 ± 0.0021</td><td rowspan=1 colspan=1>0.0200± 0.0023</td><td rowspan=1 colspan=1>0.0181± 0.0018</td></tr><tr><td rowspan=1 colspan=1>PercentBestRank</td><td rowspan=1 colspan=1>0.63%</td><td rowspan=1 colspan=1>22.97%</td><td rowspan=1 colspan=1>15.31%</td><td rowspan=1 colspan=1>61.09 %</td></tr></table>
189
+
190
+ Table 3: GANs trained with unrolling are better able to match images in the training set than standard GANs, likely due to mode dropping by the standard GAN. Results show the MSE between training images and the best reconstruction for a model with the given number of unrolling steps. The fraction of training images best reconstructed by a given model is given in the final column. The best reconstructions is found by optimizing the latent representation $z$ to produce the closest matching pixel output $G \left( z ; \theta _ { G } \right)$ . Results are averaged over all 5 runs of each model with different random seeds.
191
+
192
+ # 3.4.1 INFERENCE VIA OPTIMIZATION
193
+
194
+ Since likelihood cannot be tractably computed, over-fitting of GANs is typically tested by taking samples and computing the nearest-neighbor images in pixel space from the training data (Goodfellow et al., 2014). We will do the reverse, and measure the ability of the generative model to generate images that look like specific samples from the training data. If we did this by generating random samples from the model, we would need an exponentially large number of samples. We instead treat finding the nearest neighbor $x _ { \mathrm { n e a r e s t } }$ to a target image $x _ { \mathrm { { t a r g e t } } }$ as an optimization task,
195
+
196
+ $$
197
+ \begin{array} { r l } & { z _ { \mathrm { n e a r e s t } } = \underset { z } { \mathrm { a r g m i n } } | | G ( z ; \theta _ { G } ) - x _ { \mathrm { t a r g e t } } | \rvert _ { 2 } ^ { 2 } } \\ & { x _ { \mathrm { n e a r e s t } } = G ( z _ { \mathrm { n e a r e s t } } ; \theta _ { G } ) . } \end{array}
198
+ $$
199
+
200
+ This concept of backpropagating to generate images has been widely used in visualizing features from discriminative networks (Simonyan et al., 2013; Yosinski et al., 2015; Nguyen et al., 2016) and has been applied to explore the visual manifold of GANs in (Zhu et al., 2016).
201
+
202
+ We apply this technique to each of the models trained. We optimize with 3 random starts using LBFGS, which is the optimizer typically used in similar settings such as style transfer (Johnson et al., 2016; Champandard, 2016). Results comparing average mean squared errors between xnearest and $x _ { \mathrm { { t a r g e t } } }$ in pixel space can be found in Table 3. In addition we compute the percent of images for which a certain configuration achieves the lowest loss when compared to the other configurations.
203
+
204
+ In the zero step case, there is poor reconstruction and less than $1 \%$ of the time does it obtain the lowest error of the 4 configurations. Taking 1 unrolling step results in a significant improvement in MSE. Taking 10 unrolling steps results in more modest improvement, but continues to reduce the reconstruction MSE.
205
+
206
+ To visually see this, we compare the result of the optimization process for 0, 1, 5, and 10 step configurations in Figure 5. To select for images where differences in behavior is most apparent, we sort the data by the absolute value of a fractional difference in MSE between the 0 and 10 step models, $\left| \frac { l _ { 0 s t e p } - l _ { 1 0 s t e p } } { \frac { 1 } { 2 } ( l _ { 0 s t e p } + l _ { 1 0 s t e p } ) } \right|$ This highlights examples where either the 0 or 10 step model cannot accurately fit the data example but the other can. In Appendix G we show the same comparison for models initialized using different random seeds. Many of the zero step images are fuzzy and illdefined suggesting that these images cannot be generated by the standard GAN generative model, and come from a dropped mode. As more unrolling steps are added, the outlines become more clear and well defined – the model covers more of the distribution and thus can recreate these samples.
207
+
208
+ # 3.4.2 PAIRWISE DISTANCES
209
+
210
+ A second complementary approach is to compare statistics of data samples to the corresponding statistics for samples generated by the various models. One particularly simple and relevant statistic is the distribution over pairwise distances between random pairs of samples. In the case of mode collapse, greater probability mass will be concentrated in smaller volumes, and the distribution over inter-sample distances should be skewed towards smaller distances. We sample random pairs of images from each model, as well as from the training data, and compute histograms of the $\ell _ { 2 }$ distances between those sample pairs. As illustrated in Figure 6, the standard GAN, with zero unrolling steps, has its probability mass skewed towards smaller $\ell _ { 2 }$ intersample distances, compared to real data. As the number of unrolling steps is increased, the histograms over intersample distances increasingly come to resemble that for the data distribution. This is further evidence in support of unrolling decreasing the mode collapse behavior of GANs.
211
+
212
+ ![](images/3f34af532391d651dea1658c3e0b24559b5a1f84c026a63aecddf941edff8580.jpg)
213
+ Figure 5: Training set images are more accurately reconstructed using GANs trained with unrolling than by a standard (0 step) GAN, likely due to mode dropping by the standard GAN. Raw data is on the left, and the optimized images to reach this target follow for 0, 1, 5, and 10 unrolling steps. The reconstruction MSE is listed below each sample. A random 1280 images where selected from the training set, and corresponding best reconstructions for each model were found via optimization. Shown here are the eight images with the largest absolute fractional difference between GANs trained with 0 and 10 unrolling steps.
214
+
215
+ # 4 DISCUSSION
216
+
217
+ In this work we developed a method to stabilize GAN training and reduce mode collapse by defining the generator objective with respect to unrolled optimization of the discriminator. We then demonstrated the application of this method to several tasks, where it either rescued unstable training, or reduced the tendency of the model to drop regions of the data distribution.
218
+
219
+ The main drawback to this method is computational cost of each training step, which increases linearly with the number of unrolling steps. There is a tradeoff between better approximating the true generator loss and the computation required to make this estimate. Depending on the architecture, one unrolling step can be enough. In other more unstable models, such as the RNN case, more are needed to stabilize training. We have some initial positive results suggesting it may be sufficient to further perturb the training gradient in the same direction that a single unrolling step perturbs it. While this is more computationally efficient, further investigation is required.
220
+
221
+ The method presented here bridges some of the gap between theoretical and practical results for training of GANs. We believe developing better update rules for the generator and discriminator is an important line of work for GAN training. In this work we have only considered a small fraction of the design space. For instance, the approach could be extended to unroll $G$ when updating $D$ as well – letting the discriminator react to how the generator would move. It is also possible to unroll sequences of $G$ and $D$ updates. This would make updates that are recursive: $G$ could react to maximize performance as if $G$ and $D$ had already updated.
222
+
223
+ # ACKNOWLEDGMENTS
224
+
225
+ We would like to thank Laurent Dinh, David Dohan, Vincent Dumoulin, Liam Fedus, Ishaan Gulrajani, Julian Ibarz, Eric Jang, Matthew Johnson, Marc Lanctot, Augustus Odena, Gabriel Pereyra,
226
+
227
+ ![](images/34368461772c640ab500044ba570ada5248c204871939191a4efbed64c4bf4ee.jpg)
228
+ Figure 6: As the number of unrolling steps in GAN training is increased, the distribution of pairwise distances between model samples more closely resembles the same distribution for the data. Here we plot histograms of pairwise distances between randomly selected samples. The red line gives pairwise distances in the data, while each of the five blue lines in each plot represents a model trained with a different random seed. The vertical lines are the medians of each distribution.
229
+
230
+ Colin Raffel, Sam Schoenholz, Ayush Sekhari, Jon Shlens, and Dale Schuurmans for insightful conversation, as well as the rest of the Google Brain Team.
231
+
232
+ # REFERENCES
233
+
234
+ Guillaume Alain, Yoshua Bengio, Li Yao, Jason Yosinski, Eric Thibodeau-Laufer, Saizheng Zhang, and Pascal Vincent. Gsns : Generative stochastic networks. arXiv preprint arXiv:1503.05571, 2015.
235
+
236
+ 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. arXiv preprint arXiv:1606.04474, 2016.
237
+
238
+ David Belanger and Andrew McCallum. Structured prediction energy networks. arXiv preprint arXiv:1511.06350, 2015.
239
+
240
+ Jorg Bornschein, Samira Shabanian, Asja Fischer, and Yoshua Bengio. Bidirectional helmholtz machines. arXiv preprint arXiv:1506.03877, 2015.
241
+
242
+ Michael Bowling and Manuela Veloso. Multiagent learning using a variable learning rate. Artificial Intelligence, 136(2):215–250, 2002.
243
+
244
+ Yuri Burda, Roger B. Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
245
+
246
+ Alex J. Champandard. Semantic style transfer and turning two-bit doodles into fine artworks. arXiv preprint arXiv:1603.01768, 2016.
247
+
248
+ Tong Che, Yanran Li, Athul Paul Jacob, Yoshua Bengio, and Wenjie Li. Mode regularized generative adversarial networks. arXiv preprint arXiv: 1612.02136, 2016.
249
+
250
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. arXiv preprint arXiv:1606.03657, 2016.
251
+
252
+ John M Danskin. The theory of max-min and its application to weapons allocation problems, volume 5. Springer Science & Business Media, 1967.
253
+
254
+ Peter Dayan, Geoffrey E Hinton, Radford M Neal, and Richard S Zemel. The helmholtz machine. Neural computation, 7(5):889–904, 1995.
255
+
256
+ Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
257
+
258
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real NVP. arXiv preprint arXiv:1605.08803, 2016.
259
+
260
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
261
+
262
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In JMLR W&CP: Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2010), volume 9, pp. 249–256, May 2010.
263
+
264
+ 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.
265
+
266
+ Karol Gregor, Ivo Danihelka, Alex Graves, and Daan Wierstra. DRAW: A recurrent neural network for image generation. In Proceedings of The 32nd International Conference on Machine Learning, pp. 1462–1471, 2015. URL http://www.jmlr.org/proceedings/papers/v37/ gregor15.html.
267
+
268
+ Tian Han, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. Alternating back-propagation for generator network, 2016. URL https://arxiv.org/abs/1606.08571.
269
+
270
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8):1735– 1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx. doi.org/10.1162/neco.1997.9.8.1735.
271
+
272
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, pp. 448–456, 2015. URL http://jmlr. org/proceedings/papers/v37/ioffe15.html.
273
+
274
+ Justin Johnson, Alexandre Alahi, and Fei-Fei Li. Perceptual losses for real-time style transfer and super-resolution. arXiv preprint arXiv:1603.08155, 2016.
275
+
276
+ Anatoli Juditsky, Arkadi Nemirovski, et al. First order methods for nonsmooth convex large-scale optimization, i: general purpose methods. Optimization for Machine Learning, pp. 121–148, 2011.
277
+
278
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
279
+
280
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes, 2013. URL https: //arxiv.org/abs/1312.6114.
281
+
282
+ Diederik P. Kingma, Tim Salimans, and Max Welling. Improving variational inference with inverse autoregressive flow. 2016.
283
+
284
+ Tejas D. Kulkarni, Will Whitney, Pushmeet Kohli, and Joshua B. Tenenbaum. Deep convolutional inverse graphics network. arXiv preprint arXiv:1503.03167, 2015.
285
+
286
+ Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image super-resolution using a generative adversarial network, 2016. URL https://arxiv.org/abs/1609.04802.
287
+
288
+ Dougal Maclaurin, David Duvenaud, and Ryan P. Adams. Gradient-based hyperparameter optimization through reversible learning, 2015.
289
+
290
+ Anh Nguyen, Alexey Dosovitskiy, Jason Yosinski, Thomas Brox, and Jeff Clune. Synthesizing the preferred inputs for neurons in neural networks via deep generator networks. arXiv preprint arXiv:1605.09304, 2016.
291
+
292
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. arXiv preprint arXiv:1606.00709, 2016.
293
+
294
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier gans. arXiv preprint arXiv:1610.09585, 2016.
295
+
296
+ Barak A. Pearlmutter and Jeffrey Mark Siskind. Reverse-mode ad in a functional framework: Lambda the ultimate backpropagator. ACM Trans. Program. Lang. Syst., 30(2):7:1–7:36, March 2008. ISSN 0164-0925. doi: 10.1145/1330017.1330018. URL http://doi.acm.org/10. 1145/1330017.1330018.
297
+
298
+ Ben Poole, Alexander A Alemi, Jascha Sohl-Dickstein, and Anelia Angelova. Improved generator objectives for gans. arXiv preprint arXiv:1612.02780, 2016.
299
+
300
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
301
+
302
+ Scott Reed, Zeynep Akata, Santosh Mohan, Samuel Tenka, Bernt Schiele, and Honglak Lee. Learning what and where to draw. In NIPS, 2016a.
303
+
304
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text-to-image synthesis. In Proceedings of The 33rd International Conference on Machine Learning, 2016b.
305
+
306
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and variational inference in deep latent gaussian models. In International Conference on Machine Learning. Citeseer, 2014.
307
+
308
+ Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
309
+
310
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
311
+
312
+ Satinder Singh, Michael Kearns, and Yishay Mansour. Nash convergence of gradient dynamics in general-sum games. In Proceedings of the Sixteenth conference on Uncertainty in artificial intelligence, pp. 541–548. Morgan Kaufmann Publishers Inc., 2000.
313
+
314
+ Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of The 32nd International Conference on Machine Learning, pp. 2256–2265, 2015. URL http://arxiv.org/abs/ 1503.03585.
315
+
316
+ Casper Kaae Sonderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszar. Amortised map inference for image super-resolution, 2016. URL https://arxiv.org/abs/1610. 04490v1.
317
+
318
+ L. Theis and M. Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems 28, Dec 2015. URL http://arxiv.org/abs/1506. $0 3 4 7 8 /$ .
319
+
320
+ L. Theis, A. van den Oord, and M. Bethge. A note on the evaluation of generative models. In International Conference on Learning Representations, Apr 2016. URL http://arxiv.org/ abs/1511.01844.
321
+
322
+ 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, 2012.
323
+
324
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks.¨ arXiv preprint arXiv:1601.06759, abs/1601.06759, 2016a. URL http://arxiv.org/abs/ 1601.06759.
325
+
326
+ Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Ko-¨ ray Kavukcuoglu. Conditional image generation with pixelcnn decoders. arXiv preprint arXiv:1606.05328, 2016b.
327
+
328
+ Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. J. Mach. Learn. Res., 11:3371–3408, December 2010. ISSN 1532-4435. URL http://dl.acm.org/citation.cfm?id=1756006.1953039.
329
+
330
+ Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015.
331
+
332
+ Chongjie Zhang and Victor R Lesser. Multi-agent learning with policy prediction. In Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, 2010.
333
+
334
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
335
+
336
+ Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A. Efros. Generative visual manipula- ¨ tion on the natural image manifold. In Proceedings of European Conference on Computer Vision (ECCV), 2016.
337
+
338
+ # Appendix
339
+
340
+ # A 2D GAUSSIAN TRAINING DETAILS
341
+
342
+ Network architecture and experimental details for the experiment in Section 3.1 are as follows:
343
+
344
+ The dataset is sampled from a mixture of 8 Gaussians of standard deviation 0.02. The means are equally spaced around a circle of radius 2.
345
+
346
+ The generator network consists of a fully connected network with 2 hidden layers of size 128 with relu activations followed by a linear projection to 2 dimensions. All weights are initialized to be orthogonal with scaling of 0.8.
347
+
348
+ The discriminator network first scales its input down by a factor of 4 (to roughly scale to (-1,1)), followed by 1 layer fully connected network with relu activations to a linear layer to of size 1 to act as the logit.
349
+
350
+ The generator minimizes $\mathcal { L } _ { G } = \log ( D ( x ) ) + \log ( 1 - D ( G ( z ) ) )$ and the discriminator minimizes $\mathcal { L } _ { D } \stackrel { = } { = } - \log ( D ( x ) ) - \log ( 1 - D ( \stackrel { . } { G } ( z ) ) )$ where $\mathbf { X }$ is sampled from the data distribution and $z \sim$ $\mathcal { N } ( 0 , I _ { 2 5 6 } )$ . Both networks are optimized using Adam (Kingma & Ba, 2014) with a learning rate of 1e-4 and $\beta _ { 1 } { = } 0 . 5$ .
351
+
352
+ The network is trained by alternating updates of the generator and the discriminator. One step consists of either $\mathbf { G }$ or $\mathbf { D }$ updating.
353
+
354
+ # B MORE MIXTURE OF GAUSSIAN EXPERIMENTS
355
+
356
+ # B.1 EFFECTS OF TIME DELAY / HISTORICAL AVERAGING
357
+
358
+ Another comparison we looked at was with regard to historical averaging based approaches. Recently similarly inspired approaches have been used in (Salimans et al., 2016) to stabilize training. For our study, we looked at taking an ensemble of discriminators over time.
359
+
360
+ First, we looked at taking an ensemble of the last N steps, as shown in Figure App.1.
361
+
362
+ ![](images/ca00dc71a894afed5412e7d9c9476916ab9ab1f2648dedea7d529b310373bd67.jpg)
363
+ Figure App.1: Historical averaging does not visibly increase stability on the mixture of Gaussians task. Each row corresponds to an ensemble of discriminators which consists of the indicated number of immediately preceding discriminators. The columns correspond to different numbers of training steps.
364
+
365
+ To further explore this idea, we ran experiments with an ensemble of 5 discriminators, but with different periods between replacing discriminators in the ensemble. For example, if I sample at a rate of 100, it would take 500 steps to replace all 5 discriminators. Results can be seen in Figure App.2.
366
+
367
+ We observe that given longer and longer time delays, the model becomes less and less stable. We hypothesize that this is due to the initial shape of the discriminator loss surface. When training, the discriminator’s estimates of probability densities are only accurate on regions where it was trained. When fixing this discriminator, we are removing the feedback between the generator exploitation and the discriminators ability to move. As a result, the generator is able to exploit these fixed areas of poor performance for older discriminators in the ensemble. New discriminators (over)compensate for this, leading the system to diverge.
368
+
369
+ ![](images/04adbd77c06eb06d8623be8ab50fe44136a6a0398a13d8fdd2a583c617dbcff0.jpg)
370
+ Figure App.2: Introducing longer time delays between the discriminator ensemble results in instability and probability distributions that are not in the window being visualized. The $\mathbf { X }$ axis is the number of weight updates and the y axis is how many steps to skip between discriminator updates when selecting the ensemble of 5 discriminators.
371
+
372
+ # B.2 EFFECTS OF THE SECOND GRADIENT
373
+
374
+ A second factor we analyzed is the effect of backpropagating the learning signal through the unrolling in Equation 12. We can turn on or off this backpropagation through the unrolling by introducing stop gradient calls into our computation graph between each unrolling step. With the stop gradient in place, the update signal corresponds only to the first term in Equation 12. We looked at 3 configurations: without stop gradients; vanilla unrolled GAN, with stop gradients; and with stop gradients but taking the average over the $k$ unrolling steps instead of taking the final value. Results can be see in Figure App.3.
375
+
376
+ We initially observed no difference between unrolling with and without the second gradient, as both required 3 unrolling steps to become stable. When the discriminator is unrolled to convergence, the second gradient term becomes zero. Due to the simplicity of the problem, we suspect that the discriminator nearly converged for every generator step, and the second gradient term was thus irrelevant.
377
+
378
+ To test this, we modified the dynamics to perform five generator steps for each discriminator update. Results are shown in Figure App.4. With the discriminator now kept out of equilibrium, successful training can be achieved with half as many unrolling steps when using both terms in the gradient than when only including the first term.
379
+
380
+ # C RNN MNIST TRAINING DETAILS
381
+
382
+ The network architecture for the experiment in Section 3.2 is as follows:
383
+
384
+ The MNIST dataset is scaled to [-1, 1).
385
+
386
+ The generator first scales the 256D noise vector through a 256 unit fully connected layer with relu activation. This is then fed into the initial state of a 256D LSTM(Hochreiter & Schmidhuber, 1997) that runs 28 steps corresponding to the number of columns in MNIST. The resulting sequence of activations is projected through a fully connected layer with 28 outputs with a tanh activation function. All weights are initialized via the ”Xavier” initialization (Glorot & Bengio, 2010). The forget bias on the LSTM is initialized to 1.
387
+
388
+ The discriminator network feeds the input into a Convolution(16, stride $^ { = 2 }$ ) followed by a Convolution(32, stride $^ { = 2 }$ ) followed by Convolution(32, stride ${ \boldsymbol { \mathbf { \mathit { \varepsilon } } } } = 2 { \boldsymbol { \mathbf { \mathit { \varepsilon } } } }$ ). All convolutions have stride 2. As in (Radford et al., 2015) leaky rectifiers are used with a 0.3 leak. Batch normalization is applied after each layer (Ioffe & Szegedy, 2015). The resulting 4D tensor is then flattened and a linear projection is performed to a single scalar.
389
+
390
+ ![](images/e082e1fa15fe3c8c65693a9ca8c06d3ede7c2ddcf2d0287c257abe4e8c2ff9b6.jpg)
391
+ Figure App.3: If the discriminator remains nearly at its optimum during learning, then performance is nearly identical with and without the second gradient term in Equation 12. As shown in Figure App.4, when the discriminator lags behind the generator, backpropagating through unrolling aids convergence.
392
+
393
+ The generator network minimises $\mathcal { L } _ { G } = \log ( D ( G ( z ) ) )$ and the discriminator minimizes $\mathcal { L } _ { D } =$ $\log ( D ( x ) ) + \log ( 1 - D ( G ( z ) ) )$ . Both networks are trained with Adam(Kingma & Ba, 2014) with learning rates of 1e-4 and $\beta _ { 1 } { = } 0 . 5$ . The network is trained alternating updating the generator and the discriminator for 150k steps. One step consists of just 1 network update.
394
+
395
+ # D CIFAR10/MNIST TRAINING DETAILS
396
+
397
+ The network architectures for the discriminator, generator, and encoder as as follows. All convolutions have a kernel size of 3x3 with batch normalization and leaky ReLU’s with a 0.3 leak.
398
+
399
+ The generator network is defined as:
400
+
401
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>number outputs</td><td rowspan=1 colspan=1>stride</td></tr><tr><td rowspan=1 colspan=1>Input: z ~ N(0,I256)Fully connectedReshape to image 4,4,512ConvolutionConvolutionConvolutionConvolution</td><td rowspan=1 colspan=1>4*4*512256128641or3</td><td rowspan=1 colspan=1>2221</td></tr></table>
402
+
403
+ ![](images/ddba8731c308e072b5532fd2f2dfbcf72fd2fc3c5d92dcb601c2c03608beee85.jpg)
404
+ Unrolled GAN with 5 G Steps per D without second gradient
405
+
406
+ Unrolled GAN with 5 G Steps per D
407
+
408
+ <table><tr><td></td><td>number outputs</td><td>stride</td></tr><tr><td>Input: x~ Pdata or G Transposed Convolution Transposed Convolution Transposed Convolution</td><td>64 128 256</td><td>222</td></tr><tr><td>Flatten</td><td></td><td></td></tr><tr><td>Fully Connected</td><td>1</td><td></td></tr></table>
409
+
410
+ ![](images/c5b3fa4bd5bb790af426480883819ba983aa6618ec11502817b7cc7fa39e22d5.jpg)
411
+ Figure App.4: Backpropagating through the unrolling process aids convergence when the discriminator does not fully converge between generator updates. When taking 5 generator steps per discriminator step unrolling greatly increases stability, requiring only 5 unrolling steps to converge. Without the second gradient it requires 10 unrolling steps. Also see Figure App.3.
412
+
413
+ The discriminator network is defined as:
414
+
415
+ The generator network minimises $\mathcal { L } _ { G } = \log ( D ( G ( z ) ) )$ and the discriminator minimizes $\mathcal { L } _ { D } =$ $\log ( D ( x ) ) + \log ( 1 - D ( G ( z ) ) )$ . The networks are trained with Adam with a generator learning rate of 1e-4, and a discriminator learning rate of 2e-4. The network is trained alternating updating the generator and the discriminator for $1 0 0 \mathrm { k }$ steps. One step consists of just 1 network update.
416
+
417
+ # E 1000 CLASS MNIST
418
+
419
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>number outputs</td><td rowspan=1 colspan=1>stride</td></tr><tr><td rowspan=1 colspan=1>Input: z ~ N(0,I256)Fully connectedReshape to image 4,4,64ConvolutionConvolutionConvolutionConvolution</td><td rowspan=1 colspan=1>4 *4*64321683</td><td rowspan=1 colspan=1>2221</td></tr></table>
420
+
421
+ The discriminator network is parametrized by a size $\mathrm { X }$ and is defined as follows. In our tests, we used X of 1/4 and 1/2.
422
+
423
+ <table><tr><td></td><td>number outputs</td><td>stride</td></tr><tr><td>Input: x ~ Pdata or G Transposed Convolution Transposed Convolution</td><td>8*X 16*X</td><td>222</td></tr><tr><td>Transposed Convolution Flatten</td><td>32*X</td><td></td></tr><tr><td>Fully Connected</td><td>1</td><td></td></tr></table>
424
+
425
+ # F COLORED MNIST DATASET
426
+
427
+ # F.1 DATASET
428
+
429
+ To generate this dataset we first took the mnist digit, $I$ , scaled between 0 and 1. For each image we sample a color, $C$ , normally distributed with mean $\scriptstyle = 0$ and std $\scriptstyle \mathtt { = 0 . 5 }$ . To generate a colored digit between (-1, 1) we do $I * C + \mathsf { \bar { ( } } I - 1 )$ . Finally, we add a small amount of pixel independent noise sampled from a normal distribution with std $= 0 . 2$ , and the resulting values are cliped between (-1, 1). When visualized, this generates images and samples that can be seen in figure App.5. Once again it is very hard to visually see differences in sample diversity when comparing the 128 and the 512 sized models.
430
+
431
+ ![](images/44d318f018c78dbdaec0c5211309ab172baeb975108ebe77f750982a4193cef6.jpg)
432
+ Figure App.5: Right: samples from the data distribution. Middle: Samples from 1/4 size model with 0 look ahead steps (worst diversity). Left: Samples from 1/1 size model with 10 look ahead steps (most diversity).
433
+
434
+ # F.2 MODELS
435
+
436
+ The models used in this section are parametrized by a variable $\mathrm { X }$ to control capacity. A value of ${ \bf X } { = } 1$ is same architecture used in the cifar10 experiments. We used 1/4, 1/2 and 1 as these values.
437
+
438
+ The generator network is defined as:
439
+
440
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>number outputs</td><td rowspan=1 colspan=1>stride</td></tr><tr><td rowspan=1 colspan=1>Input: z~ N(0,I256)Fully connectedReshape to image 4,4,512*XConvolutionConvolutionConvolutionConvolution</td><td rowspan=1 colspan=1>4*4*512*X256*X128*X64*X3</td><td rowspan=1 colspan=1>2221</td></tr></table>
441
+
442
+ The discriminator network is defined as:
443
+
444
+ <table><tr><td></td><td>number outputs</td><td>stride</td></tr><tr><td>Input: x ~ Pdata or G Transposed Convolution Transposed Convolution Transposed Convolution Flatten Fully Connected</td><td>64*X 128*X 256*X</td><td>222</td></tr></table>
445
+
446
+ # G OPTIMIZATION BASED VISUALIZATIONS
447
+
448
+ More examples of model based optimization. We performed 5 runs with different seeds of each of of the unrolling steps configuration. Bellow are comparisons for each run index. Ideally this would be a many to many comparison, but for space efficiency we grouped the runs by the index in which they were run.
449
+
450
+ ![](images/8d38e597124cc936be0c8530d6fb7e8b1ecc41f5e50351124daf12a2d78e11fa.jpg)
451
+ Figure App.6: Samples from 1/5 with different random seeds.
452
+
453
+ ![](images/be94e2bb107541e788983b4ad2bdc31bebdff50fbbb8529c915238f8cca809e8.jpg)
454
+ Figure App.7: Samples from 2/5 with different random seeds.
455
+
456
+ ![](images/e17957e3a6c6fffe5b489567eb4830a1720a2ae85eadaf27b1b6017a82527e8b.jpg)
457
+ Figure App.8: Samples from 3/5 with different random seeds.
458
+
459
+ ![](images/fbca68637cf3798a1a739daff1548046fba7251170be090a9d1d669d0aa5603e.jpg)
460
+ Figure App.9: Samples from 4/5 with different random seeds.
461
+
462
+ ![](images/c67273dbe4f3a1a6aee81a0d0854850226af640cdd34215ec9e0663f82c11a7d.jpg)
463
+ Figure App.10: Samples from 5/5 with different random seeds.
md/train/GvqjmSwUxkY/GvqjmSwUxkY.md ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RETHINKING THE TRULY UNSUPERVISED IMAGE-TOIMAGE TRANSLATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Every recent image-to-image translation model uses either image-level (i.e. inputoutput pairs) or set-level (i.e. domain labels) supervision at a minimum. However, even the set-level supervision can be a serious bottleneck for data collection in practice. In this paper, we tackle image-to-image translation in a fully unsupervised setting, i.e., neither paired images nor domain labels. To this end, we propose a truly unsupervised image-to-image translation model (TUNIT) that simultaneously learns to separate image domains and translate input images into the estimated domains. Experimental results show that our model achieves comparable or even better performance than the set-level supervised model trained with full labels, generalizes well on various datasets, and is robust against the choice of hyperparameters (e.g. the preset number of pseudo domains). In addition, TUNIT extends well to the semi-supervised scenario with various amount of labels provided.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Given an image of one domain, image-to-image translation is a task to generate the plausible images of the other domains. Based on the success of conditional generative models (Mirza & Osindero, 2014; Sohn et al., 2015), many image translation methods have been proposed either using imagelevel supervision (e.g. paired data) (Isola et al., 2017; Hoffman et al., 2018; Zhu et al., 2017b; Wang et al., 2018; Park et al., 2019) or using set-level supervision (e.g. domain labels) (Zhu et al., 2017a; Kim et al., 2017; Liu et al., 2017; Huang et al., 2018; Liu et al., 2019; Lee et al., 2020). Though the latter approach is generally called unsupervised as a counterpart of the former, it actually assumes that the domain labels are given a priori. This assumption can be a serious bottleneck in practice as the number of domains and samples increases. For example, labeling individual samples of a large dataset, such as FFHQ, is expensive, and the distinction across domains can be ambiguous.
12
+
13
+ Here, we first clarify that unsupervised image-to-image translation should strictly denote the task without any supervision neither paired images nor domain labels. Under this definition, our goal is to develop an unsupervised translation model given a mixed set of images of many domains (Figure 1). We tackle this problem by formulating three sub-problems: 1) clustering the images by approximating the set-level characteristics (i.e. domains), 2) encoding the individual content and style of an input image, and 3) learning a mapping function among the estimated domains.
14
+
15
+ To this end, we introduce a guiding network that simultaneously solves 1) unsupervised domain classification and 2) style encoding. It has two branches of providing pseudo domain labels and encoding style features, which are later used in the discriminator and the generator training, respectively. We employ a differentiable clustering method based on mutual information maximization for estimating domain labels. This helps the guiding network group similar images together while evenly separate their categories. For embedding style codes, we adopt a contrastive loss (Hadsell et al., 2006; He et al., 2020; Chen et al., 2020a), which leads the model to further understand the dissimilarity between images, resulting in better representation learning. Finally, conditioned on the style features and domain labels from the guiding network, we use generative adversarial networks (GAN) to learn the image translation functions across various domains.
16
+
17
+ Although GAN and the guiding network play different roles, we do not separate their training process– our guiding network participates in the translation process. By doing so, the guiding network can exploit gradients from GAN training. The guiding network now understands the recipes of domain-separating attributes because the generator wants the style code to contain sufficient information to fool the domain-specific discriminator, and vice versa. Thanks to this interaction between the guiding network and GAN, our model successfully separates domains and translates images.
18
+
19
+ ![](images/726797f2ef17218ef12f9d9ccbbc5c6eb69b4f4ab8fe6e7c14af7f9a836ef628.jpg)
20
+ Figure 1: Levels of supervision. To perform image-to-image translation, existing methods need either (a) a dataset with input-output pairs or, (b) a dataset with domain information. Our method is capable of learning mappings among multiple domains using (c) a dataset without any supervision.
21
+
22
+ We quantitatively and qualitatively compare our model with the existing set-level supervised method under unsupervised and semi-supervised setting. The experiments on various datasets show that the proposed model outperforms the previous method over all different levels of supervision. Our experimental results show that, by exploiting the synergy between two tasks, the guiding network helps the image translation model to largely improve the generation performance.
23
+
24
+ Our contributions are summarized as follows:
25
+
26
+ • We clarify the definition of unsupervised image-to-image translation and to the best of our knowledge, our model is the first to succeed in this task in an end-to-end manner.
27
+ • We propose the guiding network to handle the unsupervised translation task and show that the interaction between translation and clustering is helpful for the task.
28
+ • We show the effectiveness of our model through the extensive experiments on various datasets.
29
+ • We confirm that our model is applicable to various numbers of clusters and the practical case, where ground truth labels of several samples are available.
30
+
31
+ # 2 TRULY UNSUPERVISED IMAGE-TO-IMAGE TRANSLATION (TUNIT)
32
+
33
+ We consider the unsupervised image-to-image translation problem, where we have images $\chi$ from $K$ domains $K \geq 2 )$ ) without domain labels $y$ . Here, $K$ is an unknown property of the dataset. Throughout the paper, we denote $K$ as the actual number of domains in a dataset and $\hat { K }$ as the arbitrarily chosen number of domains to train models. We design a module that integrates both a domain classifier and a style encoder, which we call guiding network. It guides the translation by feeding reference images as the style code to the generator and as the pseudo domain labels to the discriminator. Using the feedback from the discriminator regarding the pseudo labels, the generator synthesizes images of the target domains (e.g. breeds) while respecting styles (e.g. fur patterns) of the reference images and maintaining the content (e.g. pose) of source images (Figure 2).
34
+
35
+ # 2.1 LEARNING TO PRODUCE DOMAIN LABELS AND ENCODE STYLE FEATURES
36
+
37
+ In our framework, the guiding network $E$ plays a central role as an unsupervised domain classifier as well as a style encoder. Our guiding network $E$ consists of two branches, $E _ { C }$ and $E _ { S }$ , each of which learns to provide domain labels and style codes, respectively. In experiments, we compare our guiding network against straightforward approaches, i.e.., K-means on image or feature space.
38
+
39
+ Unsupervised domain classification. The discriminator requires target domain labels to provide useful gradients for image translation into the target domain. $E _ { C }$ adopts a differentiable clustering technique to provide pseudo domain labels of reference images, maximizing the mutual information (MI) between an image $\mathbf { x }$ and its randomly augmented version $\mathbf { x } ^ { + }$ (Ji et al., 2019). The optimum of the mutual information $I ( \mathbf { p } , \mathbf { p } ^ { + } )$ is reached as the entropy $H ( \mathbf { p } )$ is maximum and the conditional entropy $H ( \mathbf { p } | \mathbf { p } ^ { + } )$ is minimum, where $\mathbf { p } = E _ { C } ( \mathbf { x } )$ represents the softmax output from $E _ { C }$ , indicating a probability vector of $\mathbf { x }$ over $\cdot$ domains. Please refer to Section 3.3 for more details about $\cdot$ . Maximizing MI encourages $E _ { C }$ to assign the same domain label to the pair $\mathbf { \bar { x } }$ and $\mathbf { x } ^ { + }$ ) while evenly distributing entire samples to all domains.
40
+
41
+ ![](images/d06a3a92ca3377b8950e5dca64ab7215c6897ba6bc71cdd37600a52b869f55a1.jpg)
42
+ Figure 2: Overview of our proposed method. The figure illustrates how our model changes the breed of the cat. (a) An estimated domain from our guiding network $E$ is used to train the multi-task discriminator $D$ . (b) $E$ provides the generator $G$ with the style code of a reference image and the estimated domain is again used for GAN training.
43
+
44
+ Formally, $E _ { C }$ maximizes the mutual information:
45
+
46
+ $$
47
+ \mathcal { L } _ { M I } = I ( \mathbf { p } , \mathbf { p } ^ { + } ) = I ( \mathbf { P } ) = \sum _ { i = 1 } ^ { \hat { K } } \sum _ { j = 1 } ^ { \hat { K } } \mathbf { P } _ { i j } \ln \frac { \mathbf { P } _ { i j } } { \mathbf { P } _ { i } \mathbf { P } _ { j } } ,
48
+ $$
49
+
50
+ where $f$ is a composition of random augmentations such as random cropping and affine transformation. $\mathbf { P } _ { i } = \mathbf { P } ( \mathbf { p } = i )$ denotes the $\hat { K }$ -dimensional marginal probability vector, and $\mathbf { P } _ { i j } = \mathbf { P } ( \mathbf { p } =$ $i , \mathbf { p } ^ { + } = j$ ) denotes the joint probability. To provide a deterministic one-hot label to the discriminator, we use the argmax operation (i.e. $y = \tt a r g m a x ( { E _ { C } ( x ) } ) )$ . We note that the mutual information is one way to implement TUNIT, therefore, any differentiable clustering methods can be adopted such as SCAN (Van Gansbeke et al., 2020).
51
+
52
+ Style encoding and improving domain classification. $E _ { S }$ encodes an image into a style code s which provides translation guide for the generator. In addition to the style guide to the generator, $E _ { S }$ is beneficial in improving unsupervised domain classification, where pseudo labels from $E _ { C }$ fail to scale up when samples are complex and diverse (e.g., AnimalFaces (Liu et al., 2019)). Since $E _ { S }$ is an another branch of the guiding network, imposing the contrastive loss (He et al., 2020) on the style codes improves representation of the shared embeddings:
53
+
54
+ $$
55
+ \mathcal { L } _ { s t y l e } ^ { E } = - \log \frac { \exp ( \mathbf { s } \cdot \mathbf { s } ^ { + } / \tau ) } { \sum _ { i = 0 } ^ { N } \exp ( \mathbf { s } \cdot \mathbf { s } _ { i } ^ { - } / \tau ) } ,
56
+ $$
57
+
58
+ where ${ \bf s } = E _ { S } ( { \bf x } )$ . $\mathbf { x }$ and $\mathbf { x } ^ { + }$ denote an image and randomly augmented version of $\mathbf { x }$ , respectively. This $( N + 1 )$ -way classification enables $E$ to utilize not only the similarity of the positive pair (s, $\mathbf { s } ^ { + }$ ) but also the dissimilarity of the negative pairs (s, $\mathbf { s } _ { i } ^ { - }$ ). We adopt a queue to store the negative codes $\cdot$ of the previously sampled images as MoCo (He et al., 2020). By doing so, we can conduct the contrastive learning efficiently without large batch sizes (Saunshi et al., 2019). We observe that adding this objective significantly improves unsupervised classification accuracy on AnimalFaces from $6 8 . 0 \%$ to $8 4 . 1 \%$ compared to the previous approach (Ji et al., 2019).
59
+
60
+ In this subsection, we describe how to perform the unsupervised image-to-image translation under the guidance of our guiding network. For successful translation, the model should provide the realistic images containing the visual feature of the target domain. To this end, we adopt three losses: 1) adversarial loss to produce realistic images, 2) style contrastive loss that encourages the model not to ignore the style codes, 3) image reconstruction loss for preserving the domain-invariant features. We explain each loss and the overall objective for each network.
61
+
62
+ Adversarial loss. For adversarial training, we adopt a variant of conditional discriminator, the multitask discriminator (Mescheder et al., 2018). It is designed to conduct discrimination for each domain simultaneously. However, its gradient is calculated only with the loss for estimating the domain of the input image. For the domain label of the input image, we utilize the pseudo label from the guiding network. Formally, given the pseudo label $\tilde { y }$ for a reference image $\tilde { \mathbf { x } }$ , we train our generator $G$ and multi-task discriminator $D$ via the adversarial loss:
63
+
64
+ $$
65
+ \mathcal { L } _ { a d v } = \mathbb { E } _ { \tilde { \mathbf { x } } \sim p _ { d a t a } ( \mathbf { x } ) } [ \log D _ { \tilde { y } } ( \tilde { \mathbf { x } } ) ] + \mathbb { E } _ { \mathbf { x } , \tilde { \mathbf { x } } \sim p _ { d a t a } ( \mathbf { x } ) } [ \log ( 1 - D _ { \tilde { y } } ( G ( \mathbf { x } , \tilde { \mathbf { s } } ) ) ) ] ,
66
+ $$
67
+
68
+ where $D _ { \tilde { y } } ( \cdot )$ denotes the logit from the domain-specific $( \tilde { y } )$ discriminator, and $\tilde { \mathbf { s } } = E _ { S } ( \tilde { \mathbf { x } } )$ denotes a target style code of the reference image $\tilde { \bf x }$ . The generator $G$ learns to translate $\mathbf { x }$ to the target domain $\tilde { y }$ while reflecting the style code ˜s.
69
+
70
+ Style constrastive loss. In order to prevent a degenerate case where the generator ignores the given style code ˜s and synthesize a random image of the domain $\tilde { y }$ , we impose a style contrastive loss:
71
+
72
+ $$
73
+ \mathcal { L } _ { s t y l e } ^ { G } = \mathbb { E } _ { \mathbf { x } , \tilde { \mathbf { x } } \sim p _ { d a t a } ( \mathbf { x } ) } \left[ - \log \frac { \exp ( \mathbf { s } ^ { \prime } \cdot \tilde { \mathbf { s } } ) } { \sum _ { i = 0 } ^ { N } \exp ( \mathbf { s } ^ { \prime } \cdot \mathbf { s } _ { i } ^ { - } / \tau ) } \right] .
74
+ $$
75
+
76
+ Here, $\mathbf { s } ^ { \prime } = E _ { S } ( G ( \mathbf { x } , \tilde { \mathbf { s } } ) )$ denotes the style code of the translated image $G ( \mathbf { x } , \tilde { \mathbf { s } } )$ and $\mathbf { s } _ { i } ^ { - }$ denotes the negative style codes, which are from the same queue used in equation (2). And we follow the training scheme of MoCo (He et al., 2020) as equation (2). The above loss guides the generated image $\cdot$ to have a style similar to the reference image $\cdot$ and dissimilar to negative (other) samples. By doing so, we also avoid the degenerated solution where the encoder maps all the images to the same style code of the reconstruction loss (Choi et al., 2020) based on L1 or L2 norm. Equation (2) and (4) are based on contrastive loss, but they are used for different purposes. Please refer to Appendix H for more discussion.
77
+
78
+ Image reconstruction loss. To ensure that the generator $G$ can reconstruct the source image $\mathbf { x }$ when given with its original style ${ \bf s } = E _ { S } ( { \bf x } )$ , we impose an image reconstruction loss:
79
+
80
+ $$
81
+ \mathcal { L } _ { r e c } = \mathbb { E } _ { { \mathbf { x } } \sim p _ { d a t a } ( { \mathbf { x } } ) } [ | | { \mathbf { x } } - G ( { \mathbf { x } } , { \mathbf { s } } ) | | _ { 1 } ] .
82
+ $$
83
+
84
+ This objective not only ensures the generator $G$ to preserve domain-invariant characteristics (e.g., pose) of its input image $\mathbf { x }$ , but also helps to learn the style representation of the guiding network $E$ by extracting the original style s of the source image $\mathbf { x }$ .
85
+
86
+ Overall objective. Finally, we train the three networks jointly as follows:
87
+
88
+ $$
89
+ \begin{array} { r l } & { \mathcal { L } _ { D } = - \mathcal { L } _ { a d v } , } \\ & { \mathcal { L } _ { G } = \mathcal { L } _ { a d v } + \lambda _ { s t y l e } ^ { G } \mathcal { L } _ { s t y l e } ^ { G } + \lambda _ { r e c } \mathcal { L } _ { r e c } , } \\ & { \mathcal { L } _ { E } = \mathcal { L } _ { G } - \lambda _ { M I } \mathcal { L } _ { M I } + \lambda _ { s t y l e } ^ { E } \mathcal { L } _ { s t y l e } ^ { E } } \end{array}
90
+ $$
91
+
92
+ where $\lambda$ ’s are hyperparameters. Note that our guiding network $E$ receives feedback from $L _ { G }$ , which is essential for our method. We discuss the effect of feedback to $E$ on performance in Section 3.1.
93
+
94
+ # 3 EXPERIMENTS
95
+
96
+ We first evaluate TUNIT on labeled datasets by treating them as unlabeled because the desired behaviours of the translation models in labeled datasets are well defined (Section 3.1). Here, we provide an ablation study to analyze the effect of each component and compare the models both quantitatively and qualitatively. We then move on to unlabeled datasets to validate our model in the unsupervised scenario in the wild (Section 3.2). Lastly, we show that TUNIT is robust against the choice
97
+
98
+ <table><tr><td rowspan="2">Configuration</td><td colspan="3">AnimalFaces-10</td><td colspan="3">Food-10</td></tr><tr><td>mFID</td><td>D&amp;C</td><td>Acc.</td><td>mFID</td><td>D&amp;C</td><td>Acc.</td></tr><tr><td>A Baseline FUNIT (supervised)</td><td>74.0</td><td>0.749 / 0.671</td><td>1.000</td><td>68.4</td><td>0.989 / 0.782</td><td>1.000</td></tr><tr><td>B (A)+Improved G&amp;D (supervised)</td><td>46.2</td><td>0.896 / 0.732</td><td>1.000</td><td>57.6</td><td>1.284 / 0.857</td><td>1.000</td></tr><tr><td>C (B)+ K-means on image space</td><td>110.7</td><td>0.822 / 0.615</td><td>0.215</td><td>90.7</td><td>0.849 / 0.648</td><td>0.201</td></tr><tr><td>D (B) + K-means on feature space</td><td>76.2</td><td>0.770 / 0.597</td><td>0.428</td><td>64.6</td><td>0.968 / 0.808</td><td>0.331</td></tr><tr><td>E (B) + Differentiable clustering</td><td>73.5</td><td>0.940 / 0.588</td><td>0.680</td><td>64.2</td><td>1.038 / 0.819</td><td>0.542</td></tr><tr><td>F TUNIT w/ sequential training</td><td>46.0</td><td>1.060 / 0.789</td><td>0.850</td><td>61.1</td><td>0.908 / 0.777</td><td>0.860</td></tr><tr><td>G TUNIT w/ joint training</td><td>47.7</td><td>1.039 / 0.805</td><td>0.841</td><td>52.2</td><td>1.079 / 0.875</td><td>0.848</td></tr></table>
99
+
100
+ Table 1: Main results. mFID, Density / Coverage (D & C), and classification accuracy (Acc) of each training configuration. Note that the configurations (A) - (B) use ground-truth class labels, while (C) - (G) use pseudo-labels. We bold the best results separately for supervised and unsupervised settings.
101
+
102
+ ![](images/88571bb423f86a5b771181cfa37f3796a8c5c8b5c7ffc1981e9edec274f61969.jpg)
103
+ Figure 3: Qualitative comparison of translation results using each configuration in Table 1. Here, B reflects the style feature (e.g. species or type of food) of the reference images while A does not. The model C performs much worse than A and B in that it overly adopts the source image, not adequately merging styles and contents from both sides. The model D generates more plausible images than C but fails to reflect the characteristics of the reference images. For example, D on fifth row does not look like several pieces of dumpling due to its shape and dish color, meaning that the reference styles are not properly reflected. Similarly, E also fails to generate the dumpling in the fifth row. TUNIT with sequential training F reflects the visual features of each reference on both datasets. However, in terms of visual fidelity, we observe that G consistently outperforms F. Akin to the quantitative results, TUNIT achieves equivalent or even better visual quality than the set-level supervised model A and B.
104
+
105
+ of hyperparameters (e.g. the preset number of clusters, $K .$ ) and extends well to the semi-supervised scenario (Section 3.3). In all experiments, we use FUNIT (Liu et al., 2019) as our baseline.
106
+
107
+ Datasets. For the labeled datasets, we randomly select ten classes among 149 classes of AnimalFaces and 101 classes of Food-101, which we call AnimalFaces-10 and Food-10, respectively. Here, the labels are used only for the evaluation purpose. For the unlabeled datasets, we use AFHQ, FFHQ, and LSUN Car (Choi et al., 2020; Karras et al., 2019; Yu et al., 2015), which do not have any or are missing with fine-grained labels. Specifically, AFHQ roughly has three groups (i.e., dog, cat and wild), but each group contains diverse species and these species labels are not provided. FFHQ and LSUN Car contain various human faces and cars without any labels, respectively.
108
+
109
+ ![](images/55a9488623cb69c72d4de1bca06515d3d37bc916780476c730bb5325666af15c.jpg)
110
+ Figure 4: Reference-guided image translation results on unlabeled datasets.
111
+
112
+ ![](images/214c164faf6bdbca092f21b1ca1527fbc7947db60f659fec53878ba855201c0d.jpg)
113
+ Figure 5: t-SNE visualization of the style space of our guiding network trained on AFHQ Wild. Since AFHQ Wild does not have ground-truth labels, each point is colored with the guiding network’s prediction. Although we set the number of domains to be quite large $\hat { K } = 1 0 $ ), the network separates one species into two domains, which are so closely located that the model creates six clusters.
114
+
115
+ Evaluation Metrics. We report two scores to assess the generated images. First, to provide a general sense of image quality, we use the mean of class-wise Frenchet Inception Distance (mFID) (Heusel ´ et al., 2017). It can avoid the degenerate case of the original FID, which assigns a good score when the model conveying the source image as is. Additionally, to provide a finer assessment of the generated images, we report Density and Coverage (D&C) (Naeem et al., 2020). D&C separately evaluates the fidelity and the diversity of the model outputs, which is also known to be robust against outliers and model hyperparameters (e.g. the number of samples used for evaluation). Denote that a lower mFID score means better image quality, and D&C scores that are bigger or closer to 1.0 indicate the better fidelity and diversity, respectively. Please refer to Appendix C for the detailed information.
116
+
117
+ # 3.1 COMPARATIVE EVALUATION ON LABELED DATASETS
118
+
119
+ Table 1 summarizes the effect of each component of TUNIT and rigorous comparisons with the state-of-the-art supervised method, FUNIT. First, we report the set-level supervised performance
120
+
121
+ ![](images/75d51c13a67bf1ecc74547dc5c8277f2332d6b5792826479497837a54811f2b0.jpg)
122
+
123
+ <table><tr><td>K</td><td>AnimalFaces-10 mFID D&amp;C</td><td>Food-10 mFID</td><td>D&amp;C</td></tr><tr><td>1 4 7 10 13 16 20 50 500</td><td>129.6 0.561 /0.512 77.7 0.879 /0.738 62.7 1.016 /0.729 47.7 1.039 /0.805 56.8 0.993/ 0.805 54.1 1.093 / 0.782 55.4 1.019 / 0.778 63.8 0.858 /0.701 67.2</td><td>95.1 67.4 52.7 52.2 54.8 54.8 57.7 60.8 0.921/ 0.694 63.2</td><td>1.113 / 0.771 0.851/0.785 1.079 /0.875 1.079 /0.875 0.970/0.845 1.029 /0.857 0.937 /0.846 1.067 /0.837</td></tr></table>
124
+
125
+ Table 2: t-SNE visualization of the model with (a) $\scriptstyle { \hat { K } } = 1 0$ and (b) $\scriptstyle { \hat { K } } = 2 0$ trained on AnimalFaces-10 and quantitative evaluation of our method by varying the number of pseudo domains $\cdot$ . Each point is colored with the ground-truth labels. As shown in t-SNE visualizations, even if $\cdot$ is set to overly larger than the actual number of domains, the guiding network clusters the domains reasonably well.
126
+
127
+ ![](images/12399874c7d44a8da845f303377a9173ddc43c29caa472ab0b6d48283c524b3f.jpg)
128
+ Figure 6: Qualitative comparison on the number of pseudo domains $\cdot$ . The performance varies along with $\cdot$ . When we set $\hat { K }$ large enough, the results are reasonable.
129
+
130
+ of FUNIT and its variant (Table 1). Here, A is the original FUNIT and B denotes the modified FUNIT using our architecture (e.g. We do not use PatchGAN discriminator), which brings a large improvement over every score on both datasets. One simple way to extend B to the unsupervised scenario is to add an off-the-shelf clustering method and use its estimated labels instead of the ground truth. We employ K-means clustering on the image space for C, and the pretrained feature space for D. Here, we use ResNet-50 (He et al., 2016) features trained with MoCo v2 (Chen et al., 2020b) on ImageNet. Not surprisingly, because the estimated labels are inaccurate, the overall performance significantly drops. Although using the pretrained features helps a little, not only is it far from the setlevel supervised performance but it requires three steps to train the entire model, which complicates the application. This can be partially addressed by employing the differentiable clustering method (Ji et al., 2019), which trains VGG-11BN (Simonyan & Zisserman, 2015) with mutual information maximization that makes E. This reduces the number of training steps from three to two and provides better label estimation, which enables the model to approach the performance of original FUNIT A. However, as seen in the coverage score, the sample diversity is unsatisfactory.
131
+
132
+ Finally, we build TUNIT by introducing the guiding network and the new objective functions described in Section 2. The changes significantly improve the accuracy on both datasets, particularly achieving similar mFID of the improved set-level supervised model B. Our final model, G matches or outperforms mFID and D&C of B. This is impressive because B utilizes oracles for training while G has no labels. Notably, TUNIT can cover $7 \% \mathrm { p }$ wider support of the data on AnimalFaces-10 than B. We conjecture that TUNIT benefits from the style codes that represent meaningful domain features learned by clustering. By comparing $\mathbb { E }$ and G, we confirm that they are comparable in terms of clustering and G is more stable in terms of inter-dataset performance. Therefore, we adopt the joint training of style encoder and clustering as our final model (G). In addition, we remove the adversarial loss for training the guiding network. It directly degrades the performance; mFID changes from 47.7 to 63.0 on AnimalFaces-10. It indicates that our training scheme takes an important portion of performance gains. Qualitative results also show superiority of TUNIT over competitors (Figure 3).
133
+
134
+ Table 3: Quantitative evaluation (mFID) when few labels are available during training.
135
+
136
+ <table><tr><td rowspan="2">Configuration</td><td rowspan="2">20%</td><td colspan="3">AnimalFaces-10</td><td rowspan="2"></td><td colspan="3">Food-10</td></tr><tr><td>40%</td><td>60%</td><td>80%</td><td>20%</td><td>40% 60%</td><td>80%</td></tr><tr><td>A FUNIT</td><td></td><td>124.4</td><td>106.4</td><td>96.0</td><td>79.6</td><td>111.4</td><td>85.8</td><td>74.8</td><td>70.3</td></tr><tr><td>G</td><td>TUNIT (ours)</td><td>42.0</td><td>42.6</td><td>43.9</td><td>46.2</td><td>53.6</td><td>56.2</td><td>52.8</td><td>53.4</td></tr></table>
137
+
138
+ <table><tr><td rowspan="2">Configuration</td><td colspan="4">AnimalFaces-10</td><td colspan="4">Food-10</td></tr><tr><td>1%</td><td>2%</td><td>4%</td><td>8%</td><td>1%</td><td>2%</td><td>4%</td><td>8%</td></tr><tr><td>A FUNIT</td><td>107.8</td><td>104.7</td><td>90.3</td><td>93.9</td><td>71.9</td><td>71.5</td><td>71.6</td><td>69.0</td></tr><tr><td>G TUNIT (ours)</td><td>47.9</td><td>44.8</td><td>42.7</td><td>42.4</td><td>54.5</td><td>56.1</td><td>55.9</td><td>55.8</td></tr></table>
139
+
140
+ Table 4: Quantitative evaluation (mFID) when few labels are available during training. Here, an auxliary classifier is adopted to improve the FUNIT baseline by giving pseudo-labels to $\mathcal { D } _ { u n }$ .
141
+
142
+ # 3.2 VALIDATION ON UNLABELED DATASET
143
+
144
+ We evaluate TUNIT on the unlabeled datasets having no clear separations of the domains, which are AFHQ, FFHQ and LSUN Cars. For AFHQ, we train three individual models for dog, cat and wild. For all experiments, FUNIT is used as a baseline. We train it by presuming all labels to be the same as one. We set $\scriptstyle { \hat { K } } = 1 0$ for all the TUNIT models. More discussions on $\cdot$ will be in Section 3.3.
145
+
146
+ Figure 4 demonstrates the results. We observe that the results of TUNIT adequately reflect the style feature of the references such as the textures of cats or cars and the species of the wilds. Although FFHQ has no clear domain distinctions, TUNIT captures the existence of glasses or smile as domains, and then add or remove glasses or smile. However, FUNIT performs much worse than TUNIT in this truly unsupervised scenario. For example, FUNIT outputs the inputs as is (cats and wilds) or insufficiently reflects the species (third row of AFHQ Wild). For FFHQ, despite that FUNIT makes some changes, the changes are not interpreted as meaningful domain translations. For LSUN Car, FUNIT fails to keep the fidelity.
147
+
148
+ We also visualize the style space of both models to qualitatively assess the quality of the representation. Figure 5 shows the t-SNE maps trained on AFHQ Wild and the examples of each cluster. Surprisingly, TUNIT organizes the samples according to the species where it roughly separates the images into six species. Although we set $\cdot$ to be overly large, the model represents one species into two domains where those two domains position much closely. The highly disentangled, meaningful style features can be an important factor in the success of our model. On the other hand, the style features of FUNIT hardly learn meaningful domains so that the model cannot conduct the translation properly as shown in Figure 4. Because of the page limit, we include more results in Appendix E, G.
149
+
150
+ # 3.3 ANALYSIS ON GENERALIZABILITY
151
+
152
+ Robustness to various $\hat { K }$ ’s. When TUNIT conducts clustering for estimating domain labels, the number of clusters $\cdot$ can affect the overall performances. Here, we study the effects on different $\cdot$ on the labeled datasets and report them in Figure 6 and Table 2. As expected, the model performs best in terms of mFID when $\cdot$ equals to the ground truth $K$ (i.e. $\hat { K } { = } 1 0 $ ). Additionally, TUNIT performs reasonably well for sufficiently large $\cdot$ $\geq 7 )$ , and even with 100 times larger $\hat { K }$ than the actual number of the domains, TUNIT still works well on both datasets. From this study, we conclude that TUNIT is relatively robust against $\hat { K }$ as long as it is sufficiently large. We suggest using a sufficiently large number of $\hat { K }$ or studying different $\hat { K }$ ’s in log scale to find the optimal model.
153
+
154
+ With Few labels. We investigate whether or not TUNIT is effective for the partially labeled dataset that corresponds to a more practical scenario. To this end, we use AnimalFaces-10 and Food-10. We partition the dataset $\mathcal { D }$ into the labeled set $\mathcal { D } _ { s u p }$ and the unlabeled set $\mathcal { D } _ { u n }$ with varying ratio $\gamma = \vert \mathcal { D } _ { s u p } \vert / \vert \mathcal { D } \vert$ . Like before, we choose FUNIT as a competitor. We first train the networks while changing $\gamma$ from 0.2 to 1.0 and report the result Table 3. As $\gamma$ decreases, the performance of FUNIT significantly degrades whereas our model maintains mFID around 45 and 55 on both datasets. We also train an auxiliary classifier (VGG-11BN) with $\mathcal { D } _ { s u p }$ then provide pseudo-labels for $\mathcal { D } _ { u n }$ to FUNIT. As shown in Table 4, the performance of FUNIT is no longer sensitive to the changes in $\gamma$ but still much worse than TUNIT. Although semi-supervised learning schemes can further improve FUNIT, TUNIT outperforms FUNIT using all labels as seen in Table 1. Under the empirical results in the semi-supervised scenario, we verify that TUNIT is also effective for semi-supervised setting.
155
+
156
+ # 4 CONCLUSION
157
+
158
+ We argue that the unsupervised image-to-image translation should not utilize any supervision, such as image-level (i.e. paired) or set-level (i.e. unpaired) supervision. Under this rigorous regime, many previous studies fall into the set-level supervised framework that uses the domain information at a minimum. In this paper, for the first time, we proposed an effective model to handle the truly unsupervised image-to-image translation. To this end, we suggested the guiding network that performs unsupervised representation learning for providing pseudo labels and the image translation tasks. The experimental results showed that guiding network indeed exploits the synergy between two tasks, and the proposed model successfully conducts the unsupervised-image-to-image translation. We also showed the generalizability on the value of $\hat { K }$ and the partially labeled scenario.
159
+
160
+ # REFERENCES
161
+
162
+ H. Bahng, S. Chung, S. Yoo, and J. Choo. Exploring unlabeled faces for novel attribute discovery. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5820– 5829, 2020.
163
+
164
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020a.
165
+
166
+ Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
167
+
168
+ Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. Stargan: Unified generative adversarial networks for multi-domain image-to-image translation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8789–8797, 2018.
169
+
170
+ Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. Stargan v2: Diverse image synthesis for multiple domains. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2020.
171
+
172
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In International Conference on Learning Representations, 2018.
173
+
174
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 2, pp. 1735–1742. IEEE, 2006.
175
+
176
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015.
177
+
178
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
179
+
180
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9729–9738, 2020.
181
+
182
+ 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.
183
+
184
+ Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learning lecture 6a overview of mini-batch gradient descent. 2012.
185
+
186
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2019.
187
+
188
+ Judy Hoffman, Eric Tzeng, Taesung Park, Jun-Yan Zhu, Phillip Isola, Kate Saenko, Alexei Efros, and Trevor Darrell. Cycada: Cycle-consistent adversarial domain adaptation. In International conference on machine learning, pp. 1989–1998, 2018.
189
+
190
+ Xun Huang, Ming-Yu Liu, Serge Belongie, and Jan Kautz. Multimodal unsupervised image-toimage translation. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 172–189, 2018.
191
+
192
+ 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.
193
+
194
+ Xu Ji, Joao F Henriques, and Andrea Vedaldi. Invariant information clustering for unsupervised˜ image classification and segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 9865–9874, 2019.
195
+
196
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations, 2018.
197
+
198
+ 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.
199
+
200
+ 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.
201
+
202
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
203
+
204
+ Orest Kupyn, Volodymyr Budzan, Mykola Mykhailych, Dmytro Mishkin, and Jiˇr´ı Matas. Deblurgan: Blind motion deblurring using conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8183–8192, 2018.
205
+
206
+ Hsin-Ying Lee, Hung-Yu Tseng, Qi Mao, Jia-Bin Huang, Yu-Ding Lu, Maneesh Singh, and MingHsuan Yang. Dri $^ { + + }$ : Diverse image-to-image translation via disentangled representations. International Journal of Computer Vision, pp. 1–16, 2020.
207
+
208
+ Jae Hyun Lim and Jong Chul Ye. Geometric gan. arXiv preprint arXiv:1705.02894, 2017.
209
+
210
+ Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. arXiv preprint arXiv:1312.4400, 2013.
211
+
212
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In Advances in neural information processing systems, pp. 700–708, 2017.
213
+
214
+ Ming-Yu Liu, Xun Huang, Arun Mallya, Tero Karras, Timo Aila, Jaakko Lehtinen, and Jan Kautz. Few-shot unsupervised image-to-image translation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 10551–10560, 2019.
215
+
216
+ Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Which training methods for gans do actually converge? In ICML, 2018.
217
+
218
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
219
+
220
+ Muhammad Ferjad Naeem, Seong Joon Oh, Youngjung Uh, Yunjey Choi, and Jaejun Yoo. Reliable fidelity and diversity metrics for generative models. 2020.
221
+
222
+ Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In CVPR, 2019.
223
+
224
+ 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.
225
+
226
+ Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In International Conference on Machine Learning, pp. 5628–5637, 2019.
227
+
228
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
229
+
230
+ Saurabh Singh and Shankar Krishnan. Filter response normalization layer: Eliminating batch dependence in the training of deep neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11237–11246, 2020.
231
+
232
+ Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in neural information processing systems, pp. 3483–3491, 2015.
233
+
234
+ Dustin Tran, Rajesh Ranganath, and David Blei. Hierarchical implicit models and likelihood-free variational inference. In Advances in Neural Information Processing Systems, pp. 5523–5533, 2017.
235
+
236
+ Wouter Van Gansbeke, Simon Vandenhende, Stamatios Georgoulis, Marc Proesmans, and Luc Van Gool. Scan: Learning to classify images without labels. In European Conference on Computer Vision (ECCV), 2020.
237
+
238
+ 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 CVPR, 2018.
239
+
240
+ I Zeki Yalniz, Herve J ´ egou, Kan Chen, Manohar Paluri, and Dhruv Mahajan. Billion-scale semi- ´ supervised learning for image classification. arXiv preprint arXiv:1905.00546, 2019.
241
+
242
+ Dingdong Yang, Seunghoon Hong, Yunseok Jang, Tiangchen Zhao, and Honglak Lee. Diversitysensitive conditional generative adversarial networks. In International Conference on Learning Representations, 2019.
243
+
244
+ Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
245
+
246
+ 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, 2017a.
247
+
248
+ Jun-Yan Zhu, Richard Zhang, Deepak Pathak, Trevor Darrell, Alexei A Efros, Oliver Wang, and Eli Shechtman. Toward multimodal image-to-image translation. In Advances in neural information processing systems, pp. 465–476, 2017b.
249
+
250
+ # APPENDIX
251
+
252
+ # A RELATED WORK
253
+
254
+ Image-to-image translation. Since the seminal work of Pix2Pix (Isola et al., 2017), image-to-image translation models have shown impressive results (Zhu et al., 2017a; Liu et al., 2017; Kim et al., 2017; Kupyn et al., 2018; Choi et al., 2018; Huang et al., 2018; Liu et al., 2019; Yang et al., 2019). Exploiting the cycle consistency constraint, these methods were able to train the model with a setlevel supervision (domains) solely. However, acquiring domain information can be a huge burden in practical applications where a large amount of data are gathered from several mixed domains, e.g., web images (Yalniz et al., 2019). Not only does this complicates the data collection, but it restricts the methods only applicable to the existing dataset and domains. Inspired from few shot learning, Liu et al. (2019) proposed FUNIT that works on previously unseen target classes. However, FUNIT still requires the labels for training. Recently, Bahng et al. (Bahng et al., 2020) has partially addressed this by adopting the ImageNet pre-trained classifier for extracting domain information. Unlike the previous methods, we aim to design an image-to-image translation model that can be applied without any supervision such as a pre-trained network or supervision on both the train and the test datasets.
255
+
256
+ Unsupervised representation learning and clustering. Unsupervised representation learning aims to extract meaningful features for downstream tasks without any human supervision. To this end, many researchers have proposed to utilize the information that can be acquired from the data itself (Gidaris et al., 2018; Hjelm et al., 2019; Ji et al., 2019; He et al., 2020; Van Gansbeke et al., 2020). Recently, by incorporating the contrastive learning into a dictionary learning framework, MoCo (He et al., 2020) has achieved outstanding performance in various downstream tasks under reasonable mini-batch size. On the other hand, IIC (Ji et al., 2019) have utilized the mutual information maximization in a unsupervised way so that the network clusters images while assigning the images evenly. Though IIC provided a principled way to perform unsupervised clustering, it fails to scale up when combined with a difficult downstream task such as image-to-image translation. By taking the best of both worlds, we aim to solve unsupervised image-to-image translation.
257
+
258
+ # B TRAINING DETAILS
259
+
260
+ We train the guiding network for the first 65K iterations while freezing the update from both the generator and the discriminator. Then, we train the whole framework 100K more iterations for training all the networks. The batch size is set to 32 and 16 for $1 2 8 \times 1 2 8$ and $2 5 6 \times 2 5 6$ images, respectively. Training takes about 36 hours on a single Tesla V100 GPU with our implementation using PyTorch(Paszke et al., 2017). We use Adam (Kingma & Ba, 2014) optimizer with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . { \dot { 9 } } 9$ for the guiding network, and RMSprop (Hinton et al., 2012) optimizer with $\alpha = 0 . 9 9$ for the generator and the discriminator. All learning rates are set to 0.0001 with a weight decay 0.0001. We adopt hinge version adversarial loss (Lim & Ye, 2017; Tran et al., 2017) with $R _ { 1 }$ regularization (Mescheder et al., 2018) using $\gamma = 1 0$ (Eq. 5). We set $\lambda _ { \mathrm { { r e c } } } = 0 . 1 , \lambda _ { \mathrm { { s t y l e } } } ^ { G } = 0 . 0 1 , \lambda _ { \mathrm { { s t y l e } } } ^ { E } = \bar { 1 }$ , and $\lambda _ { \mathrm { M I } } = 5$ in equation. 6 for all experiments. When the guiding network is simultaneously trained with the generator, we decrease $\lambda _ { \mathrm { s t y l e } } ^ { E ^ { \ast } }$ and $\lambda _ { \mathrm { M I } }$ to 0.1 and 0.5, respectively. For evaluation, we use the exponential moving average over the parameters (Karras et al., 2018) of the guiding network and the generator. We initialize the weights of convolution layers with He initialization (He et al., 2015), all biases to zero, and weights of linear layers from $N ( 0 , 0 . 0 1 )$ with zero biases. The source code will be available publicly.
261
+
262
+ # C EVALUATION PROTOCOL
263
+
264
+ For evaluation, we use class-wise Frechet Inception Distance (FID) (Heusel et al., 2017), which´ is often called mFID in literatures and D&C (Naeem et al., 2020). FID measures Frechet distance ´ between real and fake samples embedded by the last average pooling layer of Inception-V3 pretrained on ImageNet. Class-wise FID is obtained by averaging the FIDs of individual classes. In the experiments with fewer labels, we report the mean value of best five mFID’s over 100K iterations. For example, we use entire real images of each class and generate 810 fake images where $1 8 ~ \times$ $( K - 1 )$ source images $K = 1 0$ for AnimalFaces-10) and five reference images of AnimalFaces10 are used to produce those fake images. We choose the source images from all classes except for the target class. For each source image, the five references are selected arbitrarily. For D&C, we generate fake images the similar number of training images with randomly selected source and reference images. Then, we use Inception-V3 pre-trained on ImageNet for extracting feature vectors and measure D&C by using the feature vectors.
265
+
266
+ # D ARCHITECTURE DETAILS
267
+
268
+ For the guiding network, we use VGG11 before the linear layers followed by the average pooling operation as the shared part and append two branches $E _ { \mathrm { c l a s s } }$ and $E _ { \mathrm { s t y l e } }$ . The branches are one linear layer with $\hat { K }$ and 128 dimensional outputs, respectively. The detailed information of the generator, the guiding network and the discriminator architectures are provided in Table 5, Table 6 and Table 7.
269
+
270
+ Table 5: Generator architecture. “ch” represents the channel multiplier that is set to 64. IN and AdaIN indicate instance normalization and adaptive instance normalization, respectively.
271
+
272
+ <table><tr><td>LAYER</td><td>RESAMPLE</td><td>NORM</td><td>OUTPUT SHAPE</td></tr><tr><td>Image x</td><td></td><td>1</td><td>128×128×3</td></tr><tr><td>Conv7×7</td><td></td><td>IN</td><td>128 ×128 × ch</td></tr><tr><td>Conv4×4</td><td>Stride 2</td><td>IN</td><td>64 × 64× 2ch</td></tr><tr><td>Conv4×4</td><td>Stride 2</td><td>IN</td><td>32 × 32×4ch</td></tr><tr><td>Conv4×4</td><td>Stride 2</td><td>IN</td><td>16 ×16 ×8ch</td></tr><tr><td>ResBlk</td><td></td><td>IN</td><td>16 ×16 ×8ch</td></tr><tr><td>ResBlk</td><td></td><td>IN</td><td>16 × 16 × 8ch</td></tr><tr><td>ResBlk</td><td></td><td>AdaIN</td><td>16 ×16 ×8ch</td></tr><tr><td>ResBlk</td><td></td><td>AdaIN</td><td>16 ×16× 8ch</td></tr><tr><td>Conv5×5</td><td>Upsample</td><td>AdaIN</td><td>32 × 32 × 4ch</td></tr><tr><td>Conv5×5</td><td>Upsample</td><td>AdaIN</td><td>64 ×64× 2ch</td></tr><tr><td>Conv5×5</td><td>Upsample</td><td>AdaIN</td><td>128 ×128 × ch</td></tr><tr><td>Conv7×7</td><td></td><td>1</td><td>128 ×128×3</td></tr></table>
273
+
274
+ <table><tr><td>LAYER</td><td>RESAMPLE</td><td>NORM</td><td>OUTPUT SHAPE</td></tr><tr><td>Image X</td><td></td><td>■</td><td>128 ×128×3</td></tr><tr><td>Conv3×3</td><td>MaxPool</td><td>BN</td><td>64 × 64× ch</td></tr><tr><td>Conv3×3</td><td>MaxPool</td><td>BN</td><td>32 × 32× 2ch</td></tr><tr><td>Conv3×3</td><td>=</td><td>BN</td><td>32 × 32 ×4ch</td></tr><tr><td>Conv3×3</td><td>MaxPool</td><td>BN</td><td>16 ×16 ×4ch</td></tr><tr><td>Conv3×3</td><td>=</td><td>BN</td><td>16 ×16 ×8ch</td></tr><tr><td>Conv3×3</td><td>MaxPool</td><td>BN</td><td>8×8×8ch</td></tr><tr><td>Conv3×3</td><td>=</td><td>BN</td><td>8×8×8ch</td></tr><tr><td>Conv3×3</td><td>MaxPool</td><td>BN</td><td>4×4×8ch</td></tr><tr><td>GAP</td><td></td><td></td><td>1×1×8ch</td></tr><tr><td>FC</td><td></td><td></td><td>128</td></tr><tr><td>FC</td><td></td><td></td><td>K</td></tr></table>
275
+
276
+ Table 6: Guiding network architecture. “ch” represents the channel multiplier that is set to 64. The architecture is based on VGG11-BN. GAP and FC denote global average polling (Lin et al., 2013) and fully connected layer, respectively.
277
+
278
+ Table 7: Discriminator architecture. “ch” and $\hat { K }$ represent the channel multiplier that is set to 64 and the number of clusters, respectively. FRN indicates filter response normalization (Singh & Krishnan, 2020).
279
+
280
+ <table><tr><td>LAYER</td><td>RESAMPLE</td><td>NORM</td><td>OUTPUT SHAPE</td></tr><tr><td>Image x</td><td></td><td></td><td>128 × 128 × 3</td></tr><tr><td>Conv3×3</td><td></td><td>1</td><td>128 ×128×ch</td></tr><tr><td>ResBlk</td><td></td><td>FRN</td><td>128 × 128× ch</td></tr><tr><td>ResBlk</td><td>AvgPool</td><td>FRN</td><td>64×64×2ch</td></tr><tr><td>ResBlk</td><td></td><td>FRN</td><td>64 × 64 × 2ch</td></tr><tr><td>ResBlk</td><td>AvgPool</td><td>FRN</td><td>32 × 32 × 4ch</td></tr><tr><td>ResBlk</td><td></td><td>FRN</td><td>32 ×32×4ch</td></tr><tr><td>ResBlk</td><td>AvgPool</td><td>FRN</td><td>16 ×16× 8ch</td></tr><tr><td>ResBlk</td><td></td><td>FRN</td><td>16 ×16 ×8ch</td></tr><tr><td>ResBlk</td><td>AvgPool</td><td>FRN</td><td>8×8×16ch</td></tr><tr><td>ResBlk</td><td>=</td><td>FRN</td><td>8×8×16ch</td></tr><tr><td>ResBlk</td><td>AvgPool</td><td>FRN</td><td>4×4×16ch</td></tr><tr><td>LReLU</td><td></td><td>-</td><td>4×4×16ch</td></tr><tr><td>Conv4×4</td><td></td><td></td><td>1 ×1×16ch</td></tr><tr><td>LReLU</td><td></td><td></td><td>1×1×16ch</td></tr><tr><td>Conv1 ×1</td><td></td><td></td><td>K</td></tr></table>
281
+
282
+ # E T-SNE VISUALIZATION & CLUSTER EXAMPLE IMAGES
283
+
284
+ # E.1 AFHQ CAT
285
+
286
+ ![](images/fc348f4607da18baa172df674d4f49f61120f9d2e8826232de5da073fd1a8cf4.jpg)
287
+ Figure 7: t-SNE visualization and representative images of each domain.
288
+
289
+ # E.2 AFHQ DOG
290
+
291
+ ![](images/2c33a719764bd4c2605c0f8b74bde3f74980d4147e314e1af19f6680f91ba8d1.jpg)
292
+ Figure 8: t-SNE visualization and representative images of each domain.
293
+
294
+ # E.3 FFHQ
295
+
296
+ ![](images/8291e471dc5724d37120bc58abe1bff180aa37d5fe815b57b5511f6aa0b1f7c0.jpg)
297
+ Figure 9: t-SNE visualization and representative images of each domain.
298
+
299
+ ![](images/a326590eebf7a605dd8b25613cefa15e4c1fc8dc45a97bb723d090384a36f254.jpg)
300
+ Figure 10: t-SNE visualization and representative images of each domain.
301
+
302
+ # F ADDITIONAL COMPARISON WITH FUNIT: AFHQ, LSUN CAR AND FFHQ
303
+
304
+ ![](images/07f155349578d6c592d3bda8fa9a778649e764bca7098c1ae8aa2e7d2b19cf3a.jpg)
305
+ Figure 11: AFHQ Cat, unsupervised reference-guided image-to-image translation results of FUNIT and TUNIT. The content and the style are from the source and the reference, respectively. While FUNIT usually fails to reflect the style of the reference image, TUNIT generates the fake images with the style – color, fur texture.
306
+
307
+ ![](images/b3bace1042798af3e0fb5a2795170a9a5009ac7d71692429a07f1c6c18b72238.jpg)
308
+ Figure 12: AFHQ Wild, unsupervised reference-guided image-to-image translation results of FUNIT and TUNIT. FUNIT rarely reflects the correct style of the reference image – the species, on the other hand, TUNIT translates the source image to the correct species.
309
+
310
+ ![](images/e084a58d925cf91bb1fa567c3d631805ab09fb971ca71f7075df97d44e937ebb.jpg)
311
+ Figure 13: LSUN Car, unsupervised reference-guided image-to-image translation results of FUNIT and TUNIT. While TUNIT generates plausible and changes the color of the source image to that of the reference image, FUNIT not also generates unrealistic image but also fails to changes the color.
312
+
313
+ ![](images/5874faa938abe04badb873854ec73b30399a316537234f2f48efb68402327600.jpg)
314
+ Figure 14: FFHQ, unsupervised reference-guided image-to-image translation results of FUNIT and TUNIT. Our model, TUNIT can remove or add the glasses to the source while preserving the identity better than FUNIT. In addition, TUNIT can change the hair color (last column) and the hair style – especially, bang (fifth column). It is hard to specify the definition of domains in the results of FUNIT while domains of TUNIT are more interpretable.
315
+
316
+ # G ADDITIONAL RESULTS OF TUNIT: AFHQ, LSUN CAR, FFHQ, ANIMALFACES-10, AND S2W
317
+
318
+ # G.1 ANIMALFACES-10
319
+
320
+ ![](images/88b0b3eeee8ffcbc01a5759b9788c45391fc79eb37935d71124a22ebc32b48c2.jpg)
321
+ Figure 15: AnimalFaces-10, unsupervised image-to-image translation results.
322
+
323
+ # G.2 AFHQ CAT
324
+
325
+ ![](images/9cb4d71aa0710ef8dd9714741e5f8d79c1b0fac3feaaa2ccacb5815b7301cc21.jpg)
326
+ Figure 16: AFHQ Cat, unsupervised image-to-image translation results.
327
+
328
+ # G.3 AFHQ DOG
329
+
330
+ ![](images/6b8adf8c098cb154222098a401cdbfa102bd9031f81841dad4da280e3f7123d4.jpg)
331
+ Figure 17: AFHQ Dogs, unsupervised image-to-image translation results.
332
+
333
+ ![](images/80b9f2e057c5c37a520f5b27b98152ce046e400208859aae223622c8eeb5e271.jpg)
334
+ Figure 18: AFHQ Wild, unsupervised image-to-image translation results.
335
+
336
+ # G.5 FFHQ
337
+
338
+ ![](images/e9b3985e1717ce957b749fafa8203b287216137b9fb976fb00cb7af88299df7f.jpg)
339
+ Figure 19: FFHQ, unsupervised image-to-image translation results.
340
+
341
+ ![](images/532ae5574b3192ebc35d51df8e9ee4181978770b03f90bdb42b7823829f2993b.jpg)
342
+ Figure 20: LSUN Car, unsupervised image-to-image translation results.
343
+
344
+ # G.7 SUMMER2WINTER (S2W)
345
+
346
+ ![](images/ddaa5e2107475c064cc2c585a0b55ec9428d95f68325596665efa96acfd37489.jpg)
347
+ (b) Results guided by reference images
348
+ Figure 21: Summer2Winter (S2W), unsupervised image-to-image translation results.
349
+
350
+ # H DIFFERENCE BETWEEN EQUATION (2) AND EQUATION (4)
351
+
352
+ Equation (2) and (4) have similar forms – contrastive loss, but they are used for different purposes. We use equation (2) to improve the representation power of the guiding network, which affects the performance of the generator and the discriminator. On the other hand, equation (4) is used to enforce the generator to reflect the style of a reference image when translating a source image. To examine the effect of each loss, we train models without either equation (2) or (4) on AnimalFaces10. The mFID score without equation (2) or (4) is 86.8 and 93.3, respectively. Both models are significantly worse than the original setting (47.7). It means that both equation (2) and (4) should be considered during training. In addition to the purpose, they are different in terms of the way to choose positive pairs. We use a real image and its randomly augmented version as a positive pair in equation (2) while we use the translated image and reference image as a positive pair. In summary, the role of equation (2) is to enhance the representation power of the guiding network and lead the guiding network to learn how to encode the style vector in terms of a style encoder while the role of equation (4) is to guide the generator to learn how to interpret the provided style vector as a form of the output image.
353
+
354
+ # I FID AND LPIPS ON UNLABELED DATASET
355
+
356
+ ![](images/7a8c6b6e2634ff1d75b3020ef9c1db65c6f1bf71cd84e0c87f1e28de3dba5251.jpg)
357
+ Figure 22: LPIPS and FID of models and their status.
358
+
359
+ We also utilize LPIPS to evaluate the models in addition to FID and D&C. However, LPIPS is not proper to evaluate the loyalty for reflecting the reference image and the fidelity of images, we use LPIPS with FID. Figure 22 shows the result. It is clear that a model with high FID and LPIPS generates a noise-like image. Even if FID is low, a model with high LPIPS also fails to conduct the reference-guided image translation, because it does not preserve the structure of the source image. The model with low LPIPS and high FID might be an adversarial example of LPIPS. We generate the image via optimization on LPIPS. If a model exhibits low FID and LPIPS, it might not reflect the visual feature of the reference image enough. The simple combination of LPIPS and FID can detect several failed models but can not evaluate the loyalty for the reference image. We suggest that the rigorous way to combine several metrics for the quantitative evaluation of the reference-guided translation might be a interesting future work.
md/train/H1exf64KwH/H1exf64KwH.md ADDED
@@ -0,0 +1,426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXPLORING MODEL-BASED PLANNING WITH POLICY NETWORKS
2
+
3
+ Tingwu Wang1,2& Jimmy $\mathbf { B a } ^ { 1 , 2 }$
4
+ 1 Department of Computer Science, University of Toronto 2 Vector Institute
5
+ {tingwuwang,jba}@cs.toronto.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Model-based reinforcement learning (MBRL) with model-predictive control or online planning has shown great potential for locomotion control tasks in both sample efficiency and asymptotic performance. Despite the successes, the existing planning methods search from candidate sequences randomly generated in the action space, which is inefficient in complex high-dimensional environments. In this paper, we propose a novel MBRL algorithm, model-based policy planning (POPLIN), that combines policy networks with online planning. More specifically, we formulate action planning at each time-step as an optimization problem using neural networks. We experiment with both optimization w.r.t. the action sequences initialized from the policy network, and also online optimization directly w.r.t. the parameters of the policy network. We show that in the MuJoCo benchmarking environments, POPLIN is about $3 \mathbf { x }$ more sample efficient than the previously stateof-the-art algorithms, such as PETS, TD3 and SAC. To explain the effectiveness of our algorithm, we show that the optimization surface in parameter space is smoother than in action space. Further more, we found the distilled policy network can be effectively applied without the expansive model predictive control during test time for some environments such as Cheetah. Code is released here1.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ A model-based reinforcement learning (MBRL) agent learns its internal model of the world, i.e. the dynamics, from repeated interactions with the environment. With the learnt dynamics, a MBRL agent can for example perform online planning, interact with imaginary data, or optimize the controller through dynamics, which provides significantly better sample efficiency (Deisenroth & Rasmussen, 2011; Sutton, 1990; Levine & Abbeel, 2014; Levine & Koltun, 2013). However, MBRL algorithms generally do not scale well with the increasing complexity of the reinforcement learning (RL) tasks in practice. And modelling errors in dynamics that accumulate with time-steps greatly limit the applications of MBRL algorithms. As a result, many latest progresses in RL has been made with model-free reinforcement learning (MFRL) algorithms that are capable of solving complex tasks at the cost of large number of samples (Schulman et al., 2017; Heess et al., 2017; Schulman et al., 2015; Mnih et al., 2013; Lillicrap et al., 2015; Haarnoja et al., 2018).
14
+
15
+ With the success of deep learning, a few recent works have proposed to learn neural network-based dynamics models for MBRL. Among them, random shooting algorithms (RS), which uses modelpredictive control (MPC), is shown to have good robustness and scalability (Richards, 2005). In shooting algorithms, the agent randomly generates action sequences, use the dynamics to predict the future states, and choose the first action from the sequence with the best expected reward. However, RS usually has worse asymptotic performance than model-free controllers (Nagabandi et al., 2017), and the authors of the the PETS algorithm (Chua et al., 2018) suggest that the performance of RS is directly affected by the quality of the learnt dynamics. They propose a probabilistic ensemble to capture model uncertainty, which enables PETS algorithm to achieve both better sample efficiency and better asymptotic performance than state-of-the-art model-free controllers in environments such as Cheetah. However, PETS is not as effective on environments with higher dimensionality.
16
+
17
+ ![](images/ad3dddae5537aad63d7ae3de75a7d3d6229eccb8ab15eeda336635a3a20e249d.jpg)
18
+ Figure 1: We transform each planned candidate action trajectory with PCA into a 2D blue scatter. The top and bottom figures are respectively the visualization of PETS (Chua et al., 2018) and our algorithm. The red area has higher reward. From left to right, we show how candidate trajectories are updated, across different planning iterations within one time-step. As we can see, while both reward surface is not smooth with respect to action trajectory. POPLIN, using policy networks, has much better search efficiency, while PETS is stuck around its initialization. The details are in section 5.3.
19
+
20
+ In this paper, we explore MBRL algorithms from a different perspective, where we treat the planning at each time-step as an optimization problem. Random search in action space, as what is being done in state-of-the-art MBRL algorithms such as PETS, is insufficient for more complex environments. On the one hand, we are inspired by the success of AlphaGo (Silver et al., 2016; 2017), where a policy network is used to generate proposals for the Monte-Carlo tree search. On the other hand, we are inspired by the recent research into understanding deep neural networks (Nguyen & Hein, 2017; Li et al., 2018; Soudry & Hoffer, 2017). Deep neural networks, frequently observed in practices, is much less likely to get stuck in sub-optimal points. In Figure 1, we apply principal component analysis (PCA) on the action sequences generated in each planning iteration within one time-step. The reward surface of the action space is not smooth and prone to local-minimas. We argue that optimization in the policy network’s parameter space will be more efficient. Furthermore, we note that the state-of-the-art MBRL algorithm with MPC cannot be applied real-time. We therefore experiment with different policy network distillation schemes for fast control without MPC. To sum up, the contribution of this paper is three-fold:
21
+
22
+ • We apply policy networks to generate proposals for MPC in high dimensional locomotion control problems with unknown dynamics.
23
+ • We formulate planning as optimization with neural networks, and propose policy planning in parameter space, which obtain state-of-the-art performance on current bench-marking environments, being about 3x more sample efficient than the previous state-of-the-art algorithm, such as PETS (Chua et al., 2018), TD3 (Fujimoto et al., 2018) and SAC (Haarnoja et al., 2018).
24
+ • We also explore policy network distillation from the planned trajectories. We found the distilled policy network alone achieves high performance on environments like Cheetah without the expansive online planning.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Model-based reinforcement learning (MBRL) has been long studied. Dyna (Sutton, 1990; 1991) algorithm alternately performs sampling in the real environments and optimize the controllers on the learned model of the environments. Other pioneering work includes PILCO (Deisenroth & Rasmussen, 2011), where the authors model the dynamics using Gaussian Process and directly optimize the surrogate expected reward. Effective as it is to solve simple environments, PILCO heavily suffers the curse of dimensionality. In (Levine & Abbeel, 2014; Levine & Koltun, 2013; Levine et al., 2016; Chebotar et al., 2017; Zhang et al., 2018), the authors propose guided policy search (GPS). GPS uses iLQG (Li & Todorov, 2004; Todorov & Li, 2005; Tassa et al., 2012) as the local controller, and distill the knowledge into a policy neural network. In SVG (Heess et al., 2015), the authors uses stochastic value gradient so that the stochastic policy network can be optimized by back-propagation with off-policy data. Recently with the progress of model-free algorithms such as TRPO and PPO (Schulman et al., 2015; 2017), Kurutach et al. (2018); Luo et al. (2019) propose modern variants of Dyna, where TRPO (Schulman et al., 2015) is used to optimize the policy network using data generated by the learnt dynamics. Concurrent to this work, Janner et al. (2019) further use SAC (Haarnoja et al., 2018) to train the policy network, and gets state-of-the-art performance on many tasks. At the same time, random shooting methods proposed by Nagabandi et al. (2017); Chua et al. (2018) have shown its robustness and effectiveness on benchmarking environments. PETS algorithm (Chua et al., 2018) is considered by many to be the state-of-the-art shooting algorithm, which we discuss in detail in section 3. Dynamics is also used to obtain better value estimation to speed up training (Gu et al., 2016; Feinberg et al., 2018; Buckman et al., 2018). Latent dynamics models using VAE (Kingma & Welling, 2013) are commonly used to solve problems with image input (Ha & Schmidhuber, 2018a;b; Hafner et al., 2018; Kaiser et al., 2019).
29
+
30
+ # 3 BACKGROUND
31
+
32
+ # 3.1 REINFORCEMENT LEARNING
33
+
34
+ In reinforcement learning, the problem of solving the given task is formulated as a infinite-horizon discounted Markov decision process. For the agent, we denote the action space and state space respectively as $\mathcal { A }$ and $s$ . We also denote the reward function and transition function as $r ( s _ { t } , a _ { t } )$ and $f ( s _ { t + 1 } | s _ { t } , a _ { t } )$ , where $s _ { t } \in S$ and $a _ { t } \in \mathcal A$ are the state and action at time-step $t$ . The reward $\begin{array} { r } { J ( \pi ) = \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { \infty } r ( s _ { t } , a _ { t } ) ] } \end{array}$ to the agent in this work. The agent mwith respect to the agent’s controller $\pi$ ximizes its expected total reward.
35
+
36
+ # 3.2 RANDOM SHOOTING ALGORITHM AND PETS
37
+
38
+ Our proposed algorithm is based on the random shooting algorithm (Richards, 2005). In random shooting algorithms (Nagabandi et al., 2017; Chua et al., 2018), a data-set of $\mathcal { D } = \{ ( s _ { t } , a _ { t } , s _ { t + 1 } ) \}$ is collected from previously generated real trajectories. The agent learns an ensemble of neural networks denoted as $f _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } )$ , with the parameters of the neural networks denoted as $\phi$ . In planning, the agent randomly generates a population of $K$ candidate action sequences. Each action sequence, denoted as $\mathbf { a } = \{ a _ { 0 } , . . . , a _ { \tau } \}$ , contains the control signals at every time-steps within the planning horizon $\tau$ . The action sequence with the best expected reward given the current dynamics network $f _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } )$ is chosen. RS, as a model-predictive control algorithm, only executes the first action signal and re-plan at time-step. In PETS (Chua et al., 2018), the authors further use cross entropy method (CEM) (De Boer et al., 2005; Botev et al., 2013) to re-samples sequences near the best sequences from the last CEM iteration.
39
+
40
+ # 4 MODEL-BASED POLICY PLANNING
41
+
42
+ In this section, we describe two variants of POPLIN: model-based policy planning in action space (POPLIN-A) and model-based policy planning in parameter space (POPLIN-P). Following the notations in section 3.2, we define the expected planning reward function at time-step $i$ as follows:
43
+
44
+ <table><tr><td colspan="2">Algorithm1GeneralPOPLINFramework</td></tr><tr><td></td><td>1: while Training iterations not Finished do</td></tr><tr><td>2:</td><td>for ith time-step of the agent do</td></tr><tr><td>3:</td><td>CEM planning as in section 4.1, 4.2</td></tr><tr><td>4:</td><td>Execute the first action from CEM.</td></tr><tr><td>5:</td><td>end for</td></tr><tr><td>6:</td><td>Dynamics update and policy distillation.</td></tr><tr><td>7: end while</td><td></td></tr></table>
45
+
46
+ $$
47
+ \mathcal { R } ( s _ { i } , \mathbf { a } _ { i } ) = \mathbb { E } \left[ \sum _ { t = i } ^ { i + \tau } r ( s _ { t } , a _ { t } ) \right] , \mathrm { w h e r e } s _ { t + 1 } \sim f _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } ) .
48
+ $$
49
+
50
+ The action sequence $\mathbf { a } _ { i } = \{ a _ { i } , a _ { i + 1 } , . . . , a _ { i + \tau } \}$ is generated by the policy search module, as later described in Section 4.1 and 4.2. The expectation of predicted trajectories $\{ s _ { i } , s _ { i + 1 } , . . . , s _ { i + \tau } \}$ is estimated by creating $P$ particles from the current state. The dynamics model $f _ { \phi } ^ { k , t } ( s _ { t + 1 } | s _ { t } , a _ { t } )$ used by $k ^ { t h }$ particle at time-step $t$ is sampled from deterministic or probabilistic ensemble models. To better illustrate, throughout the paper we denote this dynamics as a fixed deterministic model, i.e. $f _ { \phi } ^ { k , t } \equiv f _ { \phi }$ . In practice the dynamics uses probabilistic ensemble models, which requires some trivial modifications to the math and we refer readers to PETS Chua et al. (2018) for details.
51
+
52
+ # 4.1 MODEL-BASED POLICY PLANNING IN ACTION SPACE
53
+
54
+ In model-based policy planning in action space (POPLIN-A), we use a policy network to generate good initial action distribution. We denote the policy network as $\pi ( s _ { t } )$ . Once the policy network proposes sequences of actions on the expected trajectories, we add Gaussian noise to the candidate actions and use CEM to fine-tune the mean and standard deviation of the noise distribution.
55
+
56
+ Similar to defining $\mathbf { a } _ { i } = \{ a _ { i } , a _ { i + 1 } , . . . , a _ { i + \tau } \}$ , we denote the noise sequence at time-step $t$ with horizon $\tau$ as $\delta _ { i } = \{ \delta _ { i } , \delta _ { i + 1 } , . . . , \delta _ { i + \tau } \}$ . We initialize the noise distribution as a Gaussian distribution with mean $\mu _ { 0 } = \mathbf { 0 }$ and covariance $\Sigma _ { 0 } = \sigma _ { 0 } ^ { 2 } { \cal I }$ , where $\sigma _ { 0 } ^ { 2 }$ is the initial noise variance. In each CEM iteration, we first sort out the sequences with the top $\xi + 1$ expected planning reward, whose noise sequences are denoted as $\{ \delta _ { i } ^ { 0 } , \delta _ { i } ^ { 1 } , . . . , \delta _ { i } ^ { \xi } \}$ . Then we estimate the noise distribution of the elite candidates, i. e.,
57
+
58
+ $$
59
+ \Sigma ^ { \prime } \mathrm { C o v } ( \{ \delta _ { i } ^ { 0 } , \delta _ { i } ^ { 1 } , . . . , \delta _ { i } ^ { \xi } \} ) , \mu ^ { \prime } \mathrm { M e a n } ( \{ \delta _ { i } ^ { 0 } , \delta _ { i } ^ { 1 } , . . . , \delta _ { i } ^ { \xi } \} ) .
60
+ $$
61
+
62
+ The elite distribution $( \mu ^ { \prime } , \Sigma ^ { \prime } )$ in CEM algorithm is used to update the candidate noise distribution as $\mu = ( 1 - \alpha ) \mu + \alpha \dot { \mu } ^ { \prime }$ , $\Sigma = ( 1 - \alpha ) \Sigma + \alpha \Sigma ^ { \prime }$ . For every time-step, several CEM iterations are performed by candidate re-sampling and noise distribution updating. We provide detailed algorithm boxes in appendix A.1. We consider the following two schemes to add action noise.
63
+
64
+ POPLIN-A-Init: In this planning schemes, we use the policy network only to propose the initialization of the action sequences. When planning at time-step $i$ with observed state $s _ { i }$ , we first obtain the initial reference action sequences, denoted as $\hat { \mathbf { a } } _ { i } = \{ \hat { a } _ { i } , \hat { a } _ { i + 1 } , . . . , \hat { a } _ { i + \tau } \}$ , by running the initial forward pass with policy network. At each planning time-step $t$ , where $i \leq t \leq i + \tau$ , we have $\hat { a } _ { t } = \pi ( \hat { s } _ { t } )$ , where $\hat { s } _ { t } = f _ { \phi } ( \hat { s } _ { t - 1 } , a _ { t - 1 } )$ , $\hat { s _ { i } } = s _ { i }$ The expected reward given search noise $\delta _ { i }$ will be:
65
+
66
+ $$
67
+ \mathcal { R } ( s _ { i } , \delta _ { i } ) = \mathbb { E } \left[ \sum _ { t = i } ^ { i + \tau } r ( s _ { t } , \hat { a } _ { t } + \delta _ { t } ) \right] , \mathrm { w h e r e } s _ { t + 1 } = f _ { \phi } ( s _ { t + 1 } | s _ { t } , \hat { a } _ { t } + \delta _ { t } ) .
68
+ $$
69
+
70
+ POPLIN-A-Replan: POPLIN-A-Replan is a more aggressive planning schemes, which always re-plans the controller according the changed trajectory given the current noise distribution. If we had the perfect dynamics network and the policy network, then we expect re-planning to achieve faster convergence the optimal action distribution. But it increases the risk of divergent behaviors. In this case, the expected reward for each trajectory is
71
+
72
+ $$
73
+ \mathcal { R } ( s _ { i } , \delta _ { i } ) = \mathbb { E } \left[ \sum _ { t = i } ^ { i + \tau } r ( s _ { t } , \pi ( s _ { t } ) + \delta _ { t } ) \right] , \mathrm { w h e r e } s _ { t + 1 } = f _ { \phi } ( s _ { t + 1 } | s _ { t } , \pi ( s _ { t } ) + \delta _ { t } ) .
74
+ $$
75
+
76
+ # 4.2 MODEL-BASED POLICY PLANNING IN PARAMETER SPACE
77
+
78
+ While planning in the action space is a natural extension of the original PETS algorithm, we found it provides little performance improvement in complex environments. One potential reason is that POPLIN-A still performs CEM searching in action sequence space, where the conditions of convergence for CEM is usually not met. Let’s assume that a robot arm needs to either go left or right to get past the obstacle in the middle. In CEM planning in the action space, the theoretic distribution mean is always going straight, which fails to model the bi-modal action distribution.
79
+
80
+ Indeed, planning in action space is a non-convex optimization whose surface has lots of holes and peaks. Recently, much research progress has been made in understanding why deep neural networks are much less likely to get stuck in sub-optimal points Nguyen & Hein (2017); Li et al. (2018); Soudry & Hoffer (2017). And we believe that planning in parameter space is essentially using deeper neural networks. Therefore, we propose model-based policy planning in parameter space (POPLIN-P).
81
+
82
+ Instead of adding noise in the action space, POPLIN-P adds noise in the parameter space of the policy network. We denote the parameter vector of policy network as $\theta$ , and the parameter noise sequence starting from time-step $i$ as $\omega _ { i } = \{ \omega _ { i } , \omega _ { i + 1 } , . . . , \omega _ { i + \tau } \}$ . The expected reward function is now
83
+
84
+ $$
85
+ \mathcal { R } ( s _ { i } , \omega _ { i } ) = \mathbb { E } \left[ \sum _ { t = i } ^ { i + \tau } r \left( s _ { t } , \pi _ { \theta + \omega _ { t } } ( s _ { t } ) \right) \right] , \mathrm { w h e r e } s _ { t + 1 } = f _ { \phi } ( s _ { t + 1 } | s _ { t } , \pi _ { \theta + \omega _ { t } } ( s _ { t } ) ) .
86
+ $$
87
+
88
+ Similarly, we update the CEM distribution towards the following elite distribution:
89
+
90
+ $$
91
+ \Sigma ^ { \prime } \mathrm { C o v } ( \{ \omega _ { i } ^ { 0 } , \omega _ { i } ^ { 1 } , . . . , \omega _ { i } ^ { \xi } \} ) , \mu ^ { \prime } \mathrm { M e a n } ( \{ \omega _ { i } ^ { 0 } , \omega _ { i } ^ { 1 } , . . . , \omega _ { i } ^ { \xi } \} ) .
92
+ $$
93
+
94
+ We can force the policy network noise within the sequence to be consistent, i.e. $\omega _ { i } = \omega _ { i + 1 } = . . . =$ $\omega _ { i + \tau }$ , which we name as POPLIN-P-Uni. This reduces the size of the flattened noise vector from $( \tau + 1 ) | \theta |$ to $| \theta |$ , and is more consistent in policy behaviors. The noise can also be separate for each time-step, which we name as POPLIN-P-Sep. We benchmark both schemes in section 5.4.
95
+
96
+ Equivalence to re-parameterized stochastic policy: Stochastic policy network encourages exploration, and increases the robustness against the impact of compounded model errors. POPLIN-P, which inserts exogenous noise into the parameter space, can be regarded as a re-parameterized stochastic policy network, which natural combines stochastic policy network with planning.
97
+
98
+ # 4.3 MODEL-PREDICTIVE CONTROL AND POLICY CONTROL
99
+
100
+ MBRL with online re-planning or model-predictive control (MPC) is effective, but at the same time time-consuming. Many previous attempts have tried to distill the planned trajectories into a policy network Levine & Abbeel (2014); Levine & Koltun (2013); Chebotar et al. (2017); Zhang et al. (2018), and control only with policy network. In this paper, we define two settings of using POPLIN: MPC Control and Policy Control. In MPC control, the agent uses policy network during the online planning and only execute the first action. In policy control, the agent directly executes the signal produced by the policy network given current observation, just like how policy network is used in MFRL algorithms. We show both performance of POPLIN in this paper.
101
+
102
+ # 4.4 POLICY DISTILLATION SCHEMES
103
+
104
+ The agents iterate between interacting with the environments, and distilling the knowledge from planning trajectory into a policy network. We consider several policy distillation schemes here, and discuss their effectiveness in the later experimental section.
105
+
106
+ Behavior cloning (BC): BC can be applied to POPLIN-A and POPLIN-P, by minimizing the squared L2 loss as Equation 7. $\mathcal { D }$ is the collection of observation and planned action from real environment. When applying BC to POPLIN-P, we fix parameter noise of the network to be zeros.
107
+
108
+ $$
109
+ \operatorname* { m i n } _ { \theta } \mathbb { E } _ { s , a \in \mathcal { D } } | | \pi _ { \theta } ( s ) - a | | ^ { 2 } .
110
+ $$
111
+
112
+ Generative adversarial network training (GAN) Goodfellow et al. (2014): GAN can be applied to POPLIN-P. We consider the following fact. During MPC control, the agent only needs to cover the best action sequence in its action sequence distribution. Therefore, instead of point-to-point supervised training such as BC, we can train the policy network using GAN:
113
+
114
+ $$
115
+ \operatorname* { m i n } _ { \pi _ { \theta } } \operatorname* { m a x } _ { \psi } \mathbb { E } _ { s , a \in \mathcal { D } } \log ( D _ { \psi } ( s , a ) ) + \mathbb { E } _ { s \in \mathcal { D } , z \sim \mathcal { N } ( \mathbf { 0 } , \sigma _ { 0 } I ) } \log ( 1 - D _ { \psi } ( s , \pi _ { \theta + z } ( s ) ) ) ,
116
+ $$
117
+
118
+ where a discriminator $D$ parameterized by $\psi$ is used, and we sample the random noise $z$ from the initial CEM distribution $\mathcal { N } ( \mathbf { 0 } , \sigma _ { 0 } \pmb { I } )$ .
119
+
120
+ Setting parameter average (AVG): AVG is also applicable to POPLIN-P. During interaction with real environment, we also record the optimized parameter noise in to the data-set, i. e. $\mathcal { D } = \{ ( s , \omega ) \}$ . And we sacrifice the effectiveness of the policy control and only use policy network as a good search initialization. The new parameter is updated as $\theta = \theta + 1 / | \mathcal { D } | \sum _ { \omega \in \mathcal { D } } \omega$ .
121
+
122
+ ![](images/0954ae969c23a32d6b70e33aa2e83b3c5cd6c3df60c039a0bfbdacac64afb471.jpg)
123
+
124
+ Figure 2: Performance curves on different bench-marking environments. 4 random seeds are run for each environment. The full figures of all 12 MuJoCo environments are summarized in appendix 8.
125
+
126
+ <table><tr><td></td><td>Cheetah</td><td>Ant</td><td>Hopper</td><td>Swimmer</td><td>Cheetah-v0</td><td>Walker2d</td></tr><tr><td>POPLIN-P (ours)</td><td>12227.9 ± 5652.8</td><td>2330.1 ± 320.9</td><td>2055.2 ± 613.8</td><td>334.4 ± 34.2</td><td>4235.0 ± 1133.0</td><td>597.0 ± 478.8</td></tr><tr><td>POPLIN-A (ours)</td><td>4651.1 ± 1088.5</td><td>1148.4 ± 438.3</td><td>202.5 ± 962.5</td><td>344.9 ± 7.1</td><td>1562.8 ± 1136.7</td><td>-105.0 ± 249.8</td></tr><tr><td>PETS (Chua et al., 2018)</td><td>4204.5 ± 789.0</td><td>1165.5 ± 226.9</td><td>114.9 ± 621.0</td><td>326.2 ± 12.6</td><td>2288.4 ± 1019.0</td><td>282.5 ± 501.6</td></tr><tr><td>METRPO (Kurutach et al., 2018)</td><td>-744.8 ± 707.1</td><td>282.2 ±18.0</td><td>1272.5 ± 500.9</td><td>225.5 ± 104.6</td><td>2283.7 ± 900.4</td><td>-1609.3 ± 657.5</td></tr><tr><td>TD3 (Fujimoto et al.,2018)</td><td>218.9 ± 593.3</td><td>870.1 ± 283.8</td><td>1816.6 ± 994.8</td><td>72.1 ± 130.9</td><td>3015.7 ± 969.8</td><td>-516.4 ± 812.2</td></tr><tr><td>SAC (Haarnoja et al., 2018)</td><td>1745.9 ± 839.2</td><td>548.1 ± 146.6</td><td>788.3 ± 738.2</td><td>204.6 ± 69.3</td><td>3459.8 ± 1326.6</td><td>164.5 ± 1318.6</td></tr><tr><td>Training Time-step</td><td>50000</td><td>200000</td><td>200000</td><td>50000</td><td>200000</td><td>200000</td></tr><tr><td></td><td>Reacher3D</td><td>Pusher</td><td>Pendulum</td><td>InvertedPendulum</td><td>Acrobot</td><td>Cartpole</td></tr><tr><td>POPLIN-P (ours)</td><td>-29.0± 25.2</td><td>-55.8 ± 23.1</td><td>167.9 ± 45.9</td><td>-0.0 ±0.0</td><td>23.2 ± 27.2</td><td>200.8 ± 0.3</td></tr><tr><td>POPLIN-A (ours)</td><td>-27.7 ± 25.2</td><td>-56.0 ± 24.3</td><td>178.3 ± 19.3</td><td>-0.0±0.0</td><td>20.5 ± 20.1</td><td>200.6 ± 1.3</td></tr><tr><td>PETS (Chua et al.,2018)</td><td>-47.7 ± 43.6</td><td>-52.7 ± 23.5</td><td>155.7 ± 79.3</td><td>-29.5 ± 37.8</td><td>-18.4 ± 46.3</td><td>199.6 ± 4.6</td></tr><tr><td>METRPO (Kurutach et al., 2018)</td><td>-43.5 ± 3.7</td><td>-98.5 ± 12.6</td><td>174.8 ± 6.2</td><td>-29.3 ± 29.5</td><td>-78.7 ± 5.0</td><td>138.5 ± 63.2</td></tr><tr><td>TD3 (Fujimoto et al.,2018)</td><td>-331.6 ± 134.6</td><td>-216.4 ± 39.6</td><td>168.6 ± 12.7</td><td>-102.9 ± 101.0</td><td>-76.5 ± 10.2</td><td>-409.2 ± 928.8</td></tr><tr><td>SAC (Haarnoja et al., 2018)</td><td>-161.6 ± 43.7</td><td>-227.6 ± 42.2</td><td>159.5 ± 12.1</td><td>-0.2 ± 0.1</td><td>-69.4 ± 7.0</td><td>195.5 ± 8.7</td></tr><tr><td>Training Time-step</td><td>50000</td><td>50000</td><td>50000</td><td>50000</td><td>50000</td><td>50000</td></tr></table>
127
+
128
+ Table 1: The training time-step varies from 50,000 to 200,000 depending on the difficulty of the tasks.
129
+ The performance is averaged across four random seeds with the last 3 episodes.
130
+
131
+ # 5 EXPERIMENTS
132
+
133
+ In section 5.1, we compare POPLIN with existing algorithms. We also show the policy control performance of POPLIN with different training methods in section 5.2. In section 5.3, we provide explanations and analysis for the effectiveness of our proposed algorithms by exploring and visualizing the planner’s reward optimization surface. In section 5.4, we study the sensitivity of our algorithms with respect to hyper-parameters, and show the performance of different algorithm variants.
134
+
135
+ # 5.1 MUJOCO BENCHMARKING PERFORMANCE
136
+
137
+ In this section, we compare POPLIN with existing reinforcement learning algorithms including PETS (Chua et al., 2018), GPS (Levine et al., 2016), RS (Richards, 2005), MBMF (Nagabandi et al., 2017), TD3 (Fujimoto et al., 2018) METRPO (Kurutach et al., 2018), PPO (Schulman et al., 2017; Heess et al., 2017), TRPO (Schulman et al., 2015) and SAC (Haarnoja et al., 2018), which includes the most recent progress of both model-free and model-based algorithms. We examine the algorithms with 12 environments, which is a wide collection of environments from OpenAI Gym (Brockman et al., 2016) and the environments proposed in PETS (Chua et al., 2018), which are summarized in appendix A.2. Due to the page limit and to better visualize the results, we put the complete figures and tables in appendix A.3. And in Figure 2 and Table 1, we show the performance of our algorithms and the best performing baselines. The hyper-parameter search is summarized in appendix A.3.1.
138
+
139
+ As shown in Table 1, POPLIN achieves state-of-the-art performance in almost all environments, solving most of the them with 200,000 or 50,000 time-steps, instead of 1 million time-steps commonly used in MFRL algorithms. POPLIN-A (POPLIN-A-BC-Replan) has the best performance in simpler environments such as Pendulum, Cart-pole, Swimmer. But on complex environments such as Ant, Cheetah or Hopper, POPLIN-A does not have obvious performance gain compared with PETS. POPLIN-P (POPLIN-P-Sep-AVG) on the other hand, has consistent and stable performance among different environments. POPLIN-P is significantly better than all other algorithms in complex environments such as Ant and Cheetah. However, like other model-based algorithms, POPLIN cannot solve environments such as Walker and Humanoid. the performance of POPLIN plateaus quickly. Gradually model-free algorithms will have better asymptotic performance. We view this as a bottleneck of our algorithms and leave it to future research.
140
+
141
+ ![](images/34206e50481f86d9d1ff67f7d876af5c62077c8724b725fa6cd4cddb3dff6a0d.jpg)
142
+ Figure 3: The MPC control and policy control performance of the proposed POPLIN-A, and POPLINP with its three training schemes, which are namely behavior cloning (BC), generative adversarial network training (GAN) and setting parameter average (Avg).
143
+
144
+ ![](images/68c77255f3ee36d9b9ca5cc8396725e12243d8c23a72c6b5e6e0b6833c8633b5.jpg)
145
+ Figure 4: The performance of PETS, POPLIN-A, POPLIN-P using different population size of candidates on Cheetah. The variance of the candidates trajectory $\sigma$ in POPLIN-P is set to 0.1.
146
+
147
+ # 5.2 POLICY CONTROL PERFORMANCE
148
+
149
+ In this section, we show the performance of POPLIN without MPC. To be more specific, we show the performance with the Cheetah, Pendulum, Pusher and Reacher3D, as shown in Figure 3, and we refer readers to appendix A.4 for the full results.
150
+
151
+ We note that policy control is not always successful, and in environments such as Ant and Walker2D, the performance is almost random. In simple environments such as Pusher and Reacher3D, POPLIN-A has the best MPC performance, but has worse policy control performance compared with POPLIN-PBC and POPLIN-P-GAN. At the same time, both POPLIN-P-BC and POPLIN-P-GAN are able to efficiently distill the knowledge from planned trajectory. Which one of POPLIN-P-BC and POPLIN-PGAN is better depends on the environment tested, and they can be used interchangeably. This indicates that POPLIN-A, which uses a deterministic policy network, is more prone to distillation collapse than POPLIN-P, which can be interpreted as using a stochastic policy network with reparameterization trick. POPLIN-P-Avg, which only use policy network as optimization initialization has good MPC performance, but sacrifices the policy control performance. In general, the performance of policy control lags behind MPC control.
152
+
153
+ # 5.3 SEARCH EFFECTIVENESS AND REWARD SURFACE
154
+
155
+ In this section, we explore the reasons for the effectiveness of POPLIN. In Figure 4, we show the performance of PETS, POPLIN-A and POPLIN-P with different population sizes. As we can see, PETS and POPLIN-A, which are the two algorithms that add search noise in the action space, cannot increase their performance by having bigger population size. However, POPLIN-P is able to efficiently increase performance with bigger population size. We then visualize the candidates in their reward or optimization surface in Figure 1. We use PCA (principal component analysis) to transform the action sequences into 2D features. As we can see, the reward surface is not smooth, with lots of local-minima and local-maxima islands. The CEM distribution of PETS algorithm is almost fixed across iterations on this surface, even if there are potentially higher reward regions. POPLIN is able to efficiently search through the jagged reward surface, from the low-reward center to the high reward left-down corner. To further understand why POPLIN is much better at searching through the reward surface, we then plot the figures in the solution space in Figure 5. More specifically, we now perform PCA on the policy parameters for POPLIN-P. As we can see in Figure 5 (c), the reward surface in parameter space is much smoother than the reward surface in action space, which are shown in Figure 5 (a), (b). POPLIN-P can efficiently search through the smoother reward surface in parameter space.
156
+
157
+ ![](images/d8e2a87ec31b5725be0a377ebc989b6db12deb393309a31ba0ae66d0846a6fa6.jpg)
158
+ Figure 5: The reward optimization surface in the solution space. The expected reward is higher from color blue to color red. We visualize candidates using different colors as defined in the legend. The full results can be seen in appendix A.7.
159
+
160
+ ![](images/602ec86d32c596f9197c83835dbe46c307fa2a17434f00ab22cb6ce160d6fba6.jpg)
161
+ Figure 7: The ablation study of of POPLIN-A, POPLIN-P-BC, POPLIN-P-Avg, POPLIN-P-GAN.
162
+
163
+ In Figure 6, we also visualize the actions distribution in one episode taken by PETS, POPLIN-A and POPLINP using policy networks of different number of hidden layers. We again use PCA to project the actions into 2D feature space. As we can see, POPLIN-P shows a clear pattern of being more multi-modal with the use of deeper the network.
164
+
165
+ ![](images/45e471c80af2fbf96b218d3a5ea609ba6bd3c0b45b446d8ca5a58d8597883886.jpg)
166
+ x x Figure 6: Projected action distribution.
167
+
168
+ # 5.4 ABLATION STUDY
169
+
170
+ In this section, we study how sensitive our algorithms are with respect to some of the crucial hyperparameters, for example, the initial variance of the CEM noise distribution. We also show the performance of different algorithm variants. The full ablation study and performance against different random seeds are included in appendix A.5. In Figure 7 (a), we show the performance of POPLIN-A using different training schemes. We try both training with only the real data samples, which we denote as "Real", and training also with imaginary data the agent plans into the future, which we denote as "Hallucination". In practice, POPLIN-A-Init performs better than POPLIN-A-Replan, which suggests that there can be divergent or overconfident update in POPLIN-A-Replan. And training with or without imaginary does not have big impact on the performance. In Figure7 (b) and (c), we also compare the performance of POPLIN-P-Uni with POPLIN-P-Sep, where we show that POPLIN-P-Sep has much better performance than POPLIN-P-Uni, indicating the search is not efficient enough in the constrained parameter space. For POPLIN-P-Avg, with bigger initial variance of the noise distribution, the agent gets better at planning. However, increasing initial noise variance does not increase the performance of PETS algorithm, as shown in 7 (b), (d). It is worth mentioning that POPLIN-P-GAN is highly sensitive to the entropy penalty we add to the discriminator, with the 3 curves in Figure7 (c) using entropy penalty of 0.003, 0.001 and 0.0001 respectively,
171
+
172
+ # 6 CONCLUSIONS
173
+
174
+ In this paper, we explore efficient ways to combine policy networks with model-based planning. We propose POPLIN, which obtains state-of-the-art performance on the MuJoCo benchmarking environments. We study different distillation schemes to provide fast controllers during testing. More importantly, we formulate online planning as optimization using deep neural networks. We believe POPLIN will scale to more complex environments in the future.
175
+
176
+ # REFERENCES
177
+
178
+ Zdravko I Botev, Dirk P Kroese, Reuven Y Rubinstein, and Pierre L’Ecuyer. The cross-entropy method for optimization. In Handbook of statistics, volume 31, pp. 35–59. Elsevier, 2013.
179
+
180
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
181
+
182
+ Jacob Buckman, Danijar Hafner, George Tucker, Eugene Brevdo, and Honglak Lee. Sampleefficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pp. 8224–8234, 2018.
183
+
184
+ Yevgen Chebotar, Karol Hausman, Marvin Zhang, Gaurav Sukhatme, Stefan Schaal, and Sergey Levine. Combining model-based and model-free updates for trajectory-centric reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 703–711. JMLR. org, 2017.
185
+
186
+ Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. arXiv preprint arXiv:1805.12114, 2018.
187
+
188
+ Pieter-Tjerk De Boer, Dirk P Kroese, Shie Mannor, and Reuven Y Rubinstein. A tutorial on the cross-entropy method. Annals of operations research, 134(1):19–67, 2005.
189
+
190
+ Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pp. 465–472, 2011.
191
+
192
+ Vladimir Feinberg, Alvin Wan, Ion Stoica, Michael I Jordan, Joseph E Gonzalez, and Sergey Levine. Model-based value estimation for efficient model-free reinforcement learning. arXiv preprint arXiv:1803.00101, 2018.
193
+
194
+ Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018.
195
+
196
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014.
197
+
198
+ Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, pp. 2829–2838, 2016.
199
+
200
+ David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. In Advances in Neural Information Processing Systems, pp. 2450–2462, 2018a.
201
+
202
+ David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018b.
203
+
204
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018.
205
+
206
+ Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018.
207
+
208
+ Nicolas Heess, Gregory Wayne, David Silver, Timothy Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pp. 2944–2952, 2015.
209
+
210
+ Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
211
+
212
+ Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. arXiv preprint arXiv:1906.08253, 2019.
213
+
214
+ Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Model-based reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019.
215
+
216
+ Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
217
+
218
+ Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018.
219
+
220
+ Sergey Levine and Pieter Abbeel. Learning neural network policies with guided policy search under unknown dynamics. In Advances in Neural Information Processing Systems, pp. 1071–1079, 2014.
221
+
222
+ Sergey Levine and Vladlen Koltun. Guided policy search. In International Conference on Machine Learning, pp. 1–9, 2013.
223
+
224
+ 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.
225
+
226
+ Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In Advances in Neural Information Processing Systems, pp. 6389–6399, 2018.
227
+
228
+ Weiwei Li and Emanuel Todorov. Iterative linear quadratic regulator design for nonlinear biological movement systems. In ICINCO (1), pp. 222–229, 2004.
229
+
230
+ 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.
231
+
232
+ Yuping Luo, Huazhe Xu, Yuanzhi Li, Yuandong Tian, Trevor Darrell, and Tengyu Ma. Algorithmic framework for model-based deep reinforcement learning with theoretical guarantees. ICLR, 2019.
233
+
234
+ 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.
235
+
236
+ Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. arXiv preprint arXiv:1708.02596, 2017.
237
+
238
+ Quynh Nguyen and Matthias Hein. The loss surface of deep and wide neural networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2603–2612. JMLR. org, 2017.
239
+
240
+ Arthur George Richards. Robust constrained model predictive control. PhD thesis, Massachusetts Institute of Technology, 2005.
241
+
242
+ 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.
243
+
244
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015.
245
+
246
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
247
+
248
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
249
+
250
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676):354–359, 2017.
251
+
252
+ Daniel Soudry and Elad Hoffer. Exponentially vanishing sub-optimal local minima in multilayer neural networks. arXiv preprint arXiv:1702.05777, 2017.
253
+
254
+ Richard S Sutton. Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. In Machine Learning Proceedings 1990, pp. 216–224. Elsevier, 1990.
255
+
256
+ Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM SIGART Bulletin, 2(4):160–163, 1991.
257
+
258
+ Yuval Tassa, Tom Erez, and Emanuel Todorov. Synthesis and stabilization of complex behaviors through online trajectory optimization. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 4906–4913. IEEE, 2012.
259
+
260
+ Emanuel Todorov and Weiwei Li. A generalized iterative lqg method for locally-optimal feedback control of constrained nonlinear stochastic systems. In Proceedings of the 2005, American Control Conference, 2005., pp. 300–306. IEEE, 2005.
261
+
262
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
263
+
264
+ Marvin Zhang, Sharad Vikram, Laura Smith, Pieter Abbeel, Matthew J Johnson, and Sergey Levine. Solar: Deep structured latent representations for model-based reinforcement learning. arXiv preprint arXiv:1808.09105, 2018.
265
+
266
+ # A APPENDIX
267
+
268
+ # A.1 ALGORITHM DIAGRAMS
269
+
270
+ To better illustrate the algorithm variants of our proposed methods, we summarize them in Algorithm 2, 3, 4.
271
+
272
+ # Algorithm 2 POPLIN-A-Init
273
+
274
+ 1: Initialize policy network parameters $\theta$ , dynamics network parameters $\phi$ , data-set $\mathcal { D }$
275
+ 2: while Training iterations not Finished do
276
+ 3: for $i ^ { t h }$ time-step of the agent do . Sampling Data
277
+ 4: Initialize reference action sequence $\{ \hat { a } _ { i } , \hat { a } _ { i + 1 } , . . . , \hat { a } _ { i + \tau } \}$ . . Using Equation 3
278
+ 5: Initialize action-sequence noise distribution. $\mu = \mu _ { 0 }$ , $\dot { \Sigma } = \sigma _ { 0 } ^ { 2 } { \cal I }$
279
+ 6: for $j ^ { t h }$ CEM Update do . CEM Planning
280
+ 7: Sample action noise sequences $\{ \delta _ { i } \}$ from $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ .
281
+ 8: for Every candidate $\delta _ { i }$ do $\triangleright$ Trajectory Predicting
282
+ 9: for $t = i$ to $i + \tau$ , $s _ { t + 1 } = f _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } = \hat { a } _ { t } + \delta _ { t } )$
283
+ 10: Evaluate expected reward of this candidate.
284
+ 11: end for
285
+ 12: Fit distribution of the elite candidates as $\mu ^ { \prime } , \Sigma ^ { \prime }$ .
286
+ 13: Update noise distribution $\mu = ( 1 - \alpha ) \mu + \alpha \mu ^ { \prime }$ , $\Sigma = ( 1 - \alpha ) \Sigma + \alpha \Sigma ^ { \prime }$
287
+ 14: end for
288
+ 15: Execute the first action from the optimal candidate action sequence.
289
+ 16: end for
290
+ 17: Update $\phi$ using data-set $\mathcal { D }$ $\triangleright$ Dynamics Update
291
+ 18: Update $\theta$ using data-set $\mathcal { D }$ . Policy Distillation
292
+ 19: end while
293
+
294
+ # Algorithm 3 POPLIN-A-Replan
295
+
296
+ 1: Initialize policy network parameters $\theta$ , dynamics network parameters $\phi$ , data-set $\mathcal { D }$
297
+ 2: while Training iterations not Finished do
298
+ 3: for $i ^ { t h }$ time-step of the agent do . Sampling Data
299
+ 4: Initialize action-sequence noise distribution. $\mu = \mu _ { 0 }$ , $\Sigma = \sigma _ { 0 } ^ { 2 } I$
300
+ 5: for $j ^ { t h }$ CEM Update do . CEM Planning
301
+ 6: Sample action noise sequences $\{ \delta _ { i } \}$ from $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ .
302
+ 7: for Every candidate $\delta _ { i }$ do . Trajectory Predicting
303
+ 8: for $t = i$ to $i + \tau$ , $s _ { t + 1 } = f _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } = \pi _ { \theta } ( s _ { t } ) + \delta _ { t } )$
304
+ 9: Evaluate expected reward of this candidate.
305
+ 10: end for
306
+ 11: Fit distribution of the elite candidates as $\mu ^ { \prime } , \Sigma ^ { \prime }$ .
307
+ 12: Update noise distribution $\mu = ( 1 - \alpha ) \mu + \alpha \mu ^ { \prime }$ , $\Sigma = ( 1 - \alpha ) \Sigma + \alpha \Sigma ^ { \prime }$
308
+ 13: end for
309
+ 14: Execute the first action from the optimal candidate action sequence.
310
+ 15: end for
311
+ 16: Update $\phi$ using data-set $\mathcal { D }$ $\triangleright$ Dynamics Update
312
+ 17: Update $\theta$ using data-set $\mathcal { D }$ . Policy Distillation
313
+ 18: end while
314
+
315
+ # A.2 BENCH-MARKING ENVIRONMENTS
316
+
317
+ In the original PETS paper Chua et al. (2018), the authors only experiment with 4 environments, which are namely Reacher3D, Pusher, Cartpole and Cheetah. In this paper, we experiment with the 9 more environments based on the standard bench-marking environments from OpenAI Gym Brockman et al. (2016). More specifically, we experiment with InvertedPendulum, Acrobot, Pendulum, Ant, Hopper, Swimmer, Walker2d. We also note that the Cheetah environment in PETS Chua et al. (2018) is different from the standard HalfCheetah-v1 in OpenAI Gym. Therefore we experiment with both versions in our paper, where the Cheetah from PETS is named as "Cheetah", and the HalfCHeetah
318
+
319
+ # Algorithm 4 POPLIN-P
320
+
321
+ <table><tr><td colspan="2">1: Initialize policy network parameters 0, dynamics network parameters Φ, data-set D 2: while Training iterations not Finished do</td></tr><tr><td>3:</td><td>for ith time-step of the agent do &gt; Sampling Data</td></tr><tr><td>4: 5:</td><td>Initialize parameter-sequence noise distribution. μ = μo,∑ = o² I for jth CEM Update do CEM Planning</td></tr><tr><td>6:</td><td>Sample parameter noise sequences {ωi} from N(μ,Σ).</td></tr><tr><td>7:</td><td>for Every candidate ωi do</td></tr><tr><td></td><td>Trajectory Predicting</td></tr><tr><td>8:</td><td>fort=itoi+T,St+1 = f(St+1lSt,at = Tθ+ωt(St))</td></tr><tr><td>9:</td><td>Evaluate expected reward of this candidate.</td></tr><tr><td>10:</td><td>end for</td></tr><tr><td>11:</td><td>Fit distribution of the elite candidates as μ&#x27;,∑&#x27;.</td></tr><tr><td>12:</td><td>Update noise distribution μ= (1-α)μ + αμ&#x27;,∑= (1-α)Σ+αΣ&#x27;</td></tr><tr><td>13:</td><td>end for</td></tr><tr><td>14:</td><td>Execute the first action from the optimal candidate action sequence.</td></tr><tr><td>15:</td><td>end for</td></tr><tr><td>16:</td><td>Update using data-set D</td></tr><tr><td>17:</td><td></td></tr><tr><td>18: end while</td><td>Update 0 using data-set D</td></tr></table>
322
+
323
+ Table 2: Performance of each algorithm on environments based on OpenAI Gym Brockman et al. (2016) MuJoCoTodorov et al. (2012) environments. In the table, we record the performance at 200,000 time-step.
324
+
325
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Cheetah</td><td rowspan=1 colspan=1>Ant</td><td rowspan=1 colspan=1>Hopper</td><td rowspan=1 colspan=1>Swimmer</td><td rowspan=1 colspan=1>Cheetah-v0</td><td rowspan=1 colspan=1>Walker2d</td><td rowspan=1 colspan=1>Swimmer-v0</td></tr><tr><td rowspan=1 colspan=1>POPLIN-P</td><td rowspan=1 colspan=1>12227.9 ± 5652.8</td><td rowspan=1 colspan=1>2330.1 ± 320.9</td><td rowspan=1 colspan=1>2055.2 ±613.8</td><td rowspan=1 colspan=1>334.4 ± 34.2</td><td rowspan=1 colspan=1>4235.0± 1133.0</td><td rowspan=1 colspan=1>597.0 ± 478.8</td><td rowspan=1 colspan=1>37.1 ± 4.6</td></tr><tr><td rowspan=1 colspan=1>POPLIN-A</td><td rowspan=1 colspan=1>4651.1 ± 1088.5</td><td rowspan=1 colspan=1>1148.4 ± 438.3</td><td rowspan=1 colspan=1>202.5 ± 962.5</td><td rowspan=1 colspan=1>344.9 ± 7.1</td><td rowspan=1 colspan=1>1562.8 ± 1136.7</td><td rowspan=1 colspan=1>-105.0 ± 249.8</td><td rowspan=1 colspan=1>26.7 ± 13.2</td></tr><tr><td rowspan=1 colspan=1>PETS</td><td rowspan=1 colspan=1>4204.5 ± 789.0</td><td rowspan=1 colspan=1>1165.5 ± 226.9</td><td rowspan=1 colspan=1>114.9 ± 621.0</td><td rowspan=1 colspan=1>326.2 ± 12.6</td><td rowspan=1 colspan=1>2288.4± 1019.0</td><td rowspan=2 colspan=1>282.5 ± 501.6-2060.3 ± 228.0</td><td rowspan=2 colspan=1>29.7 ± 13.526.8± 2.3</td></tr><tr><td rowspan=1 colspan=1>RS</td><td rowspan=1 colspan=1>191.1 ± 21.2</td><td rowspan=1 colspan=1>535.5± 37.0</td><td rowspan=1 colspan=1>-2491.5 ± 35.1</td><td rowspan=1 colspan=1>22.4±9.7</td><td rowspan=1 colspan=1>421.0 ± 55.2</td></tr><tr><td rowspan=2 colspan=1>MBMFTRPO</td><td rowspan=1 colspan=1>-459.5 ± 62.5</td><td rowspan=1 colspan=1>134.2 ± 50.4</td><td rowspan=1 colspan=1>-1047.4 ± 1098.7</td><td rowspan=1 colspan=1>110.7 ± 45.6</td><td rowspan=1 colspan=1>126.9 ± 72.7</td><td rowspan=1 colspan=1>-2218.1 ± 437.7</td><td rowspan=1 colspan=1>30.6 ± 4.9</td></tr><tr><td rowspan=1 colspan=1>-412.4 ± 33.3</td><td rowspan=1 colspan=1>323.3 ± 24.9</td><td rowspan=1 colspan=1>-2100.1 ± 640.6</td><td rowspan=1 colspan=1>47.8 ± 11.1</td><td rowspan=1 colspan=1>-12.0 ± 85.5</td><td rowspan=1 colspan=1>-2286.3± 373.3</td><td rowspan=1 colspan=1>26.3 ± 2.6</td></tr><tr><td rowspan=1 colspan=1>PPO</td><td rowspan=1 colspan=1>-483.0± 46.1</td><td rowspan=1 colspan=1>321.0 ± 51.2</td><td rowspan=1 colspan=1>-103.8 ± 1028.0</td><td rowspan=1 colspan=1>155.5 ± 14.9</td><td rowspan=1 colspan=1>17.2 ± 84.4</td><td rowspan=1 colspan=1>-1893.6± 234.1</td><td rowspan=3 colspan=1>24.7 ± 4.08.2 ±10.235.4± 2.2</td></tr><tr><td rowspan=1 colspan=1>GPS</td><td rowspan=1 colspan=1>129.4 ± 140.4</td><td rowspan=1 colspan=1>445.5 ± 212.9</td><td rowspan=1 colspan=1>-768.5 ± 200.9</td><td rowspan=1 colspan=1>-30.9 ± 6.3</td><td rowspan=1 colspan=1>52.3 ± 41.7</td><td rowspan=1 colspan=1>-1730.8 ± 441.7</td></tr><tr><td rowspan=1 colspan=1>METRPO</td><td rowspan=1 colspan=1>-744.8 ± 707.1</td><td rowspan=1 colspan=1>282.2 ± 18.0</td><td rowspan=1 colspan=1>1272.5 ± 500.9</td><td rowspan=1 colspan=1>225.5 ± 104.6</td><td rowspan=1 colspan=1>2283.7 ± 900.4</td><td rowspan=1 colspan=1>-1609.3 ± 657.5</td></tr><tr><td rowspan=1 colspan=1>TD3</td><td rowspan=1 colspan=1>218.9 ± 593.3</td><td rowspan=1 colspan=1>870.1 ± 283.8</td><td rowspan=1 colspan=1>1816.6 ± 994.8</td><td rowspan=1 colspan=1>72.1 ± 130.9</td><td rowspan=1 colspan=1>3015.7 ±969.8</td><td rowspan=1 colspan=1>-516.4 ± 812.2</td><td rowspan=1 colspan=1>17.0 ± 12.9</td></tr><tr><td rowspan=2 colspan=1>SACRandom</td><td rowspan=2 colspan=1>1745.9 ± 839.2-284.2 ± 83.3</td><td rowspan=1 colspan=1>548.1 ± 146.6</td><td rowspan=1 colspan=1>788.3 ± 738.2</td><td rowspan=1 colspan=1>204.6 ± 69.3</td><td rowspan=1 colspan=1>3459.8 ± 1326.6</td><td rowspan=1 colspan=1>164.5 ± 1318.6</td><td rowspan=2 colspan=1>23.0 ± 17.32.4 ± 12.0</td></tr><tr><td rowspan=1 colspan=1>478.0 ± 47.8</td><td rowspan=1 colspan=1>-2768.0 ± 571.6</td><td rowspan=1 colspan=1>-12.4 ± 12.8</td><td rowspan=1 colspan=1>-312.4± 44.2</td><td rowspan=1 colspan=1>-2450.1± 406.5</td></tr><tr><td rowspan=1 colspan=1>Time-step</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>200000</td><td rowspan=1 colspan=1>200000</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>200000</td><td rowspan=1 colspan=1>200000</td><td rowspan=1 colspan=1>200000</td></tr></table>
326
+
327
+ Table 3: The normalized performance of Table 2.
328
+
329
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>Cheetah</td><td rowspan=1 colspan=5>Ant</td><td rowspan=1 colspan=1>Hopper</td><td rowspan=1 colspan=1>Swimmer</td><td rowspan=1 colspan=1>Cheetah-v0</td><td rowspan=1 colspan=3>Walker2d</td><td rowspan=1 colspan=1>Swimmer-v0</td></tr><tr><td rowspan=2 colspan=1>POPLIN-PPOPLIN-A</td><td rowspan=2 colspan=2>0.944 ± 0.0790.395 ± 0.057</td><td rowspan=2 colspan=5>0.932 ± 0.1280.459 ± 0.175</td><td rowspan=1 colspan=1>0.919 ± 0.112</td><td rowspan=1 colspan=1>0.936 ± 0.086</td><td rowspan=1 colspan=1>0.927 ± 0.227</td><td rowspan=1 colspan=3>0.968 ± 0.15</td><td rowspan=1 colspan=1>0.928 ± 0.115</td></tr><tr><td rowspan=1 colspan=1>0.582 ± 0.175</td><td rowspan=1 colspan=1>0.962 ± 0.018</td><td rowspan=1 colspan=1>0.393 ± 0.227</td><td rowspan=1 colspan=3>0.748 ± 0.078</td><td rowspan=1 colspan=1>0.668 ± 0.33</td></tr><tr><td rowspan=1 colspan=1>PETS</td><td rowspan=1 colspan=2>0.363 ± 0.002</td><td rowspan=1 colspan=5>0.466 ± 0.091</td><td rowspan=1 colspan=1>0.566 ± 0.113</td><td rowspan=1 colspan=1>0.916 ± 0.032</td><td rowspan=1 colspan=1>0.538 ± 0.204</td><td rowspan=1 colspan=3>0.87 ± 0.157</td><td rowspan=1 colspan=1>0.743 ± 0.338</td></tr><tr><td rowspan=1 colspan=1>RS</td><td rowspan=1 colspan=2>0.072 ± 0.005</td><td rowspan=1 colspan=5>0.214 ± 0.015</td><td rowspan=1 colspan=1>0.092 ± 0.006</td><td rowspan=1 colspan=1>0.156 ± 0.024</td><td rowspan=1 colspan=1>0.164 ± 0.011</td><td rowspan=1 colspan=3>0.137 ± 0.071</td><td rowspan=1 colspan=1>0.67 ± 0.058</td></tr><tr><td rowspan=1 colspan=1>MBMF</td><td rowspan=1 colspan=2>0.025 ± 0.002</td><td rowspan=1 colspan=5>0.054 ±0.02</td><td rowspan=1 colspan=1>0.355± 0.2</td><td rowspan=1 colspan=1>0.377 ± 0.114</td><td rowspan=1 colspan=1>0.105 ± 0.015</td><td rowspan=1 colspan=2>0.088 ± 0.137</td><td rowspan=1 colspan=1>.137</td><td rowspan=1 colspan=1>0.765 ± 0.123</td></tr><tr><td rowspan=1 colspan=1>TRPO</td><td rowspan=1 colspan=2>0.028 ± 0.003</td><td rowspan=1 colspan=5>0.129 ± 0.01</td><td rowspan=1 colspan=1>0.164 ± 0.116</td><td rowspan=1 colspan=1>0.22 ± 0.028</td><td rowspan=1 colspan=1>0.078 ± 0.017</td><td rowspan=1 colspan=2>0.067 ± 0.117</td><td rowspan=1 colspan=1>.117</td><td rowspan=1 colspan=1>7</td></tr><tr><td rowspan=1 colspan=1>PPO</td><td rowspan=1 colspan=2>0.023 ± 0.01</td><td rowspan=1 colspan=5>0.128 ± 0.02</td><td rowspan=1 colspan=1>0.527 ± 0.187</td><td rowspan=1 colspan=1>0.489 ± 0.037</td><td rowspan=1 colspan=1>0.083 ± 0.017</td><td rowspan=1 colspan=3>0.19 ± 0.073</td><td></td></tr><tr><td rowspan=1 colspan=1>GPS</td><td rowspan=1 colspan=2>0.067 ± 0.051</td><td rowspan=1 colspan=5>0.178 ± 0.085</td><td rowspan=1 colspan=1>0.406 ±0.037</td><td rowspan=1 colspan=1>0.023 ± 0.016</td><td rowspan=1 colspan=1>0.09 ± 0.008</td><td rowspan=1 colspan=3>0.24 ±0.138</td><td rowspan=1 colspan=1>0.205 ± 0.255</td></tr><tr><td rowspan=1 colspan=1>METRPO</td><td rowspan=1 colspan=2>0.004 ± 0.043</td><td rowspan=1 colspan=5>0.113 ± 0.007</td><td rowspan=1 colspan=1>0.777 ± 0.091</td><td rowspan=1 colspan=1>0.664 ± 0.262</td><td rowspan=1 colspan=1>0.537 ± 0.18</td><td rowspan=1 colspan=3>0.278 ± 0.205</td><td rowspan=1 colspan=1>0.885 ± 0.055</td></tr><tr><td rowspan=3 colspan=1>TD3SACRandom</td><td rowspan=3 colspan=2>0.074 ± 0.0610.184 ± 0.0060.037±0</td><td rowspan=1 colspan=3>0.074 ± 0.061</td><td rowspan=1 colspan=3>0.348 ± 0.114</td><td rowspan=1 colspan=1>0.876 ± 0.181</td><td rowspan=1 colspan=1>0.28 ±0.327</td><td rowspan=1 colspan=3>0.683 ± 0.194</td><td rowspan=1 colspan=1>0.62 ± 0.254</td></tr><tr><td rowspan=1 colspan=5>0.219 ± 0.059</td><td rowspan=2 colspan=2>.019</td><td rowspan=2 colspan=1>0.689 ± 0.1340.042 ± 0.104</td><td rowspan=2 colspan=1>0.612 ± 0.1730.069 ± 0.032</td><td rowspan=1 colspan=1>0.772 ± 0.265</td><td rowspan=1 colspan=2>0.833 ± 0.412</td><td></td><td></td></tr><tr><td rowspan=1 colspan=4>0.191 ± 0.019</td><td rowspan=1 colspan=1>0.</td><td rowspan=1 colspan=1>0.018 ± 0.009</td><td rowspan=1 colspan=3>0.016 ± 0.127</td><td></td></tr><tr><td rowspan=1 colspan=1>max, min</td><td rowspan=1 colspan=2>13000,-800</td><td rowspan=1 colspan=5>2500,0</td><td rowspan=1 colspan=1>2500,0</td><td rowspan=1 colspan=1>2500,0</td><td rowspan=1 colspan=1>2500,-3000</td><td rowspan=1 colspan=3>360,-40</td><td rowspan=1 colspan=1>-400,4600</td></tr></table>
330
+
331
+ from OpenAI Gym is named as "Cheetah-v0". Empirically, Cheetah is much easier to solve than Cheetah-v0, as show in Table 2 and Table 4. We also include two swimmer, which we name as Swimmer and Swimmer-v0, which we explain in section A.2.1.
332
+
333
+ ![](images/afd38f05377d3237fb55a77e96efb88d6fd11e191551ac2c0f45a0e4fd559ffd.jpg)
334
+ Figure 8: Full Performance of POPLIN-P, POPLIN-A and other state-of-the-art algorithms on 12 different bench-marking environments. In the figure, we include baselines such as TD3, SAC, PPO, METRPO, PETS, RS and our proposed algorithm.
335
+
336
+ # A.2.1 FIXING THE SWIMMER ENVIRONMENTS
337
+
338
+ We also notice that after an update in the Gym environments, the swimmer became unsolvable for almost all algorithms. The reward threshold for solving is around 340 for the original swimmer, but almost all algorithms, including the results shown in many published papers Schulman et al. (2017), will be stuck at the 130 reward local-minima. We note that this is due the fact that the velocity sensor is on the neck of the swimmer, making swimmer extremely prone to this performance local-minimum. We provide a fixed swimmer, which we name as Swimmer, by moving the sensor from the neck to the head. We believe this modification is necessary to test the effectiveness of the algorithms.
339
+
340
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Reacher3D</td><td rowspan=1 colspan=1>Pusher</td><td rowspan=1 colspan=1>Pendulum</td><td rowspan=1 colspan=1>InvertedPendulum</td><td rowspan=1 colspan=1>Acrobot</td><td rowspan=1 colspan=1>Cartpole</td></tr><tr><td rowspan=2 colspan=1>POPLIN-PPOPLIN-A</td><td rowspan=1 colspan=1>-29.0 ± 25.2</td><td rowspan=1 colspan=1>-55.8 ± 23.1</td><td rowspan=1 colspan=1>167.9 ± 45.9</td><td rowspan=1 colspan=1>-0.0±0.0</td><td rowspan=1 colspan=1>23.2 ± 27.2</td><td rowspan=2 colspan=1>200.8 ± 0.3200.6 ± 1.3</td></tr><tr><td rowspan=1 colspan=1>-27.7 ± 25.2</td><td rowspan=1 colspan=1>-56.0 ± 24.3</td><td rowspan=1 colspan=1>178.3 ± 19.3</td><td rowspan=1 colspan=1>-0.0±0.0</td><td rowspan=1 colspan=1>20.5± 20.1</td></tr><tr><td rowspan=1 colspan=1>PETS</td><td rowspan=1 colspan=1>-47.7 ± 43.6</td><td rowspan=1 colspan=1>-52.7± 23.5</td><td rowspan=1 colspan=1>155.7 ± 79.3</td><td rowspan=1 colspan=1>-29.5 ± 37.8</td><td rowspan=1 colspan=1>-18.4 ± 46.3</td><td rowspan=1 colspan=1>199.6 ± 4.6</td></tr><tr><td rowspan=1 colspan=1>RS</td><td rowspan=1 colspan=1>-107.6 ± 5.2</td><td rowspan=1 colspan=1>-146.4± 3.2</td><td rowspan=1 colspan=1>161.2 ± 11.5</td><td rowspan=1 colspan=1>-0.0±0.0</td><td rowspan=1 colspan=1>-12.5 ± 14.3</td><td rowspan=1 colspan=1>201.0 ± 0.0</td></tr><tr><td rowspan=1 colspan=1>MBMF</td><td rowspan=1 colspan=1>-168.6 ± 23.2</td><td rowspan=1 colspan=1>-285.8 ±15.2</td><td rowspan=1 colspan=1>163.7 ± 15.2</td><td rowspan=1 colspan=1>-202.3 ± 17.0</td><td rowspan=1 colspan=1>-146.8 ± 29.9</td><td rowspan=1 colspan=1>22.5 ± 67.7</td></tr><tr><td rowspan=1 colspan=1>TRPO</td><td rowspan=1 colspan=1>-176.5 ± 24.3</td><td rowspan=1 colspan=1>-235.5 ± 6.2</td><td rowspan=1 colspan=1>158.7 ± 9.1</td><td rowspan=1 colspan=1>-134.6 ± 6.9</td><td rowspan=1 colspan=1>-291.2 ± 6.7</td><td rowspan=1 colspan=1>46.3 ±6.0</td></tr><tr><td rowspan=1 colspan=1>PPO</td><td rowspan=1 colspan=1>-162.2 ± 15.7</td><td rowspan=1 colspan=1>-243.2 ± 6.9</td><td rowspan=1 colspan=1>160.9 ± 12.5</td><td rowspan=1 colspan=1>-137.3 ± 12.4</td><td rowspan=1 colspan=1>-205.4 ± 51.5</td><td rowspan=1 colspan=1>68.8 ± 4.9</td></tr><tr><td rowspan=1 colspan=1>GPS</td><td rowspan=1 colspan=1>-552.8 ± 577.7</td><td rowspan=1 colspan=1>-151.2 ± 1.3</td><td rowspan=1 colspan=1>164.3 ± 4.1</td><td rowspan=1 colspan=1>-14.7 ± 20.7</td><td rowspan=1 colspan=1>-214.3 ± 15.3</td><td rowspan=1 colspan=1>-18.7 ± 101.1</td></tr><tr><td rowspan=1 colspan=1>METRPO</td><td rowspan=1 colspan=1>-43.5± 3.7</td><td rowspan=1 colspan=1>-98.5 ± 12.6</td><td rowspan=1 colspan=1>174.8 ± 6.2</td><td rowspan=1 colspan=1>-29.3 ± 29.5</td><td rowspan=1 colspan=1>-78.7 ±5.0</td><td rowspan=1 colspan=1>138.5 ± 63.2</td></tr><tr><td rowspan=1 colspan=1>TD3</td><td rowspan=1 colspan=1>-331.6 ± 134.6</td><td rowspan=1 colspan=1>-216.4 ± 39.6</td><td rowspan=1 colspan=1>168.6 ± 12.7</td><td rowspan=1 colspan=1>-102.9 ± 101.0</td><td rowspan=1 colspan=1>-76.5 ±10.2</td><td rowspan=1 colspan=1>-409.2 ± 928.8</td></tr><tr><td rowspan=2 colspan=1>SACRandom</td><td rowspan=2 colspan=1>-161.6 ± 43.7-183.1 ± 41.5</td><td rowspan=1 colspan=1>-227.6 ± 42.2</td><td rowspan=1 colspan=1>159.5 ± 12.1</td><td rowspan=1 colspan=1>-0.2 ± 0.1</td><td rowspan=1 colspan=1>-69.4 ± 7.0</td><td rowspan=1 colspan=1>195.5 ± 8.7</td></tr><tr><td rowspan=1 colspan=1>-199.0 ± 10.0</td><td rowspan=1 colspan=1>-249.5 ± 228.4</td><td rowspan=1 colspan=1>-205.9 ± 12.1</td><td rowspan=1 colspan=1>-374.1 ± 15.6</td><td rowspan=1 colspan=1>31.3 ± 36.3</td></tr><tr><td rowspan=1 colspan=1>Time-step</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>50000</td><td rowspan=1 colspan=1>50000</td></tr></table>
341
+
342
+ Table 4: Performance of each algorithm on environments based on OpenAI Gym Brockman et al.
343
+ (2016) classic control environments. In the table, we record the performance at 50000 time-step.
344
+
345
+ # A.3 FULL RESULTS OF BENCH-MARKING PERFORMANCE
346
+
347
+ In this section, we show the figures of all the environments in Figure 8. We also include the final performance in the Table 2 and 4. As we can see, POPLIN has consistently the best performance among almost all the environments. We also include the time-steps we use on each environment for all the algorithms in Table 2 and 4.
348
+
349
+ # A.3.1 HYPER-PARAMETERS
350
+
351
+ In this section, we introduce the hyper-parameters we search during the experiments. One thing to notice is that, for all of the experiments on PETS, POPLIN, we use the model type PE (probabilistic ensembles) and propagation method of E (expectation). While other combinations of model type and propagation methods might result in better performance, they are usually prohibitively computationally expensive. For example, the combination of PE-DS requires a training time of about 68 hours for one random seed, for PETS to train with 200 iteration, which is 200,000 time-step. As a matter of fact, PE-E is actually one of the best combination in many environments. Since POPLIN is based on PETS, we believe this is a fair comparison for all the algorithms.
352
+
353
+ We show the hyper-parameter search we perform for PETS in the paper in Table 5. For the hyperparameters specific to POPLIN, we summarize them in 6 and 7.
354
+
355
+ Table 5: Hyper-parameter grid search options for PETS.
356
+
357
+ <table><tr><td>Hyper-parameter</td><td>Value Tried</td></tr><tr><td>Population Size</td><td>100,200,.., 2000</td></tr><tr><td>Planning Horizon</td><td>30,50,100</td></tr><tr><td>Initial Distribution Sigma</td><td>0.01, 0.03, 0.1, 0.25, 0.3, 0.5</td></tr><tr><td>CEMIterations</td><td>5,8,10,20</td></tr><tr><td>ELite Size g</td><td>50,100,200</td></tr></table>
358
+
359
+ Table 6: Hyper-parameter grid search options for POPLIN-A.
360
+
361
+ <table><tr><td>Hyper-parameter</td><td>Value Tried</td></tr><tr><td>Training Data</td><td>real data, hallucination data</td></tr><tr><td>Variant</td><td>Replan, Init</td></tr><tr><td>Initial Distribution Sigma</td><td>0.001, 0.003, 0.01, 0.03, 0.1</td></tr></table>
362
+
363
+ Table 7: Hyper-parameter grid search options for POPLIN-P. We also experiment with using WGAN in Salimans et al. (2016) to train the policy network, which does not results in good performance and is not put into the article.
364
+
365
+ <table><tr><td>Hyper-parameter</td><td>Value Tried</td></tr><tr><td>Training Data</td><td>real data, hallucination data</td></tr><tr><td>Training Variant</td><td>BC, GAN, Avg</td></tr><tr><td>Noise Variant</td><td>Uni, Sep</td></tr><tr><td>Initial Distribution Sigma</td><td>0.001, 0.003, 0.01, 0.03, 0.1</td></tr></table>
366
+
367
+ # A.4 FULL RESULTS OF POLICY CONTROL
368
+
369
+ Due to the space limit, we are not able to put all of the results of policy control in the main article. More specifically, we add the figure for the original Cheetah-v0 compared to the figures shown in the main article, as can be seen in 9 (b). Again, we note that POPLIN-P-BC and POPLIN-P-GAN are comparable to each other, as mentioned in the main article. POPLIN-P-BC and POPLIN-P-GAN are the better algorithms respectively in Cheetah and Cheetah-v0, which are essentially the same environment with different observation functions.
370
+
371
+ ![](images/8221b21f6322860b9f01fa92ae6488a1dbcc9b6192e40aded7f385f33ba9e368.jpg)
372
+ Figure 9: The planning performance and the testing performance of the proposed POPLIN-A, and POPLIN-P with its three training schemes, which are namely behavior cloning (BC), generative adversarial network training (GAN) and setting parameter average (Avg).
373
+
374
+ # A.5 ABLATION STUDY FOR DIFFERENT VARIANT OF POPLIN
375
+
376
+ In this section, we show the results of different variant of our algorithm. In Figure 11, the performances of different random seeds are visualized, where we show that POPLIN has similar randomness in performance to PETS. Additionally, we visualize POPLIN-P-BC in Figure 10 (b), whose best distribution variance for policy planning is 0.01, while the best setting for testing is 0.03.
377
+
378
+ # A.6 POPULATION SIZE
379
+
380
+ In Figure 12, we include more detailed figures of the performance of different algorithms with different population size. One interesting finding is that even with fixed parameters of zeros, POPLINP can still performance very efficient search. This is indicating that the efficiency in optimization of
381
+
382
+ ![](images/56075b1bdfb9944a39483a27e6378e6d32d67609de583511325741d53fdb37bc.jpg)
383
+ Figure 10: The performance of POPLIN-A, POPLIN-P-BC, POPLIN-P-Avg, POPLIN-P-GAN using different hyper-parameters. The tested environment is Cheetah.
384
+
385
+ ![](images/37f1689d9f7c2c377533c3073a23b7a68344d3e3de373082a97a539657c4b491.jpg)
386
+ Figure 11: The performance of POPLIN-A, POPLIN-P, and PETS of different random seeds on Cheetah environment.
387
+
388
+ POPLIN-P, especially of POPLIN-P-AVG, is the key reasons for successful planning. However, this scheme naturally sacrifices the policy distillation and thus cannot be applied without planning.
389
+
390
+ # A.7 THE REWARD SURFACE OF DIFFERENT ALGORITHM
391
+
392
+ In this section, we provide a more detailed description of the reward surface with respect the the solution space (action space for PETS and POPLIN-A, and parameter space for POPLIN-P) in Figure 13, 14, 15, 16, 17. As we can see, variants of POPLIN-A are better at searching, but the reward surface is still not smooth. POPLIN-A-Replan is more efficient in searching than POPLIN-A-Init, but the errors in dynamics limit its performance. We also include the results for POPLIN-P using a 1-layer neural network in solution space in Figure 16 (g), (h). The results indicate that the deeper the network, the better the search efficiency.
393
+
394
+ We also provide more detailed version of Figure 1 in Figure 18. We respectively show the surface for PETS, POPLIN-P-P using 1 and 0 hidden layers. Their planned trajectories across different CEM updates are visualized in Figure 19, 20, 21. Originally in Figure 1, we use the trajectories in iteration
395
+
396
+ ![](images/13d8c2c97675d52ebb0b6435803d019388a3a7530fc3276090c5030c2722e88a.jpg)
397
+ Figure 12: The performance of PETS, POPLIN-A, POPLIN-P-Avg, POPLIN-P-BC and POPLIN$\mathrm { \bf P }$ whose network has fixed parameters of zeros. The variance of the candidates trajectory $\sigma$ in POPLIN-P is set to 0.1. The tested environment is Cheetah.
398
+
399
+ ![](images/8f77e02c33e9d8032249a47c856791eb40f6304908a8323a6943886cdf154998.jpg)
400
+ Figure 13: Reward surface in solution space (action space) for PETS algorithm.
401
+
402
+ 1, 3, 5 for better illustration. In the appendix, we also provide all the iteration data. Again, the color indicates the expected cost (negative of expected reward). From left to right, we show the updated the trajectories in each iteration with blue scatters.
403
+
404
+ ![](images/2576f42a4b17ce79560f36d35914df4a7897d92f2dcd92bb0dcce3414668eb4c.jpg)
405
+ Figure 14: Reward surface in solution space (action space) for POPLIN-A-Replan.
406
+
407
+ ![](images/a4aa1551605bf7d787a031cdc502f7a6a1a5e38f13f5e05061933ce66e69f0bb.jpg)
408
+ Figure 15: Reward surface in solution space (action space) for POPLIN-A-Init.
409
+
410
+ ![](images/2abed00bf9a008870d2822d44e72121619319eebb4ad815526bbbebdd4b08325.jpg)
411
+ Figure 16: Reward surface in solution space (parameter space) for POPLIN-P with 0 hidden layer.
412
+
413
+ ![](images/c4bc85def0313485dc21d825ae6c6528918b50b86eb717381eb36040dba5f461.jpg)
414
+ Figure 17: Reward surface in solution space (parameter space) for POPLIN-P using 1 hidden layer.
415
+
416
+ ![](images/78bece7f6f57925094360628dab866de56993b44e50053a457e01e4cae8dc292.jpg)
417
+ Figure 18: The color indicates the expected cost (negative of expected reward). We emphasis that all these figures are visualized in the action space. And all of them are very unsmooth. For the figures visualized in solution space, we refer to Figure 13.
418
+
419
+ ![](images/0734c7052f7e4bdbe24c4b7ad28bb43200e9c4063acc79bfe8fc2722fdf0f3ff.jpg)
420
+ Figure 19: The figures are the planned trajectories of PETS.
421
+
422
+ ![](images/a9e671208826b8c04f165509cdceb59ba0f3c6b6e97b6c754a464e5f616cacd7.jpg)
423
+ Figure 20: The figures are the planned trajectories of POPLIN-P using 1 hidden layer MLP.
424
+
425
+ ![](images/af3d30179ece38af09b204be587041a0d2f026e011c6f333432814274ff483d8.jpg)
426
+ Figure 21: The figures are the planned trajectories of POPLIN-P using 0 hidden layer MLP.
md/train/H1lJJnR5Ym/H1lJJnR5Ym.md ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXPLORATION BY RANDOM NETWORK DISTILLATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We introduce an exploration bonus for deep reinforcement learning methods that is easy to implement and adds minimal overhead to the computation performed. The bonus is the error of a neural network predicting features of the observations given by a fixed randomly initialized neural network. We also introduce a method to flexibly combine intrinsic and extrinsic rewards. We find that the random network distillation (RND) bonus combined with this increased flexibility enables significant progress on several hard exploration Atari games. In particular we establish state of the art performance on Montezuma’s Revenge, a game famously difficult for deep reinforcement learning methods. To the best of our knowledge, this is the first method that achieves better than average human performance on this game without using demonstrations or having access to the underlying state of the game, and occasionally completes the first level. This suggests that relatively simple methods that scale well can be sufficient to tackle challenging exploration problems.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Reinforcement learning (RL) methods work by maximizing the expected return of a policy. This works well when the environment has dense rewards that are easy to find by taking random sequences of actions, but tends to fail when the rewards are sparse and hard to find. In reality it is often impractical to engineer dense reward functions for every task one wants an RL agent to solve. In these situations methods that explore the environment in a directed way are necessary.
12
+
13
+ ![](images/ab0191a2e302181a2fe9e1d8b350a53e737be3ef46f8f31be4adfd4d2c43d1f5.jpg)
14
+ Figure 1: RND exploration bonus over the course of the first episode where the agent picks up the torch (19-21). To do so the agent passes 17 rooms and collects gems, keys, a sword, an amulet, and opens two doors. Many of the spikes in the exploration bonus correspond to meaningful events: losing a life (2,8,10,21), narrowly escaping an enemy (3,5,6,11,12,13,14,15), passing a difficult obstacle (7,9,18), or picking up an object (20,21). The large spike at the end corresponds to a novel experience of interacting with the torch, while the smaller spikes correspond to relatively rare events that the agent has nevertheless experienced multiple times. See goo.gl/DGPC8E for videos.
15
+
16
+ Recent developments in RL seem to suggest that solving the most challenging tasks (Silver et al., 2016; Zoph & Le, 2016; Horgan et al., 2018; Espeholt et al., 2018; OpenAI, 2018; OpenAI et al., 2018) requires processing large numbers of samples obtained from running many copies of the environment in parallel. In light of this it is desirable to have exploration methods that scale well with large amounts of experience. However many of the recently introduced exploration methods based on counts, pseudo-counts, information gain or prediction gain are difficult to scale up to large numbers of parallel environments.
17
+
18
+ This paper introduces an exploration bonus that is particularly simple to implement, works well with high-dimensional observations, can be used with any policy optimization algorithm, and is efficient to compute as it requires only a single forward pass of a neural network on a batch of experience. Our exploration bonus is based on the observation that neural networks tend to have significantly lower prediction errors on examples similar to those on which they have been trained. This motivates the use of prediction errors of networks trained on the agent’s past experience to quantify the novelty of new experience.
19
+
20
+ As pointed out by many authors, agents that maximize such prediction errors tend to get attracted to transitions where the answer to the prediction problem is a stochastic function of the inputs. For example if the prediction problem is that of predicting the next observation given the current observation and agent’s action (forward dynamics), an agent trying to maximize this prediction error will tend to seek out stochastic transitions, like those involving randomly changing static noise on a TV, or outcomes of random events such as coin tosses. This observation motivated the use of methods that quantify the relative improvement of the prediction, rather than its absolute error. Unfortunately, as previously mentioned, such methods are hard to implement efficiently.
21
+
22
+ We propose an alternative solution to this undesirable stochasticity by defining an exploration bonus using a prediction problem where the answer is a deterministic function of its inputs. Namely we predict the output of a fixed randomly initialized neural network on the current observation.
23
+
24
+ Atari games have been a standard benchmark for deep reinforcement learning algorithms since the pioneering work by Mnih et al. (2013). Bellemare et al. (2016) identified among these games the hard exploration games with sparse rewards: Freeway, Gravitar, Montezuma’s Revenge, Pitfall!, Private Eye, Solaris, and Venture. RL algorithms tend to struggle on these games, often not finding even a single positive reward.
25
+
26
+ In particular, Montezuma’s Revenge is considered to be a difficult problem for RL agents, requiring a combination of mastery of multiple in-game skills to avoid deadly obstacles, and finding rewards that are hundreds of steps apart from each other even under optimal play. Significant progress has been achieved by methods with access to either expert demonstrations (Pohlen et al., 2018; Aytar et al., 2018; Garmulewicz et al., 2018), special access to the underlying emulator state (Tang et al., 2017; Stanton & Clune, 2018), or both (Salimans & Chen, 2018). However without such aids, progress on the exploration problem in Montezuma’s Revenge has been slow, with the best methods finding about half the rooms (Bellemare et al., 2016). For these reasons we provide extensive ablations of our method on this environment.
27
+
28
+ We find that even when disregarding the extrinsic reward altogether, an agent maximizing the RND exploration bonus consistently finds more than half of the rooms in Montezuma’s Revenge. To combine the exploration bonus with the extrinsic rewards we introduce a modification of Proximal Policy Optimization (PPO, Schulman et al. (2017)) that uses two value heads for the two reward streams. This allows the use of different discount rates for the different rewards, and combining episodic and non-episodic returns. With this additional flexibility, our best agent often finds 22 out of the 24 rooms on the first level in Montezuma’s Revenge, and occasionally (though not frequently) passes the first level. The same method gets state of the art performance on Venture and Gravitar.
29
+
30
+ # 2 METHOD
31
+
32
+ # 2.1 EXPLORATION BONUSES
33
+
34
+ Exploration bonuses are a class of methods that encourage an agent to explore even when the environment’s reward $e _ { t }$ is sparse. They do so by replacing $e _ { t }$ with a new reward $\boldsymbol { r } _ { t } = \boldsymbol { e } _ { t } + \boldsymbol { i } _ { t }$ , where $i _ { t }$ is the exploration bonus associated with the transition at time $t$ .
35
+
36
+ To encourage the agent to visit novel states, it is desirable for $i _ { t }$ to be higher in novel states than in frequently visited ones. Count-based exploration methods provide an example of such bonuses.
37
+
38
+ In a tabular setting with a finite number of states one can define $i _ { t }$ to be a decreasing function of the visitation count $n _ { t } ( s )$ of the state $\pmb { s }$ . In particular $i _ { t } = 1 / n _ { t } ( s )$ and $i _ { t } = 1 / \sqrt { n _ { t } ( s ) }$ have been used in prior work (Bellemare et al., 2016; Ostrovski et al., 2018). In non-tabular cases it is not straightforward to produce counts, as most states will be visited at most once. One possible generalization of counts to non-tabular settings is pseudo-counts (Bellemare et al., 2016) which uses changes in state density estimates as an exploration bonus. In this way the counts derived from the density model can be positive even for states that have not been visited in the past, provided they are similar to previously visited states.
39
+
40
+ An alternative is to define $i _ { t }$ as the prediction error for a problem related to the agent’s transitions. Generic examples of such problems include forward dynamics and inverse dynamics (Schmidhuber, 1991b; Stadie et al., 2015; Achiam & Sastry, 2017; Pathak et al., 2017; Burda et al., 2018; Haber et al., 2018). Non-generic prediction problems can also be used if specialized information about the environment is available, like predicting physical properties of objects the agent interacts with (Denil et al., 2016). Such prediction errors tend to decrease as the agent collects more experience similar to the current one. For this reason even trivial prediction problems like predicting a constant zero function can work as exploration bonuses (Fox et al., 2018).
41
+
42
+ # 2.2 RANDOM NETWORK DISTILLATION
43
+
44
+ This paper introduces a different approach where the prediction problem is randomly generated. This involves two neural networks: a fixed and randomly initialized target network which sets the prediction problem, and a predictor network trained on data collected by the agent. The target network takes an observation to an embedding $f : \mathcal { O } \to \mathbb { R } ^ { k }$ and the predictor neural network $\hat { f } : \mathcal { O } \to \mathbb { R } ^ { k }$ is trained by gradient descent to minimize the expected MSE $\| \hat { f } ( \mathbf { x } ; \theta ) - f ( \mathbf { x } ) \| ^ { 2 }$ with respect to its parameters $\theta _ { \hat { f } }$ . This process distills a randomly initialized neural network into a trained one. The prediction error $i _ { t } = \| { \hat { f } } ( \mathbf { x } ) - f ( \mathbf { x } ) \| ^ { 2 }$ is expected to be higher for novel states dissimilar to the ones the predictor has been trained on. This allows to use $i _ { t }$ as an exploration bonus.
45
+
46
+ To build intuition we consider a toy model of this process on MNIST. We train a predictor neural network to mimic a randomly initialized target network on training data consisting of a mixture of images with the label 0 and of a target class, varying the proportion of the classes, but not the total number of training examples. We then test the predictor network on the unseen test examples of the target class and report the MSE. In this model the zeros are playing the role of states that have been seen many times before, and the target class is playing the role of states that have been visited infrequently. The results are shown in Figure 2. The figure shows that test error decreases as a function of the number of training examples in the target class, suggesting that this method can be used to detect novelty. Figure 1 shows that the intrinsic reward is high in novel states in an episode of Montezuma’s Revenge.
47
+
48
+ One objection to this method is that a sufficiently powerful optimization algorithm might find a predictor that mimics the target random network perfectly on any input (for example the target network itself would be such a predictor). However the above experiment on MNIST shows that standard gradient-based methods don’t overgeneralize in this undesirable way.
49
+
50
+ # 2.2.1 SOURCES OF PREDICTION ERRORS
51
+
52
+ In general, prediction errors can be attributed to a number of factors:
53
+
54
+ 1. Amount of training data. Prediction error is high where few similar examples were seen by the predictor (epistemic uncertainty). 2. Stochasticity. Prediction error is high because the target function is stochastic (aleatoric uncertainty). Stochastic transitions are a source of such error for forward dynamics prediction. 3. Model misspecification. Prediction error is high because necessary information is missing, or the model class is too limited to fit the complexity of the target function. 4. Learning dynamics. Prediction error is high because the optimization process fails to find a predictor in the model class that best approximates the target function.
55
+
56
+ Factor 1 is what allows one to use prediction error as an exploration bonus. In practice the prediction error is caused by a combination of all of these factors, not all of them desirable.
57
+
58
+ For instance if the prediction problem is forward dynamics, then factor 2 results in the ‘noisy-TV’ problem. This is the thought experiment where an agent that is rewarded for errors in the prediction of its forward dynamics model gets attracted to stochastic transitions in the environment. A TV randomly switching between channels would be such an attractor, as would a coin flip.
59
+
60
+ To avoid the undesirable factors 2 and 3, methods such as those by Schmidhuber (1991a); Oudeyer et al. (2007); Lopes et al. (2012); Achiam & Sastry (2017) instead use a measurement of how much the prediction model improves upon seeing a new datapoint. However these approaches tend to be computationally expensive and hence difficult to scale.
61
+
62
+ RND obviates factors 2 and 3 since the target network can be chosen to be deterministic and inside the model-class of the predictor network.
63
+
64
+ # 2.2.2 RELATION TO UNCERTAINTY QUANTIFICATION
65
+
66
+ In this section we highlight a link between the RND prediction error and an uncertainty quantification method introduced by Osband et al. (2018). Namely, consider a regression problem with data distribution $D = \{ x _ { i } , y _ { i } \} _ { i }$ . In the Bayesian setting we would consider a prior $p ( \theta ^ { * } )$ over the parameters of a mapping $f _ { \theta ^ { \ast } }$ and calculate the posterior after updating on the evidence.
67
+
68
+ Let $\mathcal { F }$ be the distribution over functions $g _ { \theta } = f _ { \theta } + f _ { \theta ^ { \ast } }$ , where $\theta ^ { * }$ is drawn from $p ( \theta ^ { * } )$ and $\theta$ is given by minimizing the expected prediction error
69
+
70
+ $$
71
+ \theta = \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { ( \boldsymbol { x } _ { i } , \boldsymbol { y } _ { i } ) \sim D } \| f _ { \theta } ( \boldsymbol { x } _ { i } ) + f _ { \theta ^ { * } } ( \boldsymbol { x } _ { i } ) - \boldsymbol { y } _ { i } \| ^ { 2 } + \mathcal { R } ( \theta ) ,
72
+ $$
73
+
74
+ where ${ \mathcal { R } } ( \theta )$ is a regularization term coming from the prior (see Lemma 3, Osband et al. (2018)). Osband et al. (2018) argue that the ensemble $\mathcal { F }$ is an approximation of the posterior. In the case of Bayesian linear regression this statement can be made precise. However even in the case where the functions are not linear, (Osband et al., 2018) experimentally validate that the same procedure can be used as a part of a heuristic for quantifying uncertainty.
75
+
76
+ If we specialize the regression targets $y _ { i }$ to be zero, then the optimization problem $\begin{array} { r } { \arg \operatorname* { m i n } _ { \theta } \dot { \mathbb { E } } _ { ( x _ { i } , y _ { i } ) \sim D } \big \| f _ { \theta } ( x _ { i } ) + f _ { \theta ^ { * } } ( x _ { i } ) \big \| ^ { \overline { { 2 } } } } \end{array}$ is equivalent to distilling a randomly drawn function from the prior. (Here we omit the regularization term from the objective and assume that the prior is symmetric around the origin in the parameter space). Seen from this perspective, each coordinate of the output of the predictor and target networks would correspond to a member of an ensemble (with parameter sharing amongst the ensemble), and the MSE would be an estimate of the predictive variance of the ensemble (assuming the ensemble is unbiased). In other words the distillation error could be seen as a quantification of uncertainty in predicting the constant zero function. We believe that a similar mechanism might underlie the performance of RND and (Osband et al., 2018).
77
+
78
+ # 2.3 COMBINING INTRINSIC AND EXTRINSIC RETURNS
79
+
80
+ In preliminary experiments that used only intrinsic rewards, treating the problem as non-episodic resulted in better exploration. In that setting the return is not truncated at “game over”. We argue that this is a natural way to do exploration in simulated environments, since the agent’s intrinsic return should be related to all the novel states that it could find in the future, regardless of whether they all occur in one episode or are spread over several. It is also argued in (Burda et al., 2018) that using episodic intrinsic rewards can leak information about the task to the agent.
81
+
82
+ We also argue that this is closer to how humans explore games. For example let’s say Alice is playing a videogame and is attempting a tricky maneuver to reach a suspected secret room. Because the maneuver is tricky the chance of a game over is high, but the payoff to Alice’s curiosity will be high if she succeeds. If Alice is modelled as an episodic reinforcement learning agent, then her future return will be exactly zero if she gets a game over, which might make her overly risk averse. The real cost of a game over to Alice is the opportunity cost incurred by having to play through the game from the beginning (which is presumably less interesting to Alice having played the game for some time).
83
+
84
+ However using non-episodic returns for extrinsic rewards could be exploited by a strategy that finds a reward close to the beginning of the game, deliberately restarts the game by getting a game over, and repeats this in an endless cycle.
85
+
86
+ ![](images/93a1a5af091e14224e6c334fcc19af50ec939179be247f3f60872f83ea7a693d.jpg)
87
+ Figure 2: Novelty detection on MNIST: a predictor network mimics a randomly initialized target network. The training data consists of varying proportions of images from class $\mathbf { \ddot { \rho } } _ { 0 } , \mathbf { \vec { \rho } }$ and a target class. Each curve shows the test MSE on held out target class examples plotted against the number of training examples of the target class (log scale). Curves are an average over 10 random seeds.
88
+
89
+ ![](images/ca601f9a9a6278ec814eee7fc6a9863430a2a1fc548995f179b9822fd9797600.jpg)
90
+ Figure 3: Mean episodic return and number of rooms found by pure exploration agents on Montezuma’s Revenge trained without access to the extrinsic reward. The agents explores more in the non-episodic setting (see also Section 2.3). Curves are an average over 5 random seeds.
91
+
92
+ It is not obvious how to estimate the combined value of the non-episodic stream of intrinsic rewards $i _ { t }$ and the episodic stream of extrinsic rewards $e _ { t }$ . Our solution is to observe that the return is linear in the rewards and so can be decomposed as a sum $R = R _ { E } + R _ { I }$ of the extrinsic and intrinsic returns respectively. Hence we can fit two value heads $V _ { E }$ and $V _ { I }$ separately using their respective returns, and combine them to give the value function $V = V _ { E } + V _ { I }$ . This same idea can also be used to combine reward streams with different discount factors.
93
+
94
+ Note that even where one is not trying to combine episodic and non-episodic reward streams, or reward streams with different discount factors, there may still be a benefit to having separate value functions since there is an additional supervisory signal to the value function. This may be especially important for exploration bonuses since the extrinsic reward function is stationary whereas the intrinsic reward function is non-stationary.
95
+
96
+ # 3 EXPERIMENTS
97
+
98
+ We begin with an intrinsic reward only experiment on Montezuma’s Revenge in Section 3.1 to isolate the inductive bias of the RND bonus, follow by extensive ablations of RND on Montezuma’s Revenge in Sections 3.2-3.5 to understand the factors that contribute to RND’s performance, and conclude with a comparison to baseline methods on 6 hard exploration Atari games in Section 3.6. For details of hyperparameters and architectures we refer the reader to Appendices A.3 and A.4. Most experiments are run for 30K rollouts of length 128 per environment with 128 parallel environments, for a total of 1.97 billion frames of experience. Each curve is an average over a number of random seeds detailed in the caption, and the shaded region is a standard error. Both the mean and the standard error curves were smoothed by averaging over a sliding window of $1 . 3 \%$ of the datapoints to make the figures more legible. We use the PPO (Schulman et al., 2017) as our policy optimization algorithm for all experiments.
99
+
100
+ # 3.1 PURE EXPLORATION
101
+
102
+ In this section we explore the performance of RND in the absence of any extrinsic reward. In Section 2.3 we argued that exploration with RND might be more natural in the non-episodic setting. By comparing the performance of the pure exploration agent in episodic and non-episodic settings we can see if this observation translates to improved exploration performance.
103
+
104
+ We report two measures of exploration performance in Figure 3: mean episodic return, and the number of rooms the agent finds over the training run. Since the pure exploration agent is not aware of the extrinsic rewards or number of rooms, it is not directly optimizing for any of these measures. However obtaining some rewards in Montezuma’s Revenge (like getting the key to open a door) is required for accessing more interesting states in new rooms, and hence we observe the extrinsic reward increasing over time up to some point. The best return is achieved when the agent interacts with some of the objects, but the agent has no incentive to keep doing the same once such interactions become repetitive, hence returns are not consistently high.
105
+
106
+ ![](images/61dca6b8e999dafc337c517cda622a65af1525f686c5306be4eb4745bb0869d6.jpg)
107
+ Figure 4: Performance of different discount factors for intrinsic and extrinsic reward streams. A higher discount factor for the extrinsic rewards leads to better performance, while for intrinsic rewards it hurts exploration. Curves are an average over 5 random seeds.
108
+
109
+ ![](images/4b6cf1f7df29e8a665c5217b92158ef80e2fbde10231faaee008438af93eafda.jpg)
110
+ Figure 5: Mean episodic return and number of discovered rooms improve as the number of parallel environments used for collecting the experience increases. The runs have processed 0.5,2,4, and 16B frames. Curves are an average over 10 random seeds.
111
+
112
+ We clearly see in Figure 3 that on both measures of exploration the non-episodic agent performs best, consistent with the discussion in Section 2.3. The non-episodic setting with $\gamma _ { I } = 0 . 9 9 9$ explores more rooms than $\gamma _ { I } = 0 . 9 9$ , with one of the runs exploring 21 rooms. The best return achieved by 4 out 5 runs of this setting was 6,700.
113
+
114
+ # 3.2 COMBINING EPISODIC AND NON-EPISODIC RETURNS
115
+
116
+ In Section 3.1 we saw that the non-episodic setting resulted in more exploration than the episodic setting when exploring without any extrinsic rewards. Next we consider whether this holds in the case where we combine intrinsic and extrinsic rewards. As discussed in Section 2.3 in order to combine episodic and non-episodic reward streams we require two value heads. This also raises the question of whether it is better to have two value heads even when both reward streams are episodic. In Figure 6 we compare episodic intrinsic rewards to non-episodic intrinsic rewards combined with episodic extrinsic rewards, and additionally two value heads versus one for the episodic case. The discount factors are $\gamma _ { I } = \gamma _ { E } = 0 . 9 9$ .
117
+
118
+ ![](images/1b42b8a064a47299032e8d06a851ea87b6cd52c1786f9b487a675ffb9a70b67a.jpg)
119
+ Figure 6: Different ways of combining intrinsic and extrinsic rewards. Combining non-episodic stream of intrinsic rewards with the episodic stream of extrinsic rewards outperforms combining episodic versions of both steams in terms of number of explored rooms, but performs similarly in terms of mean return. Single value estimate of the combined stream of episodic returns performs a little better than the dual value estimate. The differences are more pronounced with RNN policies. CNN runs are more stable than the RNN counterparts. Curves are an average over 5 random seeds.
120
+
121
+ In Figure 6 we see that using a non-episodic intrinsic reward stream increases the number of rooms explored for both CNN and RNN policies, consistent with the experiments in Section 3.1, but that the difference is less dramatic, likely because the extrinsic reward is able to preserve useful behaviors. We also see that the difference is less pronounced for the CNN experiments, and that the RNN results tend to be less stable and perform worse overall.
122
+
123
+ Contrary to our expectations (Section 2.3) using two value heads did not show any benefit over a single head in the episodic setting. Nevertheless having two value heads is necessary for combining reward streams with different characteristics (for example having different discount factors or combining episodic rewards with non-episodic reward), and so all further experiments use two value heads.
124
+
125
+ # 3.3 DISCOUNT FACTORS
126
+
127
+ Previous experiments (Salimans & Chen, 2018; Pohlen et al., 2018; Garmulewicz et al., 2018) solving Montezuma’s Revenge using expert demonstrations used a high discount factor to achieve the best performance, enabling the agent to anticipate rewards far into the future. We compare the performance of the RND agent with ${ \gamma _ { E } \in \{ 0 . 9 9 , 0 . 9 9 9 \} }$ and $\gamma _ { I } = 0 . 9 9$ . We also investigate the effect of increasing $\gamma _ { I }$ to 0.999. The results are shown in Figure 4.
128
+
129
+ In Figure 4 we see that increasing $\gamma _ { E }$ to 0.999 while holding $\gamma _ { I }$ at 0.99 greatly improves performance. This setting had a mean return of $1 1 . 5 \mathrm { K }$ at the end of training, setting a new state of the art. We also see that further increasing $\gamma _ { I }$ to 0.999 hurts performance. This is at odds with the results in Figure 3 where increasing $\gamma _ { I }$ did not significantly impact performance. We note that the effect of increasing $\gamma _ { E }$ is hard to disentangle from the effective increase in the weight of the extrinsic reward in the return. To address this ambiguity we would need to run an extensive hyperparameter sweep of the weights of intrinsic and extrinsic rewards and $\gamma _ { E }$ .
130
+
131
+ # 3.4 RECURRENCE
132
+
133
+ Montezuma’s Revenge is a partially observable environment even though large parts of the game state can be inferred from the screen. For example the number of keys the agent has appears on the screen, but not where they come from, how many keys have been used in the past, or what doors have been opened. To deal with this partial observability, an agent should maintain a state summarizing the past, for example the state of a recurrent policy. Hence it would be natural to hope for better performance from agents with recurrent policies. Contrary to expectations in Figure 6 recurrent policies performed worse than non-recurrent counterparts. We provide an additional experiment confirming this finding in the Appendix (fig. 8). However this finding did not hold true for other games as shown in Section 3.6.
134
+
135
+ # 3.5 SCALING UP RNN TRAINING
136
+
137
+ In this section we report experiments showing the effect of increased scale on RNN training. The intrinsic rewards are non-episodic with $\gamma _ { I } = 0 . 9 9$ , and $\gamma _ { E } = 0 . 9 9 9$ .
138
+
139
+ To hold the rate at which the intrinsic reward decreases over time constant across experiments with different numbers of parallel environments, we downsample the batch size when training the predictor to match the batch size with 32 parallel environments (for full details see Appendix A.4). Larger numbers of environments results in larger batch sizes per update for training the policy, whereas the predictor network batch size remains constant. Since the intrinsic reward disappears over time it is important for the policy to learn to find and exploit these transitory rewards, since they act as stepping-stones to nearby novel states.
140
+
141
+ Figure 5 shows that agents trained with larger batches of experience collected from more parallel environments obtain higher mean returns after similar numbers of updates. They also achieve better final performance.
142
+
143
+ We allowed the experiment with 32 parallel environments to run for more time, eventually reaching a mean return of 7,570 after processing 1.6 billion frames over 1.6 million parameter updates. One of these runs visited all 24 rooms, and passed the first level once, achieving a best return of 17,500. The experiment with 1024 parallel environments had mean return of 10,070 at the end of training, and yielded one run with mean return of 14,415.
144
+
145
+ # 3.6 COMPARISON TO BASELINES
146
+
147
+ In this section we compare RND to two baselines: PPO without an exploration bonus and an alternative exploration bonus based on forward dynamics error. We evaluate RND’s performance on six hard exploration Atari games: Gravitar, Montezuma’s Revenge, Pitfall!, Private Eye, Solaris, and Venture. We first compare to the performance of a baseline PPO implementation without intrinsic reward. For RND the intrinsic rewards are non-episodic with $\gamma _ { I } = 0 . 9 9$ , while $\gamma _ { E } = 0 . 9 9 9$ for both PPO and RND. The results are shown in Figure 7.
148
+
149
+ In Gravitar we see that RND does not consistently exceed the performance of PPO. However both exceed average human performance with an RNN policy, as well as the previous state of the art. On Montezuma’s Revenge and Venture RND significantly outperforms PPO, and exceeds state of the art performance and average human performance. On Pitfall! both algorithms fail to find any positive rewards. This is a typical result for this game, as the extrinsic positive reward is very sparse. On Private Eye RND’s performance exceeds that of PPO. On Solaris RND’s performance is comparable to that of PPO.
150
+
151
+ ![](images/a0506de551a67c05446cd8412d0e1fc163664795a085fd893cc73084486f208f.jpg)
152
+ Figure 7: Mean episodic return of RND, dynamics-based exploration method, and PPO with extrinsic reward only on 6 hard exploration Atari games. RND achieves state of the art performance on Gravitar, Montezuma’s Revenge, and Venture, significantly outperforming PPO on the latter two. Curves are an average over 3 random seeds. Horizontal axes show numbers of parameter updates at the bottom of the graphs and the numbers of frames at the top.
153
+
154
+ Next we consider an alternative exploration bonus based on forward dynamics error. There are numerous previous works using such a bonus (Schmidhuber, 1991b; Stadie et al., 2015; Achiam & Sastry, 2017; Pathak et al., 2017; Burda et al., 2018). Fortuitously Burda et al. (2018) show that training a forward dynamics model in a random feature space typically works as well as any other feature space when used to create an exploration bonus. This means that we can easily implement an apples to apples comparison and change the loss in RND so the predictor network predicts the random features of the next observation given the current observation and action, while holding fixed all other parts of our method such as dual value heads, non-episodic intrinsic returns, normalization schemes etc. This provides an ablation of the prediction problem defining the exploration bonus, while also being representative of a class of prior work using forward dynamics error. Our expectation was that these methods should be fairly similar except where the dynamics-based agent is able to exploit non-determinism in the environment to get intrinsic reward.
155
+
156
+ Figure 7 shows that dynamics-based exploration performs significantly worse than RND with the same CNN policy on Montezuma’s Revenge, PrivateEye, and Solaris, and performs similarly on Venture, Pitfall, and Gravitar. By analyzing agent’s behavior at convergence we notice that in Montezuma’s Revenge the agent oscillates between two rooms. This leads to an irreducibly high prediction error, as the non-determinism of sticky actions makes it impossible to know whether, once the agent is close to crossing a room boundary, making one extra step will result in it staying in the same room, or crossing to the next one. This is a manifestation of the ‘noisy TV’ problem, or aleatoric uncertainty discussed in Section 2.2.1. Similar behavior emerges in PrivateEye and Pitfall!. Table 5 in Appendix A.6 contains further details on the final mean performance of each algorithm.
157
+
158
+ # 3.7 QUALITATIVE ANALYSIS: DANCING WITH SKULLS
159
+
160
+ By observing the RND agent (goo.gl/DGPC8E), we notice that frequently once it obtains all the extrinsic rewards that it knows how to obtain reliably (as judged by the extrinsic value function), the agent settles into a pattern of behavior where it keeps interacting with potentially dangerous objects. For instance in Montezuma’s Revenge the agent jumps back and forth over a moving skull, moves in between laser gates, and gets on and off disappearing bridges. We also observe similar behavior in Pitfall!. It might be related to the very fact that such dangerous states are difficult to achieve, and hence are rarely represented in agent’s past experience compared to safer states.
161
+
162
+ # 4 RELATED WORK
163
+
164
+ Exploration. Count-based exploration bonuses are a natural and effective way to do exploration (Strehl & Littman, 2008) and a lot of work has studied how to tractably generalize count bonuses to large state spaces (Bellemare et al., 2016; Fu et al., 2017; Ostrovski et al., 2018; Tang et al., 2017; Machado et al., 2018; Fox et al., 2018).
165
+
166
+ Another class of exploration methods rely on errors in predicting dynamics (Schmidhuber, 1991b; Stadie et al., 2015; Achiam & Sastry, 2017; Pathak et al., 2017; Burda et al., 2018). As discussed in Section 2.2, these methods are subject to the ‘noisy TV’ problem in stochastic or partially-observable environments. This has motivated work on exploration via quantification of uncertainty (Still & Precup, 2012; Houthooft et al., 2016) or prediction improvement measures (Schmidhuber, 1991a; Oudeyer et al., 2007; Lopes et al., 2012; Achiam & Sastry, 2017).
167
+
168
+ Other methods of exploration include adversarial self-play (Sukhbaatar et al., 2018), maximizing empowerment (Gregor et al., 2017), parameter noise (Plappert et al., 2017; Fortunato et al., 2017), identifying diverse policies (Eysenbach et al., 2018; Achiam et al., 2018), and using ensembles of value functions (Osband et al., 2018; 2016; Chen et al., 2017).
169
+
170
+ Montezuma’s Revenge. Early neural-network based reinforcement learning algorithms that were successful on a significant portion of Atari games (Mnih et al., 2015; 2016; Hessel et al., 2017) failed to make meaningful progress on Montezuma’s Revenge, not finding a way out of the first room reliably. This is not necessarily a failure of exploration, as even a random agent finds the key in the first room once every few hundred thousand steps, and escapes the first room every few million steps. Indeed, a mean return of about 2,500 can be reliably achieved without special exploration methods (Horgan et al., 2018; Espeholt et al., 2018; Oh et al., 2018).
171
+
172
+ Combining DQN with a pseudo-count exploration bonus Bellemare et al. (2016) set a new state of the art performance, exploring 15 rooms and getting best return of 6,600. Since then a number of other works have achieved similar performance (O’Donoghue et al., 2017; Ostrovski et al., 2018; Machado et al., 2018; Osband et al., 2018), without exceeding it.
173
+
174
+ Special access to the underlying RAM state can also be used to improve exploration by using it to hand-craft exploration bonuses (Kulkarni et al., 2016; Tang et al., 2017; Stanton & Clune, 2018). Even with such access previous work achieves performance inferior to average human performance.
175
+
176
+ Expert demonstrations can be used effectively to simplify the exploration problem in Montezuma’s Revenge, and a number of works (Salimans & Chen, 2018; Pohlen et al., 2018; Aytar et al., 2018; Garmulewicz et al., 2018) have achieved performance comparable to or better than that of human experts. Learning from expert demonstrations benefits from the game’s determinism. The suggested training method (Machado et al., 2017) to prevent an agent from simply memorizing the correct sequence of actions is to use sticky actions (i.e. randomly repeating previous action) has not been used in these works. In this work we use sticky actions and thus don’t rely on determinism.
177
+
178
+ Random features. Features of randomly initialized neural networks have been extensively studied in the context of supervised learning (Rahimi & Recht, 2008; Saxe et al., 2011; Jarrett et al., 2009; Yang et al., 2015). More recently they have been used in the context of exploration (Osband et al., 2018; Burda et al., 2018). The work Osband et al. (2018) provides motivation for random network distillation as discussed in Section 2.2.
179
+
180
+ Vectorized value functions. Pong et al. (2018) find that a vectorized value function (with coordinates corresponding to additive factors of the reward) improves their method. Bellemare et al. (2017) parametrize the value as a linear combination of value heads that estimate probabilities of discretized returns. However the Bellman backup equation used there is not itself vectorized. More broadly, the issue of how to approach optimizing multiple objectives is an important topic in reinforcement learning, see (Roijers et al., 2013).
181
+
182
+ # 5 DISCUSSION
183
+
184
+ This paper introduced an exploration method based on random network distillation and experimentally showed that the method is capable of performing directed exploration on several Atari games with very sparse rewards. These experiments suggest that progress on hard exploration games is possible with relatively simple generic methods, especially when applied at scale. They also suggest that methods that are able to treat the stream of intrinsic rewards separately from the stream of extrinsic rewards (for instance by having separate value heads) can benefit from such flexibility.
185
+
186
+ We find that the RND exploration bonus is sufficient to deal with local exploration, i.e. exploring the consequences of short-term decisions, like whether to interact with a particular object, or avoid it. However global exploration that involves coordinated decisions over long time horizons is beyond the reach of our method.
187
+
188
+ To solve the first level of Montezuma’s Revenge, the agent must enter a room locked behind two doors. There are four keys and six doors spread throughout the level. Any of the four keys can open any of the six doors, but are consumed in the process. To open the final two doors the agent must therefore forego opening two of the doors that are easier to find and that would immediately reward it for opening them.
189
+
190
+ To incentivize this behavior the agent should receive enough intrinsic reward for saving the keys to balance the loss of extrinsic reward from using them early on. From our analysis of the RND agent’s behavior, it does not get a large enough incentive to try this strategy, and only stumbles upon it rarely.
191
+
192
+ Solving this and similar problems that require high level exploration is an important direction for future work.
193
+
194
+ # REFERENCES
195
+
196
+ Joshua Achiam and Shankar Sastry. Surprise-based intrinsic motivation for deep reinforcement learning. arXiv:1703.01732, 2017.
197
+
198
+ Joshua Achiam, Harrison Edwards, Dario Amodei, and Pieter Abbeel. Variational option discovery algorithms. arXiv preprint arXiv:1807.10299, 2018.
199
+
200
+ Yusuf Aytar, Tobias Pfaff, David Budden, Tom Le Paine, Ziyu Wang, and Nando de Freitas. Playing hard exploration games by watching YouTube. arXiv preprint arXiv:1805.11592, 2018.
201
+
202
+ Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In NIPS, 2016.
203
+
204
+ Marc G Bellemare, Will Dabney, and Remi Munos. A distributional perspective on reinforcement ´ learning. arXiv preprint arXiv:1707.06887, 2017.
205
+
206
+ Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A. Efros. Large-scale study of curiosity-driven learning. In arXiv:1808.04355, 2018.
207
+
208
+ Richard Y Chen, John Schulman, Pieter Abbeel, and Szymon Sidor. UCB and infogain exploration via $q$ -ensembles. arXiv:1706.01502, 2017.
209
+
210
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger ¨ Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
211
+
212
+ Misha Denil, Pulkit Agrawal, Tejas D Kulkarni, Tom Erez, Peter Battaglia, and Nando de Freitas. Learning to perform physics experiments via deep reinforcement learning. arXiv preprint arXiv:1611.01843, 2016.
213
+
214
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. IMPALA: Scalable distributed Deep-RL with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
215
+
216
+ Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint, 2018.
217
+
218
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, Charles Blundell, and Shane Legg. Noisy networks for exploration. arXiv:1706.10295, 2017.
219
+
220
+ Lior Fox, Leshem Choshen, and Yonatan Loewenstein. Dora the explorer: Directed outreaching reinforcement action-selection. International Conference on Learning Representations, 2018.
221
+
222
+ Justin Fu, John D Co-Reyes, and Sergey Levine. EX2: Exploration with exemplar models for deep reinforcement learning. NIPS, 2017.
223
+
224
+ Michał Garmulewicz, Henryk Michalewski, and Piotr Miłos. Expert-augmented actor-critic for ´ vizdoom and montezumas revenge. arXiv preprint arXiv:1809.03447, 2018.
225
+
226
+ Karol Gregor, Danilo Jimenez Rezende, and Daan Wierstra. Variational intrinsic control. ICLR Workshop, 2017.
227
+
228
+ Nick Haber, Damian Mrowca, Li Fei-Fei, and Daniel LK Yamins. Learning to play with intrinsicallymotivated self-aware agents. arXiv preprint arXiv:1802.07442, 2018.
229
+
230
+ 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.
231
+
232
+ 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.
233
+
234
+ Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. VIME: Variational information maximizing exploration. In NIPS, 2016.
235
+
236
+ Kevin Jarrett, Koray Kavukcuoglu, Yann LeCun, et al. What is the best multi-stage architecture for object recognition? In Computer Vision, 2009 IEEE 12th International Conference on, pp. 2146–2153. IEEE, 2009.
237
+
238
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015.
239
+
240
+ Tejas D Kulkarni, Karthik Narasimhan, Ardavan Saeedi, and Josh Tenenbaum. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. In Advances in neural information processing systems, pp. 3675–3683, 2016.
241
+
242
+ Manuel Lopes, Tobias Lang, Marc Toussaint, and Pierre-Yves Oudeyer. Exploration in model-based reinforcement learning by empirically estimating learning progress. In NIPS, 2012.
243
+
244
+ Marlos C Machado, Marc G Bellemare, Erik Talvitie, Joel Veness, Matthew Hausknecht, and Michael Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. arXiv preprint arXiv:1709.06009, 2017.
245
+
246
+ Marlos C Machado, Marc G Bellemare, and Michael Bowling. Count-based exploration with the successor representation. arXiv preprint arXiv:1807.11622, 2018.
247
+
248
+ 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.
249
+
250
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, February 2015.
251
+
252
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In ICML, 2016.
253
+
254
+ Brendan O’Donoghue, Ian Osband, Remi Munos, and Volodymyr Mnih. The uncertainty Bellman equation and exploration. arXiv preprint arXiv:1709.05380, 2017.
255
+
256
+ Junhyuk Oh, Yijie Guo, Satinder Singh, and Honglak Lee. Self-imitation learning. arXiv preprint arXiv:1806.05635, 2018.
257
+
258
+ OpenAI. OpenAI Five. https://blog.openai.com/openai-five/, 2018.
259
+
260
+ OpenAI, :, M. Andrychowicz, B. Baker, M. Chociej, R. Jozefowicz, B. McGrew, J. Pachocki, A. Petron, M. Plappert, G. Powell, A. Ray, J. Schneider, S. Sidor, J. Tobin, P. Welinder, L. Weng, and W. Zaremba. Learning Dexterous In-Hand Manipulation. ArXiv e-prints, August 2018.
261
+
262
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped DQN. In NIPS, 2016.
263
+
264
+ Ian Osband, John Aslanides, and Albin Cassirer. Randomized prior functions for deep reinforcement learning. arXiv preprint arXiv:1806.03335, 2018.
265
+
266
+ Georg Ostrovski, Marc G Bellemare, Aaron van den Oord, and Remi Munos. Count-based exploration ´ with neural density models. International Conference for Machine Learning, 2018.
267
+
268
+ Pierre-Yves Oudeyer, Frdric Kaplan, and Verena V Hafner. Intrinsic motivation systems for autonomous mental development. Evolutionary Computation, 2007.
269
+
270
+ Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In ICML, 2017.
271
+
272
+ 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:1706.01905, 2017.
273
+
274
+ Tobias Pohlen, Bilal Piot, Todd Hester, Mohammad Gheshlaghi Azar, Dan Horgan, David Budden, Gabriel Barth-Maron, Hado van Hasselt, John Quan, Mel Vecer ˇ ´ık, et al. Observe and look further: Achieving consistent performance on Atari. arXiv preprint arXiv:1805.11593, 2018.
275
+
276
+ Vitchyr Pong, Shixiang Gu, Murtaza Dalal, and Sergey Levine. Temporal difference models: Modelfree deep RL for model-based control. arXiv preprint arXiv:1802.09081, 2018.
277
+
278
+ Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pp. 1177–1184, 2008.
279
+
280
+ Diederik M Roijers, Peter Vamplew, Shimon Whiteson, and Richard Dazeley. A survey of multiobjective sequential decision-making. Journal of Artificial Intelligence Research, 48:67–113, 2013.
281
+
282
+ Tim Salimans and Richard Chen. Learning Montezuma’s Revenge from a single demonstration. https://blog.openai.com/learning-montezumas-revenge-from-a-single-demonstration/, 2018.
283
+
284
+ Andrew M Saxe, Pang Wei Koh, Zhenghao Chen, Maneesh Bhand, Bipin Suresh, and Andrew Y Ng. On random weights and unsupervised feature learning. In ICML, pp. 1089–1096, 2011.
285
+
286
+ Jurgen Schmidhuber. Curious model-building control systems. In ¨ Neural Networks, 1991. 1991 IEEE International Joint Conference on, pp. 1458–1463. IEEE, 1991a.
287
+
288
+ Jurgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building ¨ neural controllers. In Proceedings of the First International Conference on Simulation of Adaptive Behavior, 1991b.
289
+
290
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
291
+
292
+ David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587):484–489, Jan 2016. ISSN 0028-0836. doi: 10.1038/nature16961.
293
+
294
+ Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. NIPS Workshop, 2015.
295
+
296
+ Christopher Stanton and Jeff Clune. Deep curiosity search: Intra-life exploration improves performance on challenging deep reinforcement learning problems. arXiv preprint arXiv:1806.00553, 2018.
297
+
298
+ Susanne Still and Doina Precup. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, 2012.
299
+
300
+ 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.
301
+
302
+ Sainbayar Sukhbaatar, Ilya Kostrikov, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. In ICLR, 2018.
303
+
304
+ Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, Xi Chen, Yan Duan, John Schulman, Filip DeTurck, and Pieter Abbeel. # exploration: A study of count-based exploration for deep reinforcement learning. In NIPS, 2017.
305
+
306
+ Zichao Yang, Marcin Moczulski, Misha Denil, Nando de Freitas, Alex Smola, Le Song, and Ziyu Wang. Deep fried convnets. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1476–1483, 2015.
307
+
308
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
309
+
310
+ # A APPENDIX
311
+
312
+ A.1 ADDITIONAL METHODOLOGICAL DETAILS
313
+
314
+ # A.1.1 REWARD AND OBSERVATION NORMALIZATION
315
+
316
+ One issue with using prediction error as an exploration bonus is that the scale of the reward can vary greatly between different environments and at different points in time, making it difficult to choose hyperparameters that work in all settings. In order to keep the rewards on a consistent scale we normalized the intrinsic reward by dividing it by a running estimate of the standard deviations of the intrinsic returns.
317
+
318
+ Observation normalization is often important in deep learning but it is crucial when using a random neural network as a target, since the parameters are frozen and hence cannot adjust to the scale of different datasets. Lack of normalization can result in the variance of the embedding being extremely low and carrying little information about the inputs. To address this issue we use an observation normalization scheme often used in continuous control problems whereby we whiten each dimension by subtracting the running mean and then dividing by the running standard deviation. We then clip the normalized observations to be between -5 and 5. We initialize the normalization parameters by stepping a random agent in the environment for a small number of steps before beginning optimization. We use the same observation normalization for both predictor and target networks but not the policy network.
319
+
320
+ # A.1.2 REINFORCEMENT LEARNING ALGORITHM
321
+
322
+ An exploration bonus can be used with any RL algorithm by modifying the rewards used to train the model (i.e., $\boldsymbol { r } _ { t } = \boldsymbol { i } _ { t } + \boldsymbol { e } _ { t } ,$ ). We combine our proposed exploration bonus with a baseline reinforcement learning algorithm PPO (Schulman et al., 2017). PPO is a policy gradient method that we have found to require little tuning for good performance. For algorithmic details see Algorithm 1.
323
+
324
+ # A.2 RND PSEUDO-CODE
325
+
326
+ Algorithm 1 gives an overall picture of the RND method. Exact details of the method can be found in the code accompanying this paper (goo.gl/DGPC8E).
327
+
328
+ # Algorithm 1 RND pseudo-code
329
+
330
+ <table><tr><td>N ←number of rollouts Nopt ← number of optimization steps</td></tr><tr><td>K←length of rollout</td></tr><tr><td>M ← number of initial steps for initializing observation normalization t=0</td></tr><tr><td>Sample state So ~ po(so) for m = 1 to M do</td></tr><tr><td>sample at ~ Uniform(at)</td></tr><tr><td>sample St+1 ~ p(St+1lst, at)</td></tr><tr><td>Update observation normalization parameters using St+1</td></tr><tr><td>t+=1</td></tr><tr><td>end for</td></tr><tr><td>fori=1 to N do</td></tr><tr><td>for j = 1 to K do</td></tr><tr><td></td></tr><tr><td>sample at ~ π(at|St)</td></tr><tr><td>sample St+1,et ~p(St+1,et|St, at)</td></tr><tr><td>calculate intrinsic reward it = |lf(St+1) - f(St+1)ll²</td></tr><tr><td>add St, St+1,at, et,it to optimization batch Bi</td></tr><tr><td>Update running estimate of reward standard deviation using it</td></tr><tr><td>t+=1</td></tr><tr><td>end for</td></tr><tr><td>Normalize the intrinsic rewards contained in Bi</td></tr><tr><td>Calculate returns R1,i and advantages A1,i for intrinsic reward</td></tr><tr><td>Calculate returns RE,i and advantages AE,i for extrinsic reward</td></tr><tr><td></td></tr><tr><td>Calculate combined advantages Ai = A1,i + AE,i</td></tr><tr><td>Update observation normalization parameters using Bi</td></tr><tr><td>for j = 1 to Nopt do</td></tr><tr><td>optimize 0π wrt PPO loss on batch Bi,Ri,Ai using Adam</td></tr><tr><td></td></tr><tr><td>optimize 0f wrt distillation loss on Bi using Adam</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>end for</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>end for</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr></table>
331
+
332
+ # A.3 PREPROCESSING DETAILS
333
+
334
+ Table 1 contains details of how we preprocessed the environment for our experiments. We followed the recommendations in Machado et al. (2017) in using sticky actions in order to make the environments non-deterministic so that memorization of action sequences is not possible. In Table 2 we show additional preprocessing details for the policy and value networks. In Table 3 we show additional preprocessing details for the predictor and target networks.
335
+
336
+ Table 1: Preprocessing details for the environments for all experiments.
337
+
338
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Grey-scaling Observation downsampling</td><td>True (84,84)</td></tr><tr><td>Extrinsic reward clipping</td><td>[-1,1]</td></tr><tr><td>Intrinsic reward clipping</td><td>False</td></tr><tr><td>Max frames per episode</td><td>18K</td></tr><tr><td>Terminal on loss of life</td><td>False</td></tr><tr><td>Max and skip frames</td><td>4</td></tr><tr><td>Random starts Sticky action probability</td><td>False 0.25</td></tr></table>
339
+
340
+ Table 2: Preprocessing details for policy and value network for all experiments.
341
+
342
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Framesstacked Observation</td><td>4</td></tr><tr><td>normalization</td><td>xx/255</td></tr></table>
343
+
344
+ Table 3: Preprocessing details for target and predictor networks for all experiments.
345
+
346
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Framesstacked Observation normalization</td><td>1 x →CLIP((x- μ)/σ,[-5,5])</td></tr></table>
347
+
348
+ # A.4 PPO AND RND HYPERPARAMETERS
349
+
350
+ In Table 4 the hyperparameters for the PPO RL algorithm along with any additional hyperparameters used for RND are shown. Complete details for how these hyperparameters are used can be found in the code accompanying this paper.
351
+
352
+ Table 4: Default hyperparameters for PPO and RND algorithms for experiments where applicable. Any differences to these defaults are detailed in the main text.
353
+
354
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Rollout length</td><td>128</td></tr><tr><td>Total number of rollouts per environment</td><td>30K</td></tr><tr><td>Number of minibatches</td><td>4</td></tr><tr><td>Number of optimization epochs</td><td>4</td></tr><tr><td>Coefficient of extrinsic reward</td><td>2</td></tr><tr><td>Coefficient of intrinsic reward</td><td>1</td></tr><tr><td>Number of parallel environments</td><td>128</td></tr><tr><td>Learning rate</td><td>0.0001</td></tr><tr><td>Optimization algorithm</td><td>Adam (Kingma&amp; Ba (2015))</td></tr><tr><td>入(Schulman et al., 2017)</td><td>0.95</td></tr><tr><td>Entropy coefficient</td><td>0.001</td></tr><tr><td>Proportion of experience used for training predictor</td><td>0.25</td></tr><tr><td>YE</td><td>0.999</td></tr><tr><td>Y1</td><td>0.99</td></tr><tr><td>Clip range</td><td>[0.9,1.1]</td></tr></table>
355
+
356
+ Initial preliminary experiments with RND were run with only 32 parallel environments. We expected that increasing the number of parallel environments would improve performance by allowing the policy to adapt more quickly to transient intrinsic rewards. This effect could have been mitigated however if the predictor network also learned more quickly. To avoid this situation when scaling up from 32 to 128 environments we kept the effective batch size for the predictor network the same by randomly dropping out elements of the batch with keep probability 0.25. Similarly in our experiments with 256 and 1,024 environments we dropped experience for the predictor with respective probabilities 0.125 and 0.03125.
357
+
358
+ # A.5 ARCHITECTURES
359
+
360
+ In this paper we use two policy architectures: an RNN and a CNN. Both contain convolutional encoders identical of those in the standard architecture from (Mnih et al., 2015). The RNN architecture additionally contains GRU (Cho et al., 2014) cells to capture longer contexts. The architectures of the target and predictor networks also have convolutional encoders identical to the ones in (Mnih et al., 2015) followed by dense layers. Exact details are given in the code accompanying this paper (goo.gl/DGPC8E).
361
+
362
+ # A.6 ADDITIONAL EXPERIMENTAL RESULTS
363
+
364
+ Figure 8 compares the performance of a recurrent policy to a CNN policy with access to only the last 16 most recent frames with a matched number of parameters. The intrinsic rewards were non-episodic with $\gamma _ { I } = 0 . 9 9$ . Here again we see that the CNN policy consistently outperforms the RNN policy on Montezuma’s Revenge.
365
+
366
+ ![](images/7c276cdb57223fd4922625d1b815a932fe1f3c9461a67267c4a5fa2aedfd92a6.jpg)
367
+ Figure 8: Comparison of recurrent and nonrecurrent policies with the same number of parameters with extrinsic reward discount factors ${ \gamma _ { E } } \in \{ 0 . 9 9 , 0 . 9 9 9 \}$ . Similar to the results in Figure 4, higher discount factors lead to better performance. Contrary to our expectations recurrent policies perform worse than non-recurrent counterparts. Curves are an average over 5 random seeds.
368
+
369
+ ![](images/17ec87dd5f2e52d5cf8fb54f8d5510330bb246860ef0c688879d1a22df3e058f.jpg)
370
+ Figure 9: Comparison of RND with a CNN policy with $\gamma _ { I } = 0 . 9 9$ and $\gamma _ { E } = 0 . 9 9 9$ with an exploration defined by the reconstruction error of an autoencoder, holding all other choices constant (e.g. using dual value, treating intrinsic return as non-episodic etc). The performance of the autoencoder-based agent is worse than that of RND, but exceeds that of baseline PPO. Curves are an average over 5 random seeds.
371
+
372
+ Figure 9 compares the performance of RND with an identical algorithm, but with the exploration bonus defined as the reconstruction error of an autoencoder. The autoencoding task is similar in nature to the random network distillation, as it also obviates the second (though not necessarily the third) sources of prediction error from section 2.2.1. The experiment shows that the autoencoding task can also be successfully used for exploration.
373
+
374
+ In Table 5 we see more details of the experiments in Section 3.6. There the final training performance for each algorithm is listed, alongside the state of the art from previous work and average human performance.
375
+
376
+ Table 5: Comparison to baselines results. Final mean performance for various methods. State of the art results taken from: [1] (Fortunato et al., 2017) [2] (Bellemare et al., 2016) [3] (Horgan et al., 2018)
377
+
378
+ <table><tr><td></td><td>Gravitar</td><td>Montezuma&#x27;s Revenge</td><td>Pitfall!</td><td>PrivateEye</td><td>Solaris</td><td>Venture</td></tr><tr><td>RND RNN</td><td>3,906</td><td>8,152</td><td>-3</td><td>8,666</td><td>3,282</td><td>1,859</td></tr><tr><td>PPO RNN</td><td>3,426</td><td>2,497</td><td>0</td><td>105</td><td>3,387</td><td>0</td></tr><tr><td>RND CNN</td><td>2,217</td><td>11,347</td><td>-2</td><td>10,117</td><td>1,050</td><td>1,878</td></tr><tr><td>DYN CNN</td><td>2,654</td><td>400</td><td>-1</td><td>31</td><td>515</td><td>1,807</td></tr><tr><td>PPO CNN</td><td>2,370</td><td>1,797</td><td>0</td><td>100</td><td>1,495</td><td>0</td></tr><tr><td>SOTA</td><td>2,2091</td><td>3,700²</td><td>0</td><td>15,8062</td><td>12,3801</td><td>1,8133</td></tr><tr><td>Avg. Human</td><td>3,351</td><td>4,753</td><td>6,464</td><td>69,571</td><td>12,327</td><td>1,188</td></tr></table>
379
+
380
+ # A.7 ADDITIONAL EXPERIMENTAL DETAILS
381
+
382
+ In Table 6 we show the number of seeds used for each experiment, indexed by figure.
383
+
384
+ <table><tr><td>Figure number</td><td>Numberof seeds</td></tr><tr><td>1</td><td>NA</td></tr><tr><td>2</td><td>10</td></tr><tr><td>3</td><td>5</td></tr><tr><td>4</td><td>5</td></tr><tr><td>5</td><td>10</td></tr><tr><td>6</td><td>5</td></tr><tr><td>7</td><td>3</td></tr><tr><td>8</td><td>5</td></tr><tr><td>9</td><td>5</td></tr></table>
385
+
386
+ Table 6: The numbers of seeds run for each experiment is shown in the table. The results of each seed are then averaged to provide a mean curve in each figure, and the standard error is used make the shaded region surrounding each curve.
md/train/H1xSNiRcF7/H1xSNiRcF7.md ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SMOOTHING THE GEOMETRY OF PROBABILISTIC BOX EMBEDDINGS
2
+
3
+ Xiang $\mathbf { L i } ^ { * }$ , Luke Vilnis∗, Dongxu Zhang, Michael Boratko & Andrew McCallum
4
+ College of Information and Computer Sciences
5
+ University of Massachusetts Amherst
6
+
7
+ # ABSTRACT
8
+
9
+ There is growing interest in geometrically-inspired embeddings for learning hierarchies, partial orders, and lattice structures, with natural applications to transitive relational data such as entailment graphs. Recent work has extended these ideas beyond deterministic hierarchies to probabilistically calibrated models, which enable learning from uncertain supervision and inferring soft-inclusions among concepts, while maintaining the geometric inductive bias of hierarchical embedding models. We build on the Box Lattice model of Vilnis et al. (2018), which showed promising results in modeling soft-inclusions through an overlapping hierarchy of sets, parameterized as high-dimensional hyperrectangles (boxes). However, the hard edges of the boxes present difficulties for standard gradient based optimization; that work employed a special surrogate function for the disjoint case, but we find this method to be fragile. In this work, we present a novel hierarchical embedding model, inspired by a relaxation of box embeddings into parameterized density functions using Gaussian convolutions over the boxes. Our approach provides an alternative surrogate to the original lattice measure that improves the robustness of optimization in the disjoint case, while also preserving the desirable properties with respect to the original lattice. We demonstrate increased or matching performance on WordNet hypernymy prediction, Flickr caption entailment and a MovieLens-based market basket dataset. We show especially marked improvements in the case of sparse data, where many conditional probabilities should be low, and thus boxes should be nearly disjoint.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Embedding methods have long been a key technique in machine learning, providing a natural way to convert semantic problems into geometric problems. Early examples include the vector space (Salton et al., 1975) and latent semantic indexing (Deerwester et al., 1990) models for information retrieval. Embeddings experienced a renaissance after the publication of Word2Vec (Mikolov et al., 2013), a neural word embedding method (Bengio et al., 2003; Mnih & Hinton, 2009) that could run at massive scale.
14
+
15
+ Recent years have seen an interest in structured or geometric representations. Instead of representing e.g. images, words, sentences, or knowledge base concepts with points, these methods instead associate them with more complex geometric structures. These objects can be density functions, as in Gaussian embeddings (Vilnis & McCallum, 2015; Athiwaratkun & Wilson, 2017; 2018), convex cones, as in order embeddings (Vendrov et al., 2016; Lai & Hockenmaier, 2017), or axis-aligned hyperrectangles, as in box embeddings (Vilnis et al., 2018; Subramanian & Chakrabarti, 2018). These geometric objects more naturally express ideas of asymmetry, entailment, ordering, and transitive relations than simple points in a vector space, and provide a strong inductive bias for these tasks.
16
+
17
+ In this work, we focus on the probabilistic Box Lattice model of Vilnis et al. (2018), because of its strong empirical performance in modeling transitive relations, probabilistic interpretation (edges in a relational DAG are replaced with conditional probabilities), and ability to model complex joint probability distributions including negative correlations. Box embeddings (BE) are a generalization of order embeddings (OE) (Vendrov et al., 2016) and probabilistic order embeddings (POE) (Lai & Hockenmaier, 2017) that replace the vector lattice ordering (notions of overlapping and enclosing convex cones) in OE and POE with a more general notion of overlapping boxes (products of intervals).
18
+
19
+ While intuitively appealing, the “hard edges” of boxes and their ability to become easily disjoint, present difficulties for gradient-based optimization: when two boxes are disjoint in the model, but have overlap in the ground truth, no gradient can flow to the model to correct the problem. This is of special concern for (pseudo-)sparse data, where many boxes should have nearly zero overlap, while others should have very high overlap. This is especially pronounced in the case of e.g. market basket models for recommendation, where most items should not be recommended, and entailment tasks, most of which are currently artificially resampled into a 1:1 ratio of positive to negative examples. To address the disjoint case, Vilnis et al. (2018) introduce an ad-hoc surrogate function. In contrast, we look at this problem as inspiration for a new model, based on the intuition of relaxing the hard edges of the boxes into smoothed density functions, using a Gaussian convolution with the original boxes.
20
+
21
+ We demonstrate the superiority of our approach to modeling transitive relations on WordNet, Flickr caption entailment, and a MovieLens-based market basket dataset. We match or beat existing state of the art results, while showing substantial improvements in the pseudosparse regime.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ As mentioned in the introduction, there is much related work on structured or geometric embeddings. Most relevant to this work are the order embeddings of Vendrov et al. (2016), which embed a nonprobabilistic DAG or lattice in a vector space with order given by inclusion of embeddings’ forward cones, the probabilistic extension of that model due to Lai & Hockenmaier (2017), and the box lattice or box embedding model of Vilnis et al. (2018), which we extend. Concurrently to Vilnis et al. (2018), another hyperrectangle-based generalization of order embeddings was proposed by Subramanian & Chakrabarti (2018), also called box embeddings. The difference between the two models lies in the interpretation: the former is a probabilistic model that assigns edges conditional probabilities according to degrees of overlap, while the latter is a deterministic model in the style of order embeddings — an edge is considered present only if one box entirely encloses another.
26
+
27
+ Methods based on embedding points in hyperbolic space (Nickel & Kiela, 2017; Ganea et al., 2018) have also recently been proposed for learning hierarchical embeddings. These models, similar to order embeddings and the box embeddings of Subramanian & Chakrabarti (2018), are nonprobabilistic and optimize an energy function. Additionally, while the negative curvature of hyperbolic space is attractively biased towards learning tree structures (since distances between points increase the farther they are from the origin), this constant curvature makes the models not as suitable for learning non-treelike DAGs.
28
+
29
+ Our approach to smoothing the energy landscape of the model using Gaussian convolution is common in mollified optimization and continuation methods, and is increasingly making its way into machine learning models such as Mollifying Networks (Gulcehre et al., 2016b), diffusion-trained networks (Mobahi, 2016), and noisy activation functions (Gulcehre et al., 2016a).
30
+
31
+ Our focus on embedding orderings and transitive relations is a subset of knowledge graph embedding. While this field is very large, the main difference of our probabilistic approach is that we seek to learn an embedding model which maps concepts to subsets of event space, giving our model an inductive bias especially suited for transitive relations as well as fuzzy concepts of inclusion and entailment.
32
+
33
+ # 3 BACKGROUND
34
+
35
+ We begin with a brief overview of two methods for representing ontologies as geometric objects. First, we review some definitions from order theory, a useful formalism for describing ontologies, then we introduce the vector and box lattices. Figure 1 shows a simple two-dimensional example of these representations.
36
+
37
+ ![](images/e33c5ed448bf97a33daa06440935051df615504b85b184de3319c90014042b76.jpg)
38
+ Figure 1: Comparison between the Order Embedding (vector lattice) and Box Embedding representations for a simple ontology. Regions represent concepts and overlaps represent their entailment. Shading represents density in the probabilistic case.
39
+
40
+ # 3.1 PARTIAL ORDERS AND LATTICES
41
+
42
+ A non-strict partially ordered set (poset) is a pair $P , \preceq$ , where $P$ is a set, and $\preceq$ is a binary relation. For all $a , b , c \in P$ ,
43
+
44
+ Reflexivity: $a \preceq a$ Antisymmetry: $a \preceq b \preceq a$ implies $a = b$ Transitivity: $a \preceq b \preceq c$ implies $a \preceq c$
45
+
46
+ This generalizes the standard concept of a totally ordered set to allow some elements to be incomparable. Posets provide a good formalism for the kind of acyclic directed graph data found in many knowledge bases with transitive relations.
47
+
48
+ A lattice is a poset where any subset of elements has a single unique least upper bound, and greatest lower bound. In a bounded lattice, the set $P$ contains two additional elements, ${ \mathsf { T } } \left( t o p \right)$ , and $\perp$ (bottom), which denote the least upper bound and greatest lower bound of the entire set.
49
+
50
+ A lattice is equipped with two binary operations, $\vee$ (join), and $\wedge$ (meet). $a \lor b$ denotes the least upper bound of $a , b \in P$ , and $a \wedge b$ denotes their greatest lower bound. A bounded lattice must satisfy these properties:
51
+
52
+ Idempotency: $a \wedge a = a \vee a = a$
53
+ Commutativity: $a \wedge b = b \wedge a$ and $a \vee b = b \vee a$
54
+ Associativity: $a \wedge b \wedge c = a \wedge ( b \wedge c )$ and $( a \lor b \lor c ) = a \lor ( b \lor c )$
55
+ Absorption: $a \vee ( a \wedge b ) = a$ and $a \wedge ( a \vee b ) = a$
56
+ Bounded: $\perp \preceq a \preceq \top$
57
+
58
+ Note that the extended real numbers, $\mathbb { R } \cup \{ - \infty , \infty \}$ , form a bounded lattice (and in fact, a totally ordered set) under the min and max operations as the meet $( \wedge )$ and join $( \vee )$ operations. So do sets partially ordered by inclusion, with $\cap$ and $\cup$ as $\wedge$ and $\vee$ . Thinking of these special cases gives the intuition for the fourth property, absorption.
59
+
60
+ The $\wedge$ and $\vee$ operations can be swapped, along with reversing the poset relation $\preceq$ , to give a valid lattice, called the dual lattice. In the real numbers this just corresponds to a sign change. A semilattice has only a meet or join, but not both.
61
+
62
+ Note. In the rest of the paper, when the context is clear, we will also use $\wedge$ and $\vee$ to denote min and max of real numbers, in order to clarify the intuition behind our model.
63
+
64
+ # 3.2 VECTOR LATTICE
65
+
66
+ A vector lattice, also known as a Riesz space (Zaanen, 1997), or Hilbert lattice when the accompanying vector space has an inner product, is a vector space endowed with a lattice structure.
67
+
68
+ A standard choice of partial order for the vector lattice $\mathbb { R } ^ { n }$ is to use the product order from the underlying real numbers, which specifies for all $\mathbf { x } , \mathbf { y } \in \mathbb { R } ^ { n }$
69
+
70
+ $$
71
+ \mathbf { x } \preceq \mathbf { y } \iff \forall i \in \{ 1 . . n \} , \ x _ { i } \leq y _ { i }
72
+ $$
73
+
74
+ Under this order, meet and join operations are pointwise min and max, which gives a lattice structure. In this formalism, the Order Embeddings of Vendrov et al. (2016) embed partial orders as vectors using the reverse product order, corresponding to the dual lattice, and restrict the vectors to be positive. The vector of all zeroes represents $\top$ , and embedded objects become “more specific” as they get farther away from the origin.
75
+
76
+ Figure 1b demonstrates a toy, two-dimensional example of the Order Embedding vector lattice representation of a simple ontology. Shading represents the probability measure assigned to this lattice in the probabilistic extension of Lai & Hockenmaier (2017).
77
+
78
+ # 3.3 BOX LATTICE
79
+
80
+ Vilnis et al. (2018) introduced a box lattice, wherein each concept in a knowledge graph is associated with two vectors, the minimum and maximum coordinates of an axis-aligned hyperrectangle, or box (product of intervals).
81
+
82
+ Using the notion of set inclusion between boxes, there is a natural partial order and lattice structure. To represent a box $\mathbf { x }$ , let the pairs $( x _ { m , i } , x _ { M , i } )$ be the maximum and minimum of the interval at each coordinate $i$ . Then the box lattice structure (least upper bounds and greatest lower bounds), with $\vee$ and $\wedge$ denoting max and min when applied to the scalar coordinates, is
83
+
84
+ $$
85
+ \begin{array} { l } { { \displaystyle { \bf x } \wedge { \bf y } = \prod _ { i } [ x _ { m , i } \vee y _ { m , i } , x _ { M , i } \wedge y _ { M , i } ] } } \\ { { \displaystyle { \bf x } \vee { \bf y } = \prod _ { i } [ x _ { m , i } \wedge y _ { m , i } , x _ { M , i } \vee y _ { M , i } ] } } \end{array}
86
+ $$
87
+
88
+ Here, $\prod$ denotes a set (cartesian) product — the lattice meet is the largest box contained entirely within both $\mathbf { x }$ and $\mathbf { y }$ , or bottom (the empty set) where no intersection exists, and the lattice join is the smallest box containing both $\mathbf { x }$ and $\mathbf { y }$ .
89
+
90
+ To associate a measure, marginal probabilities of (collections of) events are given by the volume of boxes, their complements, and intersections under a suitable probability measure. Under the uniform measure, if event $\mathbf { x }$ has an associated box with interval boundaries $( x _ { m } , x _ { M } )$ , the probability $p ( \mathbf { x } )$ is given by $\textstyle \prod _ { i } ^ { n } ( x _ { M , i } - x _ { m , i } )$ . Use of the uniform measure requires the boxes to be constrained to the unit hypercube, so that $p ( \mathbf { x } ) \leq 1$ . $p ( \bot )$ is taken to be zero, since $\perp$ is an empty set. As boxes are simply special cases of sets, it is intuitive that this is a valid probability measure, but it can also be shown to be compatible with the meet semilattice structure in a precise sense (Leader, 1971).
91
+
92
+ Figure 1c demonstrates a toy, two-dimensional example of the Box Embedding lattice representation of a simple ontology.
93
+
94
+ # 4 METHOD
95
+
96
+ # 4.1 MOTIVATION: OPTIMIZATION AND SPARSE DATA
97
+
98
+ When using gradient-based optimization to learn box embeddings, an immediate problem identified in the original work is that when two concepts are incorrectly given as disjoint by the model, no gradient signal can flow since the meet (intersection) is exactly zero, with zero derivative. To see this, note that for a pair of 1-dimensional boxes (intervals), the volume of the meet under the uniform measure $p$ as given in Section 3.3 is
99
+
100
+ $$
101
+ p ( \mathbf { x } \wedge \mathbf { y } ) = m _ { h } ( \operatorname* { m i n } ( x _ { M } , y _ { M } ) - \operatorname* { m a x } ( x _ { m } , y _ { m } ) )
102
+ $$
103
+
104
+ where $m _ { h }$ is the standard hinge function, $m _ { h } ( x ) = 0 \lor x = \operatorname* { m a x } ( 0 , x )$ .
105
+
106
+ The hinge function has a large flat plateau at 0 when intervals are disjoint. This issue is especially problematic when the lattice to be embedded is (pseudo-)sparse, that is, most boxes should have very little or no intersection, since if training accidentally makes two boxes disjoint there is no way to recover with the naive measure. The authors propose a surrogate function to optimize in this case, but we will use a more principled framework to develop alternate measures that avoid this pathology, improving both optimization and final model quality.
107
+
108
+ # 4.2 RELAXED GEOMETRY
109
+
110
+ ![](images/52e273973b88b2eeb82ffad0414a0376e7873c9a60e503fb0bddeea225d759b0.jpg)
111
+ Figure 2: One-dimensional example demonstrating two disjoint indicators of intervals before and after the application of a smoothing kernel. The area under the purple product curve is proportional to the degree of overlap.
112
+
113
+ The intuition behind our approach is that the “hard edges” of the standard box embeddings lead to unwanted gradient sparsity, and we seek a relaxation of this assumption that maintains the desirable properties of the base lattice model while enabling better optimization and preserving a geometric intuition. For ease of exposition, we will refer to 1-dimensional intervals in this section, but the results carry through from the representation of boxes as products of intervals and their volumes under the associated product measures.
114
+
115
+ The first observation is that, considering boxes as indicator functions of intervals, we can rewrite the measure of the joint probability $p ( \mathbf { x } \wedge \mathbf { y } )$ between intervals $\mathbf { x } = [ a , b ]$ and $\mathbf { y } = [ c , d ]$ as an integral of the product of those indicators:
116
+
117
+ $$
118
+ p ( \mathbf { x } \wedge \mathbf { y } ) = \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( x ) \mathbb { 1 } _ { [ c , d ] } ( x ) d x
119
+ $$
120
+
121
+ since the product has support (and is equal to 1) only in the areas where the two intervals overlap.
122
+
123
+ A solution suggests itself in replacing these indicator functions with functions of infinite support. We elect for kernel smoothing, specifically convolution with a normalized Gaussian kernel, equivalent to an application of the diffusion equation to the original functional form of the embeddings (indicator functions) and a common approach to mollified optimization and energy smoothing (Neelakantan et al., 2015; Gulcehre et al., 2016b; Mobahi, 2016). This approach is demonstrated in one dimension in Figure 2.
124
+
125
+ Specifically, given $\mathbf { x } = [ a , b ]$ , we associate the smoothed indicator function
126
+
127
+ $$
128
+ f ( x ; a , b , \sigma ^ { 2 } ) = \mathbb { 1 } _ { [ a , b ] } ( x ) * \phi ( x ; \sigma ^ { 2 } ) = \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( z ) \phi ( x - z ; \sigma ^ { 2 } ) d z = \int _ { a } ^ { b } \phi ( x - z ; \sigma ^ { 2 } ) d z
129
+ $$
130
+
131
+ We then wish to evaluate, for two lattice elements $\mathbf { x }$ and $\mathbf { y }$ with associated smoothed indicators $f$ and $g$ ,
132
+
133
+ $$
134
+ p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \int _ { \mathbb { R } } f ( x ; a , b , \sigma _ { 1 } ^ { 2 } ) g ( x ; c , d , \sigma _ { 2 } ^ { 2 } ) d x
135
+ $$
136
+
137
+ This integral admits a closed form solution.
138
+
139
+ Proposition 1. Let $\begin{array} { r } { m _ { \Phi } ( x ) = \int \Phi ( x ) d x } \end{array}$ be an antiderivative of the standard normal CDF. Then the solution to equation 2 is given by,
140
+
141
+ $$
142
+ \begin{array} { r l } & { p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \sigma \left( m _ { \Phi } ( \frac { b - c } { \sigma } ) + m _ { \Phi } ( \frac { a - d } { \sigma } ) - m _ { \Phi } ( \frac { b - d } { \sigma } ) - m _ { \Phi } ( \frac { a - c } { \sigma } ) \right) } \\ & { \qquad \approx \left( \rho \operatorname { s o f t } ( \frac { b - c } { \rho } ) + \rho \operatorname { s o f t } ( \frac { a - d } { \rho } ) \right) - \left( \rho \operatorname { s o f t } ( \frac { b - d } { \rho } ) + \rho \operatorname { s o f t } ( \frac { a - c } { \rho } ) \right) } \end{array}
143
+ $$
144
+
145
+ where $\sigma = \sqrt { \sigma _ { 1 } ^ { 2 } + \sigma _ { 2 } ^ { 2 } }$ , $\operatorname { s o f t } ( x ) = \log ( 1 + \exp ( x ) )$ is the softplus function, the antiderivative of the logistic sigmoid, and ρ = σ1.702 .
146
+
147
+ Proof. The first line is proved in Appendix A, the second approximation follows from the approximation of $\Phi$ by a logistic sigmoid given in Bowling et al. (2009). □
148
+
149
+ Note that, in the zero-temperature limit, as $\rho$ goes to zero, we recover the formula
150
+
151
+ $$
152
+ { \begin{array} { l } { p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \operatorname* { l i m } _ { \rho \to 0 } \left( \rho { \mathrm { s o f t } } ( { \frac { b - c } { \rho } } ) + \rho { \mathrm { s o f t } } ( { \frac { a - d } { \rho } } ) \right) - \left( \rho { \mathrm { s o f t } } ( { \frac { b - d } { \rho } } ) + \rho { \mathrm { s o f t } } ( { \frac { a - c } { \rho } } ) \right) } \\ { \qquad = \left( m _ { h } ( b - c ) + m _ { h } ( a - d ) \right) - \left( m _ { h } ( b - d ) + m _ { h } ( a - c ) \right) } \\ { \qquad = m _ { h } ( b \wedge d - a \vee c ) } \end{array} }
153
+ $$
154
+
155
+ with equality in the last line because $( a , b )$ and $( c , d )$ are intervals. This last line is exactly our original equation equation 1, which is expected from convolution with a zero-bandwidth kernel (a Dirac delta function, the identity element under convolution). This is true for both the exact formula using $\textstyle \int \Phi ( x ) d x$ , and the softplus approximation.
156
+
157
+ Unfortunately, for any $\rho > 0$ , multiplication of Gaussian-smoothed indicators does not give a valid meet operation on a function lattice, for the simple reason that $f ^ { 2 } \neq f$ , except in the case of indicator functions, violating the idempotency requirement of Section 3.1.
158
+
159
+ More importantly, for practical considerations, if we are to treat the outputs of $p _ { \phi }$ as probabilities, the consequence is
160
+
161
+ $$
162
+ p _ { \phi } ( \mathbf { x } | \mathbf { x } ) = \frac { p _ { \phi } ( \mathbf { x } , \mathbf { x } ) } { p _ { \phi } ( \mathbf { x } ) } = \frac { p _ { \phi } ( \mathbf { x } \wedge \mathbf { x } ) } { p _ { \phi } ( \mathbf { x } ) } \neq 1
163
+ $$
164
+
165
+ which complicates our applications that train on conditional probabilities. However, by a modification of equation 3, we can obtain a function $p$ such that $p ( \mathbf { x } \wedge \mathbf { \bar { x } } ) = p ( \mathbf { x } )$ , while retaining the smooth optimization properties of the Gaussian model.
166
+
167
+ Recall that for the hinge function $m _ { h }$ and two intervals $( a , b )$ and $( c , d )$ , we have
168
+
169
+ $$
170
+ \bigl ( m _ { h } ( b - c ) + m _ { h } ( a - d ) \bigr ) - \bigl ( m _ { h } ( b - d ) + m _ { h } ( a - c ) \bigr ) = m _ { h } ( b \wedge d - a \vee c )
171
+ $$
172
+
173
+ where the left hand side is the zero-temperature limit of the Gaussian model from equation 3. This identity is true of the hinge function $m _ { h }$ , but not the softplus function.
174
+
175
+ However, an equation with a similar functional form as equation 6 (on both the left- and right-hand sides) is true not only of the hinge function from the unsmoothed model, but also true of the softplus. For two intervals $\mathbf { x } = ( a , b )$ an $\mathbf { y } = ( c , d )$ , by the commutativity of min and max with monotonic functions, we have
176
+
177
+ $$
178
+ { \bigl ( } \operatorname { s o f t } ( b - c ) \lor \operatorname { s o f t } ( a - d ) { \bigr ) } \land { \bigl ( } \operatorname { s o f t } ( b - d ) \lor \operatorname { s o f t } ( a - c ) { \bigr ) } = \operatorname { s o f t } ( b \land d - a \lor c )
179
+ $$
180
+
181
+ In the zero-temperature limit, all terms in equations 3 and 7 are equivalent. However, outside of this, equation 7 is idempotent for $\mathbf { x } = \mathbf { y } = ( { a } , { \bar { b } } ) = ( { c } , { d } )$ (when considered as a measure of overlap, made precise in the next paragraph), while equation 3 is not.
182
+
183
+ This inspires us to define the probabilities $p ( \mathbf { x } )$ and $p ( \mathbf { x } , \mathbf { y } )$ using a normalized version of equation 7 in place of equation 3. For the interval (one-dimensional box) case, we define
184
+
185
+ $$
186
+ \begin{array} { c } { p ( \mathbf { x } ) \propto \mathrm { s o f t } ( b - a ) } \\ { p ( \mathbf { x } , \mathbf { y } ) \propto \mathrm { s o f t } ( b \wedge d - a \vee c ) } \end{array}
187
+ $$
188
+
189
+ which satisfies the idempotency requirement, $p ( \mathbf { x } ) = p ( \mathbf { x } , \mathbf { x } )$
190
+
191
+ Because softplus upper-bounds the hinge function, it is capable of outputting values that are greater than 1, and therefore must be normalized. In our experiments, we use two different approaches to
192
+
193
+ normalization. For experiments with a relatively small number of entities (all besides Flickr), we allow the boxes to learn unconstrained, and divide each dimension by the measured size of the global minimum and maximum $( G _ { m } ^ { ( i ) } , G _ { M } ^ { ( i ) } )$ at that dimension
194
+
195
+ $$
196
+ m _ { \mathrm { s o f t } } ^ { ( i ) } ( x ) = \frac { \mathrm { s o f t } ( \frac { x } { \rho } ) } { \mathrm { s o f t } ( \frac { G _ { m } - G _ { m } } { \rho } ) }
197
+ $$
198
+
199
+ For data where computing these values repeatedly is infeasible, we project onto the unit hypercube and normalize by $m _ { \mathrm { { s o f t } } } ( 1 )$ . The final probability $p ( \mathbf { x } )$ is given by the product over dimensions
200
+
201
+ $$
202
+ \begin{array} { c } { { p ( { \bf x } ) = \displaystyle \prod _ { i } m _ { \mathrm { s o f t } } ^ { ( i ) } ( x _ { M , i } - x _ { m , i } ) } } \\ { { p ( { \bf x } , { \bf y } ) = \displaystyle \prod _ { i } m _ { \mathrm { s o f t } } ^ { ( i ) } ( x _ { M , i } \wedge y _ { M , i } - x _ { m , i } \vee y _ { m , i } ) } } \end{array}
203
+ $$
204
+
205
+ Note that, while equivalent in the zero temperature limit to the standard uniform probability measure of the box model, this function, like the Gaussian model, is not a valid probability measure on the entire joint space of events (the lattice). However, neither is factorization of a conditional probability table using a logistic sigmoid link function, which is commonly used for the similar tasks. Our approach retains the inductive bias of the original box model, is equivalent in the limit, and satisfies the necessary condition that $p ( \mathbf { x } , \mathbf { x } ) = p ( \mathbf { x } )$ . A comparison of the 3 different functions is given in Figure 3, with the softplus overlap showing much better behavior for highly disjoint boxes than the Gaussian model, while also preserving the meet property.
206
+
207
+ ![](images/9cc21fb6cb8ac7eae24bc49999bdb4ae1bfab3ab3d06a128598a726986167a50.jpg)
208
+ Figure 3: Comparison of different overlap functions for two boxes of width 0.3 as a function of their centers. Note that in order to achieve high overlap, the Gaussian model must drastically lower its temperature, causing vanishing gradients in the tails.
209
+
210
+ # 5 EXPERIMENTS
211
+
212
+ # 5.1 WORDNET
213
+
214
+ Table 4: Classification accuracy on WordNet test set.
215
+
216
+ <table><tr><td>Method</td><td>Test Accuracy %</td></tr><tr><td>transitive</td><td>88.2</td></tr><tr><td>word2gauss</td><td>86.6</td></tr><tr><td>OE</td><td>90.6</td></tr><tr><td>Li et al. (2017)</td><td>91.3</td></tr><tr><td>POE</td><td>91.6</td></tr><tr><td>Box</td><td>92.2</td></tr><tr><td>Smoothed Box</td><td>92.0</td></tr></table>
217
+
218
+ We perform experiments on the WordNet hypernym prediction task in order to evaluate the performance of these improvements in practice. The WordNet hypernym hierarchy contains 837,888- edges after performing the transitive closure on the direct edges in WordNet. We used the same train/dev/test split as in Vendrov et al. (2016). Positive examples are randomly chosen from the ${ } ^ { 8 3 7 \mathrm { k } }$ edges, while negative examples are generated by swapping one of the terms to a random word in the dictionary. Experimental details are given in Appendix D.1.
219
+
220
+ The smoothed box model performs nearly as well as the original box lattice in terms of test accuracy1. While our model requires less hyper-parameter tuning than the original, we suspect that our performance would be increased on a task with a higher degree of sparsity than the 50/50 positive/negative split of the standard WordNet data, which we explore in the next section.
221
+
222
+ # 5.2 IMBALANCED WORDNET
223
+
224
+ In order to confirm our intuition that the smoothed box model performs better in the sparse regime, we perform further experiments using different numbers of positive and negative examples from the WordNet mammal subset, comparing the box lattice, our smoothed approach, and order embeddings (OE) as a baseline. The training data is the transitive reduction of this subset of the mammal WordNet, while the dev/test is the transitive closure of the training data. The training data contains 1,176 positive examples, and the dev and test sets contain 209 positive examples. Negative examples are generated randomly using the ratio stated in the table.
225
+
226
+ As we can see from the table, with balanced data, all models include OE baseline, Box, Smoothed Box models nearly match the full transitive closure. As the number of negative examples increases, the performance drops for the original box model, but Smoothed Box still outperforms OE and Box in all setting. This superior performance on imbalanced data is important for e.g. real-world entailment graph learning, where the number of negatives greatly outweigh the positives.
227
+
228
+ <table><tr><td rowspan=1 colspan=1>Positive:Negative</td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>OE</td><td rowspan=1 colspan=1>Smoothed Box</td></tr><tr><td rowspan=1 colspan=1>1:1</td><td rowspan=1 colspan=1>0.9905</td><td rowspan=1 colspan=1>0.9976</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>1:2</td><td rowspan=1 colspan=1>0.8982</td><td rowspan=1 colspan=1>0.9139</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>1:6</td><td rowspan=1 colspan=1>0.6680</td><td rowspan=1 colspan=1>0.6640</td><td rowspan=1 colspan=1>0.9561</td></tr><tr><td rowspan=1 colspan=1>1:10</td><td rowspan=1 colspan=1>0.5495</td><td rowspan=1 colspan=1>0.5897</td><td rowspan=1 colspan=1>0.8800</td></tr></table>
229
+
230
+ Table 5: F1 scores of the box lattice, order embeddings, and our smoothed model, for different levels of label imbalance on the WordNet mammal subset.
231
+
232
+ # 5.3 FLICKR
233
+
234
+ We conduct experiments on the Flickr entailment dataset. Flickr is a large-scale caption entailment dataset containing of 45 million image caption pairs. In order to perform an apples-to-apples comparison with existing results we use the exact same dataset from Vilnis et al. (2018). In this case, we do constrain the boxes to the unit cube, using the same experimental setup as Vilnis et al. (2018), except we apply the softplus function before calculating the volume of the boxes. Experimental details are given in Appendix D.3.
235
+
236
+ We report KL divergence and Pearson correlation on the full test data, unseen pairs (caption pairs which are never occur in training data) and unseen captions (captions which are never occur in training data). As shown in Table 6, we see a slight performance gain compared to the original model, with improvements most concentrated on unseen captions.
237
+
238
+ # 5.4 MOVIELENS
239
+
240
+ We apply our method to a market-basket task constructed using the MovieLens dataset. Here, the task is to predict users’ preference for movie A given that they liked movie B. We first collect all pairs of user-movie ratings higher than 4 points (strong preference) from the MovieLens-20M dataset. From this we further prune to just a subset of movies which have more than 100 user ratings to make sure that counting statistics are significant enough. This leads to 8545 movies in our dataset. We calculate the conditional probability $\begin{array} { r } { \overline { { P } } ( A | B ) = \frac { \overline { { P ( A , B ) } } } { \overline { { P ( B ) } } } = \frac { \# r a t i n g ( A , B ) _ { > 4 } / \# u s e r s } { \# r a t i n g ( B ) _ { > 4 } / \# u s e r s } } \end{array}$ We randomly pick 100K conditional probabilities for training data and 10k probabilities for dev and test data 2.
241
+
242
+ Table 6: KL and Pearson correlation between model and gold probability.
243
+
244
+ <table><tr><td></td><td colspan="2">P(xly)</td></tr><tr><td>Full test data POE</td><td>KL 0.031</td><td>Pearson R 0.949</td></tr><tr><td>POE* Box</td><td>0.031 0.020</td><td>0.949 0.967</td></tr><tr><td>Smoothed Box</td><td>0.018</td><td>0.969</td></tr><tr><td>Unseen pairs POE</td><td>0.048</td><td>0.920 0.925</td></tr><tr><td>POE* Box Smoothed Box</td><td>0.046 0.025 0.024</td><td>0.957 0.957</td></tr><tr><td>Unseen captions</td><td></td><td></td></tr><tr><td>POE</td><td>0.127</td><td>0.696</td></tr><tr><td>POE*</td><td>0.084</td><td>0.854</td></tr><tr><td></td><td></td><td></td></tr><tr><td>Box Smoothed Box</td><td>0.050 0.036</td><td>0.900 0.917</td></tr></table>
245
+
246
+ We compare with several baselines: low-rank matrix factorization, complex bilinear factorization (Trouillon et al., 2016), and two hierarchical embedding methods, POE (Lai & Hockenmaier, 2017) and the Box Lattice (Vilnis et al., 2018). Since the training matrix is asymmetric, we used separate embeddings for target and conditioned movies. For the complex bilinear model, we added one additional vector of parameters to capture the “imply” relation. We evaluate on the test set using KL divergence, Pearson correlation, and Spearman correlation with the ground truth probabilities. Experimental details are given in Appendix D.4.
247
+
248
+ From the results in Table 7, we can see that our smoothed box embedding method outperforms the original box lattice as well as all other baselines’ performances, especially in Spearman correlation, the most relevant metric for recommendation, a ranking task. We perform an additional study on the robustness of the smoothed model to initialization conditions in Appendix C.
249
+
250
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>KL</td><td rowspan=1 colspan=1>Pearson R</td><td rowspan=1 colspan=1>Spearman R</td></tr><tr><td rowspan=1 colspan=1>Matrix Factorization</td><td rowspan=1 colspan=1>0.0173</td><td rowspan=1 colspan=1>0.8549</td><td rowspan=1 colspan=1>0.8374</td></tr><tr><td rowspan=1 colspan=1>Complex Bilinear Factorization</td><td rowspan=1 colspan=1>0.0141</td><td rowspan=1 colspan=1>0.8771</td><td rowspan=1 colspan=1>0.8636</td></tr><tr><td rowspan=1 colspan=1>POE</td><td rowspan=1 colspan=1>0.0170</td><td rowspan=1 colspan=1>0.8548</td><td rowspan=1 colspan=1>0.8511</td></tr><tr><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>0.0147</td><td rowspan=1 colspan=1>0.8775</td><td rowspan=1 colspan=1>0.8768</td></tr><tr><td rowspan=1 colspan=1>Smoothed Box</td><td rowspan=1 colspan=1>0.0138</td><td rowspan=1 colspan=1>0.8985</td><td rowspan=1 colspan=1>0.8977</td></tr></table>
251
+
252
+ Table 7: Performance of the smoothed model, the original box model, and several baselines on MovieLens.
253
+
254
+ # 6 CONCLUSION AND FUTURE WORK
255
+
256
+ We presented an approach to smoothing the energy and optimization landscape of probabilistic box embeddings and provided a theoretical justification for the smoothing. Due to a decreased number of hyper-parameters this model is easier to train, and, furthermore, met or surpassed current state-ofthe-art results on several interesting datasets. We further demonstrated that this model is particularly effective in the case of sparse data and more robust to poor initialization.
257
+
258
+ Tackling the learning problems presented by rich, geometrically-inspired embedding models is an open and challenging area of research, which this work is far from the last word on. This task will become even more pressing as the embedding structures become more complex, such as unions of boxes or other non-convex objects. To this end, we will continue to explore both function lattices, and constraint-based approaches to learning.
259
+
260
+ # 7 ACKNOWLEDGMENTS
261
+
262
+ We thank Travis Wolfe, Colin Evans, Rob Zinkov, Ben Poole, and Laurent Dinh for helpful discussions. We also thank the anonymous reviewers for their constructive feedback. This work was supported in part by the Center for Intelligent Information Retrieval and the Center for Data Science, in part by the Chan Zuckerberg Initiative under the project Scientific Knowledge Base Construction, and in part by the National Science Foundation under Grant No. IIS-1514053. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect those of the sponsor.
263
+
264
+ # REFERENCES
265
+
266
+ Ben Athiwaratkun and Andrew Gordon Wilson. Multimodal word distributions. In ACL, 2017.
267
+
268
+ Ben Athiwaratkun and Andrew Gordon Wilson. Hierarchical density order embeddings. In International Conference on Learning Representations, 2018. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HJCXZQbAZ.
269
+
270
+ Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
271
+
272
+ Shannon R Bowling, Mohammad T Khasawneh, Sittichai Kaewkuekool, and Byung R Cho. A logistic approximation to the cumulative normal distribution. Journal of Industrial Engineering and Management, 2(1), 2009.
273
+
274
+ Scott Deerwester, Susan T Dumais, George W Furnas, Thomas K Landauer, and Richard Harshman. Indexing by latent semantic analysis. Journal of the American society for information science, 41 (6):391–407, 1990.
275
+
276
+ Octavian-Eugen Ganea, Gary Becigneul, and Thomas Hofmann. Hyperbolic entailment cones for ´ learning hierarchical embeddings. ICML, 2018.
277
+
278
+ Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016a.
279
+
280
+ Caglar Gulcehre, Marcin Moczulski, Francesco Visin, and Yoshua Bengio. Mollifying networks. arXiv preprint arXiv:1608.04980, 2016b.
281
+
282
+ Tony Jebara, Risi Kondor, and Andrew Howard. Probability product kernels. Journal of Machine Learning Research, 5(Jul):819–844, 2004.
283
+
284
+ Alice Lai and Julia Hockenmaier. Learning to predict denotational probabilities for modeling entailment. In EACL, 2017.
285
+
286
+ Solomon Leader. Measures on semilattices. Pacific Journal of Mathematics, 39(2):407–423, 1971.
287
+
288
+ Xiang Li, Luke Vilnis, and Andrew McCallum. Improved representation learning for predicting commonsense ontologies. NIPS Workshop on Structured Prediction, 2017.
289
+
290
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2013.
291
+
292
+ Andriy Mnih and Geoffrey E Hinton. A scalable hierarchical distributed language model. In Advances in neural information processing systems, pp. 1081–1088, 2009.
293
+
294
+ Hossein Mobahi. Training recurrent neural networks by diffusion. arXiv preprint arXiv:1601.04114, 2016.
295
+
296
+ Arvind Neelakantan, Luke Vilnis, Quoc V Le, Ilya Sutskever, Lukasz Kaiser, Karol Kurach, and James Martens. Adding gradient noise improves learning for very deep networks. arXiv preprint arXiv:1511.06807, 2015.
297
+
298
+ Maximillian Nickel and Douwe Kiela. Poincare embeddings for learning hierarchical rep- ´ resentations. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 6338–6347. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 7213-poincare-embeddings-for-learning-hierarchical-representations. pdf.
299
+
300
+ Gerard Salton, Anita Wong, and Chung-Shu Yang. A vector space model for automatic indexing. Communications of the ACM, 18(11):613–620, 1975.
301
+
302
+ Sandeep Subramanian and Soumen Chakrabarti. New embedded representations and evaluation protocols for inferring transitive relations. SIGIR 2018, 2018.
303
+
304
+ Theo Trouillon, Johannes Welbl, Sebastian Riedel, ´ Eric Gaussier, and Guillaume Bouchard. Com- ´ plex embeddings for simple link prediction. In International Conference on Machine Learning, pp. 2071–2080, 2016.
305
+
306
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. In ICLR, 2016.
307
+
308
+ Luke Vilnis and Andrew McCallum. Word representations via gaussian embedding. In ICLR, 2015.
309
+
310
+ Luke Vilnis, Xiang Li, Shikhar Murty, and Andrew McCallum. Probabilistic embedding of knowledge graphs with box lattice measures. In ACL. Association for Computational Linguistics, 2018.
311
+
312
+ Adriaan C. Zaanen. Introduction to Operator Theory in Riesz Spaces. Springer Berlin Heidelberg, 1997. ISBN 9783642644870.
313
+
314
+ # Supplementary Material
315
+
316
+ # A PROOF OF GAUSSIAN OVERLAP FORMULA
317
+
318
+ We wish to evaluate, for two lattice elements $\mathbf { x }$ and $\mathbf { y }$ , with associated smoothed indicators $f$ and $g$
319
+
320
+ $$
321
+ \begin{array} { l } { f ( x ; a , b , \sigma ^ { 2 } ) = \mathbb { 1 } _ { [ a , b ] } ( x ) * \phi ( x ; \sigma ^ { 2 } ) = \displaystyle \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( z ) \phi ( x - z ; \sigma ^ { 2 } ) d z = \displaystyle \int _ { a } ^ { b } \phi ( x - z ; \sigma ^ { 2 } ) d z } \\ { p _ { \phi } ( \mathbf x \wedge \mathbf y ) = \displaystyle \int _ { \mathbb { R } } f ( x ; a , b , \sigma _ { 1 } ^ { 2 } ) g ( x ; c , d , \sigma _ { 2 } ^ { 2 } ) d x } \end{array}
322
+ $$
323
+
324
+ Since the Gaussian kernel is normalized to have total integral equal to 1, so as not to change the overall areas of the boxes, the concrete formula is
325
+
326
+ $$
327
+ \phi ( z ; \sigma ^ { 2 } ) = { \frac { 1 } { \sigma { \sqrt { 2 \pi } } } } e ^ { { \frac { - z ^ { 2 } } { 2 \sigma ^ { 2 } } } }
328
+ $$
329
+
330
+ Since the antiderivative of $\phi$ is the normal CDF, this may be recognized as the difference $\Phi ( x ; a , \sigma ^ { 2 } ) - \Phi ( x ; b , \sigma ^ { 2 } )$ , but this does not allow us to easily evaluate the integral of interest, which is the integral of the product of two such functions.
331
+
332
+ To evaluate equation 8, recall the identity (Jebara et al., 2004; Vilnis & McCallum, 2015)
333
+
334
+ $$
335
+ \int _ { \mathbb { R } } \phi ( x - \mu _ { 1 } ; \sigma _ { 1 } ^ { 2 } ) \phi ( x - \mu _ { 2 } ; \sigma _ { 2 } ^ { 2 } ) d x = \phi ( \mu _ { 1 } - \mu _ { 2 } ; \sigma _ { 1 } ^ { 2 } + \sigma _ { 2 } ^ { 2 } )
336
+ $$
337
+
338
+ For convenience, let $\begin{array} { r } { \tau : = \frac { 1 } { \sqrt { \sigma _ { 1 } ^ { 2 } + \sigma _ { 2 } ^ { 2 } } } } \end{array}$ Applying Fubini’s theorem and using equation 9, we have
339
+
340
+ $$
341
+ \begin{array} { l } { \displaystyle p _ { \phi } ( \mathbf { x } \cdot \mathbf { y } ) = \int _ { \mathbb { R } } \int _ { a } ^ { b } \phi ( x - y ; \sigma _ { 1 } ^ { 2 } ) d y \int _ { c } ^ { d } \phi ( x - z ; \sigma _ { 2 } ^ { 2 } ) d z d x } \\ { \displaystyle = \int _ { c } ^ { d } \int _ { a } ^ { b } \phi ( y - z ; \tau ^ { - 2 } ) d y d z } \\ { \displaystyle = \int _ { c } ^ { d } \int _ { a } ^ { b } \Phi ^ { \prime } ( \tau ( y - z ) ) \tau d y d z } \\ { \displaystyle = \int _ { c } ^ { d } \Phi ( \tau ( b - z ) ) - \Phi ( \tau ( a - z ) ) d z } \\ { \displaystyle = \frac { - 1 } { \tau } ( m _ { \Phi } ( \tau ( b - d ) ) - m _ { \Phi } ( \tau ( a - d ) ) - m _ { \Phi } ( \tau ( b - c ) ) + m _ { \Phi } ( \tau ( a - c ) ) ) } \end{array}
342
+ $$
343
+
344
+ and therefore, with $\sigma = \tau ^ { - 1 }$
345
+
346
+ $$
347
+ \begin{array} { r } { p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \sigma \left( m _ { \Phi } ( \frac { b - c } { \sigma } ) + m _ { \Phi } ( \frac { a - d } { \sigma } ) - m _ { \Phi } ( \frac { b - d } { \sigma } ) - m _ { \Phi } ( \frac { a - c } { \sigma } ) \right) } \end{array}
348
+ $$
349
+
350
+ as desired.
351
+
352
+ # B MOVIELENS PSEUDOSPARSITY
353
+
354
+ The MovieLens dataset, while not truly sparse, has a large proportion of small probabilities which make it especially suitable for optimization by the smoothed model. The rough distribution of probabilities, in buckets of width 0.1, is shown in Figure 1.
355
+
356
+ # C MOVIELENS INITIALIZATION SENSITIVITY
357
+
358
+ We perform an additional set of experiments to determine the robustness of the smoothed box model to initialization. While the model is normally initialized randomly so that each box is a product of intervals that almost always overlaps with the other boxes, we would like to determine the models robustness to disjoint boxes in a principled way. While we can control initialization, we cannot always control the intermediate results of optimization, which may drive boxes to be disjoint, a condition from which the original, hard-edged box model may have difficulty recovering. So, parametrizing the initial distribution of boxes with a minimum coordinate and a positive width, we adjust the width parameter so that approximately $0 \%$ , $20 \%$ , $50 \%$ , and $100 \%$ of boxes are disjoint at initialization before learning on the MovieLens dataset as usual. These results are presented in table 8. The smoothed model does not seem to suffer at all from disjoint initialization, while the performance of the original box model degrades significantly. From this we can speculate that part of the strength of the smoothed box model is its ability to smoothly optimize in the disjoint regime.
359
+
360
+ ![](images/262dd36934bbf5f0c1eafe924b8ad5d60a4fadb6282c801a3dd744a0a5c70830.jpg)
361
+ Figure 1: Distribution of probabilities in MovieLens Dataset.
362
+
363
+ <table><tr><td rowspan=1 colspan=1>Approx. % Disjoint</td><td rowspan=1 colspan=2>KL</td><td rowspan=1 colspan=2>Pearson</td><td rowspan=1 colspan=2>Spearman</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>Smooth</td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>Smooth</td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>Smooth</td></tr><tr><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>0.0147</td><td rowspan=1 colspan=1>0.0138</td><td rowspan=1 colspan=1>0.8775</td><td rowspan=1 colspan=1>0.8985</td><td rowspan=1 colspan=1>0.8768</td><td rowspan=1 colspan=1>0.8977</td></tr><tr><td rowspan=1 colspan=1>20%</td><td rowspan=1 colspan=1>0.0172</td><td rowspan=1 colspan=1>0.0141</td><td rowspan=1 colspan=1>0.8668</td><td rowspan=1 colspan=1>0.8917</td><td rowspan=1 colspan=1>0.8608</td><td rowspan=1 colspan=1>0.8898</td></tr><tr><td rowspan=1 colspan=1>50%</td><td rowspan=1 colspan=1>0.0182</td><td rowspan=1 colspan=1>0.0141</td><td rowspan=1 colspan=1>0.8613</td><td rowspan=1 colspan=1>0.8908</td><td rowspan=1 colspan=1>0.8551</td><td rowspan=1 colspan=1>0.8910</td></tr><tr><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>0.0346</td><td rowspan=1 colspan=1>0.0142</td><td rowspan=1 colspan=1>0.8401</td><td rowspan=1 colspan=1>0.8921</td><td rowspan=1 colspan=1>0.8167</td><td rowspan=1 colspan=1>0.8947</td></tr></table>
364
+
365
+ Table 8: Performance of the original box model and smoothed box model on MovieLens, as a function of different degrees of disjointness upon initialization.
366
+
367
+ # D MODEL PARAMETERS
368
+
369
+ We give a brief overview of our methodology and hyperparameter selection methods for each experiment. Detailed hyperparameter settings and code to reproduce experiments can be found at https://github.com/Lorraine333/smoothed_box_embedding.
370
+
371
+ # D.1 WORDNET PARAMETERS
372
+
373
+ For the WordNet experiments, the model is evaluated every epoch on the development set for a large fixed number of epochs, and the best development model is used to score the test set. Baseline models are trained using the parameters of Vilnis et al. (2018), with the smoothed model using hyperparameters determined on the development set.
374
+
375
+ # D.2 IMBALANCED WORDNET PARAMETERS
376
+
377
+ We follow the same routine as the WordNet experiments section to select best parameters. For the 12 experiments we conducted in this section, negative examples are generated randomly based on the ratio for each batch of positive examples. We do a parameter sweep for all models then choose the best result for each model as our final result.
378
+
379
+ # D.3 FLICKR PARAMETERS
380
+
381
+ The experimental setup uses the same architecture as Vilnis et al. (2018) and Lai & Hockenmaier (2017), a single-layer LSTM that reads captions and produces a box embedding parameterized by min and delta. Embeddings are produced by feedforward networks on the output of the LSTM. The model is trained for a large fixed number of epochs, and tested on the development data at each epoch. The best development model is used to report test set score. Hyperparameters were determined on the development set.
382
+
383
+ # D.4 MOVIELENS PARAMETERS
384
+
385
+ For all MovieLens experiments, the model is evaluated every 50 steps on the development set, and optimization is stopped if the best development set score fails to improve after 200 steps. The best development model is used to score the test set.
md/train/HJIoJWZCZ/HJIoJWZCZ.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL DROPOUT REGULARIZATION
2
+
3
+ Kuniaki Saito1, Yoshitaka Ushiku1, Tatsuya Harada1,2, and Kate Saenko3
4
+
5
+ 1The University of Tokyo, 2RIKEN, 3Boston University {k-saito,ushiku,harada}@mi.t.u-tokyo.ac.jp, saenko@bu.edu
6
+
7
+ # ABSTRACT
8
+
9
+ We present a domain adaptation method for transferring neural representations from label-rich source domains to unlabeled target domains. Recent adversarial methods proposed for this task learn to align features across domains by “fooling” a special domain classifier network. However, a drawback of this approach is that the domain classifier simply labels the generated features as in-domain or not, without considering the boundaries between classes. This means that ambiguous target features can be generated near class boundaries, reducing target classification accuracy. We propose a novel approach, Adversarial Dropout Regularization (ADR), which encourages the generator to output more discriminative features for the target domain. Our key idea is to replace the traditional domain critic with a critic that detects non-discriminative features by using dropout on the classifier network. The generator then learns to avoid these areas of the feature space and thus creates better features. We apply our ADR approach to the problem of unsupervised domain adaptation for image classification and semantic segmentation tasks, and demonstrate significant improvements over the state of the art.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Transferring knowledge learned by deep neural networks from label-rich domains to new target domains is a challenging problem, especially when the source and target input distributions have different characteristics. Such domain shifts occurs in many practical applications. For example, while simulated driving images rendered by games provide a rich source of labeled data for semantic segmentation Richter et al. (2016), deep models trained on such source data do not transfer well to real target domains (Fig. 1(a-d)). When target-domain labels are unavailable for fine-tuning, unsupervised domain adaptation must be applied to improve the source model.
14
+
15
+ Recent methods for unsupervised domain adaptation attempt to reduce the discrepancy between the source and target features via adversarial learning (Tzeng et al. (2014); Ganin $\&$ Lempitsky (2014)). They divide the base network into a feature encoder $G$ and classifier $C$ , and add a separate domain classifier (critic) network $D$ . The critic takes the features generated by $G$ and labels them as either source- or target-domain. The encoder $G$ is then trained with an additional adversarial loss that maximizes $D$ ’s mistakes and thus aligns features across domains.
16
+
17
+ However, a major drawback of this approach is that the critic simply predicts the domain label of the generated point and does not consider category information. Thus the generator may create features that look like they came from the right domain, but are not discriminative. In particular, it can generate points close to class boundaries, as shown in Fig. 1(e), which are likely to be misclassified by the source model. We argue that to achieve good performance on the target data, the adaptation model must take the decision boundaries between classes into account while aligning features across domains (Fig. 1(f)). Moreover, since our setting is unsupervised adaptation, this must be accomplished without labels on target data.
18
+
19
+ In this paper, we propose a novel adversarial alignment technique that overcomes the above limitation and preserves class boundaries. We make the following observation: if the critic could detect points near the decision boundary, then the generator would have to avoid these areas of the feature space in order to fool the critic. Thus the critic would force the generator to create more discriminative features. How can we obtain such a critic? If we alter the boundary of the classifier $C$ slightly and measure the change in the posterior class probability $p ( y | x )$ , where $y$ and $x$ denote class and input respectively, then samples near the decision boundary are likely to have the largest change. In fact, this posterior discrepancy is inversely proportional to the distance from the class boundary. We thus propose to maximize this posterior discrepancy to turn $C$ into a critic sensitive to nondiscriminative points. We call this technique Adversarial Dropout Regularization. Here, dropout is not used in the standard way, which is to regularize the main classifier and make it insensitive to noise. Instead, we use dropout in an adversarial way, to transform the classifier into a critic sensitive to noise. Compared to previous adversarial feature alignment methods, where the distributions $p ( x )$ are aligned globally, our method aligns target features away from decision boundaries, as illustrated in Fig.1(f).
20
+
21
+ ![](images/b6f4ca41441b05f1a91aeb791d5664cfbced0e867e90f0899d66085405d66cc1.jpg)
22
+ Figure 1: (a-d) An illustration of a deep model trained on simulated source training data failing to segment a real target domain image: (a) shows the target image, (b) is the ground truth segmentation into semantic categories (car, road, etc), (c) is the output of the unadapted source model, (d) is the improved segmentation obtained by our proposed ADR method. (e) Previous distribution matching methods do not consider the source decision boundary when aligning source and target feature points. (f) We propose to use the boundary information to achieve low-density separation of aligned points.
23
+
24
+ Our ADR approach has several benefits. First, we train the generator $G$ with feedback from the classifier $C$ , in contrast to existing methods, which use an unrelated critic $D$ . Second, our method is general and straightforward to apply to a variety of domain adaptation problems, such as classification and semantic segmentation. Finally, since ADR is trained to align distributions, it is also applicable to semi-supervised learning and training of generative models, such as Generative Adversarial Networks (GANs) (Goodfellow et al. (2014a)). Through extensive experiments, we demonstrate the benefit of ADR over existing domain adaptation approaches, achieving state-of-the-art results in difficult domain shifts. We also show an application to semi-supervised learning using GANs in appendix.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Domain Adaptation. Recent unsupervised domain adaptation (UDA) methods for visual data aim to align the feature distributions of the source and target domains (Sun et al. (2016); Sun & Saenko (2016); Tzeng et al. (2014); Ganin et al. (2016); Long et al. (2015b); Yan et al. (2017); Long et al. (2017)). Such methods are motivated by theoretical results stating that minimizing the divergence between domains will lower the upper bound of the error on target domain (Ben-David et al. (2010)). Many works in deep learning utilize the technique of distribution matching in hidden layers of a network such as a CNN (Tzeng et al. (2014); Ganin et al. (2016); Long et al. (2015b)). However, they measure the domain divergence based on the hidden features of the network without considering the relationship between its decision boundary and the target features, as we do in this paper.
29
+
30
+ Low-density Separation. Many semi-supervised learning (SSL) methods utilize the relationship between the decision boundary and unlabeled samples, a technique called low-density separation (Chapelle & Zien (2005); Joachims (1999)). By placing the boundary in the area where the unlabeled samples are sparse, these models aim to obtain discriminative representations. Our method aims to achieve low-density separation for deep domain adaptation and is related to entropy minimization for semi-supervised learning (Grandvalet & Bengio (2005)). (Long et al. (2016)) used entropy minimization in their approach to directly measure how far samples are from a decision boundary by calculating entropy of the classifier’s output. On the other hand, our method tries to achieve low-density separation by slightly moving the boundary and detecting target samples sensitive to the movement. As long as target samples features are robust to the movement, they will be allowed to exist relatively nearby the boundary compared to source samples, as Fig. 1 shows.
31
+
32
+ In (Long et al. (2016)) entropy minimization is only a part of the overall approach. To compare our ADR approach to entropy minimization more directly, we use a new baseline method. To our knowledge, though this method has not been proposed by any previous work, it is easily achieved by modifying a method proposed by (Springenberg (2015)). For this baseline, we train a model that generates features to minimize the entropy of the output probability for target samples. The details of the baseline are provided in appendix. In short, the generator tries to minimize the entropy of the target samples, whereas the critic tries to maximize it. The entropy is directly measured by the output of the classifier. This baseline is similar to our approach in that the goal of the method is to achieve low-density separation.
33
+
34
+ Dropout. Dropout is a method that prevents deep networks from overfitting (Srivastava et al. (2014)) by randomly dropping units from the neural network during training. Effectively, dropout samples from an exponential number of different thinned networks at training time, which prevents units from co-adapting too much. At test time, predictions are obtained by using the outputs of all neurons. If the thinned networks are able to classify the samples accurately, the full network will as well. In other words, dropout encourages the network to be robust to noise. In our work, we use dropout to regularize the feature generation network $G$ , but in an adversarial way. We train the critic $C$ to be sensitive to the noise caused by dropout and use $C$ to regularize $G$ so that it generates noise-robust features. To our knowledge, this use of dropout is completely different from existing methods.
35
+
36
+ # 3 METHOD
37
+
38
+ We assume that we have access to a labeled source image $\mathbf { x _ { s } }$ and a corresponding label $y _ { s }$ drawn from a set of labeled source images $\{ X _ { s } , Y _ { s } \}$ , as well as an unlabeled target image $\mathbf { x _ { t } }$ drawn from unlabeled target images $X _ { t }$ . We train a feature generation network $G$ , which takes inputs $\mathbf { x _ { s } }$ or $\mathbf { x _ { t } }$ , and a network $C$ that acts as both the main classifier and the critic. When acting as the classifier, $C$ takes features from $G$ and classifies them into $K$ classes, predicting a $K$ -dimensional vector of logits $\{ l _ { 1 } , l _ { 2 } , l _ { 3 } . . . l _ { K } \}$ . The logits are then converted to class probabilities by applying the softmax function. Namely, the probability that $\mathbf { x }$ is classified into class $j$ is denoted by $\begin{array} { r } { p ( y = j | \mathbf { x } ) = \frac { e x p ( l _ { j } ) } { \sum _ { k = 1 } ^ { K } e x p ( l _ { k } ) } } \end{array}$ . We use the notation $p ( \mathbf { y } \vert \mathbf { x } )$ to denote the $K$ -dimensional probabilistic output for input $\mathbf { x }$ .
39
+
40
+ When $C$ is acting as the critic, we want it to detect the feature encodings of target samples near the decision boundary. We propose to make $C$ sensitive to such samples by slightly perturbing its decision boundary and measuring the change in the posterior class probability $p ( \mathbf { y } \vert \mathbf { x } )$ . This change is likely to be largest for samples near the decision boundary. The network $C$ is then trained to increase this change, while the feature generation network $G$ is trained to decrease it. Through this adversarial training, $G$ learns to ‘fool’ the critic and generate target features far away from the decision boundary, thus avoiding ambiguous features. The weights of $G$ can be initialized either by pre-training on some auxiliary dataset (e.g., ImageNet), or with random weights, while $C$ uses random initialization. In the next section, we show how we utilize dropout to perturb the boundary in the critic and measure sensitivity. We then show the training procedure of our method. Finally, we give some intuition behind adversarial dropout and improve our method based on this insight.
41
+
42
+ # 3.1 CLASSIFIER SELECTION VIA DROPOUT
43
+
44
+ Consider the standard training of a neural network using dropout. For every sample within a minibatch, each node of the network is removed with some probability, effectively selecting a different classifier for every sample during training. We harness this idea in a very simple way.
45
+
46
+ We forward input features $G ( \bf x _ { t } )$ to $C$ twice, dropping different nodes each time and obtaining two different output vectors denoted as $C _ { 1 } ( G ( \mathbf { x _ { t } } ) )$ , $\bar { C } _ { 2 } \bar { ( \cal G ( x _ { t } ) ) }$ . In other words, we are selecting two different classifiers $C _ { 1 }$ and $C _ { 2 }$ from $C$ by dropout as in Fig. 2. In the figure, the corresponding posterior probabilities are indicated as $p _ { 1 } ( \mathbf { y } | \mathbf { x _ { t } } )$ , $p _ { 2 } ( \mathbf { y } \vert \mathbf { x _ { t } } )$ , abbreviated as $p _ { 1 }$ and $p _ { 2 }$ in the following discussion. In order to detect the change of predictions near the boundary, the critic tries to increase the difference between the predictions of $C _ { 1 }$ and $C _ { 2 }$ . This difference corresponds to $C$ ’s sensitivity to the noise caused by dropout.
47
+
48
+ To measure the sensitivity $d ( p _ { 1 } , p _ { 2 } )$ between the two obtained probabilistic outputs, we use the symmetric Kullback Leibler (KL) divergence. Formally, the divergence is calculated as
49
+
50
+ $$
51
+ d ( p _ { 1 } , p _ { 2 } ) = { \frac { 1 } { 2 } } ( D _ { k l } ( p _ { 1 } | p _ { 2 } ) + D _ { k l } ( p _ { 2 } | p _ { 1 } ) )
52
+ $$
53
+
54
+ ![](images/5b7992174e2f2c0d5a92732e1d6cc79162abd221b22a4267b1f8758b2b378f90.jpg)
55
+ Figure 2: Overview of ADR. Left: We train $G$ , $C$ with classification loss on source and sample a critic consisting of two classifiers using dropout. The critic’s sensitivity is measured as the divergence between the class predictions of $C _ { 1 }$ and $C _ { 2 }$ on the same input. Right: Adversarial training iterates two steps: the critic tries to maximize the sensitivity while the generator tries to minimize it.
56
+
57
+ where KL divergence between $p$ and $q$ is denoted as $D _ { k l } ( p | q )$ .
58
+
59
+ # 3.2 TRAINING PROCEDURE
60
+
61
+ In our approach, $C$ works as both critic and classifier. The following three requirements are imposed by our method: 1) $C$ and $G$ must classify source samples correctly to obtain discriminative features; 2) $C$ should maximize the sensitivity for target samples to detect the samples near the boundary; 3) $G$ should learn to minimize the sensitivity to move target samples away from the boundary.
62
+
63
+ The training within the same mini-batch consists of the following three steps.
64
+
65
+ Step 1, in this step, $C$ is trained as a classifier. $C$ and $G$ have to classify source samples correctly to obtain discriminative features. Thus, we update both networks’ parameters based on the following standard classification loss. Given source labels $y _ { s }$ and samples $\mathbf { x _ { s } }$ , the objective in this step is
66
+
67
+ $$
68
+ \underset { G , C } { \operatorname* { m i n } } L ( X _ { s } , Y _ { s } ) = - \mathbb { E } _ { ( \mathbf { x } _ { s } , y _ { s } ) \sim ( X _ { s } , Y _ { s } ) } \sum _ { k = 1 } ^ { K } \mathbb { 1 } _ { [ k = y _ { s } ] } \log C ( G ( \mathbf { x } _ { \mathbf { s } } ) ) _ { k }
69
+ $$
70
+
71
+ $C ( G ( \mathbf { x _ { s } } ) ) _ { k }$ returns the probability that the sample $\mathbf { x _ { s } }$ is assigned to class $k$
72
+
73
+ Step 2, in this step, $C$ is trained as a critic to detect target samples near the boundary. Two classifiers are sampled from $C$ for each target sample using dropout twice to obtain $p _ { 1 }$ and $p _ { 2 }$ . Then, $C$ ’s parameters are updated to maximize the sensitivity as measured by Eq. 1. Since $C$ should learn discriminative features for source samples, in addition to the sensitivity term, we add Eq. 2. We experimentally confirmed that this term is essential to obtain good performance.
74
+
75
+ $$
76
+ \operatorname* { m i n } _ { C } L ( X _ { s } , Y _ { s } ) - L _ { a d v } ( X _ { t } )
77
+ $$
78
+
79
+ $$
80
+ L _ { a d v } ( X _ { t } ) = \mathbb { E } _ { \mathbf { x _ { t } } \sim X _ { t } } [ d ( C _ { 1 } ( G ( \mathbf { x _ { t } } ) ) , C _ { 2 } ( G ( \mathbf { x _ { t } } ) ) ) ]
81
+ $$
82
+
83
+ $C _ { 1 }$ and $C _ { 2 }$ are sampled from $C$ randomly.
84
+
85
+ Step 3, in order to obtain representations where target samples are placed far from the decision boundary, $G$ is trained to minimize sensitivity. Here we do not add the categorical loss for source samples as in Step 2, as the generator is able to obtain discriminative features without it.
86
+
87
+ $$
88
+ \operatorname* { m i n } _ { G } L _ { a d v } ( X _ { t } )
89
+ $$
90
+
91
+ We update the parameters of $C$ and $G$ in every step following the defined objectives. We experimentally found it beneficial to repeat Step 3 $n$ times for each mini-batch.
92
+
93
+ ![](images/e236a8f1f63678aa39e6008db6475416d17c9cf2b19a9b860caab2ab1b9a4cd9.jpg)
94
+ Figure 3: (Best viewed in color) Toy Experiment. Top row: Model trained without adaptation. Columns 1-5 show the decision boundary obtained by keeping one neuron in the last hidden layer and removing the rest. Red points are source samples of class one, green points are class two. Black points are target samples. The yellow region indicates where the samples are classified as class one, cyan region class two. We see that the neurons do not learn very diverse features. Column 6 shows the boundary obtained by keeping all 5 neurons. Bottom row: Boundaries learned by the model adapted by our adversarial dropout method. Unlike the top row, here neurons 3,4,5 learn diverse features which result in diverse boundaries.
95
+
96
+ # 3.3 INSIGHT AND IMPROVEMENT
97
+
98
+ Our ADR approach encourages different neurons of the classifier to learn different characteristics of the input (see Sec. 4.1.) The output is the combination of shared and unshared nodes, therefore, to maximize the sensitivity, the unshared nodes must learn different features of target samples. As learning proceeds, each neuron in $C$ will capture different characteristics. At the same time, to minimize the sensitivity, $G$ learns to extract pure categorical information. If $G$ outputs features which are not related to categorical information, such as texture, slight contrast or difference of color, $C$ will utilize them to maximize sensitivity.
99
+
100
+ The trained classifier will be sensitive to the perturbation of targets caused by dropout. We note that our approach is contrary to methods called adversarial example training (Goodfellow et al. (2014b); Miyato et al. (2016)) which train the classifier to be robust to adversarial examples. They utilize input noise which can deceive or change the output of the classifier, and incorporate it to obtain a good classifier. Our ADR method encourages the feature generator to obtain noise-robust target features. However, with regard to the classifier, it is trained to be sensitive to noise. To improve the final accuracy, we learn another classifier $C ^ { \prime }$ that is not trained to be sensitive to the noise. $C ^ { \prime }$ takes features generated by $G$ and is trained with classification loss on source samples. The loss of $C ^ { \prime }$ is not used to update $G$ . We compare the accuracy of $C$ and $C ^ { \prime }$ in experiments on image classification.
101
+
102
+ # 4 EXPERIMENTS
103
+
104
+ # 4.1 EXPERIMENT ON TOY DATA
105
+
106
+ Experimental Setting. In this experiment, we observe the decision boundary obtained by each neuron to demonstrate that ADR encourages the neurons to learn different input characteristics. We use synthetic “two moons” data for this problem. Two dimensional samples from two classes are generated as source samples. Target samples are obtained by rotating the source samples. In our setting, the rotation was set to 30 degrees and data was generated with scikit-learn (Pedregosa et al. (2011)). We train a six-layered fully-connected network; the lower 3 layers are used as feature generator, and upper 3 layers are used as classifier. We used Batch Normalization (Ioffe & Szegedy (2015)) and ReLU as activation function. The number of neurons are [2,5,5] for feature generator, [5,5,2] for classifier. We visualize the boundary obtained from each neuron in the last layer by removing the output of all other neurons.
107
+
108
+ Results. We show the learned boundary in Fig. 3. In the baseline model trained only with source samples (top row), two of five neurons do not seem to learn an effective boundary, and three neurons learn a similar boundary. On the other hand, in our method (bottom row), although two neurons do not seem to learn any meaningful boundary, three neurons learn distinctive boundaries, demonstrating greater diversity. Each neuron is trained to be sensitive to the noise caused by target samples. The final decision boundary (rightmost column) classifies most target samples correctly. The accuracy of our proposed method is $96 \%$ whereas the accuracy of the non-adapted model was $84 \%$ .
109
+
110
+ ![](images/739f2d31aa495e5a9d6c4fd7b45d22559c2abb1868aa853612bc7403b34eaae2.jpg)
111
+ Figure 4: Relationship between sensitivity loss on target (blue line), on source (yellow line), and accuracy (red: accuracy of $C ^ { \prime }$ , green: accuracy of $C$ ) during training on digits.
112
+
113
+ # 4.2 UNSUPERVISED DOMAIN ADAPTATION FOR CLASSIFICATION
114
+
115
+ Experiments on Digits Classification. We evaluate our model on adaptation between digits datasets. We use MNIST (LeCun et al. (1998)), SVHN (Netzer et al. (2011)) and USPS datasets and follow the protocol of unsupervised domain adaptation used by (Tzeng et al. (2017)). To extensively compare our method with previous methods, in adaptation from MNIST to USPS, we applied our method to a different protocol used in Bousmalis et al. (2017). We assume no labeled target samples and use fixed hyper-parameters for all experiments, unlike other works that use a target validation set (Saito et al. (2017)). The number of iterations for Step 3 was fixed at $n = 4$ . We used the same network architecture as in (Tzeng et al. (2017)), but inserted a Batch Normalization layer before the activation layer to stabilize the training. We used Adam (Kingma & Ba (2014)) for optimizer and set the learning rate to $2 . 0 \times 1 0 ^ { - 4 }$ , a value commonly reported in the GAN literature. We compare our approach to several existing methods and to the entropy minimization baseline (ENT) obtained by modifying (Springenberg (2015)). As we mentioned in Section 2, this is a model that generates features to minimize the entropy of the output probability for target samples. Due to space limitations, we provide a detailed explanation of this baseline in the appendix.
116
+
117
+ Results in Table 1 demonstrate that ADR obtains better performance than existing methods. In particular, on the challenging adaptation task from SVHN to MNIST, our method achieves much better accuracy than previously reported. Fig. 4 shows the learning curve of each experiment. As sensitivity loss increases, the target accuracy improves. This means that as critic $C$ learns to detect the non-discriminative samples, feature generator $G$ learns to fool it, resulting in improved accuracy. In addition, we can see that the sensitivity of source samples increases too. As mentioned in Sec 3.3, the critic network should learn to capture features which are not very important for classification, such as texture or slight edges, and it seems to also capture such information in source samples. The accuracy of the classifier $C ^ { \prime }$ (denoted by red), which is trained not to be sensitive to the noise, is almost always better than the accuracy of the critic network. In adaptation from SVHN to MNIST (Fig. 5(c)), the accuracy of the critic often suffers as it becomes too sensitive to the noise caused by dropout. On the other hand, the accuracy shown by the red line is stable. Our ENT baseline shows good performance compared to other existing methods. This result indicates the effectiveness of methods based on entropy minimization. In Fig. 5, we compare our proposed method and ENT in terms of entropy of target samples. Our method clearly decreases the entropy, because target samples are moved away from the decision boundary. Yet, its behavior is different from ENT. Interestingly, the entropy is made smaller than ENT in case of adaptation from USPS to MNIST (Fig. 4(a)) though ENT directly minimizes the entropy and our method does not. On the SVHN to MNIST task (Fig. 4(c)), the entropy of ADR is larger than ENT, which indicates that our method places the target samples closer to the decision boundary than ENT does.
118
+
119
+ Experiments on Object Classification. We next evaluate our method on fine-tuning a pretrained CNN. We use a new domain adaptation benchmark called the VisDA Challenge (Peng et al. (2017)) which focuses on the challenging task of adapting from synthetic to real images. The source domain consists of 152,409 synthetic 2D images from 12 object classes rendered from 3D models. The validation and test target domains consists of real images, which belong to the same classes. We used the validation domain (55,400 images) as our target domain in an unsupervised domain adaptation setting.
120
+
121
+ ![](images/177e15de1ac8fd6d27b034896b5372cb923b428390b94b1a14d9cc289b6a1b4f.jpg)
122
+ Figure 5: Comparison of entropy of ours (blue line) with ENT (yellow line). The entropy is calculated on target samples by using the output of the classifier.
123
+
124
+ Table 1: Results on digits datasets. Please note that $^ \dagger$ means the result obtained using a few labeled target samples for validation. The reported accuracy of our method is obtained from $C ^ { \prime }$ . ENT is our proposed entropy minimization baseline, described in the appendix. MNIST(P1) and MNIST(P2) indicate different experimental settings used in Tzeng et al. (2017) and Bousmalis et al. (2017) respectively.
125
+
126
+ <table><tr><td>METHOD</td><td>SVHN to MNIST</td><td>USPS to MNIST</td><td>MNIST(P1) to USPS</td><td>MNIST(P2) to USPS</td></tr><tr><td>Source Only</td><td>67.1</td><td>68.1</td><td>77.0</td><td>78.9</td></tr><tr><td>LTN (Sener et al. (2016))</td><td>78.8</td><td>-</td><td>1</td><td>-</td></tr><tr><td>ATDA (Saito et al. (2017))</td><td>86.2†</td><td>=</td><td>1</td><td>-</td></tr><tr><td>DSN (Bousmalis et al. (2016))</td><td>82.7†</td><td></td><td></td><td>91.3†</td></tr><tr><td>PixelDA (Bousmalis et al. (2017)</td><td>1</td><td>=</td><td>-</td><td>95.9†</td></tr><tr><td>DANN (Ganin &amp; Lempitsky (2014))</td><td>73.9</td><td>73.0±2.0</td><td>77.1±1.8</td><td>85.1†</td></tr><tr><td>DoC (Tzeng et al. (2014))</td><td>68.1±0.3</td><td>66.5±3.3</td><td>79.1±0.5</td><td>1</td></tr><tr><td>ADDA (Tzeng et al. (2017))</td><td>76.0±1.8</td><td>90.1±0.8</td><td>89.4±0.2</td><td>-</td></tr><tr><td>CoGAN (Liu &amp; Tuzel (2016))</td><td>did not converge</td><td>89.1±0.8</td><td>91.2±0.8</td><td>=</td></tr><tr><td>DTN (Taigman et al. (2016))</td><td>84.7</td><td>1</td><td>-</td><td></td></tr><tr><td>ENT (Our proposed baseline) Ours</td><td>94.9±4.11 95.0±1.87</td><td>91.2±1.92 93.1±1.27</td><td>93.7±0.54 93.2±2.46</td><td>96.7±1.27 96.1±0.29</td></tr></table>
127
+
128
+ We evaluate our model on fine-tuning networks pretrained on ImageNet (Deng et al. (2009)): ResNet101 (He et al. (2016)) and ResNext (Xie et al. (2016)). For the feature generator, we use the pretrained CNN after removing the top fully connected layer. For the classification network, we use a three-layered fully connected network.
129
+
130
+ Table 2 shows that our method outperformed other distribution matching methods and our new baseline (ENT) in finetuning both networks by a large margin. ENT did not achieve better performance than existing methods, though improvement over the source only model was observed. Although this method performed well on digits, it does not work as well here, possibly because of the larger shift between very different domains. In the experiment on ResNext, after training $G$ and $C$ , we retrained a classifier $C ^ { ' }$ just on the features generated by $G$ due to GPU memory limitations, and observed improvement in both networks.
131
+
132
+ Fig. 6 visualizes the target features obtained by $G$ with the pretrained model, model fine-tuned on source, and our ADR method. While the embedding of the source only model does not separate classes well due to domain shift, we can see clearly improved separation with ADR.
133
+
134
+ Image Segmentation experiments. Next, we apply our method to adaptation for semantic image segmentation. Image segmentation is different from classification in that we classify each pixel in the image. To evaluate the performance on segmentation, the synthetic GTA5 (Richter et al. (2016)) dataset is used as source, and real CityScape (Cordts et al. (2016)) dataset is used as target. Previous work tackled this problem by matching distributions of each pixel’s feature in a middle layer of the network (Hoffman et al. (2016)). In this work, we apply ADR by calculating sensitivity between all pixels. The training procedure is exactly the same as in classification experiments.
135
+
136
+ We use the ResNet50 pretrained on ImageNet, and utilize an FCN (Long et al. (2015a)) based network architecture. Further, we utilize the more recent Dilated Residual Networks (DRN) 105 layered model (Yu et al. (2017)), which outperforms ResNet50 on a semantic segmentation task.
137
+
138
+ Table 2: Results on Visda2017 classification datasets (Peng et al. (2017)). DANN and MMD are distribution alignment methods proposed by (Ganin & Lempitsky (2014)) and (Long et al. (2015b)) respectively. Ours (retrain classifier) means the classifier retrained for our proposed generator as we mentioned in Sec 3.3. Our proposed method shows much better performance than existing methods.
139
+
140
+ <table><tr><td>Method</td><td>grrrdorae</td><td>gpaleie </td><td>3u</td><td>eoor</td><td></td><td>morreilt</td><td>uosiad</td><td></td><td>sareraert</td><td></td><td>r</td><td>naaa</td></tr><tr><td>Finetuning on ResNet101</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Source Only</td><td>55.1</td><td>53.3 61.9</td><td>59.1</td><td>80.6</td><td>17.9</td><td>79.7</td><td>31.2</td><td>81.0</td><td>26.5</td><td>73.5</td><td>8.5</td><td>52.4</td></tr><tr><td>MMD</td><td>87.1</td><td>63.0 76.5</td><td>42.0</td><td>90.3</td><td>42.9</td><td>85.9</td><td>53.1</td><td>49.7</td><td>36.3</td><td>85.8</td><td>20.7</td><td>61.1</td></tr><tr><td>DANN</td><td>81.9</td><td>77.7 82.8</td><td>44.3</td><td>81.2</td><td>29.5</td><td>65.1</td><td>28.6</td><td>51.9</td><td>54.6</td><td>82.8</td><td>7.8</td><td>57.4</td></tr><tr><td>ENT</td><td>80.3</td><td>75.5 75.8</td><td>48.3</td><td>77.9</td><td>27.3</td><td>69.7</td><td>40.2</td><td>46.5</td><td>46.6</td><td>79.3</td><td>16.0</td><td>57.0</td></tr><tr><td>Ours</td><td>94.1</td><td>51.3 83.2</td><td>72.2</td><td>88.7</td><td>68.8</td><td>92.8</td><td>70.2</td><td>77.2</td><td>63.6</td><td>82.9</td><td>30.3</td><td>72.9</td></tr><tr><td>Ours (retrained classifier)</td><td>94.2</td><td>48.5 84.0</td><td>72.9</td><td>90.1</td><td>74.2</td><td>92.6</td><td>72.5</td><td>80.8</td><td>61.8</td><td>82.2</td><td>28.8</td><td>73.5</td></tr><tr><td>Finetuning on ResNeXt</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Source Only</td><td></td><td>74.3 37.6 61.8 68.2 59.5</td><td></td><td></td><td></td><td></td><td>10.7 81.412.8 61.6 26.070.0</td><td></td><td></td><td></td><td>5.6</td><td>47.4</td></tr><tr><td>MMD</td><td>90.7</td><td>51.1 64.8</td><td>65.6</td><td>89.9</td><td>46.5</td><td>91.9</td><td>40.1</td><td>81.5</td><td>24.1</td><td>90.0</td><td>28.5</td><td>63.7</td></tr><tr><td>DANN</td><td>86.0</td><td>66.3 60.8 56.0</td><td></td><td>79.8</td><td>53.7</td><td>82.3</td><td>25.2</td><td>58.2</td><td>31.0</td><td>89.3</td><td>26.1</td><td>59.6</td></tr><tr><td>ENT</td><td>94.7</td><td>81.0 57.0</td><td>46.6</td><td>73.9</td><td>49.0</td><td>69.2</td><td>31.0</td><td>40.5</td><td>34.3</td><td>87.3</td><td>15.1</td><td>56.6</td></tr><tr><td>Ours</td><td>86.3 71.9</td><td>87.6</td><td>78.1</td><td>93.0</td><td>84.8</td><td>94.5</td><td>78.9</td><td>91.8</td><td>58.9</td><td>77.7</td><td>26.7</td><td>77.5</td></tr><tr><td>Ours (retrained classifier)</td><td>89.2</td><td>70.9 85.7</td><td>82.0</td><td>93.7</td><td></td><td>86.7 93.3</td><td>72.3</td><td>89.5</td><td>53.0</td><td>86.7</td><td>28.3</td><td>77.6</td></tr></table>
141
+
142
+ ![](images/f85e9efe625959ba93fdcfd4024851f548acbeebd038701c1fb299173a9f68e4.jpg)
143
+ Figure 6: Visualization of VisDA-classification (12 classes) target features using T-SNE (Maaten & Hinton (2008)): (a) features obtained by the Imagenet-pretrained ResNext model not finetuned on VisDA; (b) features from the ResNext model fine-tuned only on VisDA source samples without any adaptation; (c) features obtained by ResNext adapted by our ADR method.
144
+
145
+ For the feature generator, we use the pretrained network without fully-connected layers. For the classifier, we use a fully-convolutional network with dropout layers. Due to limited memory, the batch size is set to 1. We include details of the network architecture in appendix. For comparison, we train a domain classifier based model for our network (DANN). We build a domain classifier network for the features of each pixel following (Hoffman et al. (2016)).
146
+
147
+ In Table 3, we show the qualitative comparison with existing methods. ADR clearly improves mean IoU (Intersection-over-Union) compared to the source-only and competing models, beating state-ofthe-art by a large margin. When we apply ADR to DRN, the accuracy improves much more than for ResNet50, and is 12.4 points higher than the model trained only on GTA5 source samples. This is likely because ADR exploits the strong representation of the pretrained DRN network. Although we implemented ENT in this setting, the accuracy was much worse than the Source Only model with a mIoU of 15.0 in training ResNet50. The ENT method does not seem to work well on syntheticto-real shifts. Finally, we illustrate our method’s improvement on example input images, ground truth labels, images segmented by the Source Only model and our method in Fig. 7. While the Source Only model seems to suffer from domain shift, ADR generates a clean segmentation. These experiments demonstrate the effectiveness of ADR on semantic segmentation.
148
+
149
+ # 5 CONCLUSION
150
+
151
+ In this paper, we introduced a novel approach for aligning deep representation, Adversarial Dropout Regularization, which learns to generate discriminative features for the target domain. The method consists of a critic network that can detect samples near the task decision boundary and a feature generator that fools the critic. Our approach is general, applies to a variety of tasks, and does not require target domain labels. In extensive domain adaptation experiments, our method outperformed baseline methods, including entropy minimization, and achieved state-of-the-art results on three datasets.
152
+
153
+ <table><tr><td rowspan=1 colspan=1>Network</td><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>xeeepre</td><td rowspan=1 colspan=1>Buiplng</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>irilen</td><td rowspan=1 colspan=1>买</td><td rowspan=1 colspan=1>uosrad</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Mu</td><td rowspan=1 colspan=1>r0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>mrrqee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>mIoU</td></tr><tr><td rowspan=1 colspan=1>VGG-16</td><td rowspan=1 colspan=1>FCN Wild</td><td rowspan=1 colspan=1>70.4</td><td rowspan=1 colspan=1>32.4</td><td rowspan=1 colspan=1>62.1</td><td rowspan=1 colspan=1>14.9</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>10.9</td><td rowspan=1 colspan=1>14.2</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>79.2</td><td rowspan=1 colspan=1>21.3</td><td rowspan=1 colspan=1>64.6</td><td rowspan=1 colspan=1>44.1</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>70.4</td><td rowspan=1 colspan=1>8.0</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>27.1</td></tr><tr><td rowspan=2 colspan=1>ResNet50</td><td rowspan=2 colspan=1>Source OnlyDANNOurs</td><td rowspan=2 colspan=1>64.572.487.8</td><td rowspan=2 colspan=1>24.919.115.6</td><td rowspan=1 colspan=1>73.7</td><td rowspan=2 colspan=1>14.83.920.6</td><td rowspan=2 colspan=1>2.59.39.7</td><td rowspan=2 colspan=1>18.017.319.0</td><td rowspan=2 colspan=1>15.913.119.9</td><td rowspan=2 colspan=1>0.05.57.7</td><td rowspan=1 colspan=1>74.9</td><td rowspan=1 colspan=1>16.4</td><td rowspan=1 colspan=1>72.0</td><td rowspan=1 colspan=1>42.3</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>39.5</td><td rowspan=2 colspan=1>8.612.117.5</td><td rowspan=2 colspan=1>13.49.927.7</td><td rowspan=2 colspan=1>0.00.01.8</td><td rowspan=2 colspan=1>0.05.89.7</td><td rowspan=2 colspan=1>0.00.00.0</td><td rowspan=2 colspan=1>25.326.433.3</td></tr><tr><td rowspan=1 colspan=1>73.077.4</td><td rowspan=1 colspan=1>71.082.0</td><td rowspan=1 colspan=1>20.131.5</td><td rowspan=1 colspan=1>62.274.3</td><td rowspan=1 colspan=1>32.643.5</td><td rowspan=1 colspan=1>5.29.0</td><td rowspan=1 colspan=1>68.477.8</td></tr><tr><td rowspan=2 colspan=1>DRN-105</td><td rowspan=2 colspan=1>Source OnlyOurs</td><td rowspan=2 colspan=1>25.986.2</td><td rowspan=2 colspan=1>10.910.1</td><td rowspan=2 colspan=1>50.578.8</td><td rowspan=2 colspan=1>3.320.1</td><td rowspan=2 colspan=1>12.27.4</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>28.6</td><td rowspan=2 colspan=1>13.015.0</td><td rowspan=2 colspan=1>78.384.5</td><td rowspan=2 colspan=1>7.338.9</td><td rowspan=1 colspan=1>63.9</td><td rowspan=1 colspan=1>52.1</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=1>66.3</td><td rowspan=2 colspan=1>5.229.6</td><td rowspan=2 colspan=1>7.832.7</td><td rowspan=2 colspan=1>0.90.2</td><td rowspan=2 colspan=1>13.719.2</td><td rowspan=2 colspan=1>0.78.3</td><td rowspan=2 colspan=1>24.937.3</td></tr><tr><td rowspan=1 colspan=1>21.2</td><td rowspan=1 colspan=1>26.5</td><td rowspan=1 colspan=1>81.1</td><td rowspan=1 colspan=1>54.6</td><td rowspan=1 colspan=1>13.6</td><td rowspan=1 colspan=1>80.8</td></tr></table>
154
+
155
+ ![](images/2a431aecdd2cbdb38788dec71565dbda6f38a671d3881b7e8cbaa1c5630bfb5c.jpg)
156
+ Table 3: Results on adaptation from $\mathrm { G T A } 5 $ Cityscapes. DANN and FCN Wild denote methods proposed by (Ganin & Lempitsky (2014)) and (Hoffman et al. (2016) respectively.
157
+ Figure 7: Comparison of results on two real images segmented by ResNet50. Clockwise from upper left: Original image; Ground truth; Segmented image before adaptation; Segmented image after adaptation by our method.
158
+
159
+ We also show how to apply our method to train Generative Adversarial Networks for semisupervised learning in the appendix.
160
+
161
+ # 6 ACKNOWLEDGEMENTS
162
+
163
+ We would like to thank Trevor Darrell for his great advice on our paper. The first author’s stay at Boston University was partially supported by a scholarship from the University of Tokyo. The work was partially funded by the ImPACT Program of the Council for Science, Technology, and Innovation (Cabinet Office, Government of Japan), and was partially supported by CREST, JST. Saenko was supported by IARPA and NSF grants CCF-1723379 and IIS-1724237.
164
+
165
+ # REFERENCES
166
+
167
+ Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010.
168
+
169
+ Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks. In NIPS, 2016.
170
+
171
+ Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. In CVPR, 2017.
172
+
173
+ Olivier Chapelle and Alexander Zien. Semi-supervised classification by low density separation. In AISTATS, 2005.
174
+
175
+ Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In CVPR, 2016.
176
+
177
+ Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan Salakhutdinov. Good semisupervised learning that requires a bad gan. arXiv preprint arXiv:1705.09783, 2017.
178
+
179
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
180
+
181
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
182
+
183
+ Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, 2014.
184
+
185
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. JMLR, 17(59):1–35, 2016.
186
+
187
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014a.
188
+
189
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2014b.
190
+
191
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In NIPS, 2005.
192
+
193
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
194
+
195
+ Judy Hoffman, Dequan Wang, Fisher Yu, and Trevor Darrell. Fcns in the wild: Pixel-level adversarial and constraint-based adaptation. arXiv preprint arXiv:1612.02649, 2016.
196
+
197
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
198
+
199
+ Thorsten Joachims. Transductive inference for text classification using support vector machines. In ICML, 1999.
200
+
201
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
202
+
203
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
204
+
205
+ Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS, 2016.
206
+
207
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015a.
208
+
209
+ Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. In ICML, 2015b.
210
+
211
+ Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Unsupervised domain adaptation with residual transfer networks. In NIPS, 2016.
212
+
213
+ Mingsheng Long, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In ICML, 2017.
214
+
215
+ Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
216
+
217
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(Nov):2579– 2605, 2008.
218
+
219
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. 2016.
220
+
221
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, 2011.
222
+
223
+ Fabian Pedregosa, Ga”el Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, et al. Scikitlearn: Machine learning in python. JMLR, 12(10):2825–2830, 2011.
224
+
225
+ Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017.
226
+
227
+ Stephan R Richter, Vibhav Vineet, Stefan Roth, and Vladlen Koltun. Playing for data: Ground truth from computer games. In ECCV, 2016.
228
+
229
+ Kuniaki Saito, Yoshitaka Ushiku, and Tatsuya Harada. Asymmetric tri-training for unsupervised domain adaptation. In ICML, 2017.
230
+
231
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016.
232
+
233
+ Ozan Sener, Hyun Oh Song, Ashutosh Saxena, and Silvio Savarese. Learning transferrable representations for unsupervised domain adaptation. In NIPS, 2016.
234
+
235
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
236
+
237
+ Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 15(1):1929–1958, 2014.
238
+
239
+ Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In ECCV 2016 Workshops, 2016.
240
+
241
+ Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In AAAI, 2016.
242
+
243
+ Yaniv Taigman, Adam Polyak, and Lior Wolf. Unsupervised cross-domain image generation. In ICLR, 2016.
244
+
245
+ Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
246
+
247
+ Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In CVPR, 2017.
248
+
249
+ Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- ´ formations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016.
250
+
251
+ Hongliang Yan, Yukang Ding, Peihua Li, Qilong Wang, Yong Xu, and Wangmeng Zuo. Mind the class weight bias: Weighted maximum mean discrepancy for unsupervised domain adaptation. In CVPR, 2017.
252
+
253
+ Fisher Yu, Vladlen Koltun, and Thomas Funkhouser. Dilated residual networks. In CVPR, 2017.
254
+
255
+ # APPENDIX
256
+
257
+ # A ENTROPY BASED METHOD FOR DOMAIN ADAPTATION (ENT)
258
+
259
+ Our method aims to move target samples away from the decision boundary. Some techniques used in training Generative Adversarial Networks can be applied to achieve our goal too. (Springenberg (2015); Salimans et al. (2016)) used small number of labeled samples to train critic. Critic is trained to classify real samples into $K$ classes. They also trained critic to move unlabeled real images away from the boundary by minimizing entropy of the critic’s output. Generated fake images are moved near the boundary by maximizing the entropy. On the other hand, generator is trained to generate fake images which should be placed away from the boundary. This kind of method can be easily applied to domain adaptation problem. We would like to describe the method along with our problem setting.
260
+
261
+ Similar to our method, we have critic networks $C$ and generator $G$ . $C$ classifies samples into $K$ class. $C$ is trained to maximize the entropy of target samples, which encourages to move the target samples near the boundary. Then, $G$ is trained to minimize the entropy of them. Thus, $G$ tries to move target samples away from the boundary.
262
+
263
+ The only difference from our method is that we used entropy term for adversarial training loss. That is, in this method, we replace our sensitivity term $d ( p _ { 1 } , p _ { 2 } )$ in Eq. 4 with entropy of the classifier output. The adversarial loss for this baseline method is a following one.
264
+
265
+ $$
266
+ \begin{array} { r c l } { { { \cal L } _ { a d v } ( X _ { t } ) } } & { { = } } & { { \displaystyle \mathbb { E } _ { { \mathbf { x _ { t } } } \sim X _ { t } } [ H [ p ( \mathbf { y } | { \mathbf { x _ { t } } } ) ] } } \\ { { { \cal H } [ p ( \mathbf { y } | { \mathbf { x _ { t } } } ) ] } } & { { = } } & { { \displaystyle - \sum _ { k = 1 } ^ { K } p ( y = k | { \mathbf { x _ { t } } } ) \log p ( y = k | { \mathbf { x _ { t } } } ) } } \end{array}
267
+ $$
268
+
269
+ $$
270
+ H [ p ( y | x ) ] = - \sum _ { k = 1 } ^ { K } p ( y = k | x ) \log p ( y = k | x )
271
+ $$
272
+
273
+ The hyper-parameter $n$ , how many times we update $G$ for adversarial loss in one mini-batch, is set as $n = 4$ . Experimentally, it worked well for all settings.
274
+
275
+ # B DIGITS CLASSIFICATION TRAINING DETAIL
276
+
277
+ We follow the protocol used in (Tzeng et al. (2017)). For adaptation from SVHN to MNIST, we used standard training splits of each datasets as training data. For evaluation, we used test splits of MNIST. For the adaptation between MNIST and USPS (P1), we sampled 2000 images from MNIST and 1800 images from USPS. For the adaptation between MNIST and USPS (P2), we used all training images of MNIST and USPS following Bousmalis et al. (2017). In these experiments, we composed the mini-batch half from source and half from target samples. The batch-size was set as 128 for both source and target. We report the score after repeating Step $1 { \sim } 3$ (please see Sec 3.2) 20000 times. For our baseline, ENT, we used the same network architecture and the same hyper-parameters as used in our proposed method.
278
+
279
+ # C OBJECT CLASSIFICATION TRAINING DETAIL
280
+
281
+ In this experiment, SGD with learning rate $1 . 0 \times 1 0 ^ { - 3 }$ is used to optimize the parameters. For the finetuning of ResNet101, we set batch-size as 32. Due to the limit of GPU memory, we set it as 24 in finetuning ResNext model. We report the score after 20 epochs training. In order to train MMD model, we use 5 RBF kernels with the following standard deviation parameters:
282
+
283
+ $$
284
+ \sigma = [ 0 . 1 , 0 . 0 5 , 0 . 0 1 , 0 . 0 0 0 1 , 0 . 0 0 0 0 1 ]
285
+ $$
286
+
287
+ We changed the number of the kernels and their parameters, but we could not observe significant performance difference. We report the performance after 5 epochs. We could not see any improvement after the epoch.
288
+
289
+ To train a model (Ganin & Lempitsky (2014)), we used two-layered domain classification networks. Experimentally, we did not see any improvement when the network architecture is changed. According to the original method (Ganin $\&$ Lempitsky (2014)), learning rate is decreased every iteration. However, in our experiment, we could not see improvement, thus, we fixed learning rate $\mathrm { i . 0 \times 1 0 ^ { - 3 } }$ . We report the accuracy after 1 epoch. The accuracy dropped significantly after the first epoch. We assume this is due to the large domain difference between synthetic and real images.
290
+
291
+ ![](images/91334547d8f045bbc50bad32d13e84fbdd9717e2bd91e1f11d2951fede231eb5.jpg)
292
+ Figure 9: Example of results on segmentation experiments performed by DRN-105. From top to bottom, Original image; Ground truth; Segmented image before adaptation; Segmented image after adaptation by our method.
293
+
294
+ For our new baseline, ENT, we used the same hyper-parameter as we used for our proposed method. Since the accuracy of ENT drops significantly after around 5 epochs, we report the accuracy after 5 epoch updates.
295
+
296
+ # D SEGMENTATION EXPERIMENTS
297
+
298
+ We modified FCN Long et al. (2015a) architecture suitable for ResNet structure. The features from ResBlock $2 { \sim } 4$ and the first convolution layer and maxpooling layer are used in our implementation. In Fig. 8, we show how we integrated the features of each layers. We regard the layers of ResNet50 as generator and rest of the networks, namely convolution and upsampling layers as a critic network. The input images were resized to $5 1 2 \mathrm { x } 1 0 2 4$ due to the limit of GPU memory. For the same reason, the batchsize was set to one. In Fig. 9, we show the example of segmented images by DRN-105. The images are cleanly segmented by our proposed method.
299
+
300
+ ![](images/239b4a962924dc544fc56d44223b3182af3fbba803795fe928439774dffc489c.jpg)
301
+ Figure 8: Overview of architecture for semantic segmentation
302
+
303
+ # E SEMI-SUPERVISED LEARNING USING GANS
304
+
305
+ In this section, we demonstrate how to apply our method in training a Generative Adversarial Network (GAN) applied to semi-supervised learning. We follow the method proposed by (Springenberg (2015); Salimans et al. (2016)), who use a $K$ -class classification network as a critic to train a GAN in the semi-supervised setting.
306
+
307
+ Approach. In contrast to the domain adaptation setting, here $G$ tries to generate images which fool the critic $C$ . Also, in this setting, we are given labeled and unlabeled real images from the same domain. Then, we train the critic to classify labeled images correctly and to move unlabeled images far from the decision boundary. To achieve this, we propose to train the critic with the following objective:
308
+
309
+ $$
310
+ \operatorname* { m i n } _ { C } L _ { C } = L ( X _ { L } , Y _ { L } ) + L _ { a d v } ( X _ { u } ) - L _ { a d v } ( X _ { g } ) - H [ \frac { 1 } { M } \sum _ { i = 1 } ^ { M } p ( y | x _ { u } { } ^ { i } , C ) ]
311
+ $$
312
+
313
+ $$
314
+ L _ { a d v } ( X _ { u } ) = \mathbb { E } _ { \mathbf { x _ { u } } \sim X _ { u } } [ d ( C _ { 1 } ( G ( \mathbf { x _ { u } } ) ) , C _ { 2 } ( G ( \mathbf { x _ { u } } ) ) ) ]
315
+ $$
316
+
317
+ ![](images/63364abe673b063e24a800150d6aed5d16f2ac6fd54204e6ef2d434abc5d60e1.jpg)
318
+ Figure 10: Examples of generated images.
319
+
320
+ <table><tr><td></td><td>SVHN (% errors)</td><td>CIFAR (% errors)</td></tr><tr><td>Labeled Only SDGM (Maalge et al. (2016)</td><td>16.61 ± 0.24</td><td></td></tr><tr><td>CatGAN (Springenberg (2015))</td><td>=</td><td>19.58±0.46</td></tr><tr><td>ALI (Dumoulin et al. (2016))</td><td>7.42±0.65</td><td>17.99±1.62</td></tr><tr><td>ImpGAN (Salimans et al. (2016))</td><td>8.11±1.3</td><td>18.63±2.32</td></tr><tr><td>Ours</td><td>6.26±1.05</td><td>19.63±0.37</td></tr></table>
321
+
322
+ Table 4: Comparison with state-of-the-art methods on two benchmark datasets. Only methods without data augmentation are included. We used the same critic architecture as used in ImpGAN.
323
+
324
+ $$
325
+ L _ { a d v } ( X _ { g } ) = \mathbb { E } _ { { \mathbf { x } } _ { \mathbf { g } } \sim X _ { G } } [ d ( C _ { 1 } ( G ( { \mathbf { x } } _ { \mathbf { g } } ) ) , C _ { 2 } ( G ( { \mathbf { x } } _ { \mathbf { g } } ) ) ) ]
326
+ $$
327
+
328
+ where $X _ { L }$ denotes the subset of labeled samples, $X _ { u }$ denotes unlabeled ones and $X _ { g }$ denotes images generated by $G$ and $H$ denotes entropy as Eq.6 shows. The critic is trained to minimize the loss on labeled samples in the first term. Since unlabeled images should be far away from the decision boundary and should be distributed uniformly among the classes, we add the second and fourth term. The third term encourages the critic to detect fake images generated near the boundary.
329
+
330
+ The objective of $G$ is as follows,
331
+
332
+ $$
333
+ \operatorname* { m i n } _ { G } L _ { a d v } ( X _ { g } ) + | | \mathbb { E } _ { x _ { g } \sim X _ { g } } f ( \mathbf { x _ { g } } ) - \mathbb { E } _ { \mathbf { x _ { u } } \sim X _ { u } } f ( \mathbf { x _ { u } } ) | | ^ { 2 }
334
+ $$
335
+
336
+ where the second term encourages generated images to be similar to real images, which is known to be effective to stabilize the training. The first term encourages the generator to create fake images which should be placed far away from the boundary. Such images should be similar to real images because they are likely to be assigned to some class with high probability. Here, we update $C$ and $G$ same number of times.
337
+
338
+ Experiment. We evaluate our proposed GAN training method by using SVHN and CIFAR10 datasets, using the critic network architecture from (Salimans et al. (2016)). We set the batch size as 100 and used Adam with learning rate $2 . 0 \times 1 . 0 ^ { - 4 }$ for optimizer. After the conv6 layer of the critic, we constructed a classifier which was not concerned with adversarial learning process.
339
+
340
+ In the experiment on SVHN, we replaced Weight Normalization with Batch Normalization for $C$ . Also, in the experiment on CIFAR10, we construct a classifier from a middle layer of the critic, which is not incorporated into the adversarial training step. This is motivated by the insight that the critic in our method is trained to be too sensitive to the dropout noise as we explained in Sec 3.3.
341
+
342
+ Results. From Fig. 10(a), we can see that ADR seems to generate realistic SVHN images. Some images are significantly blurred, but most of the images are clear and diverse. As for generated CIFAR10 images, they do not seem as realistic, but some objects appear in most images. In Table 4, we can see that the accuracy of the critic trained by our method has better performance than other models for SVHN. For CIFAR10, the accuracy was slightly worse than other state-of-the-art methods. We conclude that, despite its clear advantage on the domain adaptation tasks, our method produces mixed results on the SSL tasks. It could still be useful for SSL, however, it needs further exploration to improve the accuracy. For example, in Eq. 6, we propose to maximize the entropy of the marginal class distribution of the unlabeled real images, as well as forcing them to be far from the boundary. However, these objectives may contradict each other, which may in turn degrade the performance. In late-breaking results, Dai et al. (2017) theoretically showed that just generating fake images that are far from decision boundaries does not help to improve accuracy in training GANs in the setting of SSL. Further improvement of our SSL approach based on these results is an interesting direction for future work.
md/train/HJfQrs0qt7/HJfQrs0qt7.md ADDED
@@ -0,0 +1,691 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Convergence Properties of Deep Neural Networks on Separable Data
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # Abstract
6
+
7
+ While a lot of progress has been made in recent years, the dynamics of learning in deep nonlinear neural networks remain to this day largely misunderstood. In this work, we study the case of binary classification and prove various properties of learning in such networks under strong assumptions such as linear separability of the data. Extending existing results from the linear case, we confirm empirical observations by proving that the classification error also follows a sigmoidal shape in nonlinear architectures. We show that given proper initialization, learning expounds parallel independent modes and that certain regions of parameter space might lead to failed training. We also demonstrate that input norm and features’ frequency in the dataset lead to distinct convergence speeds which might shed some light on the generalization capabilities of deep neural networks. We provide a comparison between the dynamics of learning with cross-entropy and hinge losses, which could prove useful to understand recent progress in the training of generative adversarial networks. Finally, we identify a phenomenon that we baptize gradient starvation where the most frequent features in a dataset prevent the learning of other less frequent but equally informative features.
8
+
9
+ # 1 Introduction
10
+
11
+ Due to extremely complex interactions between millions of parameters, nonlinear activation functions and optimization techniques, the dynamics of learning observed in deep neural networks remain much of a mystery to this day. What principles govern the evolution of the neural network weights? Why does the training error evolve as it does? How do data and optimization techniques like stochastic gradient descent interact? Where does the implicit regularization of deep neural networks trained with stochastic gradient descent come from? Shedding some light on those questions would make training neural networks more understandable, and potentially pave the way to better techniques.
12
+
13
+ It is commonly accepted that learning is composed of alternating phases: plateaus where the error remains fairly constant and periods of fast improvement where a lot of progress is made over the course of few epochs (Saxe et al., 2013a). Theoretic explanations of that phenomenon exist in the case of regression on linear neural networks (Saxe, 2015) but extensions to the nonlinear case (Heskes & Kappen, 1993; Raghu et al., 2017; Arora et al., 2018) fail to provide analytical solutions.
14
+
15
+ It has been observed in countless experiments that deep networks present strong generalization abilities. Those abilities are however difficult to ground in solid theoretical foundations. The fact that deep network have millions of parameters – a number sometimes orders of magnitude larger than the dataset size – contradicts the expectations set by classic statistical learning theory on the necessity of regularizers (Vapnik, 1998; Poggio et al., 2004). This observation drove Zhang et al. (2016) to suggest the existence of an implicit regularization happening during the training of deep neural networks. Advani & Saxe (2017) show that the dynamics of gradient descent can protect against overfitting in large networks. Kleinberg et al. (2018) also offer some explanations of the phenomenon but understanding its roots remains an open problem.
16
+
17
+ In this work, we study the learning dynamics of a deep nonlinear neural network – i.e. how its weights and outputs evolve throughout learning – trained on a standard classification task using two different losses: the cross-entropy and the hinge loss. We mainly focus on binary classification, some of the results and properties can however be extended to the multi-class case. The questions we address in Sections 3, 4 and 5 respectively can be summarized as follows:
18
+
19
+ How does the confidence of a classifier evolve throughout learning? How does the loss used during training impact its dynamics? Which properties of the features present in a dataset impact learning, and how?
20
+
21
+ Independent mode learning We show that, similarly to the case of linear networks and under certain initial conditions, learning happens independently between different classes, i.e. classes induce a partition of the network activations, corresponding to orthogonal modes of the data.
22
+
23
+ Learning dynamics We prove that in accordance to experimental findings, the hidden activations and the classification error of the network show a sigmoidal shape with slow learning at the beginning followed by fast saturation of the curve. We also characterize a region in the initialization space where learning is frozen or eventually dies out.
24
+
25
+ Hinge loss We study how using the hinge loss impacts learning and quantitatively compare it to the classic cross-entropy loss. We show that the hinge loss allows one to solve a classification task much faster, by providing strong gradients no matter how close to convergence the neural network is.
26
+
27
+ Gradient starvation Finally, we identify a phenomenon that we call gradient starvation where the most frequent features present in the dataset starve the learning of other very informative but less frequent features. Gradient starvation occurs naturally when training a neural network with gradient descent and might be part of the explanation as to why neural networks generalize so well. They intrinsically implement a variant of Occam’s razor (Ariew, 1976): the simplest explanation is the one they converge to first.
28
+
29
+ # 2 Setup and notations
30
+
31
+ We are interested in a simple binary classification task, solved by training a deep neural network with gradient descent. This simple setup encompasses for instance the training of generative adversarial networks discriminators. Some of our results extend to multi-class classification, but, for the sake of conciseness, that case is treated in Appendix A. We let $D = \{ ( x _ { i } , l _ { i } ) \} _ { 1 \leq i \leq n } \subset$ $\mathbb { R } ^ { d } \times \{ 1 , 2 \}$ denote our dataset of vectors and labels. The classifier we consider is a simple neural network with one hidden layer of $h$ neurons and a ReLU non-linearity (see Fig. 1).
32
+
33
+ The output of the network is passed through a function denoted $o$ which is either the sigmoid $\sigma$ in the binary cross-entropy case or the identity in the hinge loss case. The full function can be written as
34
+
35
+ $$
36
+ P _ { t } ( x ) : = o ( u _ { t } ( x ) ) : = o ( Z _ { t } ^ { T } ( W _ { t } x ) _ { + } ) ,
37
+ $$
38
+
39
+ ![](images/f7126aaa021e2ee05a8d063973cff15215bba2e16d529869dc7591ec10759a44.jpg)
40
+ Figure 1: Network Architecture
41
+
42
+ where $W _ { t }$ is an $h \times d$ matrix and $Z _ { t }$ a vector of length $h$ . In the $C$ -class case, $Z _ { t }$ is instead a $C \times h$ matrix and $o$ the softmax function. An extension to deeper networks can be found in Appendix B. $W _ { t }$ and $Z _ { t }$ are the parameters of the neural network. The subscript $^ +$ (resp. t) denotes the positive part of a real number (resp. the state of the element at time step $t$ of training).
43
+
44
+ The superscript $T$ stands for the transpose operation. In the case of cross-entropy, $P _ { t } ( x )$ represents the probability that $x$ belongs to class 1, for the hinge loss, $P _ { t } ( x )$ is trained to reach $\{ 1 , - 1 \}$ for classes 1 and 2. For a given class $k$ , we let $D _ { k }$ denote the set of vectors belonging to it. We make the assumption
45
+
46
+ (H1) For any $x , x ^ { \prime } \in D _ { k }$ , $x ^ { T } x ^ { \prime } > 0$ . For any $x \in D _ { 1 }$ and $x ^ { \prime } \in D _ { 2 }$ , $x ^ { T } x ^ { \prime } \leq 0$
47
+
48
+ It implies linear separability of the data, an assumption often necessary in theoretical studies (Soudry et al., 2017; Liao & Couillet, 2018; Nacson et al., 2018; Xu et al., 2018) and the positioning of the origin between the two sets. It is a very strong assumption which admittedly bypasses a large part of the deep learning dynamics. Nevertheless, it allows the discovery of interesting properties and is potentially a first step towards understanding behaviors observed in more general settings.
49
+
50
+ # 3 Learning dynamics for binary cross-entropy
51
+
52
+ In this section, we focus on the case of the binary cross-entropy loss
53
+
54
+ $$
55
+ \begin{array} { r } { L _ { B C E } ( W _ { t } , Z _ { t } ; x ) = - \mathbb { 1 } _ { x \in D _ { 1 } } \log ( \sigma ( Z _ { t } ^ { T } ( W _ { t } x ) _ { + } ) ) - \mathbb { 1 } _ { x \in D _ { 2 } } \log ( 1 - \sigma ( Z _ { t } ^ { T } ( W _ { t } x ) _ { + } ) ) , } \end{array}
56
+ $$
57
+
58
+ and train our network using stochastic gradient descent to minimize $L _ { B C E }$
59
+
60
+ # 3.1 Independent modes of learning
61
+
62
+ Our first lemma states that over the course of training and under suitable initialization, the active neurons of the hidden layer remain the same for each datapoint, and the coordinates of $Z _ { t }$ remain of the same sign. To prove it, we let $w _ { t } ^ { i }$ denote the $i$ -th row of $W _ { t }$ and make the additional assumptions: there exists a partition $\{ \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } \}$ of $\{ 1 , \ldots , h \}$ such that with $k \in \{ 1 , 2 \}$
63
+
64
+ (H2) For any $i \in \mathcal { Z } _ { k }$ , $x \in D _ { k }$ and $x ^ { \prime } \notin D _ { k }$ , $w _ { 0 } ^ { i } x > 0$ and $w _ { 0 } ^ { i } x ^ { \prime } \leq 0$ .
65
+
66
+ (H3) The $i$ -th coordinate of $Z _ { 0 }$ is positive if $i \in \mathcal { Z } _ { 1 }$ , negative otherwise.
67
+
68
+ Assumption (H2) states that at the beginning of training, data points from different classes do not activate the same neurons. It is an analogue to the orthogonal initialization used in Saxe et al. (2013b). In Appendix A.8, we show that relaxing it hints towards an extended period of slow learning in the early stages of training. (H3) is introduced for Lemma 3.1 and Theorem 3.2 but will be relaxed later.
69
+
70
+ Lemma 3.1. For any $k \in \{ 1 , 2 \}$ , $x \in D _ { k }$ and $t \geq 0$ , the only non-negative elements of $W _ { t } x$ are the ones with an index $i \in \mathcal { T } _ { k }$ . The signs of the coordinates of $Z _ { t }$ remain the same throughout training.
71
+
72
+ This lemma proves that updates to the parameters of our network are fully decoupled from one class to the other. An update for a data point in $D _ { k }$ will only influence the corresponding active rows and elements of $W _ { t }$ and $Z _ { t }$ . This "independent mode learning" is an equivalent of the results by Saxe et al. (2013b) in a non-linear network trained on the cross entropy loss. The proof of the lemma and its extension to $N - 1$ hidden layers and multi-class classification can be found in Appendix A.
73
+
74
+ # 3.2 Learning dynamics
75
+
76
+ We are now interested in the actual dynamics of learning, and move from discrete updates to continuous ones by considering an infinitesimal learning rate $\alpha$ (Heskes & Kappen, 1993). Lemma 3.1 can easily be extended to this setting. For simplicity we assume $h = 2$ , but similar results hold for arbitrary $h$ (see Appendix A.4). For the moment, we maintain the assumptions (H1-3).
77
+
78
+ Theorem 3.2. Assuming that each class $k$ contains the same vector $x _ { k }$ repeated $| D _ { k } |$ times, then the output of the classifier on $D _ { k }$ verifies (with $p _ { k } = | D _ { k } | / | D |$ the fraction of $D$ belonging to $D _ { k }$ ):
79
+
80
+ $$
81
+ \begin{array} { r l r } { P _ { t } ( x _ { k } \in D _ { k } ) } & { { } = } & { \sigma ( u ( \| x _ { k } \| p _ { k } t ) ) , } \end{array}
82
+ $$
83
+
84
+ where u is defined below. The classification curves are sigmoidal and can be found on Fig. 2 Right.
85
+
86
+ Proof. To simplify the notations, we arbitrarily assume that ${ { \cal T } _ { 1 } } ~ = ~ \{ 1 \}$ and we write $w _ { t }$ and $z _ { t }$ the row and element modified by an update made using $x \in D _ { 1 }$ (the case of $D _ { 2 }$ can be treated symmetrically). By the independence above, we know that $w _ { t }$ and $z _ { t }$ are only affected by updates from $D _ { 1 }$ . This greatly simplifies our evolution equations to: $\bar { w _ { t } ^ { \prime } } = \delta _ { f } \bar { ( x ) } z _ { t } x ^ { T }$ and $z _ { t } ^ { \prime } = \delta _ { f } ( x ) \ w _ { t } x$ where $\delta _ { f } ( x )$ is the gradient of the loss with respect to the pre-sigmoid output of the network $u _ { t } ( x )$ : $\delta _ { f } ( x ) \stackrel { } { = } 1 _ { \{ k = 1 \} } - \sigma ( u _ { t } ( x ) )$ and the prime indicates a time derivative. We let $y _ { t } = w _ { t } x$ , which gives
87
+
88
+ $$
89
+ y _ { t } ^ { \prime } = { \frac { x ^ { T } x z _ { t } } { 1 + e ^ { y _ { t } z _ { t } } } } , \qquad z _ { t } ^ { \prime } = { \frac { y _ { t } } { 1 + e ^ { y _ { t } z _ { t } } } } .
90
+ $$
91
+
92
+ Writing $\| x \| ^ { 2 } = x ^ { T } x$ , we see that the quantity $y _ { t _ { - } } ^ { 2 } - \| x \| ^ { 2 } z _ { t } ^ { 2 }$ is an invariant of the problem, so its solutions live on hyperbolas of equation $y ^ { 2 } - \| x \| ^ { 2 } z ^ { 2 } = \pm c$ with $c : = | y _ { 0 } ^ { 2 } - \| x \| ^ { 2 } z _ { 0 } ^ { 2 } |$ .
93
+
94
+ We only treat the case of a degenerate hyperbola $c = 0$ i.e. $y _ { 0 } ^ { 2 } = \| x \| ^ { 2 } z _ { 0 } ^ { 2 }$ , and refer the interested reader to Appendix A.3 for the full derivation. In the case $c = 0$ , we have $\forall t$ , $y _ { t } = \| x \| z _ { t }$ (those quantities are both positive as $x \in D _ { 1 }$ and (H2-3)). $u ( t ) : = z _ { t } w _ { t } x = z _ { t } y _ { t }$ thus follows the equation
95
+
96
+ ![](images/245d3d29eedaecb147295f8011901366ab5610b50699954194a3e1f07d7ddebb.jpg)
97
+ Figure 2: Left. Phase diagram representing the dynamics of learning for the couple $\left( z _ { t } , y _ { t } \right)$ depending on its initialization. $y _ { t }$ is the value for the class considered, in which all examples have lined up. Each couple lives on a hyperbola. The slope of the linear curves is equal $\pm \| x \|$ (set to 0.7 in this diagram). The green region represents the initializations of $( y , z )$ where the classification task will be solved by the network. In the red region, learning does not start (the neuron is inactive at the beginning of training) or collapses as the neuron dies off when $y$ reaches 0. The $c _ { i }$ points show the three cases from Section 3.3. Right. $y _ { t }$ and $P _ { t } ( x \in D _ { 1 } ) = \sigma ( z _ { t } y _ { t } )$ for different values of $c$ and $\lVert x \rVert$ .
98
+
99
+ $u ^ { \prime } ( t ) = 2 \| x \| u ( t ) \sigma ( - u ( t ) )$ . One can see the equivalence between our evolution equation and Eq. (10) in Saxe et al. (2013b). Its analytical solution is (see Appendix A.3):
100
+
101
+ $$
102
+ u ( t ) = ( \log + E i ) ^ { < - 1 > } ( 2 \| x \| t + \log ( u _ { 0 } ) + E i ( u _ { 0 } ) ) ,
103
+ $$
104
+
105
+ where $E i$ is the exponential integral (Wiki., 2018) and ${ < - 1 > }$ denotes the inverse function.
106
+
107
+ We let $\bar { u }$ denote that function for $\| { \boldsymbol x } \| = 1$ . For $x \in D _ { 2 }$ , the degeneracy assumption becomes $y _ { 0 } =$ $- \| x \| z _ { 0 }$ . It can be shown similarly that $v ( t ) : = z _ { t } y _ { t }$ verifies the equation $v ^ { \prime } ( t ) = 2 \| x \| v ( t ) \sigma ( v ( t ) )$ with a negative initial condition (H2-3). In other words, $u$ and $v$ follow symmetric trajectories on the positive/negative real line. Below, $\bar { u }$ (resp. $\bar { v }$ ) denote those two trajectories for $\| x \| = 1$ and initial conditions $u _ { 0 } > 0$ (resp. $v _ { 0 } < 0$ ). Let us now write $p _ { 1 } = | D _ { 1 } | / | D |$ the fraction of points belonging to $D _ { 1 }$ . Because we sample randomly from the dataset, this amounts to sampling $p _ { 1 }$ (resp. $1 - p _ { 1 } )$ points from $D _ { 1 }$ (resp. $D _ { 2 }$ ) for each time unit during training, i.e. to rescaling the time axis by $p _ { 1 }$ for $D _ { 1 }$ and $1 - p _ { 1 }$ for $D _ { 2 }$ . This allows us to quantify the network’s performance at any time $t$ :
108
+
109
+ $$
110
+ \left\{ \begin{array} { r c l l } { \mathrm { ~ } \begin{array} { r c l } { P _ { t } ( x \in D _ { 1 } ) } & { = } & { \sigma ( \bar { u } ( \| x \| p _ { 1 } t ) ) } & { \qquad \quad } & { \mathrm { i f ~ } x \in D _ { 1 } } \\ { P _ { t } ( x \in D _ { 2 } ) } & { = } & { \sigma ( - \bar { v } ( \| x \| ( 1 - p _ { 1 } ) t ) ) } & { \qquad \mathrm { i f ~ } x \in D _ { 2 } } \end{array} } \end{array} \right.
111
+ $$
112
+
113
+ In particular, the convergence of $u ( t )$ to $+ \infty$ can be bounded using our results: convergence happens at a rate slower than $\log ( t )$ (Appendix A.3), a fact proved on its own by Soudry et al. (2017). □
114
+
115
+ Interpretation Fig. 2 Right. shows the learning dynamics for different values of $\| x \|$ and $c$ . One common characteristic between all the curves is their sigmoidal shape. Learning is slow at first, then accelerates before saturating. This is aligned with empirical results from the literature. We also see on e.g. the blue and yellow curves that a larger $\| x \|$ (or similarly a larger $p$ ) converges much faster. The effect of $c$ on the dynamics can mostly been seen at the beginning of training (for instance on the green and yellow curves). It fades as convergence happens, corresponding to points of the hyperbolas getting closer to the asymptote $y = \| x \| z$ , see Fig. 2 Left. and below for more details. We can characterize the convergence speeds more quantitatively with the following corollary.
116
+
117
+ Corollary 3.3. Let $\delta$ be the required accuracy on the classification task (i.e. $P _ { t } ( x \in D _ { 1 } ) \geq 1 - \delta$ for $x \in D _ { 1 } $ ). Under certain assumptions, the times $t _ { 1 } ^ { * }$ and $t _ { 2 } ^ { * }$ required to reach that accuracy for each classifier verify $\begin{array} { r } { \frac { t _ { 2 } ^ { * } } { t _ { 1 } ^ { * } } \approx \frac { \| x _ { 1 } \| } { \| x _ { 2 } \| } \frac { p _ { 1 } } { 1 - p _ { 1 } } } \end{array}$ where $\| x _ { k } \|$ is the norm of vector $\| x _ { k } \|$ from class $k$ .
118
+
119
+ The proof can be found in Appendix A.5. More frequent classes and larger inputs will be classified at a given level of confidence faster. The class frequency observation is fairly straightforward as updates on a more frequent class occur at a higher rate. As far as input sizes are considered, this can be seen as an analogous to the results from Saxe et al. (2013b) stating that input-output correlations drive the speed of learning. Because a sigmoid is applied on the network output, its (pre-sigmoid) targets are sent to $\pm \infty$ . A larger input is more correlated with its target and converges faster.
120
+
121
+ On the assumptions The assumption that each class only contains one vector allows us to obtain the first closed-form solutions of the learning dynamics for the binary cross-entropy. It can be relaxed to classes containing orthogonal datapoints (see Appendix A.7) which still remains restrictive. A possible interpretation is the following: if one were to consider a deep neural network that has learnt two discriminative features for the two classes, applying classic SGD on those features would result in a learning rate proportional to the prominence of those two features in the original dataset, and to learning curves of that exact shape. It is worth noting that such shapes are regularly observed by ML practitioners (Saxe et al., 2013b), our results reveal insights - otherwise unobtainable - into them.
122
+
123
+ # 3.3 Phase diagram
124
+
125
+ In this section, we build the phase diagram of Fig. 2 Left. The notations follow Theorem 3.2, in particular $y _ { t } = w _ { t } x$ . So far, we have considered points in the top-right quadrant. In that region, the couple $\left( z _ { t } , y _ { t } \right)$ lives on a hyperbola of equation $\dot { y } ^ { 2 } - \| x \| ^ { 2 } z ^ { 2 } = \pm c$ where $c \geq 0$ . The sign in the equation is defined by the position of $( z _ { 0 } , y _ { 0 } )$ relative to the function $y = \| x \| z$ (positive if above, negative otherwise). If $\left( z _ { 0 } , y _ { 0 } \right)$ is originally on that line, it will remain there throughout training. We now explore the rest of the parameter space by relaxing some of our assumptions. We still consider a point $x \in D _ { 1 }$ , the diagram for $D _ { 2 }$ can be obtained by mirroring the $z$ axis.
126
+
127
+ Assumption $( H 2 )$ . Let us first consider the simple case of $w _ { 0 } x = y _ { 0 } < 0$ . The neuron is initially inactive because of the ReLU. No updates will ever be made to $w _ { t }$ during training. This corresponds to the bottom half of the phase diagram, the parameters are frozen (also see Advani & Saxe (2017)).
128
+
129
+ Assumption $( H 3 )$ . We now assume that $z _ { 0 } \le 0$ . In that case, a simple extension of Lemma 3.1 shows that learning still happens independently on each row of $w _ { t }$ . The outcome from Theorem 3.2 is still valid: the couple $( z _ { t } , y _ { t } )$ lives on a hyperbola. It is however not guaranteed anymore that $y _ { t }$ shall remain positive throughout training. There are three possible situations (numbered 1 to 3), each represented by the corresponding point on the diagram.
130
+
131
+ 1) If $y _ { 0 } = - \| x \| z _ { 0 }$ , then the points $\left( z _ { t } , y _ { t } \right)$ are stuck in the top-left quadrant and converge to zero. The equation verified by the logit $u ( t )$ is $\dot { u } ^ { \prime } ( t ) = - 2 \| x \| u ( t ) \sigma ( - u ( t ) )$ (see Appendix A.6).
132
+
133
+ 2) If $y _ { 0 } > - \| x \| z _ { 0 }$ , the points $( z _ { t } , y _ { t } )$ move on the hyperbola towards the top-right quadrant, at which point $z _ { t }$ becomes positive and $y _ { t }$ starts increasing again.
134
+
135
+ 3) If $y _ { 0 } < - \| x \| z _ { 0 }$ , the points $( z _ { t } , y _ { t } )$ move on the hyperbola towards the bottom-left quadrant, at which point $y _ { t }$ becomes negative. When that happens, the neuron dies out, learning stops.
136
+
137
+ Only in the second case will the classifier end up solving the task: random initialization only functions in certain parts of the $( y _ { t } , z _ { t } )$ space. Those findings are summarized in the phase diagram Fig. 2 Left. The red region represents the initialization where the network will not be able to solve the task.
138
+
139
+ Failure modes Assumption (H2) essentially means that the network’s first layer is able to separate the data at $t = 0$ . It is remarkable that even under (H2) the model fails on a non-zero measure set of the initialization space (top-left red region of Fig. 2 Left): in that region, it converges to a classifier assigning a probability of 0.5 to the true class (dash-dotted curves in Fig. 3 Right).
140
+
141
+ # 3.4 Relaxing Assumption (H2)
142
+
143
+ Assumption (H2) states that for any $i \in \mathcal { T } _ { k }$ , $x \in D _ { k }$ and $x ^ { \prime } \notin D _ { k }$ , $w _ { 0 } ^ { i } x > 0$ and $w _ { 0 } ^ { i } x ^ { \prime } \leq 0$ . We now relax it by assuming that a point $x _ { 2 }$ in $D _ { 2 }$ verifies $w _ { 0 } ^ { 1 } x _ { 2 } > 0$ and we study the evolution of $w _ { t } ^ { 1 }$ . We consider updates coming from sampling equally $x _ { 1 }$ from $D _ { 1 }$ and $x _ { 2 }$ from $D _ { 2 }$ . To simplify the analysis, we assume that $x _ { 1 } ^ { T } x _ { 2 } = 0$ and write $\alpha _ { t } = w _ { t } ^ { 1 } x _ { 1 }$ (equivalent to $y _ { t }$ above) and $\beta _ { t } \doteq \dot { w } _ { t } ^ { 1 } x _ { 2 }$ . The triplet $( \alpha _ { t } , \beta _ { t } , z _ { t } )$ satisfies the following system of ODEs (see Appendix A.8 for the derivation):
144
+
145
+ $$
146
+ \alpha _ { t } ^ { \prime } = \frac { \| x _ { 1 } \| ^ { 2 } z _ { t } } { 1 + e ^ { z _ { t } \alpha _ { t } } } , \qquad \beta _ { t } ^ { \prime } = - \frac { \| x _ { 2 } \| ^ { 2 } z _ { t } } { 1 + e ^ { - z _ { t } \beta _ { t } } } , \qquad z _ { t } ^ { \prime } = \frac { \alpha _ { t } } { 1 + e ^ { z _ { t } \alpha _ { t } } } - \frac { \beta _ { t } } { 1 + e ^ { - z _ { t } \beta _ { t } } } .
147
+ $$
148
+
149
+ From our relaxation of (H2), we have $\alpha _ { 0 } , \beta _ { 0 } \ > \ 0$ . Since the system is symmetric under the transformation $( \alpha _ { t } , \beta _ { t } , z _ { t } ) ( \beta _ { t } , \alpha _ { t } , - z _ { t } )$ , we can assume $z _ { 0 } \geq 0$ . Due to the ReLU activations of the network, whenever $\alpha _ { t }$ or $\beta _ { t }$ reaches zero, it becomes constant and its contribution to $z _ { t }$ disappears: the model reaches the independent modes of learning regime from Section 3.1 and evolves according to the results above (e.g. green hyperbolas in the plane $\beta = 0$ on Fig. 3 Left). If $\beta _ { t }$ (resp. $\alpha _ { t }$ ) reaches 0 at some point, $D _ { 1 }$ (resp. $D _ { 2 }$ ) becomes the only class activating the neuron. Let us now characterize how the initialization of the network influences the outcome of learning.
150
+
151
+ ![](images/bc93abd14e3afec4cdf8beb267423044a26778d151f37049af617db99630b3d6.jpg)
152
+ Figure 3: Left. Solutions of (4) for different initializations and $c = 1$ . Right. Values of $\alpha _ { t }$ , $\beta _ { t }$ and $P _ { t }$ the confidence of the classifier on an example from class $D _ { 1 }$ for three different initializations. The “full” curves correspond to $( \alpha _ { 0 } , \beta _ { 0 } , z _ { 0 } ) \stackrel { - } { = } ( 0 . 1 , 0 . 1 , 0 . 1 )$ i.e. a trajectory in the green region where $\beta _ { t }$ reaches 0 (orange curve). The confidence on class $D _ { 1 }$ tends to 1 (green curve). The “dashed” curves correspond to $( \alpha _ { 0 } , \beta _ { 0 } , z _ { 0 } ) = ( 0 . 2 , 0 . 9 , 0 . 2 )$ i.e. a trajectory in the yellow region, corresponding to $\alpha _ { t }$ reaching 0 (red curve). The confidence on $D _ { 1 }$ goes to 0.5 in that case (brown curve), and the confidence on class $D _ { 2 }$ goes to 1 (not shown). The “dash-dotted" curves correspond to $( \alpha _ { 0 } , \beta _ { 0 } , z _ { 0 } ) \ = \ ( 1 , 0 , - 1 . 1 )$ and are an instance of the aforementioned failure mode: $\alpha _ { t }$ (or equivalently $y _ { t }$ ) tends to 0 (pink curve), $\beta _ { t }$ (not shown) remains 0 and $P _ { t }$ tends to 0.5 (grey curve).
153
+
154
+ Theorem 3.4. Letting $c : = \alpha _ { 0 } ^ { 2 } / \| x _ { 1 } \| ^ { 2 } + \beta _ { 0 } ^ { 2 } / \| x _ { 2 } \| ^ { 2 } - z _ { 0 } ^ { 2 }$ , the solutions of (4) verify for all $t \geq 0$ $\alpha _ { t } ^ { 2 } / \lVert x _ { 1 } \rVert ^ { 2 } + \beta _ { t } ^ { 2 } / \lVert x _ { 2 } \rVert ^ { 2 } - z _ { t } ^ { 2 } = c$ . In other terms, they live on hyperboloids (see Fig. 3 Left).
155
+
156
+ If $c \leq 0$ , $\beta _ { t }$ reaches 0 at some point during training (Fig. 6 of the Appendix). If $c > 0$ , there exists $a$ curve $\mathcal { C } _ { c }$ (shown in black on Fig. 3 Left) such that as $t \to + \infty$ , for any initialization $( \alpha _ { 0 } , \beta _ { 0 } , z _ { 0 } ) \in \mathcal { C } _ { c }$
157
+
158
+ $$
159
+ \alpha _ { t } \to ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } ) ^ { - 1 / 2 } \sqrt { c } , \qquad \beta _ { t } \to ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } ) ^ { - 1 / 2 } \sqrt { c } , \qquad z _ { t } \to 0 .
160
+ $$
161
+
162
+ That curve defines two regions of the initialization space. In one, colored yellow on Fig. 3 Left, the trajectories verify $\alpha _ { t } = 0$ for some t. In the other, colored green, $\beta _ { t }$ reaches 0 at some point.
163
+
164
+ Interpretation The proof of the theorem can be found in Appendix A.8. Fig. 3 Left shows some solutions of (4). Concretely, we see from the equations that the sign of $z _ { t }$ determines whether $\alpha _ { t }$ and $\beta _ { t }$ increase or decrease, and how fast they do so. $z _ { t }$ ’s evolution on the other hand is the result of a competition between $\alpha _ { t }$ and $\beta _ { t }$ . If $z _ { 0 }$ and/or $\alpha _ { 0 }$ are sufficiently large, $\beta _ { t }$ will decrease fast and long enough to reach 0 at some point (green curves). Conversely, for a large $\beta _ { 0 }$ , $z _ { t }$ can reach 0 before $\beta _ { t }$ . When that is the case, $\alpha _ { t }$ then decreases until it reaches 0 (yellow curves). We plot examples of those behaviors in Fig. 3 Right. We notice in particular the classic sigmoidal shape appearing, even when Assumption (H2) is violated. This can be explained as follows. In the regime of small initializations (customary in deep learning), the competition between $\alpha _ { t }$ , $\beta _ { t }$ and $z _ { t }$ happens in a part of parameter space where all the weights are small (i.e. where the confidence of the network is close to 0.5). When one class finally prevails over the other, e.g. $\beta _ { t }$ reaching 0 (orange curve in the plot), the analytical solutions from previous sections apply and the sigmoidal shape arises.
165
+
166
+ # 4 On the hinge loss
167
+
168
+ Recent results in the field of generative adversarial networks have resurrected the hinge loss (Miyato et al., 2018). While its exact impact on performance is unclear, we run a small experiment to show its ability to generate better samples than the customary cross-entropy (see Fig. 4 and Appendix E). In order to perhaps uncover reasons behind its efficiency, we extend our results to the hinge loss:
169
+
170
+ $$
171
+ L _ { H } ( W _ { t } , Z _ { t } ; x ) = \operatorname* { m a x } ( 0 , 1 - Z _ { t } ^ { T } ( W _ { t } x ) _ { + } \cdot ( \mathbb { 1 } _ { x \in D _ { 1 } } - \mathbb { 1 } _ { x \in D _ { 2 } } ) ) .
172
+ $$
173
+
174
+ ![](images/d6b56cf465cea6ff97ef9fdc7ee945eacc0ffc5742f04e6b8cebb0a61d9518cb.jpg)
175
+ Figure 4: Left. The three figures on the left are the result of training a generative adversarial network on 8 Gaussians (see Appendix E for details on the experiment). The samples from the hinge loss are incomparably better. Right. Comparison between hinge loss and binary cross-entropy: training time required to reach a confidence $\delta$ on the classification problem. Subplot: Solutions of Eqs. 3 and 5.
176
+
177
+ The hinge loss is non differentiable, but one can simply consider that learning stops as soon as the output of the network reaches 1 (resp. -1) for class $D _ { 1 }$ (resp. $D _ { 2 }$ ). Under the same assumptions than in Theorem 3.2 (some of which can be relaxed, see Appendix C), we have the following result:
178
+
179
+ Theorem 4.1. For $x \in D _ { 1 }$ (for $D _ { 2 }$ it is simply the opposite), the output $u ( t )$ of the network verifies
180
+
181
+ $$
182
+ u ( t ) = \operatorname* { m i n } ( 1 , \mathrm { ~ } u _ { 0 } \ : e ^ { 2 p \| x \| t ) } ) , \qquad u ( t ) = \operatorname* { m i n } ( 1 , \mathrm { ~ } \frac { c } { 2 \| x \| } \sinh ( \theta _ { 0 } + 2 p \| x \| t ) ) ,
183
+ $$
184
+
185
+ where $\theta _ { 0 } = \cosh ^ { - 1 } \bigl ( \frac { y _ { 0 } ^ { 2 } + \| x \| ^ { 2 } z _ { 0 } ^ { 2 } } { c } \bigr )$ and the left and right equations correspond to $c = 0$ and $c \neq 0$
186
+
187
+ Proof. Simple computations show that the dynamics of the system are governed by $y _ { t } ^ { \prime } = x ^ { T } x \ z _ { t }$ and $z _ { t } ^ { \prime } = y _ { t }$ . Following the method from Section 3, we see that $u ^ { \prime } ( t ) = 2 \| x \| u ( t )$ in the case where $c = 0$ , leading to to the result. When $c \neq 0$ , a classic hyperbolic change of variables allows to find the solution. Its full derivation is presented in Appendix C. □
188
+
189
+ The learning curves are plotted in Fig. 4 Right. We notice a hard sigmoidal shape corresponding to learning stopping when $u _ { t }$ reaches 1. Confidence increases exponentially in $t$ , much faster than for binary cross-entropy (all other parameters kept equal) where $\bar { u ( t ) } \sim \log \bar { ( t ) }$ . With $\delta$ the required confidence for our classifier, the time $t ^ { * }$ required to reach $\delta$ can easily be computed. We plot it in Fig. 4 Right which confirms visually that the hinge loss converges much faster. We also notice the expected divergence of $t ^ { * }$ for the binary cross entropy as $\delta$ reaches 1 (training never converges in that case). We refer the interested reader to Appendix C for a more general treatment of the Hinge loss, which fully relaxes the assumption on the number of points in the classes.
190
+
191
+ # 5 Gradient Starvation
192
+
193
+ In this section, we attempt to quantify the impact of feature frequency inside a given class. We keep our simplified framework and consider that the input $x$ to our network is composed of two underlying features $x _ { 1 } \in \mathbb { R } ^ { d _ { 1 } }$ and $x _ { 2 } \in \mathbb { R } ^ { d _ { 2 } }$ with $d = d _ { 1 } + d _ { 2 }$ . We let $( x _ { 1 } , x _ { 2 } ) \in \mathbb { R } ^ { d }$ denote the concatenation of the vectors $x _ { 1 }$ and $x _ { 2 }$ . We assume that all the points in class $D _ { 1 }$ contain the feature $x _ { 1 }$ but only a fraction $\lambda$ of them contains the feature $x _ { 2 }$ . This is equivalent to making continuous gradient updates using the vector $( x _ { 1 } , x _ { 2 } )$ with a rate $\lambda$ and the vector $( x _ { 1 } , 0 )$ with a rate $1 - \lambda$ . We also assume that those features are fully informative for $D _ { 1 } - i . e$ . are absent from class $D _ { 2 }$ . A network trained using gradient descent on the dataset we just described has the following property
194
+
195
+ Even though the feature represented by $x _ { 2 }$ is fully informative of the class, the network will not classify a sample containing only $x _ { 2 }$ with high confidence.
196
+
197
+ It is the result of a phenomenon we coin gradient starvation where the most frequent features starve the gradient for the least frequent ones, resulting in a slower learning of those:
198
+
199
+ Theorem 5.1. Let $\delta$ be our confidence requirement on class $D _ { 1 }$ i.e. training stops as soon as $\forall x \in D _ { 1 }$ , $P _ { t } ( x \in D _ { 1 } ) \geq 1 - \delta$ , and let $t ^ { * }$ denote that instant. Then, under some mild assumptions,
200
+
201
+ $$
202
+ P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } ) \le \frac { 1 } { 1 + e ^ { - \lambda \log ( \frac { 1 - \delta } { \delta } ) } } .
203
+ $$
204
+
205
+ Proof. From Lemma 3.1, assumptions (H2-3) are sufficient to guarantee independent mode learning as well as positiveness of $z _ { t }$ . We decompose $w _ { t } = ( \alpha _ { t } x _ { 1 } , \beta _ { t } x _ { 2 } ) \overset { \vartriangle } { + } ( x _ { 1 } ^ { \perp } , x _ { 2 } ^ { \perp } )$ where $x _ { 1 } ^ { T } x _ { 1 } ^ { \perp } = x _ { 2 } ^ { T } x _ { 2 } ^ { \perp } =$ 0, and assume that $\alpha _ { 0 } \geq \beta _ { 0 } / \lambda > 0$ (in App. D, we relax some of those assumptions and prove an equivalent result). The evolution equation for $w _ { t }$ is $\begin{array} { r } { w _ { t } ^ { \prime } = \frac { z _ { t } x } { 1 + e ^ { z _ { t } w _ { t } x } } } \end{array}$ with $\boldsymbol { x } = ( x _ { 1 } , x _ { 2 } )$ (resp. $( x _ { 1 } , 0 ) \big )$ ) at an $\lambda$ (resp. $1 - \lambda )$ rate. Projecting on $x _ { 1 }$ and $x _ { 2 }$ gives
206
+
207
+ $$
208
+ \alpha _ { t } ^ { \prime } = \lambda \frac { z _ { t } } { 1 + e ^ { z _ { t } ( \alpha _ { t } + \beta _ { t } ) } } + ( 1 - \lambda ) \frac { z _ { t } } { 1 + e ^ { z _ { t } \alpha _ { t } } } , \beta _ { t } ^ { \prime } = \lambda \frac { z _ { t } } { 1 + e ^ { z _ { t } ( \alpha _ { t } + \beta _ { t } ) } } .
209
+ $$
210
+
211
+ From $z _ { t } > 0$ , we see that $\beta _ { t }$ is an increasing function of time, which guarantees $\beta _ { t } > 0$ , and
212
+
213
+ $$
214
+ \alpha _ { t } ^ { \prime } \geq \beta _ { t } ^ { \prime } + ( 1 - \lambda ) \frac { z _ { t } } { 1 + e ^ { z _ { t } ( \alpha _ { t } + \beta _ { t } ) } } = ( 1 + \frac { 1 - \lambda } { \lambda } ) \beta _ { t } ^ { \prime } = \frac { \beta _ { t } ^ { \prime } } { \lambda } .
215
+ $$
216
+
217
+ This proves that $\forall t \geq 0$ , $\alpha _ { t } \geq \beta _ { t } / \lambda$ . We now consider $t ^ { * }$ such that $\begin{array} { r } { z _ { t ^ { * } } \alpha _ { t ^ { * } } = \log ( \frac { 1 - \delta } { \delta } ) } \end{array}$ . It is the smallest $t$ such that $P _ { t } ( ( x _ { 1 } , x _ { 2 } ) \in D _ { 1 } ) \ge P _ { t } ( ( x _ { 1 } , 0 ) \in D _ { 1 } ) = 1 - \delta$ , its existence is guaranteed by $z _ { t }$ and $\alpha _ { t }$ being increasing (we also assume that $t = 0$ does not verify those (in)equalities). We get
218
+
219
+ $$
220
+ P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } ) = \frac { 1 } { 1 + e ^ { - z _ { t ^ { * } } \beta _ { t ^ { * } } } } \leq \frac { 1 } { 1 + e ^ { - \lambda z _ { t ^ { * } } \alpha _ { t ^ { * } } } } = \frac { 1 } { 1 + e ^ { - \lambda \log ( \frac { 1 - \delta } { \delta } ) } } .
221
+ $$
222
+
223
+ As can be seen in Eq. 7, the presence of $\alpha _ { t }$ – which detects feature $x _ { 1 }$ – in the denominator of $\beta _ { t } ^ { \prime }$ greatly reduces its value, thus preventing the network from learning $x _ { 2 }$ properly. □
224
+
225
+ ![](images/2643ba970dae94e21a480289c4717394738b03e9fd01112f8676a8eecdd8ff9a.jpg)
226
+ Figure 5: Upper bound on $P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \ \in \ D _ { 1 } )$ as a function of $1 - \delta$ for different values of $\lambda$ .
227
+
228
+ Table 1: Gradient starvation
229
+
230
+ <table><tr><td rowspan="2">8</td><td colspan="3">入</td></tr><tr><td>0.5</td><td>0.2 0.1</td><td>0.01</td></tr><tr><td>99%</td><td>91%</td><td>71%</td><td>61% 51%</td></tr><tr><td>99.99%</td><td>99%</td><td>86% 72%</td><td>52%</td></tr></table>
231
+
232
+ Table 2: Accuracy on the cats and dogs dataset (Real means the untouched test set)
233
+
234
+ <table><tr><td>Training</td><td>Testing</td><td>Testing (Real)</td></tr><tr><td>100%</td><td>100%</td><td>43.2%</td></tr></table>
235
+
236
+ In Fig. 5 Left., we plot for different values of $\lambda$ the confidence of the network when classifying $x _ { 2 }$ as a function of its confidence on $x _ { 1 }$ (see App. D. for more details). The gap between the two is very significant: with e.g. $\lambda = 0 . 1$ and $\delta = 1 0 ^ { - 4 }$ (Table 1), $P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } ) \leq 7 2 \% !$ Even though $x _ { 2 }$ is exclusively present in $D _ { 1 }$ , and is thus extremely informative, the network is unable to classify it.
237
+
238
+ Experiment To validate those findings empirically, we design an artificial experiment based on the cats and dogs dataset (Kaggle, 2018). We create a very strong, perfectly discriminative feature by making the dog pictures brighter, and the cat pictures darker. We then train a standard deep neural network to classify the modified images and measure its performance on the untouched testing set.
239
+
240
+ Results The results can be seen in Table 2. The network perfectly learns to classify both the train and test modified set, but utterly fails on the real test data. This proves that the handcrafted light feature was learnt by the network, and is used exclusively to classify images. All the features allowing to recognize a cat from a dog are still present in the data, but the low level features (e.g. the presence of whiskers, how edges combine to form the shape of the animals and so on) are far less frequent than the light intensity, and thus were not learnt. The most frequent feature starved all the others.
241
+
242
+ # 6 Related work
243
+
244
+ The learning dynamics of neural networks have been explored for decades. Baldi & Hornik (1989) studied the energy landscape of linear networks and the fixed point structure of gradient descent learning in that context. Heskes & Kappen (1993) developed a theory encompassing stochastic gradient descent and parameter dynamics and wrote down their evolution equations in on-line learning. However, those equations are heavily nonlinear and do not have closed-form solutions in the general case. Saxe et al. (2013b) study the case of deep linear networks trained with regression. They prove the existence of nonlinear learning phenomena similar to those seen in simulations of nonlinear networks and provide exact solutions to the dynamics of learning in the linear case. Some of our results are an extension of theirs to nonlinear networks. Choromanska et al. (2014); Raghu et al. (2017); Saxe (2015); Yosinski et al. (2014) also focus on neural network dynamics, while Nacson et al. (2018); Xu et al. (2018); Soudry et al. (2017) study the convergence rate of learning on separable data. Arora et al. (2018) prove that overparameterization can lead to faster optimization.
245
+
246
+ Recent work in the domain of generative adversarial networks (Goodfellow et al., 2014) has shown the resurgence of the hinge loss (Rosasco et al., 2004). In particular, part of the success encountered by Miyato et al. (2018) is due to their use of that specific loss function. Their main contribution however is a spectral normalization technique that produces state-of-the-art results on image generation. Their paper is part of a larger trend focusing on the spectra of neural network weight matrices and their evolution during learning (Vorontsov et al., 2017; Odena et al., 2018; Pennington et al., 2017). It, nevertheless, remains a poorly understood subject.
247
+
248
+ Zhang et al. (2016) performed some experiments proving that deep neural networks expound a socalled implicit regularization. Even though they have the ability to entirely memorize the dataset, they still converge to solutions that generalize well. A variety of explanations for that phenomenon have been advanced: correlation between flatness of minima and generalization (Hochreiter & Schmidhuber, 1997), natural convergence of stochastic gradient descent towards such minima (Kleinberg et al., 2018), built-in hierarchical representations (LeCun et al., 2015), gradient descent naturally protecting against overfitting (Advani & Saxe, 2017), and structure of deep networks biasing learning towards simpler functions (Neyshabur et al., 2014; Perez et al., 2018). Our results from Section 5 suggest that gradient descent indeed has a beneficial effect, but can also hurt in some situations.
249
+
250
+ # 7 Discussion
251
+
252
+ In order to obtain closed form solutions for the learning dynamics, we made the extremely simplifying assumption that each class only contains one point. We leave overcoming that limitation to future work. In the spirit of the proof in Section 5 where we considered two datapoints, we might be able to obtain upper and lower bounds on the learning dynamics.
253
+
254
+ Our comparison between the cross-entropy and the hinge losses reveals fundamental differences. It is noteworthy that the hinge loss is an important ingredient of the recently introduced spectral normalization (Miyato et al., 2018). The fast convergence of networks trained with the hinge loss might in part explain its beneficial impact. A deeper analysis of the connections between the two would lead to a better understanding of the performance of the algorithm.
255
+
256
+ In this paper, we introduce the concept of gradient starvation and suggest that it might be a plausible explanation for the generalization abilities of deep neural networks. By focusing most of the learning on the frequent features of the dataset, it makes the network ignore the idiosyncrasies of individual datapoints. That rather desirable property has a downside however: very informative but rare features will not be learnt during training. This strongly limits the ability of the network to transfer to different data distributions where e.g. the rare feature exists on its own.
257
+
258
+ # References
259
+
260
+ Madhu S. Advani and Andrew M. Saxe. High-dimensional dynamics of generalization error in neural networks. CoRR, abs/1710.03667, 2017.
261
+
262
+ Roger Ariew. Ockham’s Razor: A Historical and Philosophical Analysis of Ockham’s Principle of Parsimony. PhD thesis, University of Illinois at Urbana-Champaign, 1976.
263
+
264
+ Sanjeev Arora, Nadav Cohen, and Elad Hazan. On the optimization of deep networks: Implicit acceleration by overparameterization. CoRR, abs/1802.06509, 2018. URL http://arxiv.org/ abs/1802.06509.
265
+
266
+ P. Baldi and K. Hornik. Neural networks and principal component analysis: Learning from examples without local minima. Neural Networks, 2:53–58, 1989.
267
+
268
+ Anna Choromanska, Mikael Henaff, Michaël Mathieu, Gérard Ben Arous, and Yann LeCun. The loss surface of multilayer networks. CoRR, abs/1412.0233, 2014. URL http://arxiv.org/ abs/1412.0233.
269
+
270
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014. URL http://papers.nips.cc/paper/ 5423-generative-adversarial-nets.pdf.
271
+
272
+ Tom M. Heskes and Bert Kappen. On-line learning processes in artificial neural networks, 1993.
273
+
274
+ S. Hochreiter and J. Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
275
+
276
+ Kaggle. Dogs vs. cats, 2018. URL https://www.kaggle.com/c/dogs-vs-cats.
277
+
278
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. URL http: //arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
279
+
280
+ Robert Kleinberg, Yuanzhi Li, and Yang Yuan. An alternative view: When does sgd escape local minima? CoRR, abs/1802.06175, 2018. URL http://dblp.uni-trier.de/db/journals/ corr/corr1802.html#abs-1802-06175.
281
+
282
+ Yann LeCun, Yoshua Bengio, and Geoffrey E. Hinton. Deep learning. Nature, 521(7553):436– 444, 2015. URL http://dblp.uni-trier.de/db/journals/nature/nature521.html# LeCunBH15.
283
+
284
+ Zhenyu Liao and Romain Couillet. The dynamics of learning: A random matrix approach. In Jennifer G. Dy and Andreas Krause (eds.), ICML, volume 80 of JMLR Workshop and Conference Proceedings, pp. 3078–3087. JMLR.org, 2018. URL http://dblp.uni-trier.de/db/conf/ icml/icml2018.html#LiaoC18a.
285
+
286
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral Normalization for Generative Adversarial Networks, 2018. arXiv:1802.05957v1.
287
+
288
+ Mor Shpigel Nacson, Jason Lee, Suriya Gunasekar, Nathan Srebro, and Daniel Soudry. Convergence of gradient descent on separable data. CoRR, abs/1803.01905, 2018. URL http://dblp. uni-trier.de/db/journals/corr/corr1803.html#abs-1803-01905.
289
+
290
+ Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. CoRR, abs/1412.6614, 2014. URL http://dblp.uni-trier.de/db/journals/corr/corr1412.html#NeyshaburTS14.
291
+
292
+ Augustus Odena, Jacob Buckman, Catherine Olsson, Tom B. Brown, Christopher Olah, Colin Raffel, and Ian J. Goodfellow. Is generator conditioning causally related to gan performance? CoRR, abs/1802.08768, 2018. URL http://dblp.uni-trier.de/db/journals/corr/corr1802. html#abs-1802-08768.
293
+
294
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In NIPS-W, 2017.
295
+
296
+ Jeffrey Pennington, Samuel S. Schoenholz, and Surya Ganguli. Resurrecting the sigmoid in deep learning through dynamical isometry: theory and practice. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), NIPS, pp. 4788–4798, 2017. URL http://dblp.uni-trier.de/db/conf/nips/nips2017. html#PenningtonSG17.
297
+
298
+ Guillermo Valle Perez, Chico Q. Camargo, and Ard A. Louis. Deep learning generalizes because the parameter-function map is biased towards simple functions. CoRR, abs/1805.08522, 2018. URL http://dblp.uni-trier.de/db/journals/corr/corr1805.html#abs-1805-08522.
299
+
300
+ Tomaso Poggio, Ryan Rifkin, Sayan Mukherjee, and Partha Niyogi. General conditions for predictivity in learning theory. Nature, 428(6981):419–422, 2004.
301
+
302
+ Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. Svcca: Singular vector canonical correlation analysis for deep understanding and improvement. arXiv preprint arXiv:1706.05806, 2017.
303
+
304
+ Lorenzo Rosasco, Ernesto De Vito, Andrea Caponnetto, Michele Piana, and Alessandro Verri. Are loss functions all the same?. Neural Computation, 16(5):1063–107, 2004. URL http: //dblp.uni-trier.de/db/journals/neco/neco16.html#RosascoVCPV04.
305
+
306
+ Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Learning hierarchical categories in deep neural networks. In Markus Knauff, Michael Pauen, Natalie Sebanz, and Ipke Wachsmuth (eds.), CogSci. cognitivesciencesociety.org, 2013a. ISBN 978-0-9768318-9-1. URL http:// dblp.uni-trier.de/db/conf/cogsci/cogsci2013.html#SaxeMG13.
307
+
308
+ Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. cite arxiv:1312.6120, 2013b. URL http: //arxiv.org/abs/1312.6120.
309
+
310
+ Andrew Michael Saxe. Deep Linear Neural Networks: A Theory of Learning in the Brain and Mind. PhD thesis, Stanford University, 2015.
311
+
312
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014.
313
+
314
+ Daniel Soudry, Elad Hoffer, and Nathan Srebro. The implicit bias of gradient descent on separable data. CoRR, abs/1710.10345, 2017. URL http://dblp.uni-trier.de/db/journals/corr/ corr1710.html#abs-1710-10345.
315
+
316
+ Morris Tenenbaum and Harry Pollard. Ordinary Differential Equations : An Elementary Textbook for Students of Mathematics, Engineering, and the Sciences. Dover, October 1985. ISBN 0486649407. URL http://www.worldcat.org/isbn/0486649407.
317
+
318
+ Vladimir Naumovich Vapnik. Statistical Learning Theory. Wiley-Interscience, September 1998.
319
+
320
+ Eugene Vorontsov, Chiheb Trabelsi, Samuel Kadoury, and Chris Pal. On orthogonality and learning recurrent networks with long term dependencies. CoRR, abs/1702.00071, 2017. URL http: //arxiv.org/abs/1702.00071.
321
+
322
+ Wiki. Exponential integral, 2018. URL https://en.wikipedia.org/wiki/Exponential_ integral.
323
+
324
+ Tengyu Xu, Yi Zhou, Kaiyi Ji, and Yingbin Liang. Convergence of sgd in learning relu models with separable data. CoRR, abs/1806.04339, 2018. URL http://dblp.uni-trier.de/db/ journals/corr/corr1806.html#abs-1806-04339.
325
+
326
+ Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
327
+
328
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. CoRR, abs/1611.03530, 2016. URL http: //dblp.uni-trier.de/db/journals/corr/corr1611.html#ZhangBHRV16.
329
+
330
+ # Appendix A.
331
+
332
+ A.1 Proof of Lemma 3.1
333
+
334
+ In this section, we prove the following lemma:
335
+
336
+ Lemma 3.1 For any $k \in \{ 1 , 2 \}$ , $x \in D _ { k }$ and $t \geq 0$ , the only non-negative elements of $W _ { t } x$ are the ones with an index $i \in \mathcal { Z } _ { k }$ . The signs of the coordinates of $Z _ { t }$ remain the same throughout training.
337
+
338
+ Proof. We prove this with a simple induction. The claim is true at $t = 0$ from assumptions (H1-3). Let us assume that at time set $t$ , the different parts of the lemma are true. The SGD updates to the weights stemming from a single observation $x \in D _ { k }$ (the extension to a mini-batch is straightforward) with a learning rate $\alpha$ are:
339
+
340
+ $$
341
+ \Delta Z _ { t } ( x ) = \alpha \delta _ { f } ( x ) \left( W _ { t } x \right) _ { + } \qquad \Delta W _ { t } ( x ) = \alpha \delta _ { f } ( x ) \left( Z _ { t } ^ { T } \otimes e _ { k } \right) x ^ { T } ,
342
+ $$
343
+
344
+ where $\otimes$ denotes the element-wise product of two vectors and $\boldsymbol { e } _ { k } \in \mathbb { R } ^ { h }$ is the binary vector with ones on the indices from $\mathcal { T } _ { k }$ . $\delta _ { f } ( x )$ is the gradient of the loss with respect to the pre-sigmoid output of the network $F _ { t } ( x )$ : $\delta _ { f } \dot { ( } x ) = 1 _ { \{ k = 1 \} } - \sigma ( F _ { t } ( x ) )$ . The updates to $Z _ { t }$ are positive on its indices belonging to $\mathcal { T } _ { 1 }$ , and negative otherwise, proving the second claim of the lemma. Moving to $W _ { t }$ , only its rows and hidden neurons with indices $i \in \mathcal { Z } _ { k }$ are modified. For an element $x ^ { \prime } \in D$ , $\begin{array} { r } { W _ { t + 1 } x ^ { \prime } \stackrel { } { = } W _ { t } x ^ { \prime } + \alpha \delta _ { f } ( x ) ( \sum _ { i \in \mathcal { T } _ { k } } z _ { i } ) \| x \| ^ { \prime } } \end{array}$ where $z _ { i }$ is the $i$ -th element of $Z _ { t }$ . By induction, $\textstyle \sum _ { i \in { \mathcal { T } } _ { k } } z _ { i }$ has the same sign as $\delta _ { f } ( x )$ (positive on $D _ { 1 }$ , negative on $D _ { 2 }$ ). From (H1), $\| x \| ^ { \prime }$ is positive (resp. negative) if $x ^ { \prime }$ is in $D _ { k }$ (resp. otherwise). The update keeps the $k$ -th neuron active (resp. inactive). □
345
+
346
+ # A.2 Extension of Lemma 3.1 to multi-class classification
347
+
348
+ Let us consider a simple $C$ -classification task. $D = \{ ( x _ { i } , y _ { i } ) \} _ { 1 \leq i \leq n } \subset \mathbb { R } ^ { d } \times C$ is our dataset of vectors/labels where $C$ denotes both the set of possible labels and its cardinal depending on the context. The classifier we are training is a simple neural network with one hidden layer of $C$ neurons, a ReLU non-linearity and a softmax $\sigma$ . The full function is written as
349
+
350
+ $$
351
+ P _ { t } ( x ) : = \sigma ( F _ { t } ( x ) ) : = \sigma ( Z _ { t } ( W _ { t } x ) _ { + } ) ,
352
+ $$
353
+
354
+ where $W _ { t }$ (resp. $Z _ { t }$ ) is a $C \times d$ (resp. $C \times C )$ weight matrix and $\sigma$ the softmax function. The subscript $^ +$ denotes the positive part of a real number. $P _ { t } ( x )$ is a $C$ -vector representing the probability that $x$ belongs to each class. The subscript $t$ denotes the state of the element at time step $t$ of training.
355
+
356
+ For a given class $k$ , we let $D _ { k }$ be the set of vectors belonging to class $k$ . We make the following assumptions, with $k \neq k ^ { \prime } \in C$ two arbitrary classes
357
+
358
+ (H4) For any $x , x ^ { \prime } \in D _ { k }$ , $x ^ { T } x ^ { \prime } > 0$ . For any $x \in D _ { k }$ and $\boldsymbol { x } ^ { \prime } \in D _ { \boldsymbol { k } ^ { \prime } }$ , $x ^ { T } x ^ { \prime } \leq 0$ .
359
+ (H5) For any $x \in D _ { k }$ and $x ^ { \prime } \in D \setminus D _ { k } , w _ { 0 } ^ { k } x > 0$ and $w _ { 0 } ^ { k } x ^ { \prime } \leq 0$ , where $w _ { 0 } ^ { k }$ is the $k$ -th row of $W _ { 0 }$ .
360
+ (H6) $Z _ { 0 }$ is initialized randomly to positive numbers on the diagonal, and non-positive elsewhere.
361
+
362
+ Those assumptions are straightforward extensions of the ones from the main text. We train the classifier using stochastic gradient descent on the cross-entropy loss of our problem. $F _ { t + 1 }$ is the state of the neural network after one SGD update to $F _ { t }$ . Our first lemma states that over the course of training, the active neurons of the hidden layer remain the same for each element of the dataset, and the elements of $Z _ { t }$ remain of the same sign.
363
+
364
+ Lemma A.1. For any $k \in C$ , $x \in D _ { k }$ and $t \geq 0$ , the only non-negative element of $W _ { t } x$ is its $k$ -th element and all diagonal (resp. non-diagonal) elements of $Z _ { t }$ are positive (resp. negative).
365
+
366
+ Proof. We prove this with a simple induction. The claim is true at $t = 0$ from assumptions (H4-6). Let us assume that at time set $t$ , the different parts of the lemma are true. The SGD updates to the weight matrices stemming from a single observation $x \in D _ { k ^ { * } }$ (the extension to a mini-batch is straightforward) and a learning rate $\alpha$ are:
367
+
368
+ $$
369
+ \delta Z _ { t } = \alpha \nabla _ { y } L ( W _ { t } x ) _ { + } ^ { T } \qquad \delta W _ { t } = \alpha ( Z _ { t } ^ { T } \nabla _ { y } L \otimes e _ { k ^ { * } } ) x ^ { T } ,
370
+ $$
371
+
372
+ where $\otimes$ denotes the element-wise product of two vectors and $e _ { k ^ { * } }$ the $k ^ { * }$ basis vector of $\mathbb { R } ^ { C }$ . $\nabla _ { y } L$ is the gradient of $\log F _ { t } ( x ) _ { k ^ { * } }$ (the cross entropy loss for a sample from class $k ^ { * }$ ) with respect to the output of $Z _ { t }$ . One can show that $\begin{array} { r } { ( \nabla _ { y } L ) _ { k ^ { * } } = 1 - \frac { e ^ { F _ { t } ( x ) _ { k ^ { * } } } } { \sum _ { j } { e ^ { F _ { t } ( x ) _ { j } } } } } \end{array}$ and $\begin{array} { r } { ( \nabla _ { y } L ) _ { i } = - \frac { e ^ { F _ { t } ( x ) _ { i } } } { \sum _ { j } e ^ { F _ { t } ( x ) _ { j } } } } \end{array}$ for $i \neq k ^ { * }$ i.e. $\nabla _ { y } L = e _ { k ^ { * } } - Y _ { t } ( x )$ . The update to $Z _ { t }$ is non-negative on the diagonal, and non-positive elsewhere, which proves the second claim of the lemma. As far as $W _ { t }$ is concerned, only its $k ^ { * }$ - th row is modified. For an element $x ^ { \prime } \in D$ , $\boldsymbol { W _ { t + 1 } } \boldsymbol { x ^ { \prime } } = \boldsymbol { W _ { t } } \boldsymbol { x ^ { \prime } } + \boldsymbol { K } \boldsymbol { x ^ { T } } \boldsymbol { x ^ { \prime } } \boldsymbol { e } _ { k ^ { * } }$ where $K$ is the dot product between the $k ^ { * }$ -th column of $Z _ { t }$ and $\nabla _ { y } L$ . By assumptions on the data, $x ^ { T } x ^ { \prime }$ is positive (resp. negative) if $x ^ { \prime }$ is in $D _ { k ^ { * } }$ (resp. otherwise), so the update keeps the $k ^ { * }$ -th neuron active (resp. inactive). □
373
+
374
+ The proof can be extended to any number of hidden layers $h \geq C$ by modifying assumptions (H5-6) using a partition $\{ \mathcal { T } _ { 1 } , \ldots , \mathcal { T } _ { C } \}$ of $\{ 1 , \ldots , h \}$ similar to the binary classification case. Each set $\mathcal { T } _ { i }$ in the partition describes the neurons active at the initialization of the network for an element $x \in D _ { i }$ . The modified assumptions are:
375
+
376
+ (H5’) For any $i \in \mathcal { Z } _ { k }$ , $x \in D _ { k }$ and $x ^ { \prime } \in D \backslash D _ { k }$ , $w _ { 0 } ^ { i } x > 0$ and $w _ { 0 } ^ { i } x ^ { \prime } \leq 0$ .
377
+ (H6’) For any $i \in \mathcal { T } _ { k } , j \notin \mathcal { T } _ { k } , ( Z _ { 0 } ) _ { k i } > 0$ and $( Z _ { 0 } ) _ { k j } \le 0$ .
378
+
379
+ The lemma then translates to those inequalities remaining true at any time $t \geq 0$ .
380
+
381
+ # A.3 Proofs for Theorem 3.2
382
+
383
+ In this section we develop the proof of Theorem 3.2 of the main text.
384
+
385
+ Proof. We consider an update made using $x \in D _ { 1 }$ . Writing $y _ { t } = w _ { t } x$ , our system follows the system of ordinary differential equations
386
+
387
+ $$
388
+ y _ { t } ^ { \prime } = { \frac { x ^ { T } x z _ { t } } { 1 + e ^ { y _ { t } z _ { t } } } } , \qquad z _ { t } ^ { \prime } = { \frac { y _ { t } } { 1 + e ^ { y _ { t } z _ { t } } } } .
389
+ $$
390
+
391
+ Writing $x ^ { T } x = \| x \| ^ { 2 }$ , we see that $y _ { t } y _ { t } ^ { \prime } = \| x \| ^ { 2 } z _ { t } z _ { t } ^ { \prime }$ . The quantity $y _ { t } ^ { 2 } - \| x \| ^ { 2 } z _ { t } ^ { 2 }$ is thus an invariant of the problem. With $c : = | y _ { 0 } ^ { 2 } - \| \dot { x } \| ^ { 2 } z _ { 0 } ^ { 2 } |$ , the solutions of Eq. 11 live on hyperbolas of equation
392
+
393
+ $$
394
+ \left\{ \begin{array} { l l } { y ^ { 2 } - \| x \| ^ { 2 } z ^ { 2 } = \begin{array} { l l l l l } { c } & { \quad } & { \mathrm { i f } \ y _ { 0 } ^ { 2 } - \| x \| ^ { 2 } z _ { 0 } ^ { 2 } > 0 , } \\ { y ^ { 2 } - \| x \| ^ { 2 } z ^ { 2 } = - c \quad } & { \quad } & { \mathrm { i f } \ y _ { 0 } ^ { 2 } - \| x \| ^ { 2 } z _ { 0 } ^ { 2 } < 0 , } \end{array} } \\ y ^ { 2 } - \| x \| ^ { 2 } z ^ { 2 } = \begin{array} { l l l l l } { \ } & { 0 } & { \quad } & { \mathrm { i f } \ y _ { 0 } ^ { 2 } - \| x \| ^ { 2 } z _ { 0 } ^ { 2 } = 0 . } \end{array} \right. \end{array}
395
+ $$
396
+
397
+ We start by treating the case of a degenerate hyperbola $c = 0$ . We have $\forall t$ , $y _ { t } = \| x \| z _ { t }$ (those quantities are both positive as $x \in D _ { 1 }$ and (H2-3)). We let $u ( t ) : = z _ { t } w _ { t } x = z _ { t } y _ { t }$ and see by combining the two equations in Eq. 11 that
398
+
399
+ $$
400
+ u ^ { \prime } ( t ) = { \frac { 2 \| x \| u ( t ) } { 1 + e ^ { u ( t ) } } } .
401
+ $$
402
+
403
+ For any $u _ { f } \geq u _ { 0 }$ , let $t = u ^ { < - 1 > } ( u _ { f } )$ ( $u$ is a bijection from $\mathbb { R } ^ { + } \to [ u _ { 0 } , + \infty [$ [ since its derivative is strictly positive). We have
404
+
405
+ $$
406
+ t = \frac { 1 } { 2 \| x \| } \int _ { u _ { 0 } } ^ { u _ { f } } \frac { 1 + e ^ { y } } { y } d y = \frac { 1 } { 2 \| x \| } ( \log ( \frac { u _ { f } } { u _ { 0 } } ) + E i ( u _ { f } ) - E i ( u _ { 0 } ) ) ,
407
+ $$
408
+
409
+ where $\begin{array} { r } { E i ( x ) = - \int _ { - x } ^ { \infty } \frac { e ^ { - u } } { u } d u } \end{array}$ is the exponential integral. In the end, with the superscript ${ < - 1 > }$ denoting the inverse function
410
+
411
+ $$
412
+ u _ { f } = u ( t ) = ( \log + E i ) ^ { < - 1 > } ( 2 \| x \| t + \log ( u _ { 0 } ) + E i ( u _ { 0 } ) ) .
413
+ $$
414
+
415
+ We let $\bar { u }$ denote the function $u ( t )$ above for $\| { \boldsymbol x } \| = 1$ , the solution for $\| { \boldsymbol x } \| \neq 1$ can easily be inferred by a rescaling of $t$ in $\bar { u }$ . For $x \in D _ { 2 }$ , the system of ODEs is
416
+
417
+ $$
418
+ y _ { t } ^ { \prime } = - { \frac { \| x \| ^ { 2 } z _ { t } } { 1 + e ^ { - y _ { t } z _ { t } } } } , \qquad z _ { t } ^ { \prime } = - { \frac { y _ { t } } { 1 + e ^ { - y _ { t } z _ { t } } } } ,
419
+ $$
420
+
421
+ the degeneracy assumption becomes $y _ { 0 } = - \| x \| z _ { 0 }$ (we know from (H2) that $y _ { 0 } > 0$ and from (H3) that $z _ { \mathrm { 0 } } ~ < ~ 0 )$ . It can be shown similarly that $v ( t ) : = z _ { t } y _ { t }$ verifies the equation $v ^ { \prime } ( t ) =$ $2 \| x \| v ( t ) \sigma ( v ( t ) )$ with a negative initial condition. In other words, $u$ and $v$ follow symmetric trajectories on the positive/negative real line. Below, $\bar { u }$ and $\bar { v }$ denote those two trajectories for $\| { \boldsymbol x } \| = 1$ and initial conditions $u _ { 0 } > 0$ and $v _ { 0 } < 0$ .
422
+
423
+ Let us now write $p _ { 1 } = | D _ { 1 } | / | D |$ the fraction of points in the dataset belonging to $D _ { 1 }$ . Because we sample randomly from the dataset, this amounts to sampling $p _ { 1 }$ (resp. $1 - p _ { 1 } )$ points from $D _ { 1 }$ (resp. $D _ { 2 }$ ) for each time unit during training, ie to rescaling the time axis by $p _ { 1 }$ for $D _ { 1 }$ and $1 - p _ { 1 }$ for $D _ { 2 }$ . Formally, this allows us to quantify the performance of the network at any time $t$
424
+
425
+ $$
426
+ \left\{ \begin{array} { l l } { P _ { t } ( x \in D _ { 1 } ) = \sigma ( \bar { u } ( \| x \| p _ { 1 } t ) ) \qquad } & { \mathrm { ~ i f ~ } x \in D _ { 1 } , } \\ { P _ { t } ( x \in D _ { 2 } ) = \sigma ( - \bar { v } ( \| x \| ( 1 - p _ { 1 } ) t ) ) \qquad } & { \mathrm { ~ i f ~ } x \in D _ { 2 } , } \end{array} \right.
427
+ $$
428
+
429
+ which concludes the proof for $c = 0$ .
430
+
431
+ From Eq. 14, we also see that
432
+
433
+ $$
434
+ t = \frac { 1 } { 2 \| x \| } \int _ { u _ { 0 } } ^ { u _ { f } } \frac { 1 + e ^ { y } } { y } d y \ge \frac { 1 } { 2 \| x \| } \int _ { u _ { 0 } } ^ { u _ { f } } e ^ { \frac { y } { 2 } } d y = \frac { 1 } { \| x \| } \big ( e ^ { \frac { u _ { f } } { 2 } } - e ^ { \frac { u _ { 0 } } { 2 } } \big ) ,
435
+ $$
436
+
437
+ where we used the inequality $\forall y \geq 0 , e ^ { \frac { y } { 2 } } > y$ . It eventually gives us
438
+
439
+ $$
440
+ u ( t ) \leq 2 \log ( \| x \| t + e ^ { \frac { u _ { 0 } } { 2 } } ) ,
441
+ $$
442
+
443
+ a result in line with convergence rates obtained in Soudry et al. (2017).
444
+
445
+ Let us now study the non-degenerate case. We apply the classic change of coordinates
446
+
447
+ $$
448
+ \begin{array} { r l r l r l } & { y _ { t } = \sqrt { c } \cosh ( \frac { \theta } { 2 } ) , } & & { z _ { t } = \frac { \sqrt { c } } { \| x \| } \sinh ( \frac { \theta } { 2 } ) } & & { \mathrm { i f ~ } y _ { 0 } ^ { 2 } > \| x \| ^ { 2 } z _ { 0 } ^ { 2 } , } \\ & { y _ { t } = \sqrt { c } \sinh ( \frac { \theta } { 2 } ) , } & & { z _ { t } = \frac { \sqrt { c } } { \| x \| } \cosh ( \frac { \theta } { 2 } ) } & & { \mathrm { i f ~ } y _ { 0 } ^ { 2 } < \| x \| ^ { 2 } z _ { 0 } ^ { 2 } . } \end{array}
449
+ $$
450
+
451
+ Since $y _ { t } ^ { 2 } + \| x \| ^ { 2 } z _ { t } ^ { 2 } = c \cosh ( \theta )$ and $\begin{array} { r } { y _ { t } z _ { t } = \frac { c } { 2 \| x \| } \sinh ( \theta ) } \end{array}$ , we see that
452
+
453
+ $$
454
+ ( y _ { t } z _ { t } ) ^ { \prime } = \frac { y _ { t } ^ { 2 } + \vert \vert x \vert \vert ^ { 2 } z _ { t } ^ { 2 } } { 1 + e ^ { y _ { t } z _ { t } } } = \frac { c } { 2 \vert \vert x \vert \vert } \cosh ( \theta ) \theta ^ { \prime } = \frac { c \cosh ( \theta ) } { 1 + e ^ { c \sinh ( \theta ) / 2 \vert \vert x \vert \vert } } ,
455
+ $$
456
+
457
+ where the first equality used the system of equations Eq. 11. This gives us the dynamics of $\theta$ as
458
+
459
+ $$
460
+ \theta ^ { \prime } = \frac { 2 \| x \| } { 1 + e ^ { c \sinh ( \theta ) / 2 \| x \| } } ,
461
+ $$
462
+
463
+ with an initial condition $\theta _ { 0 } = \cosh ^ { - 1 } \bigl ( \frac { y _ { 0 } ^ { 2 } + \| x \| ^ { 2 } z _ { 0 } ^ { 2 } } { c } \bigr )$ . For any $\theta _ { f } \geq \theta _ { 0 }$ , we see that $t = \theta ^ { < - 1 > } ( \theta _ { f } )$ verifies
464
+
465
+ $$
466
+ t = \int _ { \theta _ { 0 } } ^ { \theta _ { f } } \frac { 1 + e ^ { c \sinh ( \theta ) / 2 \| x \| } } { 2 \| x \| } d \theta .
467
+ $$
468
+
469
+ There is no closed-form solution for that integral (that we know of). It can however be computed numerically. On Fig. 2 Right of the main text, we plot the curves for $y _ { t }$ and $\sigma ( z _ { t } y _ { t } )$ for different values of $c$ and $\lVert x \rVert$ . We obtain a sigmoidal shape similar to previously made empirical observations. We notice in particular that for larger values of $\lVert x \rVert$ the function converges faster. □
470
+
471
+ # A.4 Extension to h hidden neurons
472
+
473
+ We now extend the result from Theorem 3.2 to the case with $h$ hidden neurons. Let us still consider an update made on $x \in D _ { 1 }$ . We know from assumptions and by Lemma 3.1 that the only active neurons in the network are indexed by $\mathcal { T } _ { 1 }$ . The network weights follow the evolution equations:
474
+
475
+ $$
476
+ ( w _ { t } ^ { i } ) ^ { \prime } = \frac { x ^ { T } z _ { t } ^ { i } } { 1 + e ^ { \sum _ { j \in \cal { Z } _ { 1 } } z _ { t } ^ { j } w _ { t } ^ { j } x } } , \qquad ( z _ { t } ^ { i } ) ^ { \prime } = \frac { w _ { t } ^ { i } x } { e ^ { \sum _ { j \in \cal { Z } _ { 1 } } z _ { t } ^ { j } w _ { t } ^ { j } x } } .
477
+ $$
478
+
479
+ We similarly define $y _ { t } ^ { i } = w _ { t } ^ { i } x$ which brings
480
+
481
+ $$
482
+ ( y _ { t } ^ { i } ) ^ { \prime } = \frac { x ^ { T } x z _ { t } ^ { i } } { 1 + e ^ { \sum _ { j \in \mathcal { Z } _ { 1 } } z _ { t } ^ { j } y _ { t } ^ { j } } } , \qquad ( z _ { t } ^ { i } ) ^ { \prime } = \frac { y _ { t } ^ { i } } { e ^ { \sum _ { j \in \mathcal { Z } _ { 1 } } z _ { t } ^ { j } y _ { t } ^ { j } } } .
483
+ $$
484
+
485
+ The couple $( y _ { t } ^ { i } , z _ { t } ^ { i } )$ follows the same hyperbolic invariance, defined by a constant $c _ { i }$ . In the case where $\forall i \in \mathcal { I } _ { 1 }$ , $c _ { i } = 0$ , we see that $u _ { t } ^ { i } : = z _ { t } ^ { i } y _ { t } ^ { i }$ verifies
486
+
487
+ $$
488
+ ( u _ { t } ^ { i } ) ^ { \prime } = \frac { 2 \| x \| u _ { t } ^ { i } } { 1 + e ^ { \sum _ { j \in \mathcal { T } _ { 1 } } u _ { t } ^ { j } } } ,
489
+ $$
490
+
491
+ and a simple summation on $i$ shows that $\begin{array} { r } { u _ { t } : = \sum _ { i \in \mathcal { I } _ { 1 } } u _ { t } ^ { i } } \end{array}$ follows Eq. 13. The dynamics of the logit in this case are identical to the single active neuron case, the only difference is potentially its initial value.
492
+
493
+ # A.5 Proof of Corollary 3.3
494
+
495
+ Corollary 3.3 Let $\delta$ be the required accuracy on the classification task (i.e. $P _ { t } ( x \in D _ { 1 } ) \geq 1 - \delta$ for $x \in D _ { 1 }$ ). Under certain assumptions, the times $t _ { 1 } ^ { * }$ and $t _ { 2 } ^ { * }$ required to reach that accuracy for each classifier verify $\begin{array} { r } { \frac { t _ { 2 } ^ { * } } { t _ { 1 } ^ { * } } \approx \frac { \| x _ { 1 } \| } { \| x _ { 2 } \| } \frac { p } { 1 - p } } \end{array}$ where $\| x _ { k } \|$ is the norm of vector $\| x _ { k } \|$ from class $k$ .
496
+
497
+ Proof. We consider the case $c = 0$ . The classification error drops at a rate proportional to $\| { x _ { 1 } } \| p$ for $D _ { 1 }$ and to $\| { \boldsymbol { x } } _ { 2 } \| ( 1 - p )$ for $D _ { 2 }$ . More precisely, let us assume that $u _ { 0 } \leq | v _ { 0 } |$ and look for a classification confidence of $1 - \delta$ . We write $\dot { u } _ { f } = \sigma ^ { \dot { < } - 1 > } ( 1 - \delta ) = \log ( 1 / \delta - 1 )$ , $t _ { v } = \bar { u } ^ { < - 1 > } ( | v _ { 0 } | )$ and
498
+
499
+ $$
500
+ t ^ { * } = \bar { u } ^ { < - 1 > } ( u _ { f } ) = \frac { 1 } { 2 } ( \log ( \frac { \log ( 1 / \delta - 1 ) } { u _ { 0 } } ) + E i ( \log ( 1 / \delta - 1 ) ) - E i ( u _ { 0 } ) ) ,
501
+ $$
502
+
503
+ $t ^ { * }$ represents the time taken to reach confidence $\delta$ with an initialization $u _ { 0 }$ , and $t _ { v }$ the time to reach $v _ { 0 }$ starting in $u _ { 0 }$ . We see that
504
+
505
+ $$
506
+ \begin{array} { l } { P ( x \in D _ { 1 } ) \geq 1 - \delta \iff t \geq t _ { 1 } ^ { * } = \frac { t ^ { * } } { \| x _ { 1 } \| p } } \\ { P ( x \in D _ { 2 } ) \geq 1 - \delta \iff t \geq t _ { 2 } ^ { * } = \frac { t ^ { * } - t _ { v } } { \| x _ { 2 } \| \left( 1 - p \right) } } \end{array}
507
+ $$
508
+
509
+ $$
510
+ \begin{array} { l } { \operatorname { i f } x \in D _ { 1 } , } \\ { \quad } \\ { \operatorname { i f } x \in D _ { 2 } . } \end{array}
511
+ $$
512
+
513
+ The ratio between the convergence times reads $\begin{array} { r } { \frac { t _ { 2 } ^ { * } } { t _ { 1 } ^ { * } } = \frac { \| x _ { 1 } \| } { \| x _ { 2 } \| } \frac { p } { 1 - p } ( 1 - \frac { t _ { v } } { t ^ { * } } ) } \end{array}$ . One sees that if the weight initializations $u _ { 0 }$ and $v _ { 0 }$ are close (i.e. $t _ { v }$ is small) and the confidence requirement large (i.e. $t ^ { * }$ is large), the ratio is approximately $\frac { \| x _ { 1 } \| } { \| x _ { 2 } \| } \frac { p } { 1 - p }$ . □
514
+
515
+ # A.6 Top-left quadrant initialization
516
+
517
+ When the initial conditions of the network verify $y _ { 0 } = - \| x \| z _ { 0 }$ , then at all time $t$ , $y _ { t } = - \| x \| z _ { t }$ . Plugging that equality in Eq. 11 results in
518
+
519
+ $$
520
+ u ^ { \prime } ( t ) = \frac { - 2 \| x \| u ( t ) } { 1 + e ^ { u ( t ) } }
521
+ $$
522
+
523
+ where again $u ( t ) = z _ { t } y _ { t }$ . This means that the logit is negative and increasing. Let $u _ { 0 } < u _ { f } < 0$ , we see that the time at which $u$ reaches $u _ { f }$ verifies
524
+
525
+ $$
526
+ t = - \frac { 1 } { 2 \| x \| } \int _ { u _ { 0 } } ^ { u _ { f } } \frac { 1 + e ^ { y } } { y } d y = \frac { 1 } { 2 \| x \| } \int _ { - u _ { f } } ^ { - u _ { 0 } } \frac { 1 + e ^ { - y } } { y } d y \ge \log ( - u _ { 0 } ) - \log ( - u _ { f } ) .
527
+ $$
528
+
529
+ $t$ diverges to $+ \infty$ as $\boldsymbol { u } _ { f }$ tends to 0 from below. The logit converges to 0 without ever reaching it.
530
+
531
+ One of the major assumptions made in the main text is the fact that each class contains a single element. In this section, we slightly relax it to the case where the points $( \{ x _ { i } \} _ { 1 \leq i \leq m } \subset \mathbb { R } ^ { d } )$ in a class are all orthogonal to one another1 (while still verifying Assumption (H1)). In that case, each presentation of a training vector will only affect $w _ { t }$ in the direction of that specific vector. Let $y _ { t } ^ { i }$ denote $w _ { t } x _ { i }$ , the unnormalized component of $w _ { t }$ along $x _ { i }$ . We consider a batch update on the weights of the neural network. In that case:
532
+
533
+ $$
534
+ ( y _ { t } ^ { i } ) ^ { \prime } = \frac { \| x _ { i } \| ^ { 2 } z _ { t } } { 1 + e ^ { z _ { t } y _ { t } ^ { i } } } , \ ~ ( z _ { t } ) ^ { \prime } = \sum _ { i = 1 } ^ { m } \frac { y _ { t } ^ { i } } { 1 + e ^ { z _ { t } y _ { t } ^ { i } } } .
535
+ $$
536
+
537
+ Assuming that the vectors all have the same norm (denoted $\lVert x \rVert$ below) and that the $y _ { 0 } ^ { i }$ are all equal, then that equality remains true at all time (they follow the same update equation). We let $y _ { t }$ denote that value:
538
+
539
+ $$
540
+ ( y _ { t } ) ^ { \prime } = \frac { \| x \| ^ { 2 } z _ { t } } { 1 + e ^ { z _ { t } y _ { t } } } , \qquad ( z _ { t } ) ^ { \prime } = \frac { m y _ { t } } { 1 + e ^ { z _ { t } y _ { t } } } .
541
+ $$
542
+
543
+ A new invariant appears in those equations: $c : = | m y _ { 0 } ^ { 2 } - \| x \| ^ { 2 } z _ { 0 } ^ { 2 } |$ . In the case $c = 0$ (the other case can be treated as above), we obtain the following evolution equation for the logit of any point in the class:
544
+
545
+ $$
546
+ u ^ { \prime } ( t ) = \frac { 2 \sqrt { m } \lVert x \rVert u ( t ) } { 1 + e ^ { u ( t ) } } .
547
+ $$
548
+
549
+ We end up with a similar equation than before except for the $\sqrt { m }$ factor, which boosts the convergence speed. However, one should not forget that we are now training on a full batch (i.e. on $m$ points) during each unit of time. Performing the same number of updates for the single point class would√ generate a $m$ factor in the convergence speed of $u$ (one $\sqrt { m }$ factor for each $y$ and $z$ functions). The slower convergence for the more general case can be explained by the fact that each point is making an update on $w _ { t }$ in its own direction. That direction being orthogonal to all others points makes it useless for their classification.
550
+
551
+ # A.8 Relaxing assumption (H2)
552
+
553
+ Let us first recall that the assumption states:
554
+
555
+ We now assume that $h = 2$ and study the evolution of the first row $w _ { t } ^ { 1 }$ of matrix $W _ { t }$ , written $w _ { t }$ in the following. We relax assumption $( \mathrm { H } 2 )$ by assuming that there is a point $x _ { 2 }$ in $D _ { 2 }$ such that $w _ { 0 } x > 0$ . And we consider updates to $w _ { t }$ coming from sampling equally $x _ { 1 }$ from $D _ { 1 }$ and $x _ { 2 }$ from $D _ { 2 }$ . The evolution equations can be written as
556
+
557
+ $$
558
+ w _ { t } ^ { \prime } = \frac { x _ { 1 } ^ { T } z _ { t } } { 1 + e ^ { z _ { t } w _ { t } x _ { 1 } } } - \frac { x _ { 2 } ^ { T } z _ { t } } { 1 + e ^ { - z _ { t } w _ { t } x _ { 2 } } } , \qquad z _ { t } ^ { \prime } = \frac { w _ { t } x _ { 1 } } { 1 + e ^ { z _ { t } w _ { t } x _ { 1 } } } - \frac { w _ { t } x _ { 2 } } { 1 + e ^ { - z _ { t } w _ { t } x _ { 2 } } } .
559
+ $$
560
+
561
+ In order to make the analysis simpler, we assume that $x _ { 1 } ^ { T } x _ { 2 } = 0$ . We write $\alpha _ { t } ~ = ~ w _ { t } x _ { 1 }$ and $\beta _ { t } = w _ { t } x _ { 2 }$ . Any component of $w _ { 0 }$ orthogonal to both $x _ { 1 }$ and $x _ { 2 }$ will be untouched by the updates, and does not affect the classification performance of the network. This gives us
562
+
563
+ $$
564
+ \alpha _ { t } ^ { \prime } = \frac { \| x _ { 1 } \| ^ { 2 } z _ { t } } { 1 + e ^ { z _ { t } \alpha _ { t } } } , \qquad \beta _ { t } ^ { \prime } = - \frac { \| x _ { 2 } \| ^ { 2 } z _ { t } } { 1 + e ^ { - z _ { t } \beta _ { t } } } , \qquad z _ { t } ^ { \prime } = \frac { \alpha _ { t } } { 1 + e ^ { z _ { t } \alpha _ { t } } } - \frac { \beta _ { t } } { 1 + e ^ { - z _ { t } \beta _ { t } } } .
565
+ $$
566
+
567
+ By assumption, we know that $\alpha _ { 0 } , \beta _ { 0 } \ > \ 0$ . The system of ODEs (23) is invariant through the transformation $( \alpha _ { t } , \beta _ { t } , z _ { t } ) ( \beta _ { t } , \alpha _ { t } , - z _ { t } )$ so it is sufficient to study the case $z _ { 0 } \geq 0$ . Let us now state the theorem from the main text.
568
+
569
+ Theorem 3.4. Letting $c : = \alpha _ { 0 } ^ { 2 } / \| x _ { 1 } \| ^ { 2 } + \beta _ { 0 } ^ { 2 } / \| x _ { 2 } \| ^ { 2 } - z _ { 0 } ^ { 2 }$ , the solutions of (23) verify for all $t \geq 0$ , $\alpha _ { t } ^ { 2 } / \lVert x _ { 1 } \rVert ^ { 2 } + \beta _ { t } ^ { 2 } / \lVert x _ { 2 } \rVert ^ { 2 } - z _ { t } ^ { 2 } = c$ . In other terms, they live on hyperboloids (see Fig. 3 from the main text and Fig. 6).
570
+
571
+ ![](images/85075fed02f7104e2e1e5dacff6afb0c13c8754e89745ac3c6b72e0917c8ef6c.jpg)
572
+ Figure 6: Solutions of the ODE system for different initializations and $c = - 1$ . Trajectories live on a hyperboloid of two sheets. Any initialization on that surface will result in $\beta _ { t }$ reaching 0, or in other terms in class $D _ { 1 }$ prevailing. This curve and Fig. 3 from the main text are plotted with $\| x _ { 1 } \| = \| x _ { 2 } \| = 1$ .
573
+
574
+ If $c \leq 0$ , $\beta _ { t }$ reaches 0 at some point during training (see Fig. 6). If $c > 0$ , there exists a curve $\mathcal { C } _ { c }$ on the hyperboloid such that as $t \to + \infty$ , for any initialization $( \alpha _ { 0 } , \beta _ { 0 } , z _ { 0 } ) \in \mathcal { C } _ { c }$ :
575
+
576
+ $$
577
+ \alpha _ { t } \to ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } ) ^ { - 1 / 2 } \sqrt { c } , \qquad \beta _ { t } \to ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } ) ^ { - 1 / 2 } \sqrt { c } , \qquad z _ { t } \to 0 .
578
+ $$
579
+
580
+ That curve defines two regions of the initialization space. In one (colored yellow on Fig. 3 Left), trajectories verify $\alpha _ { t } = 0$ for some $t$ , in the other (colored green) $\beta _ { t }$ reaches 0 at some point.
581
+
582
+ Proof. It is easy to see from the system of ODEs (23) that $( \alpha _ { t } ^ { 2 } ) ^ { \prime } / \| x _ { 1 } \| ^ { 2 } + ( \beta _ { t } ^ { 2 } ) ^ { \prime } / \| x _ { 2 } \| ^ { 2 } - ( z _ { t } ^ { 2 } ) ^ { \prime } = 0 ,$ which directly gives the invariance of $\alpha _ { t } ^ { 2 } / \lVert x _ { 1 } \rVert ^ { 2 } + \beta _ { t } ^ { 2 } / \lVert x _ { 2 } \rVert ^ { 2 } - z _ { t } ^ { 2 }$ . This implies that the trajectories $( \alpha _ { t } , \beta _ { t } , z _ { t } )$ live on hyperboloids.
583
+
584
+ If $c < 0$ , the hyperboloid has two sheets (see Fig. 6). In particular, the trajectories verify: $z _ { t } ^ { 2 } =$ $\alpha _ { t } ^ { 2 } / \lVert x _ { 1 } \rVert ^ { 2 } + \beta _ { t } ^ { 2 } \hat { / } \lVert x _ { 2 } \rVert ^ { 2 } - c \geq - c$ which means that $z _ { t }$ is bounded away from 0. As long as $\beta _ { t } \geq 0$ , we have $\begin{array} { r } { \beta _ { t } ^ { \prime } = - \frac { \| x _ { 2 } \| ^ { 2 } z _ { t } } { 1 + e ^ { - z _ { t } \beta _ { t } } } \leq \frac { \| x _ { 2 } \| ^ { 2 } c } { 2 } } \end{array}$ . This implies that $\beta _ { t }$ will reach 0 in a finite time since it decreases at a rate larger than a strictly positive number. At that point, the ReLU ensures that $\beta _ { t }$ does not evolve anymore, and that $\beta _ { t }$ ’s contribution to $z _ { t }$ disappears. The evolution equations turn into the ones studied in the previous paragraphs, plotted as the green hyperbola in the plane $\beta = 0$ in Fig. 6.
585
+
586
+ If $c = 0$ , we know that $z _ { t } ^ { 2 } = \alpha _ { t } ^ { 2 } / \| x _ { 1 } \| ^ { 2 } + \beta _ { t } ^ { 2 } / \| x _ { 2 } \| ^ { 2 } \geq \alpha _ { t } ^ { 2 } / \| x _ { 1 } \| ^ { 2 } \geq \alpha _ { 0 } ^ { 2 } / \| x _ { 1 } \| ^ { 2 }$ $\scriptstyle ( \alpha _ { t }$ increases as long as $z _ { t }$ is positive), so the same argument about $\beta _ { t }$ holds.
587
+
588
+ If $c > 0$ , let us first note that the point $\begin{array} { r } { \big ( \big ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } \big ) ^ { - 1 / 2 } \sqrt { c } , \big ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } \big ) ^ { - 1 / 2 } \sqrt { c } , 0 \big ) } \end{array}$ belongs to the hyperboloid and is stationary (the three derivatives are 0). Classic results on ordinary differential equations (Tenenbaum & Pollard, 1985) then give the result. Finding a closed-form solution to the shape of $\mathcal { C } _ { c }$ is to the best of our knowledge impossible. One can however obtain an approximation by considering a point $\begin{array} { r } { \big ( \big ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } \big ) ^ { - 1 / 2 } \sqrt { c - \epsilon } , \big ( \frac { 1 } { \| x _ { 1 } \| ^ { 2 } } + \frac { 1 } { \| x _ { 2 } \| ^ { 2 } } \big ) ^ { - 1 / 2 } \sqrt { c + \epsilon } , 0 \big ) } \end{array}$ for a small $\epsilon$ and applying finite difference methods to the evolution equations (23) to build the trajectory.
589
+
590
+ # Appendix B: Deeper Neural Networks
591
+
592
+ In this section we study the case of a deeper network with $N - 1$ hidden layers. Similarly to above, we can prove the existence of independent modes of learning. To that end, neurons need to be activated in a disjoint manner from one class to the other. Due to the growing complexity of the interactions between the parameters of the network, this requires very strong assumptions on the initialization of the network and on the shape of the network. Assuming that the network is written as
593
+
594
+ $$
595
+ P _ { t } ( x ) : = \sigma ( Z _ { t } ^ { T } ( Z _ { t } ^ { N - 2 } \cdot \cdot \cdot ( Z _ { t } ^ { 1 } ( W _ { t } x ) _ { + } ) _ { + } \cdot \cdot \cdot ) _ { + } ) ,
596
+ $$
597
+
598
+ with $W _ { t }$ an $h \times d$ matrix and for all $1 \leq i \leq N - 2$ , $Z _ { t } ^ { i }$ an $h \times h$ matrix. We maintain assumption (H2) from the main text, and extend (H3) to all $Z _ { t } ^ { i }$ by assuming that they are diagonal, and that the $j$ -th element of their diagonal is positive if $j \in \mathcal { I } _ { 1 }$ , negative otherwise. To simplify notations, we go back to assuming $h = 2$ and take an update on $x \in D _ { 1 }$ . Only the first elements of every matrix are modified, we write them $z _ { t } ^ { i }$ and keep the notations $z _ { t }$ , $w _ { t }$ and $y _ { t }$ . We can then write the evolution equations:
599
+
600
+ $$
601
+ z _ { t } ^ { \prime } = \frac { z _ { t } ^ { N - 2 } \cdot \cdot \cdot z _ { t } ^ { 1 } y _ { t } } { 1 + e ^ { u ( t ) } } , \qquad ( z _ { t } ^ { i } ) ^ { \prime } = \frac { z _ { t } z _ { t } ^ { N - 2 } \cdot \cdot \cdot z _ { t } ^ { i + 1 } z _ { t } ^ { i - 1 } \cdot \cdot \cdot y _ { t } } { 1 + e ^ { u ( t ) } } , \qquad y _ { t } ^ { \prime } = \frac { \| x \| ^ { 2 } z _ { t } z _ { t } ^ { N - 2 } \cdot \cdot \cdot z _ { t } ^ { 1 } } { 1 + e ^ { u ( t ) } } ,
602
+ $$
603
+
604
+ with $u ( t ) = z _ { t } \ \Pi z _ { t } ^ { i } \ y _ { t }$ . Assuming that $\begin{array} { r } { z _ { 0 } = z _ { 0 } ^ { 1 } = \ldots = z _ { 0 } ^ { N - 1 } = \frac { y _ { 0 } } { \| x \| } } \end{array}$ y0kxk , we see that those equals remain true throughout training. This gives us
605
+
606
+ $$
607
+ z _ { t } ^ { \prime } = \frac { ( z _ { t } ) ^ { N - 1 } \| x \| } { 1 + e ^ { u ( t ) } } , \qquad u ( t ) = ( z _ { t } ) ^ { N } \| x \| , \qquad u ^ { \prime } ( t ) = N ( z _ { t } ) ^ { N - 1 } z _ { t } ^ { \prime } \| x \| .
608
+ $$
609
+
610
+ Combining those equations gives us the ODE verified by the logit of our system
611
+
612
+ $$
613
+ u ^ { \prime } ( t ) = \frac { N \| x \| ^ { 2 / N } u ^ { 2 - 2 / N } ( t ) } { 1 + e ^ { u ( t ) } } .
614
+ $$
615
+
616
+ The solution of that equation for $N = 4$ and $N = 8$ can be found on Fig. 7. Here too, a sigmoidal shape appears during the learning process. The effect of $\lVert x \rVert$ reduces as $N$ grows due to the power $2 / N$ , however, larger values still converge faster (e.g. the blue and yellow curves). Additionally, as noted in Saxe et al. (2013b) for linear networks: the deeper the network, the faster the learning. This fact is studied in more details in Arora et al. (2018) where depth is shown to accelerate convergence in some cases.
617
+
618
+ ![](images/fb577d3b6f9d1e78972298ee90f4eded6aeedee5ebfbf014a9c64222401a398d.jpg)
619
+ Figure 7: Logit $u ( t )$ and confidence $P _ { t }$ for different number of layers and values of $\lVert x \rVert$ .
620
+
621
+ # Appendix C: Hinge Loss
622
+
623
+ # C.1 Proof of Theorem 4.1
624
+
625
+ In this section we prove Theorem 4.1 from the main text on the dynamics of learning in the case of the Hinge loss:
626
+
627
+ $$
628
+ L _ { H } ( W _ { t } , Z _ { t } ; x ) = \operatorname* { m a x } ( 0 , 1 - Z _ { t } ^ { T } ( W _ { t } x ) _ { + } \cdot ( \mathbb { 1 } _ { x \in D _ { 1 } } - \mathbb { 1 } _ { x \in D _ { 2 } } ) ) .
629
+ $$
630
+
631
+ Let us consider updates made after observing a point $x \in D _ { 1 }$ , the converse can be treated similarly with a simple change of sign. The system of ordinary differential equations verified by the parameters of our network is:
632
+
633
+ $$
634
+ y _ { t } ^ { \prime } = \| x \| ^ { 2 } z _ { t } , \qquad z _ { t } ^ { \prime } = y _ { t } .
635
+ $$
636
+
637
+ The same relation between $y _ { t }$ and $z _ { t }$ appears in those equations than in the cross-entropy case. Defining $c$ similarly, we have $u ^ { \prime } ( t ) = 2 \| x \| u ( t )$ in the case where $c = 0$ , leading to $u ( t ) = \bar { u _ { 0 } } e ^ { 2 \| x \| t }$ . When $c \neq 0$ , the same change of variables can be applied and leads to
638
+
639
+ $$
640
+ y _ { t } = \sqrt { c } \cosh ( \frac { \theta _ { 0 } } { 2 } + \Vert x \Vert { t } ) , z _ { t } = \frac { \sqrt { c } } { \Vert x \Vert } \sinh ( \frac { \theta _ { 0 } } { 2 } + \Vert x \Vert { t } ) , u _ { t } = \frac { c } { 2 \Vert x \Vert } \sinh ( \theta _ { 0 } + 2 \Vert x \Vert { t } ) ,
641
+ $$
642
+
643
+ with $\begin{array} { r } { \theta _ { 0 } = \cosh ^ { - 1 } \bigl ( \frac { y _ { 0 } ^ { 2 } + \| x \| ^ { 2 } z _ { 0 } ^ { 2 } } { c _ { \star } } \bigr ) } \end{array}$ . Those equations are only valid until $u _ { t }$ reaches 12. At that point learning stops, the network has converged. If the initialization is such that that condition is already verified, then the weights will not change as they already solve the task. The learning curves along with the initialization diagram can be found in Fig. 8. We notice a hard sigmoidal shape, corresponding to learning stopping when $u _ { t }$ reaches 1.
644
+
645
+ # C.2 General treatment
646
+
647
+ Let us now consider the general case of a class containing an arbitrary number of points $D _ { 1 } =$ $\{ x _ { i } \} _ { 1 \leq i \leq m } \subset \mathbb { R } ^ { d }$ . We consider the case of updates done in full batches (standard gradient descent in other words). In that case, we see that the network obeys the following dynamics:
648
+
649
+ $$
650
+ w _ { t } ^ { \prime } = z _ { t } \sum _ { i = 1 } ^ { m } x _ { i } ^ { T } , \qquad z _ { t } ^ { \prime } = w _ { t } \sum _ { i = 1 } ^ { m } x _ { i } ^ { T } .
651
+ $$
652
+
653
+ Letting $X = \sum _ { i = 1 } ^ { m } x _ { i }$ denote the sum of all the datapoints in that class, we see that those dynamics boil down to our previous treatment for a single point. The same cases appear, depending on the value of $c : = | ( w _ { 0 } \dot { X } ) ^ { 2 } - \| X \| ^ { 2 } z _ { 0 } ^ { 2 } |$ . We explicitly treat the $c > 0$ case. Following the methods above, we see that: $\begin{array} { r } { w _ { t } = y _ { t } \frac { X ^ { T } } { \lVert X \rVert ^ { 2 } } + w _ { 0 } ^ { \perp } } \end{array}$ where $y _ { t } = \sqrt { c } \cosh ( \frac { \theta _ { 0 } } { 2 } + \| X \| t )$ and $w _ { 0 } ^ { T }$ is the component of $w _ { 0 }$ orthogonal to $X$ (and thus unchanged during training). With $z _ { t }$ and $u _ { t }$ defined as above (with $X$ instead of $x$ ), an arbitrary example $x$ is then classified as
654
+
655
+ $$
656
+ P ( x \in D _ { 1 } ) = z _ { t } y _ { t } { \frac { X ^ { T } x } { \| X \| ^ { 2 } } } + z _ { t } w _ { 0 } ^ { \perp } x = u _ { t } { \frac { X ^ { T } x } { \| X \| ^ { 2 } } } + z _ { t } w _ { 0 } ^ { \perp } x .
657
+ $$
658
+
659
+ # Appendix D: Gradient Starvation
660
+
661
+ In this section, we prove a relaxed version of Theorem 5.1 from the main text:
662
+
663
+ Theorem D.2. Let $\delta$ be our confidence requirement on class $D _ { 1 }$ i.e. the training stops as soon as $\forall x \in D _ { 1 }$ , $P _ { t } ( x \in D _ { 1 } ) \geq 1 - \delta$ . Let $t ^ { * }$ denote that instant i.e. $\begin{array} { r } { z _ { t ^ { * } } \alpha _ { t ^ { * } } = \log ( \frac { 1 - \stackrel { \smile } { \delta } } { \delta } ) } \end{array}$ . If $\beta _ { 0 } < 0$ , the inequality (9) from the main text is valid. Otherwise, with $w _ { 0 } = \left( \alpha _ { 0 } x _ { 1 } , \beta _ { 0 } x _ { 2 } \right) + \left( x _ { 1 } ^ { \perp } , x _ { 2 } ^ { \perp } \right)$ , we have
664
+
665
+ $$
666
+ P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } ) \leq \frac { 1 } { 1 + e ^ { - \lambda \log ( \frac { 1 - \delta } { \delta } ) - z _ { t ^ { * } } ( \beta _ { 0 } - \alpha \alpha _ { 0 } ) } } .
667
+ $$
668
+
669
+ Proof. We start with the $\beta _ { 0 } < 0$ case. If $\beta _ { t ^ { * } }$ is negative, the result from the main text clearly holds. Otherwise, there exists $\tilde { t } < t ^ { * }$ such that $\beta _ { \tilde { t } } = 0$ ( $\beta _ { t }$ is increasing). The proof of Theorem 5.1 from the main text can then directly be applied to $[ \tilde { t } , t ^ { * } ]$ . If $\beta _ { 0 } > 0$ , the inequality on $\alpha _ { t } ^ { \prime }$ and $\beta _ { t } ^ { \prime }$ holds and gives $\beta _ { t } \le \beta _ { 0 } + ( \alpha _ { t } - \alpha _ { 0 } ) \lambda$ . Plugging it into $P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } )$ ) concludes our proof. □
670
+
671
+ In the main text, we assume that $\beta _ { 0 } - \alpha \alpha _ { 0 } < 0$ and obtain a bound on the confidence which is independent from $\alpha _ { 0 }$ and $\beta _ { 0 }$ . Using that bound allows to obtain Fig. 9, but is partly unfair as the initialization of the network is already favoring the strong feature.
672
+
673
+ However, we note that under small random initialization $z _ { t ^ { * } }$ and $\alpha _ { t ^ { * } }$ are of the same order of magnitude and $\left( \beta _ { 0 } - \alpha \alpha _ { 0 } \right)$ is very small compared to $\log ( \frac { 1 - \delta } { \delta } )$ . The additional term in the denominator thus has a limited effect on the exponential, gradient starvation is still happening (a fact confirmed by the experiment on the cats and dogs dataset). In the main text, Fig. 5 plots the upper bound for a fair initialization $\alpha _ { 0 } = \beta _ { 0 } = 0 . 1$ (in that case, we need to assume that $z _ { t ^ { * } } = \alpha _ { t ^ { * } }$ ).
674
+
675
+ ![](images/e933f4b848f9f5a236a4b05e1b089628a912b3c278feb6f479d8434ce078cc0a.jpg)
676
+ Figure 8: Solution of Eq.26.
677
+
678
+ ![](images/9c77039d1d135875bd3fb0e0e5b2c9f96e71bfbceefac3e7fd5ee6a1be5bdaad.jpg)
679
+ Figure 9: Upper bound on $P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } )$ as a function of $1 - \delta$ for different values of $\lambda$ .
680
+
681
+ Appendix E: Experimental Details
682
+
683
+ # E.1 Mixture of Gaussian experiment
684
+
685
+ In this experiment, the data is constructed using eight independent Gaussian distributions around a unit circle. The variance of each Gaussian is chosen such that all eight modes of the data are separated by regions of low data probability, but still contain a reasonable amount of variance. This simple experiment resembles multi-modal datasets. Although this task might seem simple, in practice many generative adversarial networks fail to capture all the modes. This problem is generally known as mode collapse.
686
+
687
+ As shown in the main text, using the hinge loss instead of the common binary cross-entropy loss alleviates the problem significantly. The architectures used for the generator and discriminator both consist of four hidden layers where each layer has 256 hidden units. As a common choice, a ReLU is used as the non-linearity function for hidden units. The length of the noise input vector is 128. The Adam optimizer (Kingma & Ba, 2014) was applied during training with $\alpha \stackrel { - } { = } 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 5$ and $\beta _ { 2 } = 0 . 9$ . The PyTorch framework (Paszke et al., 2017) was used to conduct the experiment.
688
+
689
+ # E.2 Dogs vs. Cats classification with light effect
690
+
691
+ For the purpose of highlighting the fact that the most frequent feature starved all the others, we conducted an experiment on a classification task. We modified the cats and dogs dataset (Kaggle, 2018) by setting the cats images to be lighter than the dogs images. To do so, each pixel in a cat image is scaled to be between 0 and 127 while each pixel in a dog image is scaled to be between 128 and 255. The dataset consists of 12500 images of each class. The classifier has an architecture similar to VGG16 (Simonyan & Zisserman, 2014). In order to isolate the effect of the induced bias, no regularization was applied. The Adam optimizer was applied here as well during training with $\alpha = \bar { 1 } 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9$ . The PyTorch framework was used to conduct the experiment.
md/train/Hk8N3Sclg/Hk8N3Sclg.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTI-AGENT COOPERATIONAND THE EMERGENCE OF (NATURAL) LANGUAGE
2
+
3
+ Angeliki Lazaridou1∗, Alexander Peysakhovich2, Marco Baroni2,3 1Google DeepMind, 2Facebook AI Research, 3University of Trento angeliki@google.com, {alexpeys,mbaroni}@fb.com
4
+
5
+ # ABSTRACT
6
+
7
+ The current mainstream approach to train natural language systems is to expose them to large amounts of text. This passive learning is problematic if we are interested in developing interactive machines, such as conversational agents. We propose a framework for language learning that relies on multi-agent communication. We study this learning in the context of referential games. In these games, a sender and a receiver see a pair of images. The sender is told one of them is the target and is allowed to send a message from a fixed, arbitary vocabulary to the receiver. The receiver must rely on this message to identify the target. Thus, the agents develop their own language interactively out of the need to communicate. We show that two networks with simple configurations are able to learn to coordinate in the referential game. We further explore how to make changes to the game environment to cause the “word meanings” induced in the game to better reflect intuitive semantic properties of the images. In addition, we present a simple strategy for grounding the agents’ code into natural language. Both of these are necessary steps towards developing machines that are able to communicate with humans productively.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ I tried to break it to him gently [...] the only way to learn an unknown language is to interact with a native speaker [...] asking questions, holding a conversation, that sort of thing [...] If you want to learn the aliens’ language, someone [...] will have to talk with an alien. Recordings alone aren’t sufficient.
12
+
13
+ Ted Chiang, Story of Your Life
14
+
15
+ One of the main aims of AI is to develop agents that can cooperate with others to achieve goals (Wooldridge, 2009). Such coordination requires communication. If the coordination partners are to include humans, the most obvious channel of communication is natural language. Thus, handling natural-language-based communication is a key step toward the development of AI that can thrive in a world populated by other agents.
16
+
17
+ Given the success of deep learning models in related domains such as image captioning or machine translation (e.g., Sutskever et al., 2014; Xu et al., 2015), it would seem reasonable to cast the problem of training conversational agents as an instance of supervised learning (Vinyals & Le, 2015). However, training on “canned” conversations does not allow learners to experience the interactive aspects of communication. Supervised approaches, which focus on the structure of language, are an excellent way to learn general statistical associations between sequences of symbols. However, they do not capture the functional aspects of communication, i.e., that humans use words to coordinate with others and make things happen (Austin, 1962; Clark, 1996; Wittgenstein, 1953).
18
+
19
+ This paper introduces the first steps of a research program based on multi-agent coordination communication games. These games place agents in simple environments where they need to develop a language to coordinate and earn payoffs. Importantly, the agents start as blank slates, but, by playing a game together, they can develop and bootstrap knowledge on top of each others, leading to the emergence of a language.
20
+
21
+ The central problem of our program, then, is the following: How do we design environments that foster the development of a language that is portable to new situations and to new communication partners (in particular humans)?
22
+
23
+ We start from the most basic challenge of using a language in order to refer to things in the context of a two-agent game. We focus on two questions. First, whether tabula rasa agents succeed in communication. Second, what features of the environment lead to the development of codes resembling human language.
24
+
25
+ We assess this latter question in two ways. First, we consider whether the agents associate general conceptual properties, such as broad object categories (as opposed to low-level visual properties), to the symbols they learn to use. Second, we examine whether the agents’ “word usage” is partially interpretable by humans in an online experiment.
26
+
27
+ Other researchers have proposed communication-based environments for the development of coordination-capable AI. Work in multi-agent systems has focused on the design of pre-programmed communication systems to solve specific tasks (e.g., robot soccer, Stone & Veloso 1998). Most related to our work, Sukhbaatar et al. (2016) and Foerster et al. (2016) show that neural networks can evolve communication in the context of games without a pre-coded protocol. We pursue the same question, but further ask how we can change our environment to make the emergent language more interpretable.
28
+
29
+ Others (e.g., the SHRLDU program of Winograd 1971 or the game in Wang et al. 2016) propose building a communicating AI by putting humans in the loop from the very beginning. This approach has benefits but faces serious scalability issues, as active human intervention is required at each step. An attractive component of our game-based paradigm is that humans may be added as players, but do not need to be there all the time.
30
+
31
+ A third branch of research focuses on “Wizard-of-Oz” environments, where agents learn to play games by interacting with a complex scripted environment (Mikolov et al., 2015). This approach gives the designer tight control over the learning curriculum, but imposes a heavy engineering burden on developers. We also stress the importance of the environment (game setup), but we focus on simpler environments with multiple agents that force them to get smarter by bootstrapping on top of each other.
32
+
33
+ We leverage ideas from work in linguistics, cognitive science and game theory on the emergence of language (Wagner et al., 2003; Skyrms, 2010; Crawford & Sobel, 1982; Crawford, 1998). Our game is a variation of Lewis’ signaling game (Lewis, 1969). There is a rich tradition of linguistic and cognitive studies using similar setups (e.g., Briscoe, 2002; Cangelosi & Parisi, 2002; Spike et al., 2016; Steels & Loetzsch, 2012). What distinguishes us from this literature is our aim to, eventually, develop practical AI. This motivates our focus on more realistic input data (a large collection of noisy natural images) and on trying to align the agents’ language with human intuitions.
34
+
35
+ Lewis’ classic games have been studied extensively in game theory under the name of “cheap talk”. These games have been used as models to study the evolution of language both theoretically and experimentally (Crawford, 1998; Blume et al., 1998; Crawford & Sobel, 1982). A major question in game theory is whether equilibrium actually occurs in a game as convergence in learning is not guaranteed (Fudenberg & Peysakhovich, 2014; Roth & Erev, 1995). And, if an equilibrium is reached, which one it will be (since they are typically not unique). This is particularly true for cheap talk games, which exhibit Nash equilibria in which precise language emerges, others where vague language emerges and others where no language emerges at all (Crawford & Sobel, 1982). In addition, because in these games language has no ex-ante meaning and only emerges in the context of the equilibrium, some of the emergent languages may not be very natural. Our results speak to both the convergence question and the question of what features of the game cause the appearance of different types of languages. Thus, our results are also of interest to game theorists.
36
+
37
+ An evolutionary perspective has recently been advocated as a way to mitigate the data hunger of traditional supervised approaches (Goodfellow et al., 2014; Silver et al., 2016). This research confirms that learning can be bootstrapped from competition between agents. We focus, however, on cooperation between agents as a way to foster learning while reducing the need for annotated data.
38
+
39
+ # 2 GENERAL FRAMEWORK
40
+
41
+ Our general framework includes K players, each parametrized by $\theta _ { k }$ , a collection of tasks/games that the players have to perform, a communication protocol $V$ that enables the players to communicate with each other, and payoffs assigned to the players as a deterministic function of a well-defined goal. In this paper we focus on a particular version of this: referential games. These games are structured as follows.
42
+
43
+ 1. There is a set of images represented by vectors $\{ i _ { 1 } , \dotsc , i _ { N } \}$ , two images are drawn at random from this set, call them $( i _ { L } , i _ { R } )$ , one of them is chosen to be the “target” $t \in \{ L , R \}$
44
+ 2. There are two players, a sender and a receiver, each seeing the images - the sender receives input $\theta _ { S } ( i _ { L } , i _ { R } , t )$
45
+ 3. There is a vocabulary $V$ of size $K$ and the sender chooses one symbol to send to the receiver, we call this the sender’s policy $s ( \theta _ { S } ( i _ { L } , i _ { R } , t ) ) \in V$
46
+ 4. The receiver does not know the target, but sees the sender’s symbol and tries to guess the target image. We call this the receiver’s policy $r ( i _ { L } , i _ { R } , s ( \theta _ { S } ( i _ { L } , i _ { R } , t ) ) ) \in \{ L , \bar { R } \}$
47
+ 5. If $r ( i _ { L } , i _ { R } , s ( \theta _ { S } ( i _ { L } , i _ { R } , t ) ) = t$ , that is, if the receiver guesses the target, both players receive a payoff of 1 (win), otherwise they receive a payoff of 0 (lose).
48
+
49
+ Many extensions to the basic referential game explored here are possible. There can be more images, or a more sophisticated communication protocol (e.g., communication of a sequence of symbols or multi-step communication requiring back-and-forth interaction1), rotation of the sender and receiver roles, having a human occasionally playing one of the roles, etc.
50
+
51
+ # 3 EXPERIMENTAL SETUP
52
+
53
+ Images We use the McRae et al.’s (2005) set of 463 base-level concrete concepts (e.g., cat, apple, car. . . ) spanning across 20 general categories (e.g., animal, fruit/vegetable, vehicle. . . ). We randomly sample 100 images of each concept from ImageNet (Deng et al., 2009). To create target/distractor pairs, we randomly sample two concepts, one image for each concept and whether the first or second image will serve as target. We apply to each image a forward-pass through the pretrained VGG ConvNet (Simonyan & Zisserman, 2014), and represent it with the activations from either the top 1000-D softmax layer (sm) or the second-to-last 4096-D fully connected layer $( f c )$ .
54
+
55
+ Agent Players Both sender and receiver are simple feed-forward networks. For the sender, we experiment with the two architectures depicted in Figure 1. Both sender architectures take as input the target (marked with a green square in Figure 1) and distractor representations, always in this order, so that they are implicitly informed of which image is the target (the receiver, instead, sees the two images in random order).
56
+
57
+ The agnostic sender is a generic neural network that maps the original image vectors onto a “gamespecific” embedding space (in the sense that the embedding is learned while playing the game) followed by a sigmoid nonlinearity. Fully-connected weights are applied to the embedding concatenation to produce scores over vocabulary symbols.
58
+
59
+ The informed sender also first embeds the images into a “game-specific” space. It then applies 1-D convolutions (“filters”) on the image embeddings by treating them as different channels. The informed sender uses convolutions with kernel size 2x1 applied dimension-by-dimension to the two image embeddings (in Figure 1, there are 4 such filters). This is followed by the sigmoid nonlinearity. The resulting feature maps are combined through another filter (kernel size $f \mathrm { x } 1$ , where $f$ is the number of filters on the image embeddings), to produce scores for the vocabulary symbols. Intuitively, the informed sender has an inductive bias towards combining the two images dimensionby-dimension whereas the agnostic sender does not (though we note the agnostic architecture nests the informed one).
60
+
61
+ ![](images/922b96f905d5c5ad3d20244a196d7b3b633b7d9cf1391770bbbb062b580fc805.jpg)
62
+ Figure 1: Architectures of agent players.
63
+
64
+ For both senders, motivated by the discrete nature of language, we enforce a strong communication bottleneck that discretizes the communication protocol. Activations on the top (vocabulary) layer are converted to a Gibbs distribution (with temperature parameter $\tau$ ), and then a single symbol $s$ is sampled from the resulting probability distribution.
65
+
66
+ The receiver takes as input the target and distractor image vectors in random order, as well as the symbol produced by the sender (as a one-hot vector over the vocabulary). It embeds the images and the symbol into its own “game-specific” space. It then computes dot products between the symbol and image embeddings. Ideally, dot similarity should be higher for the image that is better denoted by the symbol. The two dot products are converted to a Gibbs distribution (with temperature $\tau$ ) and the receiver “points” to an image by sampling from the resulting distribution.
67
+
68
+ General Training Details We set the following hyperparameters without tuning: embedding dimensionality: 50, number of filters applied to embeddings by informed sender: 20, temperature of Gibbs distributions: 10. We explore two vocabulary sizes: 10 and 100 symbols.
69
+
70
+ The sender and receiver parameters $\theta = \langle \theta _ { R } , \theta _ { S } \rangle$ are learned while playing the game. No weights are shared and the only supervision used is communication success, i.e., whether the receiver pointed at the right referent.
71
+
72
+ This setup is naturally modeled with Reinforcement Learning (Sutton & Barto, 1998). As outlined in Section 2, the sender follows policy $s ( \theta _ { S } ( i _ { L } , i _ { R } , t ) ) \ \in \ V$ and the receiver policy $r ( i _ { L } , i _ { R } , s ( \theta _ { S } ( i _ { L } , i _ { R } , t ) ) ) \ \in \ \{ \{ L , { R } \}$ . The loss function that the two agents must minimize is $- { \bf E } _ { \widetilde { r } } [ R ( \widetilde { r } ) ]$ where $R$ is the reward function returning 1 iff $r ( i _ { L } , i _ { R } , s ( \theta _ { S } ( \bar { i } _ { L } , i _ { R } , t ) ) = t$ . Parameters are updated through the Reinforce rule (Williams, 1992). We apply mini-batch updates, with a batch size of 32 and for a total of $5 0 \mathrm { k }$ iterations (games). At test time, we compile a set of $1 0 \mathrm { k }$ games using the same method as for the training games.
73
+
74
+ We now turn to our main questions. The first is whether the agents can learn to successfully coordinate in a reasonable amount of time. The second is whether the agents’ language can be thought of as “natural language”, i.e., symbols are assigned to meanings that make intuitive sense in terms of our conceptualization of the world.
75
+
76
+ # 4 LEARNING TO COMMUNICATE
77
+
78
+ Our first question is whether agents converge to successful communication at all. We see that they do: agents almost perfectly coordinate in the 1k rounds following the 10k training games for every architecture and parameter choice (Table 1).
79
+
80
+ We see, though, some differences between different sender architectures. Figure 2 (left) shows performance on a sample of the test set as a function of the first 5,000 rounds of training. The agents
81
+
82
+ ![](images/8b7ccb74f6ae2d5d2910b3273bff3233f9d817f0ba835a8d414dbe490337ebfa.jpg)
83
+ Figure 2: Left: Communication success as a function of training iterations, we see that informed senders converge faster than agnostic ones. Right: Spectrum of an example symbol usage matrix: the first few dimensions do capture only partial variance, suggesting that the usage of more symbols by the informed sender is not just due to synonymy.
84
+
85
+ <table><tr><td rowspan=1 colspan=1>id</td><td rowspan=1 colspan=2>sender</td><td rowspan=1 colspan=1>visrep</td><td rowspan=1 colspan=1>vocsize</td><td rowspan=1 colspan=1>usedsymbols</td><td rowspan=1 colspan=1>commsuccess(%)</td><td rowspan=1 colspan=2>purity (%)</td><td rowspan=1 colspan=1>obs-chancepurity (%)</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=2>informed</td><td rowspan=1 colspan=1>sm</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=2>46</td><td rowspan=2 colspan=1>2723</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=2>informed</td><td rowspan=1 colspan=1>fc</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>38</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=2>41</td></tr><tr><td rowspan=5 colspan=1>34567</td><td rowspan=4 colspan=2>informedinformedagnosticagnostic</td><td rowspan=1 colspan=1>informed</td><td rowspan=1 colspan=1>sm</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=2>100</td><td rowspan=1 colspan=1>35</td></tr><tr><td rowspan=1 colspan=1>fc</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=2>32</td><td></td></tr><tr><td rowspan=1 colspan=1>sm</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=2>21</td><td rowspan=2 colspan=1>1515</td></tr><tr><td rowspan=1 colspan=1>fc</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=2>21</td></tr><tr><td rowspan=1 colspan=2>agnostic</td><td rowspan=1 colspan=1>sm</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=2>20</td><td rowspan=1 colspan=1>15</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=2>agnostic</td><td rowspan=1 colspan=1>fc</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=2>19</td><td rowspan=1 colspan=1>15</td></tr></table>
86
+
87
+ Table 1: Playing the referential game: test results after 50K training games. Used symbols column reports number of distinct vocabulary symbols that were produced at least once in the test phase. See text for explanation of comm success and purity. All purity values are highly significant $( p < 0 . 0 0 1 )$ compared to simulated chance symbol assignment when matching observed symbol usage. The obschance purity column reports the difference between observed and expected purity under chance.
88
+
89
+ converge to coordination quite fast, but the informed sender reaches higher levels more quickly than the agnostic one.
90
+
91
+ The informed sender makes use of more symbols from the available vocabulary, while the agnostic sender constantly uses a compact 2-symbol vocabulary. This suggests that the informed sender is using more varied and word-like symbols (recall that the images depict 463 distinct objects, so we would expect a natural-language-endowed sender to use a wider array of symbols to discriminate among them). However, it could also be the case that the informed sender vocabulary simply contains higher redundancy/synonymy. To check this, we construct a (sampled) matrix where rows are game image pairs, columns are symbols, and entries represent how often that symbol is used for that pair. We then decompose the matrix through SVD. If the sender is indeed just using a strategy with few effective symbols but high synonymy, then we should expect a 1- or 2-dimensional decomposition. Figure 2 (right) plots the normalized spectrum of this matrix. While there is some redundancy in the matrix (thus potentially implying there is synonymy in the usage), the language still requires multiple dimensions to summarize (cross-validated SVD suggests 50 dimensions).
92
+
93
+ We now turn to investigating the semantic properties of the emergent communication protocol. Recall that the vocabulary that agents use is arbitrary and has no initial meaning. One way to understand its emerging semantics is by looking at the relationship between symbols and the sets of images they refer to.
94
+
95
+ ![](images/2ca860e20014c9fd162e1ab3ea2256686254b0b07c3b8026c618d83be37358a3.jpg)
96
+ Figure 3: t-SNE plots of object fc vectors color-coded by majority symbols assigned to them by informed sender. Object class names shown for a random subset. Left: configuration of 4th row of Table 1. Right: 2nd row of Table 2.
97
+
98
+ The objects in our images were categorized into 20 broader categories (such as weapon and mammal) by McRae et al. (2005). If the agents converged to higher level semantic meanings for the symbols, we would expect that objects belonging to the same category would activate the same symbols, e.g., that, say, when the target images depict bayonets and guns, the sender would use the same symbol to refer to them, whereas cows and guns should not share a symbol.
99
+
100
+ To quantify this, we form clusters by grouping objects by the symbols that are most often activated when target images contain them. We then assess the quality of the resulting clusters by measuring their purity with respect to the McRae categories. Purity (Zhao & Karypis, 2003) is a standard measure of cluster “quality”. The purity of a clustering solution is the proportion of category labels in the clusters that agree with the respective cluster majority category. This number reaches $100 \%$ for perfect clustering and we always compare the observed purity to the score that would be obtained from a random permutation of symbol assignments to objects. Table 1 shows that purity, while far from perfect, is significantly above chance in all cases. We confirm moreover that the informed sender is producing symbols that are more semantically natural than those of the agnostic one.
101
+
102
+ Still, surprisingly, purity is significantly above chance even when the latter is only using two symbols. From our qualitative evaluations, in this case the agents converge to a (noisy) characterization of objects as “living-vs-non-living” which, intriguingly, has been recognized as the most basic one in the human semantic system (Caramazza & Shelton, 1998).
103
+
104
+ Rather than using hard clusters, we can also ask whether symbol usage reflects the semantics of the visual space. To do so we construct vector representations for each object (defined by its ImageNet label) by averaging the CNN fc representations of all category images in our data-set (see Section 3 above). Note that the fc layer, being near the top of a deep CNN, is expected to capture highlevel visual properties of objects (Zeiler & Fergus, 2014). Moreover, since we average across many specific images, our vectors should capture rather general, high-level properties of objects.
105
+
106
+ We map these average object vectors to 2 dimensions via t-SNE mapping (Van der Maaten & Hinton, 2008) and we color-code them by the majority symbol the sender used for images containing the corresponding object. Figure 3 (left) shows the results for the current experiment. We see that objects that are close in CNN space (thus, presumably, visually similar) are associated to the same symbol (same color). However, there still appears to be quite a bit of variation.
107
+
108
+ # 4.1 OBJECT-LEVEL REFERENCE
109
+
110
+ We established that our agents can solve the coordination problem, and we have at least tentative evidence that they do so by developing symbol meanings that align with our semantic intuition. We
111
+
112
+ <table><tr><td>id</td><td>sender</td><td>vis rep</td><td>voc size</td><td>used symbols</td><td>comm success(%)</td><td>purity (%)</td><td>obs-chance purity (%)</td></tr><tr><td>1</td><td>informed</td><td>fc</td><td>100</td><td>43</td><td>100</td><td>45</td><td>21</td></tr><tr><td>2</td><td>informed</td><td>fc</td><td>10</td><td>10</td><td>100</td><td>37</td><td>19</td></tr><tr><td>3</td><td>agnostic</td><td>fc</td><td>100</td><td>2</td><td>92</td><td>23</td><td>7</td></tr><tr><td>4</td><td>agnostic</td><td>fc</td><td>10</td><td>3</td><td>98</td><td>28</td><td>12</td></tr></table>
113
+
114
+ Table 2: Playing the referential game with image-level targets: test results after 50K training plays.
115
+ Columns as in Table 1. All purity values significant at $p < 0 . 0 0 1$ .
116
+
117
+ turn now to a simple way to tweak the game setup in order to encourage the agents to further pursue high-level semantics.
118
+
119
+ The strategy is to remove some aspects of “common knowledge” from the game. Common knowledge, in game-theoretic parlance, are facts that everyone knows, everyone knows that everyone knows, and so on (Brandenburger et al., 2014). Coordination can only occur if the basis of the coordination is common knowledge (Rubinstein, 1989), therefore if we remove some facts from common knowledge, we will preclude our agents from coordinating on them. In our case, we want to remove facts pertaining to the details of the input images, thus forcing the agents to coordinate on more abstract properties. We can remove all low-level common knowledge by letting the agents play only using class-level properties of the objects. We achieve this by modifying the game to show the agents different pairs of images but maintaining the ImageNet class of both the target and distractor (e.g., if the target is dog, the sender is shown a picture of a Chihuahua and the receiver that of a Boston Terrier).
120
+
121
+ Table 2 reports results for various configurations. We see that the agents are still able to coordinate. Moreover, we observe a small increase in symbol usage purity, as expected since agents can now only coordinate on general properties of object classes, rather than on the specific properties of each image. This effect is clearer in Figure 3 (right), when we repeat t-SNE based visualization of the relationship that emerges between visual embeddings and the words used to refer to them in this new experiment.
122
+
123
+ # 5 GROUNDING AGENTS’ COMMUNICATION IN HUMAN LANGUAGE
124
+
125
+ The results in Section 4 show communication robustly arising in our game, and that we can change the environment to nudge agents to develop symbol meanings which are more closely related to the visual or class-based semantics of the images. Still, we would like agents to converge on a language fully understandable by humans, as our ultimate goal is to develop conversational machines. To do this, we will need to ground the communication.
126
+
127
+ Taking inspiration from AlphaGo (Silver et al., 2016), an AI that reached the Go master level by combining interactive learning in games of self-play with passive supervised learning from a large set of human games, we combine the usual referential game, in which agents interactively develop their communication protocol, with a supervised image labeling task, where the sender must learn to assign objects their conventional names. This way, the sender will naturally be encouraged to use such names with their conventional meaning to discriminate target images when playing the game, making communication more transparent to humans.
128
+
129
+ In this experiment, the sender switches, equiprobably, between game playing and a supervised image classification task using ImageNet classes. Note that the supervised objective does not aim at improving agents’ coordination performance. Instead, supervision provides them with basic grounding in natural language (in the form of image-label associations), while concurrent interactive game playing should teach them how to effectively use this grounding to communicate.
130
+
131
+ We use the informed sender, fc image representations and a vocabulary size of 100. Supervised training is based on 100 labels that are a subset of the object names in our data-set (see Section 3 above). When predicting object names, the sender uses the usual game-embedding layer coupled with a softmax layer of dimensionality 100 corresponding to the object names. Importantly, the game-embedding layers used in object classification and the reference game are shared. Consequently, we hope that, when playing, the sender will produce symbols aligned with object names acquired in the supervised phase.
132
+
133
+ ![](images/9dc46da9c68bda1e70a2c5179f3650cd669ccc0cfa553e9eb6447eb64e195bad.jpg)
134
+ Figure 4: Example pairs from the ReferItGame set, with word produced by sender. Target images framed in green.
135
+
136
+ The supervised objective has no negative effect on communication success: the agents are still able to reach full coordination after 10k training trials (corresponding to $5 \mathrm { k }$ trials of reference game playing). The sender uses many more symbols after training than in any previous experiment (88) and symbol purity dramatically increases to $70 \%$ (the obs-chance purity difference also increases to $3 7 \%$ ).
137
+
138
+ Even more importantly, many symbols have now become directly interpretable, thanks to their direct correspondence to labels. Considering the 632 image pairs where the target gold standard label corresponds to one of the labels that were used in the supervised phase, in $47 \%$ of these cases the sender produced exactly the symbol corresponding to the correct supervised label for the target image (chance: $1 \%$ ).
139
+
140
+ For image pairs where the target image belongs to one of the directly supervised categories, it is not surprising that the sender adopted the “conventional” supervised label to signal the target . However, a very interesting effect of supervision is that it improves the interpretability of the code even when agents must communicate about images that do not contain objects in the supervised category set. This emerged in a follow-up experiment in which, during training, the sender was again exposed (with equal probability) to the same supervised classification task as above, but now the agents played the referential game on a different dataset of images derived from ReferItGame (Kazemzadeh et al., 2014). In its general format, the ReferItGame contains annotations of bounding boxes in real images with referring expressions produced by humans when playing the game. For our purposes, we constructed $1 0 \mathrm { k }$ pairs by randomly sampling two bounding boxes, to act as target and distractor. Again, the agents converged to perfect communication after 15k trials, and this time used all 100 available symbols in some trial.
141
+
142
+ We then asked whether this language was human-interpretable. For each symbol used by the trained sender, we randomly extracted 3 image pairs in which the sender picked that symbol and the receiver pointed at the right target (for two symbols, only 2 pairs matched these criteria, leading to a set of 298 image pairs). We annotated each pair with the word corresponding to the symbol in the supervised set. Out of the 298 pairs, only 25 $( 8 \% )$ included one of the 100 words among the corresponding referring expressions in ReferItGame. So, in the large majority of cases, the sender had been faced with a pair not (saliently) containing the categories used in the supervised phase of its training, and it had to produce a word that could, at best, only indirectly refer to what is depicted in the target image. We then tested whether this code would be understandable by humans. In essence, it is as if we replaced the trained agent receiver with a human.
143
+
144
+ We prepared a crowdsourced survey using the CrowdFlower platform. For each pair, human participants were shown the two images and the sender-emitted word (that is, the ImageNet label associated to the symbol produced by the sender; see examples in Figure 4). The participants were asked to pick the picture that they thought was most related to the word. We collected 10 ratings for each pair.
145
+
146
+ We found that in $68 \%$ of the cases the subjects were able to guess the right image. A logistic regression predicting subject image choice from ground-truth target images, with subjects and words as random effects, confirmed the highly significant correlation between the true and guessed images $( z ~ = ~ 1 6 . 7 5$ , $p \ < \ 0 . 0 0 0 1 $ ). Thus, while far from perfect, we find that supervised learning on a separate data set does provide some grounding for communication with humans, that generalizes beyond the conventional word denotations learned in the supervised phase.
147
+
148
+ Looking at the results qualitatively, we found that very often sender-subject communication succeeded when the sender established a sort of “metonymic” link between the words in its possession and the contents of an image. Figure 4 shows an example where the sender produced dolphin to refer to a picture showing a stretch of sea, and fence for a patch of land. Similar semantic shifts are a core characteristic of natural language (e.g., Pustejovsky, 1995), and thus subjects were, in many cases, able to successfully play the referential game with our sender (10/10 subjects guessed the dolphin target, and 8/10 the fence). This is very encouraging. Although the language developed in referential games will be initially very limited, if both agents and humans possess the sort of flexibility displayed in this last experiment, the noisy but shared common ground might suffice to establish basic communication.
149
+
150
+ # 6 DISCUSSION
151
+
152
+ Our results confirmed that fairly simple neural-network agents can learn to coordinate in a referential game in which they need to communicate about a large number of real pictures. They also suggest that the meanings agents come to assign to symbols in this setup capture general conceptual properties of the objects depicted in the image, rather than low-level visual properties. We also showed a path to grounding the communication in natural language by mixing the game with a supervised task.
153
+
154
+ In future work, encouraged by our preliminary experiments with object naming, we want to study how to ensure that the emergent communication stays close to human natural language. Predictive learning should be retained as an important building block of intelligent agents, focusing on teaching them structural properties of language (e.g., lexical choice, syntax or style). However, it is also important to learn the function-driven facets of language, such as how to hold a conversation, and interactive games are a potentially fruitful method to achieve this goal.
155
+
156
+ # REFERENCES
157
+
158
+ John Langshaw Austin. How to do things with words. Harvard University Press, Cambridge, MA, 1962.
159
+
160
+ Andreas Blume, Douglas V DeJong, Yong-Gwan Kim, and Geoffrey B Sprinkle. Experimental evidence on the evolution of meaning of messages in sender-receiver games. The American Economic Review, 88(5):1323–1340, 1998.
161
+
162
+ Adam Brandenburger, Eddie Dekel, et al. Hierarchies of beliefs and common knowledge. The Language of Game Theory: Putting Epistemics into the Mathematics of Games, 5:31, 2014.
163
+
164
+ Ted Briscoe (ed.). Linguistic evolution through language acquisition. Cambridge University Press, Cambridge, UK, 2002.
165
+
166
+ Angelo Cangelosi and Domenico Parisi (eds.). Simulating the evolution of language. Springer, New York, 2002.
167
+
168
+ Alfonso Caramazza and Jennifer Shelton. Domain-specific knowledge systems in the brain the animate-inanimate distinction. Journal of Cognitive Neuroscience, 10(1):1–34, 1998.
169
+
170
+ Herbert H Clark. Using language. 1996. Cambridge University Press: Cambridge), 952:274–296, 1996.
171
+
172
+ Vincent Crawford. A survey of experiments on communication via cheap talk. Journal of Economic theory, 78(2):286–298, 1998.
173
+
174
+ Vincent P Crawford and Joel Sobel. Strategic information transmission. Econometrica: Journal of the Econometric Society, pp. 1431–1451, 1982.
175
+
176
+ Jia Deng, Wei Dong, Richard Socher, Lia-Ji Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proceedings of CVPR, pp. 248–255, Miami Beach, FL, 2009.
177
+
178
+ Jakob N. Foerster, Yannis M. Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate to solve riddles with deep distributed recurrent $\mathsf { q }$ -networks. Technical Report arXiv:1602.02672, 2016. URL http://arxiv.org/pdf/1602.02672v1.
179
+
180
+ Drew Fudenberg and Alexander Peysakhovich. Recency, records and recaps: learning and nonequilibrium behavior in a simple decision problem. In Proceedings of the fifteenth ACM conference on Economics and Computation, pp. 971–986. ACM, 2014.
181
+
182
+ 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.
183
+
184
+ Emilio Jorge, Mikael Kageb ˚ ack, and Emil Gustavsson. Learning to play guess who? and inventing ¨ a grounded language as a consequence. https://arxiv.org/abs/1611.03218, 2016.
185
+
186
+ Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara L Berg. Referitgame: Referring to objects in photographs of natural scenes. In EMNLP, pp. 787–798, 2014.
187
+
188
+ David Lewis. Convention. Harvard University Press, Cambridge, MA, 1969.
189
+
190
+ Ken McRae, George Cree, Mark Seidenberg, and Chris McNorgan. Semantic feature production norms for a large set of living and nonliving things. Behavior Research Methods, 37(4):547–559, 2005.
191
+
192
+ Tomas Mikolov, Armand Joulin, and Marco Baroni. A roadmap towards machine intelligence. arXiv preprint arXiv:1511.08130, 2015.
193
+
194
+ James Pustejovsky. The Generative Lexicon. MIT Press, Cambridge, MA, 1995.
195
+
196
+ Alvin E Roth and Ido Erev. Learning in extensive-form games: Experimental data and simple dynamic models in the intermediate term. Games and economic behavior, 8(1):164–212, 1995.
197
+
198
+ Ariel Rubinstein. The electronic mail game: Strategic behavior under ‘almost common knowledge’. The American Economic Review, pp. 385–391, 1989.
199
+
200
+ David Silver, Aja Huang, Christopher Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529:484–503, 2016.
201
+
202
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
203
+
204
+ Brian Skyrms. Signals: Evolution, learning, and information. Oxford University Press, 2010.
205
+
206
+ Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. Cognitive Science, 2016. In press.
207
+
208
+ Luc Steels and Martin Loetzsch. The grounded naming game. In Luc Steels (ed.), Experiments in Cultural Language Evolution, pp. 41–59. John Benjamins, Amsterdam, 2012.
209
+
210
+ Peter Stone and Manuela Veloso. Towards collaborative and adversarial learning: A case study in robotic soccer. International Journal of Human-Computer Studies, 48(1):83–104, 1998.
211
+
212
+ Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. arXiv preprint arXiv:1605.07736, 2016.
213
+
214
+ Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to sequence learning with neural networks. In Proceedings of NIPS, pp. 3104–3112, Montreal, Canada, 2014.
215
+
216
+ Richard Sutton and Andrew Barto. Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA, 1998.
217
+
218
+ Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research, 9(2579-2605), 2008.
219
+
220
+ Oriol Vinyals and Quoc Le. A neural conversational model. In Proceedings of the ICML Deep Learning Workshop, Lille, France, 2015. Published online: https://sites.google.com/ site/deeplearning2015/accepted-papers.
221
+
222
+ Kyle Wagner, James A Reggia, Juan Uriagereka, and Gerald S Wilkinson. Progress in the simulation of emergent communication and language. Adaptive Behavior, 11(1):37–69, 2003.
223
+
224
+ S. I. Wang, P. Liang, and C. Manning. Learning language games through interaction. In Association for Computational Linguistics (ACL), 2016.
225
+
226
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
227
+
228
+ Terry Winograd. Procedures as a representation for data in a computer program for understanding natural language. Technical Report AI 235, Massachusetts Institute of Technology, 1971.
229
+
230
+ Ludwig Wittgenstein. Philosophical Investigations. Blackwell, Oxford, UK, 1953. Translated by G.E.M. Anscombe.
231
+
232
+ Michael Wooldridge. An introduction to multiagent systems. John Wiley & Sons, 2009.
233
+
234
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In Proceedings of ICML, pp. 2048–2057, Lille, France, 2015.
235
+
236
+ Matthew Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Proceedings of ECCV (Part 1), pp. 818–833, Zurich, Switzerland, 2014.
237
+
238
+ Ying Zhao and George Karypis. Criterion functions for document clustering: Experiments and analysis. Technical Report 01-40, University of Minnesota Department of Computer Science, 2003.
md/train/HkepKG-Rb/HkepKG-Rb.md ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A SEMANTIC LOSS FUNCTION FOR DEEP LEARNING WITH SYMBOLIC KNOWLEDGE
2
+
3
+ # ABSTRACT
4
+
5
+ This paper develops a novel methodology for using symbolic knowledge in deep learning. From first principles, we derive a semantic loss function that bridges between neural output vectors and logical constraints. This loss function captures how close the neural network is to satisfying the constraints on its output. An experimental evaluation shows that our semantic loss function effectively guides the learner to achieve (near-)state-of-the-art results on semi-supervised multi-class classification. Moreover, it significantly increases the ability of the neural network to predict structured objects, such as rankings and paths. These discrete concepts are tremendously difficult to learn, and benefit from a tight integration of deep learning and symbolic reasoning methods.
6
+
7
+ # 1 INTRODUCTION
8
+
9
+ The widespread success of representation learning raises the question of which AI tasks are amenable to deep learning, which require classical model-based symbolic reasoning, and whether we can benefit from an integration of both. In recent years, significant effort has gone towards various ways of using representation learning to solve tasks that were previously tackled by symbolic methods. Such efforts include neural computers, Turing machines, and differentiable programming (e.g., Weston et al. (2014); Reed & De Freitas (2015); Graves et al. (2016); Riedel et al. (2016)), relational embeddings, deep learning for graph data, and neural theorem proving (e.g., Bordes et al. (2013); Neelakantan et al. (2015); Duvenaud et al. (2015); Niepert et al. (2016)), and many more. Other work has sought to augment deep learning with (symbolic) knowledge (e.g., Hu et al. (2016); Stewart & Ermon (2017); Marquez-Neila et al. (2017); Minervini et al. (2017); Wang et al. (2017)). ´
10
+
11
+ This paper considers learning tasks where we have symbolic knowledge connecting the different outputs of a neural network. This knowledge takes the form of a constraint (or sentence) in Boolean logic. It can be as simple as an exactly-one constraint for one-hot output encodings, or as complex as a structured output prediction constraint for intricate combinatorial objects such as rankings, subgraphs, and paths. Our goal is to augment neural networks with the ability to learn how to make predictions subject to these constraints, and use the symbolic knowledge to improve its performance.
12
+
13
+ Most neuro-symbolic approaches aim to simulate or learn symbolic reasoning in an end-to-end deep neural network, or capture symbolic knowledge in a vector-space embedding. This choice is partly motivated by the need for smooth differentiable models; adding symbolic reasoning code (e.g., SAT solvers) to a deep learning pipeline destroys this property. Unfortunately, while making reasoning differentiable, the precise logical meaning of the knowledge is often lost. In this paper, we take a distinctly different approach, and tackle the problem of differentiable but sound logical reasoning from first principles. Starting from a set of intuitive axioms, we derive a differentiable semantic loss function that captures how well the outputs of a neural network match a given constraint. This function precisely captures the meaning of the constraint, and is independent of its syntax.
14
+
15
+ Next, we show how this semantic loss gives significant practical improvements in semi-supervised classification. The semantic loss defined over the exactly-one constraint in this setting permits us to obtain a learning signal from vast amounts of unlabeled data. The key idea is that the semantic loss helps us improve how consistently we are able to classify the unlabeled data. This simple addition to the loss function of standard deep learning architectures yields (near-)state-of-the-art performance in semi-supervised classification on MNIST, FASHION and CIFAR-10 datasets.
16
+
17
+ ![](images/908b06431175243b10447e79ffaca6771156931dd43e1b26edd7a157a8c2ba04.jpg)
18
+ Figure 1: Outputs of a neural network feed into semantic loss functions for constraints representing a one-hot encoding, a total ranking of preferences, and paths in a grid graph.
19
+
20
+ Our final set of experiments study the benefits of the semantic loss function for complex structured output learning tasks, such as preference learning and path prediction in a graph (Daume et al., 2009; ´ Chang et al., 2013; Choi et al., 2015; Graves et al., 2016). In these scenarios, the task is two-fold: learn both the structure of the output space, and the actual classification function within that space. By capturing the structure of the output space with logical constraints, and minimizing the semantic loss for this constraint during learning, we are able to learn networks that are much more likely to correctly predict structured objects.
21
+
22
+ # 2 BACKGROUND AND NOTATION
23
+
24
+ To formally define semantic loss, we make use of concepts in propositional logic. We write uppercase letters $( X , Y )$ for Boolean variables and lowercase letters $( x , y )$ for their instantiation $X = 0$ or $X = 1$ ). Sets of variables are written in bold uppercase $( \mathbf { X } , \mathbf { Y } )$ , and their joint instantiation in bold lowercase $\mathbf { \Gamma } ( \mathbf { x } , \mathbf { y } )$ . A literal is a variable $( x )$ or its negation $( \neg x )$ . A logical sentence ( $\alpha$ or $\beta$ ) is constructed in the usual way, from variables and logical connectives $( \wedge , \vee$ , etc.), and is also called a formula or constraint. A state or world $\mathbf { x }$ is an instantiation to all variables $\mathbf { X }$ . A state $\mathbf { x }$ satisfies a sentence $\alpha$ , denoted $\mathbf { x } \Vdash \alpha$ , if the sentence evaluates to be true in that world, as defined in the usual way. A sentence $\alpha$ entails another sentence $\beta$ , denoted $\alpha \models \beta$ if all worlds that satisfy $\alpha$ also satisfy $\beta$ . A sentence $\alpha$ is logically equivalent to sentence $\beta$ , denoted $\alpha \equiv \beta$ , if both $\alpha \models \beta$ and $\beta \models \alpha$ .
25
+
26
+ The output row vector of a neural net is denoted $\mathsf { p }$ . Each value in $\mathsf { p }$ represents the probability of an output and falls in $[ 0 , 1 ]$ . We use both softmax and sigmoid units for our output activation functions. The notation for states $\mathbf { x }$ is used to refer the an assignment, the logical sentence enforcing the assignment, or the binary vector capturing that same assignment, as these are all equivalent notions.
27
+
28
+ Figure 1 illustrates the three different concrete output constraints of varying difficulty that are studied in our experiments. First, we examine the exactly-one or one-hot constraint capturing the encoding used in multi-class classification. It states that for a set of indicators $\mathbf { X } = \{ X _ { 1 } , \ldots , X _ { n } \}$ , one and exactly one of those indicators must be true, with the rest being false. This is enforced through a logical constraint $\alpha$ by conjoining sentences of the form $\neg X _ { 1 } \lor \neg X _ { 2 }$ for all pairs of variables (at most one variable is true), and a single sentence $X _ { 1 } \lor \cdots \lor X _ { n }$ (at least one variable is true). Our experiments further examine the valid simple path constraint. It states for a given source-destination pair and edge indicators, that the edge indicators which are set to true must form a valid simple path from source to destination. Finally, we explore the ordering constraint, which requires that a set of $n ^ { 2 }$ indicator variables represent a total ordering over $n$ variables, effectively encoding a permutation matrix. For a full description of the path and ordering constraints, we refer to Section 5.
29
+
30
+ # 3 SEMANTIC LOSS
31
+
32
+ Our goal in this section is to find a semantic loss function that bridges the gap between the continuous world of neural networks, and the symbolic world of propositional logic. We do so by first postulating intuitive high-level properties that we seek in such a function, and that illustrate its desired behavior. A second set of postulates establish a correspondence between constraints and data. Finally, we uniquely define the semantic loss function used throughout this paper.
33
+
34
+ The semantic loss $\mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathsf { p } )$ is a function of a sentence $\alpha$ in propositional logic, defined over variables $\mathbf { X } = \{ X _ { 1 } , \ldots , X _ { n } \}$ , and a vector of probabilities $\mathsf { p }$ for the same variables X. Element ${ \mathsf p } _ { i }$ denotes the predicted probability of variable $X _ { i }$ , and corresponds to a single output of the neural net. For example, the semantic loss between the one-hot constraint from the previous section, and a neural net output vector $\mathsf { p }$ , is intended to capture how close the prediction p is to having exactly one output set to true (that is, 1), and all others set to false (that is, 0), regardless of which output is correct.
35
+
36
+ # 3.1 HIGH-LEVEL PROPERTIES
37
+
38
+ The first axiom says that there is no loss when the logical constraint $\alpha$ is always true (it is a logical tautology), independent of the predicted probabilities p.
39
+
40
+ Axiom 1 (Truth). The semantic loss of a true sentence is zero: $\forall \mathsf { p } , \mathrm { L } ^ { \mathrm { s } } ( t r u e , \mathsf { p } ) = 0 .$ .
41
+
42
+ Next, when enforcing two constraints on disjoint sets of variables, we want the ability to compute the semantic loss of the two constraints separately, and sum the results for their joint semantic loss.
43
+
44
+ Axiom 2 (Additive Independence). Let $\alpha$ be a sentence over $\mathbf { X }$ with probabilities $\mathsf { p }$ . Let $\beta$ be a sentence over $\mathbf { Y }$ disjoint from $\mathbf { X }$ with probabilities $\mathsf { q }$ . The semantic loss between sentence $\alpha \wedge \beta$ and the joint probability vector [p q] decomposes additively: $\operatorname { L } ^ { \mathrm { s } } ( \alpha \wedge \beta , [ { \mathsf { p q } } ] ) = \operatorname { L } ^ { \mathrm { s } } ( \alpha , { \mathsf { p } } ) + \operatorname { L } ^ { \mathrm { s } } ( \beta , { \mathsf { q } } )$ .
45
+
46
+ It directly follows from Axioms 1 and 2 that the probabilities of variables that are not used on the constraint do not affect the semantic loss. Proposition 6 in Appendix A formalizes this intuition.
47
+
48
+ To maintain logical meaning, we postulate that semantic loss is monotone in the order of implication.
49
+
50
+ Axiom 3 (Monotonicity). If $\alpha \models \beta$ , then the semantic loss $\mathrm { L } ^ { \mathrm { s } } ( \alpha , { \mathfrak { p } } ) \geq \mathrm { L } ^ { \mathrm { s } } ( \beta , { \mathfrak { p } } )$ for any vector $\mathsf { p }$ .
51
+
52
+ Intuitively, as we add stricter requirements to the logical constraint, going from $\beta$ to $\alpha$ and making it harder to satisfy, the semantic loss cannot decrease. For example, when $\beta$ enforces the output of an neural network to encode a subtree of a graph, and we tighten that requirement in $\alpha$ to be a path, the semantic loss cannot decrease. Every path is also a tree and any solution to $\alpha$ is a solution to $\beta$ .
53
+
54
+ A first consequence following the monotonicity axiom is that logically equivalent sentences must incur an identical semantic loss for the same probability vector p. Hence, the semantic loss is indeed a semantic property of the logical sentence, and does not depend on the syntax of the sentence.
55
+
56
+ Proposition 1. If $\alpha \equiv \beta$ , then the semantic loss $\mathrm { L } ^ { \mathrm { s } } ( \alpha , { \mathfrak { p } } ) = \mathrm { L } ^ { \mathrm { s } } ( \beta , { \mathfrak { p } } )$ for any vector p.
57
+
58
+ A second consequence is that semantic loss must be non-negative (see Proposition 5 in Appendix A).
59
+
60
+ # 3.2 DATA-SENTENCE CORRESPONDENCE
61
+
62
+ A state $\mathbf { x }$ is equivalently represented as a data vector, as well as a logical constraint that enforces a value for every variable in $\mathbf { X }$ . When both the constraint and the predicted vector represent the same state (for example, $X _ { 1 } \wedge { \neg { X _ { 2 } } } \wedge X _ { 3 }$ vs. [1 0 1]), there should be no semantic loss.
63
+
64
+ Axiom 4 (Identity). For any state $\mathbf { x }$ , there is zero semantic loss between its representation as a sentence, and its representation as a deterministic vector: $\forall \mathbf { x } , \mathrm { L } ^ { \mathrm { s } } ( \mathbf { x } , \mathbf { x } ) = 0$ .
65
+
66
+ The axioms above together imply that any vector satisfying the constraint must incur zero loss. For example, when our constraint $\alpha$ requires that the output vector encodes an arbitrary total ranking, and the vector $\mathbf { x }$ correctly represents a single specific total ranking, there is no semantic loss.
67
+
68
+ Proposition 2 (Satisfaction). If $\mathbf { \dot { x } } \Vdash \alpha$ , then the semantic loss $\mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathbf { x } ) = 0$ .
69
+
70
+ As a special case, logical literals $\scriptstyle { \dot { x } }$ or $\neg x$ ) constrain a single variable to take on a single value, and thus play a role similar to the labels used in supervised learning. Such constraints require an even tighter correspondence: the semantic loss must act like a classical loss function (i.e., cross entropy).
71
+
72
+ Axiom 5 (Label-Literal Correspondence). The semantic loss of a single literal is proportionate to the cross-entropy loss for the equivalent data label: $\mathrm { L } ^ { \mathrm { s } } ( x , p ) \propto - \log ( p )$ and $\mathrm { L } ^ { \mathrm { s } } ( \neg { x } , \bar { p } ) \overset { \cdot } { \propto } - \log ( 1 - p )$ .
73
+
74
+ Appendix A states Axioms 7 and 8, on the symmetry between values and the symmetry between variables, as well as a Lemma 7 that ties together the multiplicative constants mentioned in Axiom 5. Finally, this allows us to prove the following form of the semantic loss for a state $\mathbf { x }$ .
75
+
76
+ Lemma 3. For state x and vector p, we have $\begin{array} { r } { \mathrm { L } ^ { \mathrm { s } } ( \mathbf { x } , \mathsf { p } ) \propto - \sum _ { i : \mathbf { x } | = X _ { i } } \log \mathsf { p } _ { i } - \sum _ { i : \mathbf { x } | = \lnot X _ { i } } \log ( 1 - \mathsf { p } _ { i } ) . } \end{array}$
77
+
78
+ ![](images/5fcbfe708dc5ef9963d1119ec14ca3d17f5eace11a8e49df2a20fcaf583e6a6f.jpg)
79
+ Figure 2: Binary classification toy example: a linear classifier without and with semantic loss.
80
+
81
+ # 3.3 A GENERAL DEFINITION
82
+
83
+ Lemma 3 falls short as a full definition of semantic loss for arbitrary sentences. One can define additional axioms to pin down $\mathrm { L } ^ { \mathrm { s } }$ . For example, the following axiom is highly desirable.
84
+
85
+ Axiom 6 (Differentiability). For any fixed $\alpha$ , the semantic loss $\mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathsf { p } )$ is monotone in each probability in p, continuous and differentiable.
86
+
87
+ Appendix A makes the notion of semantic loss precise by stating one additional axiom. It is based on the observation that the state loss of Lemma 3 is proportionate to a log-probability. In particular, it corresponds to the probability of obtaining state $\mathbf { x }$ after independently sampling each $X _ { i }$ with probability ${ \mathsf { p } } _ { i }$ . We have now derived the semantic loss function from first principles as follows.
88
+
89
+ Definition 1 (Semantic Loss). Let $\mathsf { p }$ be a vector of probabilities, one for each variable in $\mathbf { X }$ , and let $\alpha$ be a sentence over $\mathbf { X }$ . The semantic loss between $\alpha$ and $\mathsf { p }$ is
90
+
91
+ $$
92
+ \mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathfrak { p } ) \propto - \log \sum _ { \mathbf { x } \in \alpha } \ \prod _ { i : \mathbf { x } | = X _ { i } } \mathfrak { p } _ { i } \prod _ { i : \mathbf { x } | = \ l - X _ { i } } ( 1 - \mathfrak { p } _ { i } ) .
93
+ $$
94
+
95
+ Theorem 4 (Uniqueness). The semantic loss function in Definition 1 satisfies Axioms 1–9 and is the only function that does so, up to a multiplicative constant.
96
+
97
+ Intuitively, the semantic loss is proportionate to a negative logarithm of the probability of generating a state that satisfies the constraint, when sampling values according to p. Hence, it is the selfinformation (or “surprise”) of obtaining an assignment that satisfies the constraint (Jones, 1979).
98
+
99
+ # 4 SEMI-SUPERVISED CLASSIFICATION
100
+
101
+ The most straightforward constraint that is ubiquitous in multi-class classification is mutual exclusion over one-hot-encoded outputs. That is, for a given example, exactly one class and therefore exactly one binary indicator must be true. The machine learning community has made great strides in this machine learning task, due to the invention of assorted deep learning representations and their associated regularization terms (Krizhevsky et al., 2012; He et al., 2016). Many of these models take large amounts of fully labeled data for granted, and big data is indispensable for discovering accurate representations (Hastie et al., 2009). To sustain this progress, and alleviate the need for more labeled data, there is a growing interest into utilizing unlabeled data to augment the predictive power of classifiers (Stewart & Ermon, 2017; Bilenko et al., 2004). This section shows why semantic loss naturally qualifies for this task.
102
+
103
+ Illustrative Example To illustrate the benefit of semantic loss in the semi-supervised setting, we begin our discussion with a small toy example. Consider a binary classification task as depicted in Figure 2. Ignoring the unlabeled examples, a simple linear classifier learns to distinguish the two classes by separating the labeled examples in Figure 2a. However, the unlabeled examples are also informative, as they must carry some properties that give them a particular label. This is the crux of semantic loss: a model must confidently assign a consistent class even to unlabeled data. Encouraging the model to do so results in a more accurate decision boundary, as illustrated in Figure 2b. Next, we further explore this idea and apply it to real-world image classification tasks.
104
+
105
+ Table 1: MNIST. Previously reported test accuracies followed by semantic loss results $\pm$ stddev)
106
+
107
+ <table><tr><td>Accuracy % with # of used labels</td><td>100</td><td>1000</td><td>ALL</td></tr><tr><td>AtlasRBF (Pitelis et al., 2014) Deep Generative (Kingma et al., 2014) Virtual Adversarial (Miyato et al., 2016) Ladder Net (Rasmus et al., 2015)</td><td>91.9 (± 0.95) 96.67(± 0.14) 97.67 98.94(±0.37)</td><td>96.32 (± 0.12) 97.60(± 0.02) 98.64 99.16 (±0.08)</td><td>98.69 99.04 99.36 99.43 (± 0.02)</td></tr><tr><td>Baseline: MLP, Gaussian Noise Baseline: Self-Training MLP with Semantic Loss (our)</td><td>78.46 (±1.94) 72.55 (±4.21) 98.38 (±0.51)</td><td>94.26 (±0.31) 87.43 (±3.07) 98.78 (±0.17)</td><td>99.34(±0.08) 99.34 (±0.08) 99.36 (±0.02)</td></tr></table>
108
+
109
+ # 4.1 METHOD
110
+
111
+ Our proposed method intends to be generally applicable and compatible with any feedforward neural network. The semantic loss is simply another regularization term that can directly be plugged into an existing loss function. More specifically, for some weight $w$ , the new overall loss becomes
112
+
113
+ When the constraint over the output space is simple (for example, there is a small number of solutions ${ \textbf { x } } | = \alpha )$ ), the semantic loss can be directly computed from Definition 1. Concretely, for the exactly-one constraint used in $n$ -class classification, the semantic loss reduces to
114
+
115
+ $$
116
+ \mathrm { L } ^ { \mathrm { s } } ( \mathrm { e x a c t l y - o n e } , \mathsf { p } ) \propto - \log \sum _ { i = 0 } ^ { n - 1 } \mathsf { p } _ { i } \prod _ { j = 0 , j \neq i } ^ { n - 1 } ( 1 - \mathsf { p } _ { j } ) ,
117
+ $$
118
+
119
+ where he values ${ \mathsf { p } } _ { i }$ denote the probability of class $i$ as predicted by the neural net. The semantic loss for the exactly-one constraint is efficient and causes no noticeable overhead in our experiments.
120
+
121
+ In general, for arbitrary constraints $\alpha$ , the semantic loss is not efficient to compute using Definition 1, and more advanced automated reasoning is required. Section 5 discusses this issue in more detail.
122
+
123
+ # 4.2 EXPERIMENTAL EVALUATION
124
+
125
+ In this section, we evaluate semantic loss in the semi-supervised setting by comparing it with several competitive models. As most semi-supervised learners build on a supervised learner, changing the underlying model significantly affects the semi-supervised learner’s performance. For comparison, we add semantic loss to the same base models used in ladder nets (Rasmus et al., 2015), which currently achieve state-of-the-art results on semi-supervised MNIST and CIFAR-10 (Krizhevsky & Hinton, 2009). Specifically, the MNIST base model is a fully-connected multilayer perceptron (MLP), with layers of size 784-1000-500-250-250-250-10. On CIFAR-10, it is a 10-layer convolutional neural network (CNN) with 3-by-3 padded filters. After every 3 layers, features are subject to a 2-by-2 max-pool layer with strides of 2. Furthermore, we use ReLu (Nair & Hinton, 2010), batch normalization (Ioffe & Szegedy, 2015), and Adam optimization (Kingma & Ba, 2015) with a learning rate of 0.002. We refer to Appendix B and C for a specification of the CNN model and additional details about hyper-parameter tuning.
126
+
127
+ For all semi-supervised experiments, we use the standard 10,000 held-out test examples provided in the original datasets and randomly pick 10,000 from the standard 60,000 training examples (50,000 for CIFAR-10) as validation set. For values of $N$ that depend on the experiment, we retain $N$ randomly chosen labeled examples from the training set, and remove labels from the rest. We balance classes in the labeled samples to ensure no particular class is over-represented. Images are preprocessed for standardization and Gaussian noise (standard deviation 0.3) is added to every pixel.
128
+
129
+ MNIST The permutation invariant MNIST classification task is commonly used as a test-bed for general semi-supervised learning algorithms. This setting does not use any prior information about the spatial arrangement of the input pixels. Therefore, it excludes many data augmentation techniques that involve geometric distortion of images, as well as convolutional neural networks.
130
+
131
+ When evaluating on MNIST, we run experiments for 10 epochs, with a batch size of 10 labeled and 10 unlabeled examples. Experiments are repeated 10 times with different random seeds. Table 1 compares semantic loss to two baselines and state-of-the-art results from the literature. The first baseline is a purely supervised MLP, which makes no use of unlabeled data. The second is the classic self-training method for semi-supervised learning, which operates as follows. After every 1000 iterations, the unlabeled examples that are predicted by the MLP to have more than $9 5 \%$ probability of belonging to a single class, are assigned a psuedo-label and become labeled data.
132
+
133
+ Table 2: FASHION. Test accuracy comparison between MLP with semantic loss and ladder nets.
134
+
135
+ <table><tr><td>Accuracy % with # of used labels</td><td>100</td><td>500</td><td>1000</td><td>ALL</td></tr><tr><td>Ladder Net (Rasmus et al., 2015)</td><td>81.46(±0.64)</td><td>85.18 (±0.27)</td><td>86.48 (± 0.15)</td><td>90.46</td></tr><tr><td>Baseline:MLP,GaussianNoise</td><td>69.45 (±2.03)</td><td>78.12 (±1.41)</td><td>80.94(±0.84)</td><td>89.87</td></tr><tr><td>MLP with Semantic Loss (our)</td><td>86.74 (±0.71)</td><td>89.49 (±0.24)</td><td>89.67 (±0.09)</td><td>89.81</td></tr></table>
136
+
137
+ Table 3: CIFAR. Test accuracy comparison between CNN with semantic loss and ladder nets.
138
+
139
+ <table><tr><td rowspan=1 colspan=1>Accuracy % with # of used labels</td><td rowspan=1 colspan=1>4000</td><td rowspan=1 colspan=1>ALL</td></tr><tr><td rowspan=2 colspan=1>CNNBaselineinLadderNetLadder Net (Rasmus et al., 2015)Baseline: CNN,Whitening, CroppingCNN with Semantic Loss (our)</td><td rowspan=1 colspan=1>76.67 (± 0.61)79.60 (±0.47)</td><td rowspan=1 colspan=1>90.73</td></tr><tr><td rowspan=1 colspan=1>77.1381.79</td><td rowspan=1 colspan=1>90.9690.92</td></tr></table>
140
+
141
+ When given 100 labeled examples ( $N = 1 0 0 \mathrm { \ : }$ ), MLP with semantic loss gains around $2 0 \%$ improvement over the purely supervised baseline. The improvement is even larger $( 2 5 \% )$ compared to self-training. Considering the only change is an additional loss term, this result is very encouraging. Compared to the state of the art, ladder nets slightly outperform semantic loss by $0 . 5 \%$ accuracy. This difference may be an artifact of the excessive tuning of architectures, hyper-parameters and learning rates that the MNIST dataset has been subject to. In the coming experiments, we extend our work to more challenging datasets, in order to provide a clearer comparison with ladder nets.
142
+
143
+ First, we want to share a few more thoughts on how semantic loss works. A classical softmax layer interprets its output as representing a categorical distribution. Hence, by normalizing its outputs, softmax enforces the same mutual exclusion constraint enforced in our semantic loss function. However, there does not exist a natural way to extend softmax loss to unlabeled samples. In contrast, semantic loss does provide a learning signal on unlabeled samples, by forcing the underlying classifier to make an decision and construct a confident hypothesis for all data. However, for the fully supervised case $N = \mathrm { a l l }$ ), the semantic loss does not significantly affect accuracy. Because the MLP has enough capacity to almost perfectly fit the training data, where the constraint is always satisfied, the semantic loss is almost always zero. This is a direct consequence of Proposition 2.
144
+
145
+ FASHION The FASHION (Xiao et al., 2017) dataset consists of Zalando’s article images, aiming to serve as a more challenging drop-in replacement for MNIST. Arguably, it has not been overused and requires more advanced techniques to achieve good performance. As in the previous experiment, we run our method for 10 epochs, whereas ladder nets need 100 epochs to converge. Again, experiments are repeated 10 times and Table 2 reports the classification accuracy and its standard deviation (except for $N =$ all where it is close to 0 and omitted for space).
146
+
147
+ Experiments show that utilizing semantic loss results in a very large $1 7 \%$ improvement over the baseline when only 100 labels are provided. Moreover, our method compares favorably to ladder nets, except when the setting degrades to be fully supervised. Note that our method already nearly reaches its maximum accuracy with 500 labeled examples, which is only $1 \%$ of the training dataset.
148
+
149
+ CIFAR-10 To show the general applicability of semantic loss, we evaluate it on CIFAR-10. This dataset consisting of 32-by-32 RGB images in 10 classes. A simple MLP would not have enough representation power to capture the huge variance across objects within the same class. To cope with this spike in difficulty, we switch our underlying model to a 10-layer CNN as described earlier. We use a batch size of 100 samples of which half are unlabeled. Experiments are run for 100 epochs. However, due to our limited computational resources, we report on a single trial. Note that we make slight modifications to the underlying model used in ladder nets to reproduce similar baseline performance. Please refer to Appendix B for the details of this experimental setup.
150
+
151
+ As shown in Table 3, our method compares favorably to ladder nets. However, due to the slight difference in performance between the supervised base models, a direct comparison would be methodologically flawed. Instead, we compare the net improvements over baselines. In terms of this measure, our method scores a gain of $4 . { \bar { 6 } } 6 \%$ whereas ladder nets gain $2 . 9 3 \%$ .
152
+
153
+ # 4.3 DISCUSSION
154
+
155
+ Overall, the experiments so far have demonstrated the competitiveness and general applicability of our proposed method on semi-supervised learning tasks. It surpassed the previous state of the art (i.e. ladder nets ) on FASHION and CIFAR-10, while being close on MNIST. Considering the simplicity of our method, such results are encouraging. Indeed, a key advantage of semantic loss is that it only requires a simple additional loss term. Without changing the network architecture itself, we incur almost no computational overhead. Conversely, this property makes our method sensitive to the underlying model’s performance. Without the underlying predictive power of a strong supervised learning model, we do not expect to see the same benefits we observe here. Recently, we became aware that Miyato et al. (2016) extended their work to CIFAR-10 and achieved state-of-the-art results (Miyato et al., 2017), surpassing our performance by $5 \%$ . In future work, we plan to investigate whether applying semantic loss on their architecture would yield an even stronger performance.
156
+
157
+ ![](images/684ff625c16715167670292375e1562c7bf4528618063e9e1026bc8e042c3a58.jpg)
158
+ Figure 3: FASHION pictures grouped by how confidently the supervised base model classifies them correctly. With semantic loss, the final semi-supervised model predicts all correctly and confidently.
159
+
160
+ Figure 3 illustrates the effect of semantic loss on FASHION pictures whose correct label was hidden from the learner. Pictures 3a and 3b are correctly classified by the supervised base model, and on the first set it is confident about this prediction $( { \mathsf p } _ { i } > 0 . 8 )$ . The semantic loss rarely diverts the model from these initially correct labels. However, it bootstraps these unlabeled examples to achieve higher confidence in the learned concepts. With this additional learning signal, the model changes its beliefs about Pictures 3c, which it was previously uncertain about. Finally, even on confidently misclassified Pictures 3d, the semantic loss is able to fully correct the mistakes of the base model.
161
+
162
+ # 5 LEARNING WITH COMPLEX CONSTRAINTS
163
+
164
+ While much of current machine learning research is focused on problems such as multi-class classification, there remain a multitude of difficult problems involving highly constrained output domains. As mentioned in the previous section, semantic loss has little effect on the fully-supervised exactly-one classification problem. This leads us to seek out more difficult problems to illustrate that semantic loss can also be highly informative in the supervised case, provided the output domain is a sufficiently complex space. Because semantic loss is defined by a Boolean formula, it can be used on any output domain that can be fully described in this manner. Here, we develop a framework for tractable semantic loss on highly complex constraints, and evaluate it on some difficult examples.
165
+
166
+ # 5.1 A TRACTABLE SEMANTIC LOSS
167
+
168
+ Our goal here is to develop a method for computing both the semantic loss and its gradient in a tractable manner. Examining Definition 1 of semantic loss, we see that the right-hand side is a wellknown automated reasoning task called weighted model counting (WMC) (Chavira & Darwiche, 2008; Sang et al., 2005). A key property of WMC is that its partial derivatives can be computed in terms of other, slightly modified WMCs. Furthermore, we know of circuit languages that compute WMCs, and that are amenable to backpropagation (Darwiche, 2003). We use the language and circuit compilation techniques described in Darwiche (2011) to build a Boolean circuit representing our semantic loss. We refer to the literature for details of this compilation approach. Due to certain properties of this circuit form, we can use it to compute both the values and the gradients of the semantic loss in time linear in the size of the circuit (Darwiche & Marquis, 2002). Once we have constructed this function, we can add it to our standard loss function as described in Section 4.1.
169
+
170
+ Table 4: Grid shortest path test results: coherent, incoherent and constraint accuracy.
171
+
172
+ <table><tr><td rowspan=1 colspan=1>Test accuracy %</td><td rowspan=1 colspan=1>Coherent</td><td rowspan=1 colspan=1>Incoherent</td><td rowspan=1 colspan=1>Constraint</td></tr><tr><td rowspan=1 colspan=1>5-layer MLP</td><td rowspan=1 colspan=1>5.62</td><td rowspan=1 colspan=1>85.91</td><td rowspan=1 colspan=1>6.99</td></tr><tr><td rowspan=1 colspan=1>With semantic loss (our)</td><td rowspan=1 colspan=1>28.51</td><td rowspan=1 colspan=1>83.14</td><td rowspan=1 colspan=1>69.89</td></tr></table>
173
+
174
+ Table 5: Preference prediction test results: coherent, incoherent and constraint accuracy.
175
+
176
+ <table><tr><td rowspan=1 colspan=1>Test accuracy %</td><td rowspan=1 colspan=1>Coherent</td><td rowspan=1 colspan=1>Incoherent</td><td rowspan=1 colspan=1>Constraint</td></tr><tr><td rowspan=1 colspan=1>3-layer MLP</td><td rowspan=1 colspan=1>1.01</td><td rowspan=1 colspan=1>75.78</td><td rowspan=1 colspan=1>2.72</td></tr><tr><td rowspan=1 colspan=1>With semantic loss (our)</td><td rowspan=1 colspan=1>13.59</td><td rowspan=1 colspan=1>72.43</td><td rowspan=1 colspan=1>55.28</td></tr></table>
177
+
178
+ # 5.2 EXPERIMENTAL EVALUATION
179
+
180
+ Our ambition when evaluating semantic loss’ performance on complex constraints is not to achieve state-of-the-art performance on any particular problem, but rather to highlight its effect. To this end, we evaluate our method on problems with a difficult output space, where the model could no longer be fit directly from data, and purposefully use simple MLPs for evaluation. The details of hyper-parameter tuning are again given in Appendix C.
181
+
182
+ # 5.2.1 GRIDS
183
+
184
+ We begin with a classic algorithmic problem, finding the shortest path in a graph. Specifically, we use a 4-by-4 grid $G = ( V , E )$ with uniform edge weights. We randomly remove edges for each example to increase difficulty. Formally, our input is a binary vector of length $\vert V \vert + \vert E \vert$ , with the first $| V |$ variables indicating sources and destinations, and the next $| E |$ which edges are removed. Similarly, each label is a binary vector of length $| E |$ indicating which edges are in the shortest path. Finally, we require through our constraint $\alpha$ that the output form a valid simple path between the desired source and destination. To compile this constraint, we use the method of Nishino et al. (2017) to encode pairwise simple paths, and logically merge them to enforce the correct source and destination. For more details on the constraint and data generation process, see Appendix D.
185
+
186
+ To evaluate, we use our generated dataset of 1600 examples, with a 60/20/20 train/validation/test split. Table 4 compares test accuracy between a 5-layer MLP baseline, and the same model augmented with semantic loss. We report three different accuracies that illustrate the effect of semantic loss: “Coherent” indicates the percentage of examples for which the classifier gets the entire configuration right, while “Incoherent” measures the percentage of individually correct binary labels, which as a whole may not constitute a valid path at all. Finally, “Constraint” describes the percentage of predictions given by the model that satisfy the constraint associated with the problem. In the case of incoherent accuracy, semantic loss has little effect, and in fact slightly reduces the accuracy as it combats the standard sigmoid cross entropy. In regard to coherent accuracy, however, the semantic loss has a very large effect in guiding the network to jointly learn true paths, rather than optimizing each binary output individually. We further see this by observing the large increase in the percentage of predictions which really are paths between the desired nodes in the graph.
187
+
188
+ # 5.2.2 PREFERENCE LEARNING
189
+
190
+ The next problem we examine is that of predicting a complete order of preferences. That is, for a given set of user features, we would like to predict how the user would rank their preference over a fixed set of items. We encode a preference ordering over $n$ items as a flattened binary matrix $\{ X _ { i j } \}$ , where for each $i , j \in \{ 1 , \ldots , n \}$ , $X _ { i j }$ denotes that item $i$ is at position $j$ (Choi et al., 2015). Clearly, not all configurations of outputs correspond to a valid ordering.
191
+
192
+ For data, we use preference rankings over 10 types of sushi for 5000 individuals, taken from PREFLIB (Mattei & Walsh, 2013). We take the ordering over 6 types of sushi as input features to predict the ordering over the remaining 4 types, with splits identical to those in Shen et al. (2017). We again split the data 60/20/20 into train/test/split, and employ a 3 layer MLP as our baseline. Table 5 compares the baseline to the same MLP augmented with semantic loss for valid total orderings. Again, we see that semantic loss has a marginal effect on incoherent accuracy, but massively improves the network’s ability to predict valid, correct orderings. Remarkably, without semantic loss, the network is only able to output a valid ordering on $0 . 0 1 \%$ of the test examples.
193
+
194
+ # 6 RELATED WORK
195
+
196
+ Incorporating symbolic background knowledge into machine learning is a long-standing challenge (Srinivasan et al., 1995). It has received considerable attention for structured prediction in natural language processing, in both supervised and semi-supervised settings. For example, constrained conditional models extend linear models with constraints that are enforced through integer linear programming (Chang et al., 2008; 2013). Constraints have also been studied in the context of probabilistic graphical models (Mateescu & Dechter, 2008; Ganchev et al., 2010). Kisa et al. (2014) utilize a circuit language called the probabilistic sentential decision diagram to induce distributions over arbitrary logical formulas. They learn generative models that satisfy preference and path constraints (Choi et al., 2015; 2016), which we both study in a discriminative setting.
197
+
198
+ Various deep learning techniques have been proposed to enforce either arithmetic constraints (Pathak et al., 2015; Marquez-Neila et al., 2017) or logical constraints (Rockt ´ aschel et al., 2015; Hu et al., ¨ 2016; Demeester et al., 2016; Stewart & Ermon, 2017; Minervini et al., 2017; Diligenti et al., 2017; Donadello et al., 2017) on the output of a neural network. The common approach is to reduce logical constraints into differentiable arithmetic objectives by replacing logical operators with their fuzzy t-norms and logical implications with simple inequalities. A downside of this fuzzy relaxation is that the logical sentences lose their precise meaning. The learning objective becomes a function of the syntax rather than the semantics. Moreover, these relaxations are often only applied to Horn clauses. One alternative is to encode the logic into a factor graph and perform loopy belief propagation to compute a loss function (Naradowsky & Riedel, 2017), which is known to have issues in the presence of complex logical constraints (Smith & Gogate, 2014).
199
+
200
+ Several specialized techniques have been proposed to exploit the rich structure of real world labels. Deng et al. (2014) propose hierarchy and exclusion graphs that allow a flexible joint modeling of hierarchical categories. It is a method invented to address examples whose labels are not provided at the most specific level. Finally, the objective of semantic loss to increase the confidence of predictions on unlabeled data is in common with information-theoretic approaches to semi-supervised learning (Grandvalet & Bengio, 2005; Erkan & Altun, 2010), and approaches that increase robustness to output perturbation (Miyato et al., 2016). A key difference between semantic loss and these information-theoretic losses is that semantic loss generalizes to arbitrary output constraints.
201
+
202
+ # 7 CONCLUSIONS
203
+
204
+ Both reasoning and semi-supervised learning are often identified as key challenges for deep learning going forward. In this paper, we developed a principled way of combining automated reasoning for propositional logic with existing deep learning architectures. Moreover, we showed that our semantic loss function provides significant benefits during semi-supervised classification, as well as deep structured prediction for highly complex output spaces.
205
+
206
+ # REFERENCES
207
+
208
+ Mikhail Bilenko, Sugato Basu, and Raymond J Mooney. Integrating constraints and metric learning in semi-supervised clustering. In Proceedings of the International Conference on Machine learning, pp. 11. ACM, 2004.
209
+
210
+ 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, pp. 2787–2795, 2013.
211
+
212
+ Kai-Wei Chang, Rajhans Samdani, and Dan Roth. A constrained latent variable model for coreference resolution. 2013.
213
+
214
+ Ming-Wei Chang, Lev-Arie Ratinov, Nicholas Rizzolo, and Dan Roth. Learning and inference with constraints. In AAAI, pp. 1513–1518, 2008.
215
+
216
+ Mark Chavira and Adnan Darwiche. On probabilistic inference by weighted model counting. Artificial Intelligence, 172(6):772 – 799, 2008.
217
+
218
+ Arthur Choi, Guy Van den Broeck, and Adnan Darwiche. Tractable learning for structured probability spaces: A case study in learning preference distributions. In Proceedings of 24th International Joint Conference on Artificial Intelligence (IJCAI), 2015.
219
+
220
+ Arthur Choi, Nazgol Tavabi, and Adnan Darwiche. Structured features in naive Bayes classification. In Proceedings of AAAI, pp. 3233–3240, 2016.
221
+
222
+ Adnan Darwiche. A differential approach to inference in bayesian networks. J. ACM, 50(3):280– 305, May 2003. ISSN 0004-5411. doi: 10.1145/765568.765570.
223
+
224
+ Adnan Darwiche. SDD: A new canonical representation of propositional knowledge bases. In IJCAI Proceedings-International Joint Conference on Artificial Intelligence, volume 22, pp. 819, 2011.
225
+
226
+ Adnan Darwiche and Pierre Marquis. A knowledge compilation map. Journal of Artificial Intelligence Research, 17:229–264, 2002.
227
+
228
+ Hal Daume, John Langford, and Daniel Marcu. Search-based structured prediction. ´ Machine learning, 75(3):297–325, 2009.
229
+
230
+ Thomas Demeester, Tim Rocktaschel, and Sebastian Riedel. Lifted rule injection for relation em- ¨ beddings. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, EMNLP 2016, Austin, Texas, USA, November 1-4, 2016, pp. 1389–1399, 2016.
231
+
232
+ Deng, Nan Ding, Yangqing Jia, Andrea Frome, Kevin Murphy, Samy Bengio, Yuan Li, Hartmut Neven, and Hartwig Adam. Large-scale object classification using label relation graphs. In ECCV, volume 8689, 2014.
233
+
234
+ Michelangelo Diligenti, Marco Gori, and Claudio Sacca. Semantic-based regularization for learning and inference. Artificial Intelligence, 244:143–165, 2017.
235
+
236
+ Ivan Donadello, Luciano Serafini, and Artur d’Avila Garcez. Logic tensor networks for semantic image interpretation. In International Joint Conference on Artificial Intelligence, pp. 1596–1602, 2017.
237
+
238
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan´ Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in neural information processing systems, pp. 2224–2232, 2015.
239
+
240
+ Ayse Erkan and Yasemin Altun. Semi-supervised learning via generalized maximum entropy. In Thirteenth International Conference on Artificial Intelligence and Statistics, volume PMLR, pp. 209–216, 2010.
241
+
242
+ Kuzman Ganchev, Jennifer Gillenwater, Ben Taskar, et al. Posterior regularization for structured latent variable models. Journal of Machine Learning Research, 11(Jul):2001–2049, 2010.
243
+
244
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In Advances in neural information processing systems, pp. 529–536, 2005.
245
+
246
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016.
247
+
248
+ Trevor Hastie, Robert Tibshirani, and Jerome Friedman. Overview of supervised learning. In The elements of statistical learning, pp. 9–41. Springer, 2009.
249
+
250
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016.
251
+
252
+ Zhiting Hu, Xuezhe Ma, Zhengzhong Liu, Eduard Hovy, and Eric Xing. Harnessing deep neural networks with logic rules. In ACL, 2016.
253
+
254
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
255
+
256
+ Douglas Samuel Jones. Elementary information theory. Clarendon Press, 1979.
257
+
258
+ Diederik P Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. 2015.
259
+
260
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 3581– 3589. Curran Associates, Inc., 2014.
261
+
262
+ Doga Kisa, Guy Van den Broeck, Arthur Choi, and Adnan Darwiche. Probabilistic sentential decision diagrams. In Proceedings of KR, 2014.
263
+
264
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
265
+
266
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classifcation with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 25, pp. 1097–1105, 2012.
267
+
268
+ Pablo Marquez-Neila, Mathieu Salzmann, and Pascal Fua. Imposing hard constraints on deep net-´ works: Promises and limitations. arXiv preprint arXiv:1706.02025, 2017.
269
+
270
+ Robert Mateescu and Rina Dechter. Mixed deterministic and probabilistic networks. Annals of mathematics and artificial intelligence, 54(1-3):3, 2008.
271
+
272
+ Nicholas Mattei and Toby Walsh. Preflib: A library of preference data HTTP://PREFLIB.ORG. In Proceedings of ADT, 2013.
273
+
274
+ Pasquale Minervini, Thomas Demeester, Tim Rocktaschel, and Sebastian Riedel. Adversarial sets ¨ for regularising neural link predictors. arXiv preprint arXiv:1707.07596, 2017.
275
+
276
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. In ICLR, 2016.
277
+
278
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. ArXiv e-prints, 2017.
279
+
280
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th International Conference on International Conference on Machine Learning, pp. 807–814. Omnipress, 2010.
281
+
282
+ Jason Naradowsky and Sebastian Riedel. Modeling exclusion with a differentiable factor graph constraint. In International Conference on Machine Learning (Workshop Track), 2017.
283
+
284
+ Arvind Neelakantan, Benjamin Roth, and Andrew McCallum. Compositional vector space models for knowledge base inference. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pp. 156–166, 2015.
285
+
286
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In International Conference on Machine Learning, pp. 2014–2023, 2016.
287
+
288
+ Masaaki Nishino, Norihito Yasuda, Shin-ichi Minato, and Masaaki Nagata. Compiling graph substructures into sentential decision diagrams. In Proceedings of the Thirty-First Conference on Artificial Intelligence (AAAI), 2017.
289
+
290
+ Deepak Pathak, Philipp Krahenbuhl, and Trevor Darrell. Constrained convolutional neural networks for weakly supervised segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1796–1804, 2015.
291
+ Nikolaos Pitelis, Chris Russell, and Lourdes Agapito. Semi-supervised learning using an unsupervised atlas. In Proceedings of ECML-PKDD, pp. 565–580. Springer, 2014.
292
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In Advances in Neural Information Processing Systems, pp. 3546–3554, 2015.
293
+ Scott Reed and Nando De Freitas. Neural programmer-interpreters. arXiv preprint arXiv:1511.06279, 2015.
294
+ Sebastian Riedel, Matko Bosnjak, and Tim Rocktaschel. Programming with a differentiable forth ¨ interpreter. CoRR, abs/1605.06640, 2016.
295
+ Tim Rocktaschel, Sameer Singh, and Sebastian Riedel. Injecting logical background knowledge ¨ into embeddings for relation extraction. In HLT-NAACL, pp. 1119–1129, 2015.
296
+ Tian Sang, Paul Beame, and Henry A Kautz. Performing bayesian inference by weighted model counting. In AAAI, volume 5, pp. 475–481, 2005.
297
+ Yujia Shen, Arthur Choi, and Adnan Darwiche. A tractable probabilistic model for subset selection. In Proceedings of the 33rd Conference on Uncertainty in Artificial Intelligence (UAI), 2017.
298
+ David Smith and Vibhav Gogate. Loopy belief propagation in the presence of determinism. In Artificial Intelligence and Statistics, pp. 895–903, 2014.
299
+ Ashwin Srinivasan, S Muggleton, and RD King. Comparing the use of background knowledge by inductive logic programming systems. In Proceedings of ILP, pp. 199–230, 1995.
300
+ Russell Stewart and Stefano Ermon. Label-free supervision of neural networks with physics and domain knowledge. In AAAI, pp. 2576–2582, 2017.
301
+ Mingzhe Wang, Yihe Tang, Jian Wang, and Jia Deng. Premise selection for theorem proving by deep graph embedding. arXiv preprint arXiv:1709.09994, 2017.
302
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
303
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
304
+
305
+ A AXIOMATIZATION OF SEMANTIC LOSS: DETAILS
306
+
307
+ This appendix provides further details on our axiomatization of the semantic loss.
308
+ Proposition 5 (Non-Negativity). Semantic loss is non-negative.
309
+
310
+ Proof. Because $\alpha \models$ true for all $\alpha$ , the monotonicity axiom implies that $\forall \mathsf { p } , \mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathsf { p } ) \geq \mathrm { L } ^ { \mathrm { s } } ( t r u e , \mathsf { p } )$ . By the truth axiom, $\mathrm { L } ^ { \mathrm { s } } ( t r u e , \mathsf { p } ) = 0$ , and therefore $\mathrm { L } ^ { \mathrm { s } } ( \alpha , { \mathsf { p } } ) \geq 0$ for all choices of $\alpha$ and $\mathsf { p }$ . □
311
+
312
+ Proposition 6 (Locality). Let α be a sentence over $\mathbf { X }$ with probabilities p. For any $\mathbf { Y }$ disjoint from $\mathbf { X }$ with probabilities q, the semantic loss $\operatorname { L } ^ { \mathrm { s } } ( \alpha , [ \mathsf { p q } ] ) = \operatorname { L } ^ { \mathrm { s } } ( \alpha , \mathsf { p } )$ .
313
+
314
+ Proof. Follows from the additive independence and truth axioms. Set $\beta \ = \ t r u e$ in the additive independence axiom, and observe that this sets $\mathrm { L } ^ { \mathrm { s } } ( \beta , { \mathsf { q } } ) = 0$ because of the truth axiom. □
315
+
316
+ Proof of Proposition 2. The monotonicity axiom specializes to say that if ${ \textbf { x } } | = \alpha$ , we have that $\forall \mathsf { p } , \mathrm { L } ^ { \mathrm { s } } ( \mathbf { x } , \mathsf { p } ) \ \geq \ \mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathsf { p } )$ . By choosing $\mathsf { p }$ to be $\mathbf { x }$ , this implies $\mathrm { L } ^ { \mathrm { s } } ( \mathbf { x } , \mathbf { x } ) \ \geq \ \mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathbf { x } )$ . From the identity axiom, $\mathrm { L } ^ { \mathrm { s } } ( { \bf x } , { \bf x } ) = 0$ , and therefore $0 \geq \operatorname { L } ^ { \mathrm { s } } ( \alpha , \mathbf { x } )$ . Proposition 5 bounds the loss from below as $\mathrm { L } ^ { \mathrm { s } } ( \alpha , \mathbf { x } ) \geq 0$ . □
317
+
318
+ Axiom 7 (Value Symmetry). For all $\mathsf { p }$ and $\alpha$ , we have that $\mathrm { L } ^ { \mathrm { s } } ( \alpha , { \mathfrak { p } } ) = \mathrm { L } ^ { \mathrm { s } } ( { \bar { \alpha } } , 1 - { \mathfrak { p } } )$ where $\bar { \alpha }$ replaces every variable in $\alpha$ by its negation.
319
+
320
+ Axiom 8 (Variable Symmetry). Let $\alpha$ be a sentence over $\mathbf { X }$ with probabilities $\mathsf { p }$ . Let $\pi$ be a permutation of the variables $\mathbf { X }$ , let $\pi ( \alpha )$ be the sentence obtained by replacing variables $x$ by $\pi ( x )$ , and let $\pi ( { \mathfrak { p } } )$ be the corresponding permuted vector of probabilities. Then, $\operatorname { L } ^ { \mathrm { s } } ( \alpha , { \mathsf { p } } ) = \operatorname { L } ^ { \mathrm { s } } ( \pi ( \alpha ) , \pi ( { \mathsf { p } } ) )$ .
321
+
322
+ The value and variable symmetry axioms together imply the equality of the multiplicative constants in the label-literal duality axiom for all literals.
323
+
324
+ Lemma 7. There exists a single constant $K$ such that $\operatorname { L } ^ { \mathrm { s } } ( X , p ) = - K \log ( p )$ and $\operatorname { L } ^ { s } ( \lnot X , p ) =$ $- K \log ( 1 - p )$ for any literal $x$ .
325
+
326
+ Proof. Value symmetry implies that $\operatorname { L } ^ { \mathrm { s } } ( X _ { i } , \mathfrak { p } ) = \operatorname { L } ^ { \mathrm { s } } ( \lnot X _ { i } , 1 - \mathfrak { p } )$ . Using label-literal correspondence, this implies $K _ { 1 } \log ( p _ { i } ) = K _ { 2 } \log ( 1 - ( 1 - p _ { i } ) )$ for the multiplicative constants $K _ { 1 }$ and $K _ { 2 }$ that are left unspecified by that axiom. This implies that the constants are identical. A similar argument based on variable symmetry proves equality between the multiplicative constants for different $i$ .
327
+
328
+ Proof of Lemma 3. A state $\mathbf { x }$ is a conjunction of independent literals, and therefore subject to the additive independence axiom. Each literal’s loss in this sum is defined by Lemma 7. □
329
+
330
+ The following and final axiom requires that the semantic loss is proportionate to the logarithm of a function that is additive for mutually exclusive sentences.
331
+
332
+ Axiom 9 (Exponential Additivity). Let $\alpha$ and $\beta$ be mutually exclusive sentences (i.e., $\alpha \wedge \beta$ is unsatisfiable), and let $f ^ { s } ( K , \alpha , { \mathsf { p } } ) = K ^ { - \mathtt { L } ^ { \mathtt { s } } ( \alpha , { \mathsf { p } } ) }$ . Then, there exists a positive constant $K$ such that $f ^ { s } ( K , \alpha \vee \beta , \mathsf { p } ) = f ^ { s } ( K , \alpha , \mathsf { p } ) + f ^ { s } ( K , \beta , \mathsf { p } )$ .
333
+
334
+ Proof of Theorem 4. The truth axiom states that $\forall \mathsf { p }$ $, f ^ { s } ( K , t r u e , \mathfrak { p } ) = 1$ for all positive constants $K$ . This is the first Kolmogorov axiom of probability. The second Kolmogorov axiom for $f ^ { s } ( K , . , { \mathsf { p } } )$ follows from the additive independence axiom of semantic loss. The third Kolmogorov axiom (for the finite discrete case) is given by the exponential additivity axiom of semantic loss. Hence, $f ^ { s } ( K , . , { \mathsf { p } } )$ is a probability distribution for some choice of $K$ , which implies the definition up to a multiplicative constant. □
335
+
336
+ # B SPECIFICATION OF THE CONVOLUTIONAL NEURAL NETWORK MODEL
337
+
338
+ Table 6 shows the slight architectural difference between the CNN used in ladder nets and ours. The major difference lies in the choice of ReLu. Note we add standard padded cropping to preprocess images and an additional fully connected layer at the end of the model, neither is used in ladder nets. We only make those slight modification so that the baseline performance reported by Rasmus et al. (2015) can be reproduced.
339
+
340
+ # C HYPER-PARAMETER TUNING DETAILS
341
+
342
+ Validation sets are used for tuning the weight associated with semantic loss, the only hyperparameter that causes noticeable difference in performance for our method. For our semi-supervised classification experiments, we perform a grid search over $\{ 0 . 0 0 1 , 0 . 0 0 5 , 0 . 0 1 , 0 . 0 5 , 0 . 1 \}$ to find the optimal value. Empirically, 0.005 always gives the best or nearly the best results and we report its results on all experiments.
343
+
344
+ For the FASHION dataset specifically, because MNIST and FASHION share the same image size and structure, methods developed in MNIST should be able to directly perform on FASHION without heavy modifications. Because of this, we use the same hyper-parameters when evaluating our method. However, for the sake of fairness, we subject ladder nets to a small-scale parameter tuning in case its performance is more volatile.
345
+
346
+ For the grids experiment, the only hyper parameter that needed to be tuned was again the weight given to semantic loss, which after trying $\{ 0 . 0 0 1 , 0 . 0 0 5 , 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 5 , 1 \}$ was selected to be
347
+
348
+ Table 6: Specifications of CNNs in Ladder Net and our proposed method.
349
+
350
+ <table><tr><td>CNNinLadderNet</td><td>CNN in this paper</td></tr><tr><td colspan="2">Input 32×32 RGB image</td></tr><tr><td></td><td>Resizing to 36 × 36 with padding Cropping Back</td></tr><tr><td colspan="2">Whitening Contrast Normalization</td></tr><tr><td colspan="2">Gaussian Noise with std.of 0.3</td></tr><tr><td>3 ×3 conv. 96 BNLeakyReLU</td><td>3×3 conv. 96 BN ReLU</td></tr><tr><td>3×3 conv. 96 BNLeakyReLU</td><td>3 ×3 conv. 96 BN ReLU</td></tr><tr><td>3 ×3 conv. 96 BNLeakyReLU</td><td>3×3 conv. 96 BN ReLU</td></tr><tr><td colspan="2">2×2 max-pooling stride 2 BN</td></tr><tr><td>3×3 conv.192BNLeakyReLU</td><td>3×3 conv.192 BN ReLU</td></tr><tr><td>3×3 conv.192 BNLeakyReLU</td><td>3×3 conv. 192 BN ReLU</td></tr><tr><td>3×3 conv.192 BN LeakyReLU</td><td>3×3 conv.192 BN ReLU</td></tr><tr><td colspan="2">2×2 max-pooling stride 2 BN</td></tr><tr><td>3×3conv.192BNLeakyReLU</td><td>3×3conv.192 BNReLU</td></tr><tr><td>1×1 conv.192 BN LeakyReLU</td><td>3×3 conv. 192 BN ReLU</td></tr><tr><td>1×1conv.10 BNLeakyReLU</td><td>1×1 conv. 10 BN ReLu</td></tr><tr><td colspan="2">global meanpool BN</td></tr><tr><td></td><td>fully connected BN</td></tr><tr><td colspan="2">10-way softmax</td></tr></table>
351
+
352
+ 0.5 based on validation results. For the preference learning experiment, we initially chose the semantic loss weight from $\{ 0 . 0 0 1 , 0 . 0 0 5 , 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 5 , 1 \}$ to be 0.1 based on validation, and then further tuned the weight to 0.25.
353
+
354
+ # D SPECIFICATION OF COMPLEX CONSTRAINT MODELS
355
+
356
+ Grids To compile our grid constraint, we first use Nishino et al. (2017) to generate a constraint for each source destination pair. Then, we conjoin each of these with indicators specifying which source and destination pair must be used, and finally we disjoin all of these together to form our constraint.
357
+
358
+ To generate the data, we begin by randomly removing one third of edges. We then filter out connected components with fewer than 5 nodes to reduce degenerate cases, and proceed with randomly selecting pairs of point to create data points.
359
+
360
+ The predictive model we employ as our baseline is a 5 layer MLP with 50 hidden sigmoid units per layer. It is trained using Adam Optimizer, with full data batches (Kingma & Ba, 2015). Early stopping with respect to validation loss is used as a regularizer.
361
+
362
+ Preference Learning We split each user’s ordering into their ordering over sushis 1,2,3,5,7,8, which we use as the features, and their ordering over 4,6,9,10 which are the labels we predict. The constraint is compiled directly from logic, as this can be done in a straightforward manner for an n-item ordering.
363
+
364
+ The predictive model we use here is a 3 layer MLP with 25 hidden sigmoid units per layer. It is trained using Adam Optimizer with full data batches (Kingma & Ba, 2015). Early stopping with respect to validation loss is used as a regularizer.
md/train/Hyl7ygStwB/Hyl7ygStwB.md ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INCORPORATING BERT INTO NEURAL MACHINE TRANSLATION
2
+
3
+ Jinhua $\mathbf { Z } \mathbf { h } \mathbf { u } ^ { 1 , * }$ , Yingce $\mathbf { X _ { i a } ^ { \bullet } } ^ { 2 , * }$ , Lijun ${ \bf W } { \bf u } ^ { 3 }$ , Di $\mathbf { H e ^ { 4 } }$ , Tao $\mathbf { Q } \mathbf { i n } ^ { 2 }$ , Wengang Zhou1, Houqiang $\mathbf { L i } ^ { 1 }$ , Tie-Yan Liu2
4
+
5
+ 1CAS Key Laboratory of GIPAS, EEIS Department, University of Science and Technology of China;
6
+ 2Microsoft Research;
7
+ 3Sun Yat-sen University;
8
+ 4Key Laboratory of Machine Perception (MOE), School of EECS, Peking University
9
+ 1teslazhu@mail.ustc.edu.cn, {zhwg,lihq}@ustc.edu.cn
10
+ 2yingce.xia@gmail.com, {taoqin,tyliu}@microsoft.com
11
+ 3wulijun3@mail2.sysu.edu.cn 4di he@pku.edu.cn
12
+
13
+ # ABSTRACT
14
+
15
+ The recently proposed BERT (Devlin et al., 2019) has shown great power on a variety of natural language understanding tasks, such as text classification, reading comprehension, etc. However, how to effectively apply BERT to neural machine translation (NMT) lacks enough exploration. While BERT is more commonly used as fine-tuning instead of contextual embedding for downstream language understanding tasks, in NMT, our preliminary exploration of using BERT as contextual embedding is better than using for fine-tuning. This motivates us to think how to better leverage BERT for NMT along this direction. We propose a new algorithm named BERT-fused model, in which we first use BERT to extract representations for an input sequence, and then the representations are fused with each layer of the encoder and decoder of the NMT model through attention mechanisms. We conduct experiments on supervised (including sentence-level and document-level translations), semi-supervised and unsupervised machine translation, and achieve state-of-the-art results on seven benchmark datasets. Our code is available at https://github.com/bert-nmt/bert-nmt.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Recently, pre-training techniques, like ELMo (Peters et al., 2018), GPT/GPT-2 (Radford et al., 2018; 2019), BERT (Devlin et al., 2019), cross-lingual language model (briefly, XLM) (Lample & Conneau, 2019), XLNet (Yang et al., 2019b) and RoBERTa (Liu et al., 2019) have attracted more and more attention in machine learning and natural language processing communities. The models are first pre-trained on large amount of unlabeled data to capture rich representations of the input, and then applied to the downstream tasks by either providing context-aware embeddings of an input sequence (Peters et al., 2018), or initializing the parameters of the downstream model (Devlin et al., 2019) for fine-tuning. Such pre-training approaches lead to significant improvements on natural language understanding tasks. Among them, BERT is one of the most powerful techniques that inspires lots of variants like XLNet, XLM, RoBERTa and achieves state-of-the-art results for many language understanding tasks including reading comprehension, text classification, etc (Devlin et al., 2019).
20
+
21
+ Neural Machine Translation (NMT) aims to translate an input sequence from a source language to a target language. An NMT model usually consists of an encoder to map an input sequence to hidden representations, and a decoder to decode hidden representations to generate a sentence in the target language. Given that BERT has achieved great success in language understanding tasks, a question worthy studying is how to incorporate BERT to improve NMT. Due to the computation resource limitation, training a BERT model from scratch is unaffordable for many researchers. Thus, we focus on the setting of leveraging a pre-trained BERT model (instead of training a BERT model from scratch) for NMT.
22
+
23
+ Given that there is limited work leveraging BERT for NMT, our first attempt is to try two previous strategies: (1) using BERT to initialize downstream models and then fine-tuning the models, and (2) using BERT as context-aware embeddings for downstream models. For the first strategy, following Devlin et al. (2019), we initialize the encoder of an NMT model with a pre-trained BERT model, and then finetune the NMT model on the downstream datasets. Unfortunately, we did not observe significant improvement. Using a pre-trained XLM (Lample & Conneau, 2019) model, a variant of BERT for machine translation, to warm up an NMT model is another choice. XLM has been verified to be helpful for WMT’16 Romanian-to-English translation. But when applied to a language domain beyond the corpus for training XLM (such as IWSLT dataset (Cettolo et al., 2014), which is about spoken languages) or when large bilingual data is available for downstream tasks, no significant improvement is observed neither. For the second strategy, following the practice of (Peters et al., 2018), we use BERT to provide context-aware embeddings for the NMT model. We find that this strategy outperforms the first one (please refer to Section 3 for more details). This motivates us to go along this direction and design more effective algorithms.
24
+
25
+ We propose a new algorithm, BERT-fused model, in which we exploit the representation from BERT by feeding it into all layers rather than served as input embeddings only. We use the attention mechanism to adaptively control how each layer interacts with the representations, and deal with the case that BERT module and NMT module might use different word segmentation rules, resulting in different sequence (i.e., representation) lengths. Compared to standard NMT, in addition to BERT, there are two extra attention modules, the BERT-encoder attention and BERT-decoder attention. An input sequence is first transformed into representations processed by BERT. Then, by the BERTencoder attention module, each NMT encoder layer interacts with the representations obtained from BERT and eventually outputs fused representations leveraging both BERT and the NMT encoder. The decoder works similarly and fuses BERT representations and NMT encoder representations.
26
+
27
+ We conduct 14 experiments on various NMT tasks to verify our approach, including supervised, semi-supervised and unsupervised settings. For supervised NMT, we work on five tasks of IWSLT datasets and two WMT datasets. Specifically, we achieve 36.11 BLEU score on IWSLT’14 Germanto-English translation, setting a new record on this task. We also work on two document-level translations of IWSLT, and further boost the BLEU score of German-to-English translation to 36.69. On WMT’14 datasets, we achieve 30.75 BLEU score on English-to-German translation and 43.78 on English-to-French translation, significantly better over the baselines. For semi-supervised NMT, we boost BLEU scores of WMT’16 Romanian-to-English translation with back translation (Sennrich et al., 2016b), a classic semi-supervised algorithm, from 37.73 to 39.10, achieving the best result on this task. Finally, we verify our algorithm on unsupervised English French and unsupervised English Romanian translations and also achieve state-of-the-art results.
28
+
29
+ # 2 BACKGROUND AND RELATED WORK
30
+
31
+ We briefly introduce the background of NMT and review current pre-training techniques.
32
+
33
+ NMT aims to translate an input sentence from the source language to the target one. An NMT model usually consists of an encoder, a decoder and an attention module. The encoder maps the input sequence to hidden representations and the decoder maps the hidden representations to the target sequence. The attention module is first introduced by Bahdanau et al. (2015), which is used to better align source words and target words. The encoder and decoder can be specialized as LSTM (Hochreiter & Schmidhuber, 1997; Sutskever et al., 2014; Wu et al., 2016), CNN (Gehring et al., 2017) and Transformer (Vaswani et al., 2017). A Transformer layer consists of three sublayers, a self-attention layer that processes sequential data taking the context of each timestep into consideration, an optional encoder-decoder attention layer that bridges the input sequence and target sequence which exists in decoder only, and a feed-forward layer for non-linear transformation. Transformer achieves the state-of-the-art results for NMT (Barrault et al., 2019). In this work, we will use Transformer as the basic architecture of our model.
34
+
35
+ Pre-training has a long history in machine learning and natural language processing (Erhan et al., 2009; 2010). Mikolov et al. (2013) and Pennington et al. (2014) proposed to use distributional representations (i.e., word embeddings) for individual words. Dai & Le (2015) proposed to train a language model or an auto-encoder with unlabeled data and then leveraged the obtained model to finetune downstream tasks. Pre-training has attracted more and more attention in recent years and achieved great improvements when the data scale becomes large and deep neural networks are employed. ELMo was proposed in Peters et al. (2018) based on bidirectional LSTMs and its pre-trained models are fed into downstream tasks as context-aware inputs. In GPT (Radford et al., 2018), a Transformer based language model is pre-trained on unlabeled dataset and then finetuned on downstream tasks. BERT (Devlin et al., 2019) is one of the widely adopted pre-training approach for model initialization. The architecture of BERT is the encoder of Transformer (Vaswani et al., 2017). Two kinds of objective functions are used in BERT training: (1) Masked language modeling (MLM), where $1 5 \%$ words in a sentence are masked and BERT is trained to predict them with their surrounding words. (2) Next sentence prediction (NSP): Another task of pre-training BERT is to predict whether two input sequences are adjacent. For this purpose, the training corpus consists of tuples ([cls], input 1, [sep], input 2, [sep]), with learnable special tokens [cls] to classify whether input 1 and input 2 are adjacent and [sep] to segment two sentences, and with probability $50 \%$ , the second input is replaced with a random input. Variants of BERT have been proposed: In XLM (Lample & Conneau, 2019), the model is pre-trained based on multiple languages and NSP task is removed; in RoBERTa (Liu et al., 2019), more unlabeled data is leveraged without NSP task neither; in XLNet (Yang et al., 2019b), a permutation based modeling is introduced.
36
+
37
+ # 3 A PRELIMINARY EXPLORATION
38
+
39
+ While a few pieces of work (Lample & Conneau, 2019; Song et al., 2019) design specific pretraining methods for NMT, they are time and resource consuming given that they need to pre-train large models from scratch using large-scale data, and even one model for each language pair. In this work, we focus on the setting of using a pre-trained BERT model. Detailed model download links can be found in Appendix D.
40
+
41
+ Considering that pre-trained models have been utilized in two different ways for other natural language tasks, it is straightforward to try them for NMT. Following previous practice, we make the following attempts.
42
+
43
+ (I) Use pre-trained models to initialize the NMT model. There are different implementations for this approach. (1) Following (Devlin et al., 2019), we initialize the encoder of an NMT model with a pretrained BERT. (2) Following (Lample & Conneau, 2019), we initialize the encoder and/or decoder of an NMT model with XLM.
44
+
45
+ (II) Use pre-trained models as inputs to the NMT model. Inspired from (Peters et al., 2018), we feed the outputs of the last layer of BERT to an NMT model as its inputs.
46
+
47
+ We conduct experiments on the IWSLT’14 English German translation, a widely adopted dataset for machine translation consisting of $1 6 0 k$ labeled sentence pairs. We choose Transformer (Vaswani et al., 2017) as the basic model architecture with transformer iwslt de en configuration (a six-layer model with 36.7M parameters). The translation quality is evaluated by BLEU (Papineni et al., 2002) score; the larger, the better. Both $\mathbf { B E R T _ { b a s e } }$ and XLM models are pre-trained and we get them from the Web. More details about the experimental settings are included in Appendix A.2.
48
+
49
+ Table 1: Preliminary explorations on IWSLT’14 English German translation.
50
+
51
+ <table><tr><td>Algorithm</td><td>BLEU score</td></tr><tr><td>Standard Transformer</td><td>28.57</td></tr><tr><td>Use BERT to initialize the encoder of NMT</td><td>27.14</td></tr><tr><td>Use XLM to initialize the encoder of NMT</td><td>28.22</td></tr><tr><td>Use XLM to initialize the decoder of NMT</td><td>26.13</td></tr><tr><td>Use XLM to initialize both the encoder and decoder of NMT</td><td>28.99</td></tr><tr><td>Leveraging the output of BERT as embeddings</td><td>29.67</td></tr></table>
52
+
53
+ The results are shown in Table 1. We have several observations: (1) Using BERT to initialize the encoder of NMT can only achieve 27.14 BLEU score, which is even worse than standard Transformer without using BERT. That is, simply using BERT to warm up an NMT model is not a good choice. (2) Using XLM to initialize the encoder or decoder respectively, we get 28.22 or 26.13 BLEU score, which does not outperform the baseline. If both modules are initialized with XLM, the BLEU score is boosted to 28.99, slightly outperforming the baseline. Although XLM achieved great success on WMT’16 Romanian-to-English, we get limited improvement here. Our conjecture is that the XLM model is pre-trained on news data, which is out-of-domain for IWSLT dataset mainly about spoken languages and thus, leading to limited improvement. (3) When using the output of BERT as context-aware embeddings of the encoder, we achieve 29.67 BLEU, much better than using pretrained models for initialization. This shows that leveraging BERT as a feature provider is more effective in NMT. This motivates us to take one step further and study how to fully exploit such features provided by pre-trained BERT models.
54
+
55
+ # 4 ALGORITHM
56
+
57
+ In this section, we first define the necessary notations, then introduce our proposed BERT-fused model and finally provide discussions with existing works.
58
+
59
+ Notations Let $\mathcal { X }$ and $\mathcal { V }$ denote the source language domain and target language domain respectively, which are the collections of sentences with the corresponding languages. For any sentence $x \in \mathcal { X }$ and $y \in \mathcal { D }$ , let $l _ { x }$ and $l _ { y }$ denote the number of units (e.g., words or sub-words) in $x$ and $y$ . The $i$ -th unit in $x / y$ is denoted as $x _ { i } / y _ { i }$ . Denote the encoder, decoder and BERT as Enc, Dec and BERT respectively. For ease of reference, we call the encoder and decoder in our work as the NMT module. W.l.o.g., we assume both the encoder and decoder consists of $L$ layers. Let att $\scriptstyle \mathrm { { n } } ( q , K , V )$ denote the attention layer, where $q , K$ and $V$ indicate query, key and value respectively (Vaswani et al., 2017). We use the same feed-forward layer as that used in (Vaswani et al., 2017) and denote it as FFN. Mathematical formulations of the above layers are left at Appendix E.
60
+
61
+ # 4.1 BERT-FUSED MODEL
62
+
63
+ An illustration of our algorithm is shown in Figure 1. Any input $x \in \mathcal { X }$ is progressively processed by the BERT, encoder and decoder.
64
+
65
+ ![](images/9786a5b4e4dd97a7805cda89e7a4b9700738bb6f34010c1bab35b2aaf9f072df.jpg)
66
+ Figure 1: The architecture of BERT-fused model. The left and right figures represent the BERT, encoder and decoder respectively. Dash lines denote residual connections. $H _ { B }$ (red part) and $H _ { E } ^ { L }$ (green part) denote the output of the last layer from BERT and encoder.
67
+
68
+ Step-1: Given any input $x \in \mathcal { X }$ , BERT first encodes it into representation $H _ { B } = \mathtt { B E R T } ( x )$ . $H _ { B }$ is the output of the last layer in BERT. The $h _ { B , i } \in H _ { B }$ is the representation of the $i$ -th wordpiece in $x$
69
+
70
+ Step-2: Let $H _ { E } ^ { l }$ denote the hidden representation of $l$ -th layer in the encoder, and let $H _ { E } ^ { 0 }$ denote word embedding of sequence $x$ . Denote the $i$ -th element in $H _ { E } ^ { l }$ as $h _ { i } ^ { l }$ for any $i \in \left[ l _ { x } \right]$ . In the $l$ -th
71
+
72
+ layer, $l \in [ L ]$ ,
73
+
74
+ $$
75
+ \tilde { h } _ { i } ^ { l } = \frac { 1 } { 2 } \bigl ( \mathsf { a t t } \mathsf { n } _ { S } ( h _ { i } ^ { l - 1 } , H _ { E } ^ { l - 1 } , H _ { E } ^ { l - 1 } ) + \mathsf { a t t } \mathsf { n } _ { B } ( h _ { i } ^ { l - 1 } , H _ { B } , H _ { B } ) \bigr ) , \forall i \in [ l _ { x } ] ,
76
+ $$
77
+
78
+ where attn $S$ and att $\mathrm { n } _ { B }$ are attention models (see Eqn.(6)) with different parameters. Then each $\tilde { h } _ { i } ^ { l }$ is further processed by $\mathrm { { F F N } ( \cdot ) }$ defined in Eqn.(7) and we get the output of the $l$ -th layer: $H _ { E } ^ { l } =$ $\big ( \mathrm { F F N } ( \tilde { h } _ { 1 } ^ { l } ) , \cdot \cdot \cdot , \mathrm { F F N } ( \tilde { h } _ { l _ { x } } ^ { l } ) \big )$ . The encoder will eventually output $H _ { E } ^ { L }$ from the last layer.
79
+
80
+ Step-3: Let $S _ { < t } ^ { l }$ denote the hidden state of $l$ -th layer in the decoder preceding time step $t$ , i.e., $S _ { < t } ^ { l } = ( s _ { 1 } ^ { l } , \cdot \cdot \cdot , s _ { t - 1 } ^ { l } )$ . Note $s _ { 1 } ^ { 0 }$ is a special token indicating the start of a sequence, and $s _ { t } ^ { 0 }$ is the embedding of the predicted word at time-step $t - 1$ . At the $l$ -th layer, we have
81
+
82
+ $$
83
+ \begin{array} { l } { \displaystyle \hat { s } _ { t } ^ { l } = \mathsf { a t t n } _ { S } \big ( s _ { t } ^ { l - 1 } , S _ { < t + 1 } ^ { l - 1 } , S _ { < t + 1 } ^ { l - 1 } \big ) ; } \\ { \displaystyle \tilde { s } _ { t } ^ { l } = \frac { 1 } { 2 } \big ( \mathsf { a t t n } _ { B } \big ( \hat { s } _ { t } ^ { l } , H _ { B } , H _ { B } \big ) + \mathsf { a t t n } _ { E } \big ( \hat { s } _ { t } ^ { l } , H _ { E } ^ { L } , H _ { E } ^ { L } \big ) \big ) , ~ s _ { t } ^ { l } = \mathtt { F F N } \big ( \tilde { s } _ { t } ^ { l } \big ) . } \end{array}
84
+ $$
85
+
86
+ The attn $S$ , attn $B$ and attn $E$ represent self-attention model, BERT-decoder attention model and encoder-decoder attention model respectively. Eqn.(2) iterates over layers and we can eventually obtain $s _ { t } ^ { L }$ . Finally $s _ { t } ^ { L }$ is mapped via a linear transformation and softmax to get the $t { \cdot }$ -th predicted word $\hat { y } _ { t }$ . The decoding process continues until meeting the end-of-sentence token.
87
+
88
+ In our framework, the output of BERT serves as an external sequence representation, and we use an attention model to incorporate it into the NMT model. This is a general way to leverage the pre-trained model regardless of the tokenization way.
89
+
90
+ # 4.2 DROP-NET TRICK
91
+
92
+ Inspired by dropout (Srivastava et al., 2014) and drop-path (Larsson et al., 2017), which can regularize the network training, we propose a drop-net trick to ensure that the features output by BERT and the conventional encoder are fully utilized. The drop-net will effect Eqn.(1) and Eqn.(2). Denote the drop-net rate as $p _ { \mathrm { n e t } } \in [ 0 , 1 ]$ . At each training iteration, for any layer $l$ , we uniformly sample a random variable $U ^ { l }$ from $[ 0 , 1 ]$ , then all the $\tilde { h } _ { i } ^ { l }$ in Eqn.(1) are calculated in the following way:
93
+
94
+ $$
95
+ \begin{array} { r l } & { \tilde { h } _ { i , \mathrm { d e p } , \mathrm { n e t } } ^ { l } = \mathbb { I } \big ( U ^ { l } < \frac { p _ { \mathrm { n e t } } } { 2 } \big ) \cdot \mathsf { a t t n } _ { S } \big ( h _ { i } ^ { l - 1 } , H _ { E } ^ { l - 1 } , H _ { E } ^ { l - 1 } \big ) + \mathbb { I } \big ( U ^ { l } > 1 - \frac { p _ { \mathrm { n e t } } } { 2 } \big ) \cdot \mathsf { a t t n } _ { B } \big ( h _ { i } ^ { l - 1 } , H _ { B } , H _ { B } \big ) } \\ & { \qquad + \frac { 1 } { 2 } \mathbb { I } \big ( \frac { p _ { \mathrm { n e t } } } { 2 } \le U ^ { l } \le 1 - \frac { p _ { \mathrm { n e t } } } { 2 } \big ) \cdot \big ( \mathsf { a t t n } _ { S } \big ( h _ { i } ^ { l - 1 } , H _ { E } ^ { l - 1 } , H _ { E } ^ { l - 1 } \big ) + \mathsf { a t t n } _ { B } \big ( h _ { i } ^ { l - 1 } , H _ { B } , H _ { B } \big ) \big ) , } \end{array}
96
+ $$
97
+
98
+ where $\mathbb { I } ( \cdot )$ is the indicator function. For any layer, with probability $p _ { \mathrm { n e t } } / 2$ , either the BERT-encoder attention or self-attention is used only; w.p. $( 1 - p _ { \mathrm { n e t } } )$ , both the two attention models are used. For example, at a specific iteration, the first layer might uses attn $S$ only while the second layer uses attn $B$ only. During inference time, the expected output of each attention model is used, which is $\mathbb { E } _ { U \sim \mathrm { u n i f o r m } [ 0 , 1 ] } ( \tilde { h } _ { i , \mathrm { d r o p - n e t } } ^ { l } )$ . The expectation is exactly Eqn.(1).
99
+
100
+ Similarly, for training of the decoder, with the drop-net trick, we have
101
+
102
+ $$
103
+ \begin{array} { r l } & { \tilde { s } _ { t , \mathrm { d r o p - n e t } } ^ { l } = \mathbb { I } ( U ^ { l } < \frac { p _ { \mathrm { n e t } } } { 2 } ) \cdot \mathsf { a t t n } _ { B } \big ( \hat { s } _ { t } ^ { l } , H _ { B } , H _ { B } \big ) + \mathbb { I } ( U ^ { l } > 1 - \frac { p _ { \mathrm { n e t } } } { 2 } \big ) \cdot \mathsf { a t t n } _ { E } \big ( \hat { s } _ { t } ^ { l } , H _ { E } ^ { L } , H _ { E } ^ { L } \big ) } \\ & { \qquad + \displaystyle \frac { 1 } { 2 } \mathbb { I } \big ( \frac { p _ { \mathrm { n e t } } } { 2 } \le U ^ { l } \le 1 - \frac { p _ { \mathrm { n e t } } } { 2 } \big ) \cdot \big ( \mathsf { a t t n } _ { B } \big ( \hat { s } _ { t } ^ { l } , H _ { B } , H _ { B } \big ) + \mathsf { a t t n } _ { E } \big ( \hat { s } _ { t } ^ { l } , H _ { E } ^ { L } , H _ { E } ^ { L } \big ) \big ) . } \end{array}
104
+ $$
105
+
106
+ For inference, it is calculated in the same way as Eqn.(2). Using this technique can prevent network from overfitting (see the second part of Section 6 for more details).
107
+
108
+ # 4.3 DISCUSSION
109
+
110
+ Comparison with ELMo As introduced in Section 2, ELMo (Peters et al., 2018) provides a contextaware embeddings for the encoder in order to capture richer information of the input sequence. Our approach is a more effective way of leveraging the features from the pre-trained model: (1) The output features of the pre-trained model are fused in all layers of the NMT module, ensuring the well-pre-trained features are fully exploited; (2) We use the attention model to bridge the NMT module and the pre-trained features of BERT, in which the NMT module can adaptively determine how to leverage the features from BERT.
111
+
112
+ Limitations We are aware that our approach has several limitations. (1) Additional storage cost: our approach leverages a BERT model, which results in additional storage cost. However, considering the BLEU improvement and the fact that we do not need additional training of BERT, we believe that the additional storage is acceptable. (2) Additional inference time: We use BERT to encode the input sequence, which takes about $4 5 \%$ additional time (see Appendix C for details). We will leave the improvement of the above two limitations as future work.
113
+
114
+ # 5 APPLICATION TO SUPERVISED NMT AND SEMI-SUPERVISED NMT
115
+
116
+ We first verify our BERT-fused model on the supervised setting, including low-resource and richresource scenarios. Then we conduct experiments on document-level translation to verify our approach. Finally, we combine BERT-fused model with back translation (Sennrich et al., 2016b) to verify the effectiveness of our method on semi-supervised NMT.
117
+
118
+ # 5.1 SETTINGS
119
+
120
+ Dataset For the low-resource scenario, we choose IWSLT’14 English German $_ \mathrm { E n D e } )$ , English Spanish $( { \mathrm { E n } } { } { \mathrm { E s } } )$ , IWSLT’17 English French $( \mathrm { E n \to F r } )$ ) and English Chinese $( \mathrm { E n { \to } Z h } )$ ) translation. There are $1 6 0 k$ , $1 8 3 k$ , $2 3 6 k$ , $2 3 5 k$ bilingual sentence pairs for $\mathrm { E n } { } \mathrm { D e }$ , $\scriptstyle { \vec { \mathrm { { r } } } } \ n \to \mathrm { { E s } }$ , $\mathrm { E n } { } \mathrm { F r }$ and $\mathrm { E n } \to \mathrm { Z h }$ tasks. Following the common practice (Edunov et al., 2018), for $\mathrm { E n } { } \mathrm { D e }$ , we lowercase all words. All sentences are preprocessed by BPE (Sennrich et al., 2016c). The model configuration is transformer iwslt de en, representing a six-layer model with embedding size 512 and FFN layer dimension 1024. For the rich-resource scenario, we work on WMT’14 En→De and $\mathrm { E n } \mathrm { F r }$ , whose corpus sizes are $4 . 5 M$ and $3 6 M$ respectively. We concatenate newstest2012 and newstest2013 as the validation set and use newstest2014 as the test set. The model configuration is transformer big, another six-layer network with embedding size 1024 and FFN layer dimension 4096. More details about data and model are left in Appendix A.1.
121
+
122
+ We choose $\mathbf { B E R T _ { b a s e } }$ for IWSLT tasks and $\mathbf { B E R T _ { l a r g e } }$ for WMT tasks, which can ensure that the dimension of the BERT and NMT model almost match. The BERT models are fixed during training. Detailed BERT information for each task is in Appendix D. The drop-net rate $p _ { \mathrm { n e t } }$ is set as 1.0.
123
+
124
+ Training Strategy We first train an NMT model until convergence, then initialize the encoder and decoder of the BERT-fused model with the obtained model. The BERT-encoder attention and BERTdecoder attention are randomly initialized. Experiments on IWSLT and WMT tasks are conducted on 1 and $8 \mathbf { M } 4 0$ GPUs respectively. The batchsize is $4 k$ tokens per GPU. Following (Ott et al., 2018), for WMT tasks, we accumulate the gradient for 16 iterations and then update to simulate a 128-GPU environment. It takes 1, 8 and 14 days to obtain the pre-trained NMT models, and additional 1, 7 and 10 days to finish the whole training process. The optimization algorithm is Adam (Kingma & Ba, 2014) with initial learning rate 0.0005 and inverse sqrt learning rate scheduler (Vaswani et al., 2017). For WMT’ $1 4 ~ \mathrm { E n } { } \mathrm { D e }$ , we use beam search with width 4 and length penalty 0.6 for inference following (Vaswani et al., 2017). For other tasks, we use width 5 and length penalty 1.0.
125
+
126
+ Evaluation We use multi-bleu.perl to evaluate IWSLT’ $1 4 ~ \mathrm { E n } { } \mathrm { D e }$ and WMT translation tasks for fair comparison with previous work. For the remaining tasks, we use a more advance implementation of BLEU score, sacreBLEU for evaluation. Script urls are in Appendix A.1.
127
+
128
+ # 5.2 RESULTS
129
+
130
+ The results of IWSLT translation tasks are reported in Table 2. We implemented standard Transformer as baseline. Our proposed BERT-fused model can improve the BLEU scores of the five tasks by 1.88, 1.47, 2.4, 1.9 and 2.8 points respectively, demonstrating the effectiveness of our method. The consistent improvements on various tasks shows that our method works well for low-resource translations. We achieved state-of-the-art results on IWSLT’14 $\mathrm { D e } { } \mathrm { E n }$ translation, a widely investigated baseline in machine translation. The comparison with previous methods are shown in Appendix B.4 due to space limitation.
131
+
132
+ Table 2: BLEU of all IWSLT tasks.
133
+
134
+ <table><tr><td></td><td>Transformer</td><td>BERT-fused</td></tr><tr><td>En→De</td><td>28.57</td><td>30.45</td></tr><tr><td>De-→En</td><td>34.64</td><td>36.11</td></tr><tr><td>En→Es</td><td>39.0</td><td>41.4</td></tr><tr><td>En→Zh</td><td>26.3</td><td>28.2</td></tr><tr><td>En→Fr</td><td>35.9</td><td>38.7</td></tr></table>
135
+
136
+ The results of $\mathrm { W M T ^ { \prime } } 1 4 ~ \mathrm { E n \mathrm { \to } D e }$ and $\mathrm { E n } { } \mathrm { F r }$ are shown in Table 3. Our reproduced Transformer matches the results reported in Ott et al. (2018), and we can see that our BERT-fused model can improve these two numbers to 30.75 and 43.78, achieving 1.63 and 0.82 points improvement. Our approach also outperforms the well-designed model DynamicConv (Wu et al., 2019) and a model obtained through neural architecture search (So et al., 2019).
137
+
138
+ Table 3: BLEU scores of WMT’14 translation.
139
+
140
+ <table><tr><td>Algorithm</td><td>En→De</td><td>En→Fr</td></tr><tr><td>DynamicConv (Wu et al., 2019)</td><td>29.7</td><td>43.2</td></tr><tr><td>Evolved Transformer (So et al., 2019)</td><td>29.8</td><td>41.3</td></tr><tr><td>Transformer + Large Batch (Ott et al., 2018)</td><td>29.3</td><td>43.0</td></tr><tr><td>Our Reproduced Transformer</td><td>29.12</td><td>42.96</td></tr><tr><td>Our BERT-fused model</td><td>30.75</td><td>43.78</td></tr></table>
141
+
142
+ # 5.3 TRANSLATION WITH DOCUMENT-LEVEL CONTEXTUAL INFORMATION
143
+
144
+ BERT is able to capture the relation between two sentences, since the next sentence prediction (NSP) task is to predict whether two sentences are adjacent. We can leverage this property to improve translation with document-level contextual information (Miculicich et al., 2018), which is briefly denoted as document-level translation. The inputs are a couple of sentences extracted from a paragraph/document, $x _ { 1 } ^ { d } , x _ { 2 } ^ { d } , \cdot \cdot \cdot , x _ { T } ^ { d }$ , where the $T x$ ’s are contextually correlated. We want to translate them into target language by considering the contextual information.
145
+
146
+ Algorithm In our implementation, to translate a sentence $x$ to target domain, we leverage the contextual information by taking both $x$ and its preceding sentence $x _ { \mathrm { p r e v } }$ as inputs. $x$ is fed into Enc, which is the same as sentence-level translation. For the input of BERT, it is the concatenation of two sequences: ([cls], $x _ { \mathrm { p r e v } }$ , [sep], $x$ , [sep]), where both [cls] and [sep] are special tokens of BERT.
147
+
148
+ Setting We use IWSLT $1 4 ~ \mathrm { E n } { } \mathrm { I }$ De dataset as introduced in Section 5.1. The data is a collection of TED talks, where each talk consists of several sequences. We can extract the adjacent sentences for training, validation and test sets. The training strategy, hyperparameter selection and evaluation metric are the same for sentence-level translation.
149
+
150
+ Baselines We use two baselines here. (1) To demonstrate how BERT works in our model, we replace BERT by a Transformer with configuration transformer iwslt de en, which is randomly initialized and jointly trained. (2) Another baseline is proposed by Miculicich et al. (2018), where multiple preceding sentences in a document are leveraged using a hierarchical attention network.
151
+
152
+ Table 4: BLEU of document-level translation.
153
+
154
+ <table><tr><td></td><td>En→De</td><td>De→En</td></tr><tr><td>Sentence-level</td><td>28.57</td><td>34.64</td></tr><tr><td>Our Document-level</td><td>28.90</td><td>34.95</td></tr><tr><td>Miculicich et al. (2018)</td><td>27.94</td><td>33.97</td></tr><tr><td>Sentence-level +BERT</td><td>30.45</td><td>36.11</td></tr><tr><td>Document-level + BERT</td><td>31.02</td><td>36.69</td></tr></table>
155
+
156
+ Results The results are shown in Table 4. We can see that introducing contextual information from an additional encoder can boost the sentence-level baselines, but the improvement is limited (0.33 for $\mathrm { E n } { } \mathrm { D e }$ and 0.31 for $\mathrm { D e } \to \mathrm { E n }$ ). For Miculicich et al. (2018), the best results we obtain are 27.94 and 33.97 respectively, which are worse than the sentence-level baselines. Combining BERT-fused model and document-level information, we can eventually achieve 31.02 for $\mathrm { E n } { } \mathrm { D e }$ and 36.69 for $\mathrm { D e } { } \mathrm { E n }$ . We perform significant test1 between sentence-level and document-level translation. Our document-level BERT-fused model significantly outperforms sentence-level baseline with $p$ -value less than 0.01. This shows that our approach not only works for sentence-level translation, but can also be generalized to document-level translation.
157
+
158
+ # 5.4 APPLICATION TO SEMI-SUPERVISED NMT
159
+
160
+ We work on WMT’16 Romanian English $\mathrm { R o } \to \mathrm { E n }$ ) translation to verify whether our approach can still make improvement over back translation (Sennrich et al., 2016b), the standard and powerful semi-supervised way to leverage monolingual data in NMT.
161
+
162
+ The number of bilingual sentence pairs for $\mathrm { R o } { } \mathrm { E n }$ is $0 . 6 M$ . Sennrich et al. (2016a) provided $2 M$ back translated data2. We use newsdev2016 as validation set and newstest2016 as test set. Sentences were encoded using BPE with a shared source-target vocabulary of about $3 2 k$ tokens. We use transformer big configuration. Considering there is no Romanian BERT, we use the cased multilingual BERT (please refer to Appendix D) to encode inputs. The drop-net rate $p _ { \mathrm { n e t } }$ is set as 1.0. The translation quality is evaluated by multi-bleu.perl.
163
+
164
+ The results are shown in Table 5. The Transformer baseline achieves 33.12 BLEU score. With back-translation, the performance is boosted to 37.73. We use the model obtained with back-translation to initialize BERT-fused model, and eventually reach 39.10 BLEU. Such a score surpasses the previous best result 38.5 achieved by XLM (Lample & Conneau, 2019) and sets a new record. This demonstrates that
165
+
166
+ Table 5: BLEU scores of WMT’16 Ro En.
167
+
168
+ <table><tr><td>Methods</td><td>BLEU</td></tr><tr><td>Sennrich et al. (2016a)</td><td>33.9</td></tr><tr><td> XLM (Lample &amp; Conneau,2019)</td><td>38.5</td></tr><tr><td>Standard Transformer</td><td>33.12</td></tr><tr><td>+ back translation</td><td>37.73</td></tr><tr><td>+ BERT-fused model</td><td>39.10</td></tr></table>
169
+
170
+ our proposed approach is effective and can still achieve improvement over strong baselines.
171
+
172
+ # 6 ABLATION STUDY
173
+
174
+ We conduct two groups of ablation studies on IWSLT’14 En De translation to better understand our model.
175
+
176
+ Table 6: Ablation study on IWSLT’14 En→De.
177
+
178
+ <table><tr><td>Standard Transformer BERT-fused model</td><td>28.57 30.45</td></tr><tr><td>Randomly initialize encoder/decoder of BERT-fused model</td><td>27.03</td></tr><tr><td>Jointly tune BERT and encoder/decoder of BERT-fused model</td><td>28.87</td></tr><tr><td>Feed BERT feature into all layers without attention Replace BERT output with random vectors</td><td>29.61</td></tr><tr><td>Replace BERT with the encoder of another Transformer model</td><td>28.91</td></tr><tr><td></td><td>28.99</td></tr><tr><td>Remove BERT-encoder attention Remove BERT-decoder attention</td><td>29.87 29.90</td></tr></table>
179
+
180
+ # Study for training strategy and network architecture
181
+
182
+ We conduct ablation study to investigate the performance of each component of our model and training strategy. Results are reported in Table 6:
183
+
184
+ (1) We randomly initialize the NMT module (i.e., encoder and decoder) of BERT-fused model instead of using a warm-start one as introduced in the training strategy of Section 5.1. In this way, we can only achieve 27.03 BLEU score, which cannot catch up with the baseline. We also jointly train BERT model with the NMT module. Although it can also boost the baseline from 28.57 to 28.87, it is not as good as fixing the BERT part, whose BLEU is 30.45.
185
+
186
+ (2) We feed the output of BERT into all layers of the encoder without attention models. That is, the Eqn.(1) is revised to $\begin{array} { r } { \tilde { h } _ { i } ^ { l } = \frac { 1 } { 2 } \big ( \mathsf { a t t n } _ { S } \big ( h _ { i } ^ { l - 1 } , H _ { E } ^ { l - 1 } , H _ { E } ^ { l - 1 } \big ) + W _ { B } ^ { l } h _ { i } ^ { l - 1 } \big ) \big ) } \end{array}$ , where $\boldsymbol { W _ { B } ^ { l } }$ is learnable. In this case, the encoder and BERT have to share the same vocabulary. The BLEU score is 29.61, which is better than the standard Transformer but slightly worse than leveraging the output of BERT as embedding. This shows that the output of BERT should not be fused into each layer directly, and using the attention model to bridge the relation is better than using simple transformation. More results on different languages are included in Appendix B.3. To illustrate the effectiveness of our method, we choose another two kinds of ways to encode the input sequence rather than using BERT: (1) Using a fixed and randomly initialized embedding; (2) Using the encoder from another NMT model. Their BLEU scores are 28.91 and 28.99 respectively, indicating that the BERT pre-trained on large amount of unlabeled data can provide more helpful features to NMT.
187
+
188
+ (3) To verify where the output of BERT should be connected to, we remove the BERT-encoder attention (i.e., attn $B$ in Eqn.(1)) and the BERT-decoder attention (i.e,, att $\mathrm { n } _ { B }$ in Eqn.(2)) respectively. Correspondingly, the BLEU score drops from 30.45 to 29.87 and 29.90. This indicates that the output of BERT should be leveraged by both encoder and decoder to achieve better performances. At last, considering that there are two stacked encoders in our model, we also choose ensemble models and deeper NMT models as baselines. Our approach outperforms the above baselines. The results are left in Appendix B.2 due to space limitation.
189
+
190
+ # Study on drop-net
191
+
192
+ To investigate the effect of drop-net, we conduct experiments on IWSLT’ $1 4 ~ \mathrm { E n D }$ e dataset with different drop-net probability, $\bar { p _ { \mathrm { n e t } } } \in \{ 0 , 0 . 2 , 0 . 4 , 0 . \bar { 6 , } 0 . 8 , 1 . 0 \}$ . The results are shown in Figure 2. As can been seen, although larger $p _ { \mathrm { n e t } }$ leads to larger training loss, it leads to smaller validation loss and so better BLUE scores. This shows that the drop-net trick can indeed improve the generalization ability of our model. We fix $p _ { \mathrm { n e t } } = 1 . 0$ in other experiments unless specially specified.
193
+
194
+ ![](images/2bca36ed71935b317a48d4b60550e0913d5815407c1945dfa67db0822784f2da.jpg)
195
+ Figure 2: Training/validation curves with different $p _ { \mathrm { n e t } }$ ’s.
196
+
197
+ # 7 APPLICATION TO UNSUPERVISED NMT
198
+
199
+ We work on unsupervised $\mathrm { E n } { } \mathrm { F r }$ and $\mathrm { E n } { } \mathrm { R o }$ translation. The data processing, architecture selection and training strategy is the same as Lample & Conneau (2019).
200
+
201
+ Settings For $\mathrm { E n } { } \mathrm { F r }$ , we use $1 9 0 M$ monolingual English sentences and $6 2 M$ monolingual French sentences from WMT News Crawl datasets, which is the same as that used in (Song et al., 2019).3 For unsupervised $\mathrm { E n } { } \mathrm { R o }$ translation, we use $5 0 M$ English sentences from News Crawl (sampled from the data for $\mathrm { E n \to F r }$ ) and collect $2 . 9 M$ sentences for Romanian by concatenating News Crawl data sets and WMT’16 Romanian monolingual data following Lample et al. (2018). The data is preprocessed in the same way as Lample & Conneau (2019).
202
+
203
+ We use the same model configuration as Lample & Conneau (2019), with details in Appendix A.3. The BERT is the pre-trained XLM model (see Appendix D). We first train an unsupervised NMT model following Lample & Conneau (2019) until convergence. Then we initialize our BERT-fused model with the obtained model and continue training. We train models on 8 M40 GPUs, and the batchsize is 2000 tokens per GPU. We use the same optimization hyper-parameters as that described in Lample & Conneau (2019).
204
+
205
+ Table 7: BLEU scores of unsupervised NMT.
206
+
207
+ <table><tr><td></td><td>En→Fr</td><td>Fr→En</td><td>En→Ro</td><td>Ro→En</td></tr><tr><td>Lample et al. (2018)</td><td>27.6</td><td>27.7</td><td>25.1</td><td>23.9</td></tr><tr><td>XLM (Lample &amp; Conneau,2019)</td><td>33.4</td><td>33.3</td><td>33.3</td><td>31.8</td></tr><tr><td>MASS (Song et al., 2019)</td><td>37.50</td><td>34.90</td><td>35.20</td><td>33.10</td></tr><tr><td>OurBERT-fused model</td><td>38.27</td><td>35.62</td><td>36.02</td><td>33.20</td></tr></table>
208
+
209
+ Results The results of unsupervised NMT are shown in Table 7. With our proposed BERT-fused model, we can achieve 38.27, 35.62, 36.02 and 33.20 BLEU scores on the four tasks, setting stateof-the-art results on these tasks. Therefore, our BERT-fused model also benefits unsupervised NMT.
210
+
211
+ # 8 CONCLUSION AND FUTURE WORK
212
+
213
+ In this work, we propose an effective approach, BERT-fused model, to combine BERT and NMT, where the BERT is leveraged by the encoder and decoder through attention models. Experiments on supervised NMT (including sentence-level and document-level translations), semi-supervised NMT and unsupervised NMT demonstrate the effectiveness of our method.
214
+
215
+ For future work, there are many interesting directions. First, we will study how to speed up inference time. Second, we can apply such an algorithm to more applications, like questioning and answering. Third, how to compress BERT-fused model into a light version is another topic. There are some contemporary works leveraging knowledge distillation to combine pre-trained models with NMT (Yang et al., 2019a; Chen et al., 2019), which is a direction to explore.
216
+
217
+ # REFERENCES
218
+
219
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In 6th International Conference on Learning Representations, 2015. URL https://arxiv.org/pdf/1409.0473v7.pdf.
220
+
221
+ Lo¨ıc Barrault, Ond˘rej Bojar, Marta R. Costa-jussa, Christian Federmann, Mark Fishel, Yvette Gra- ´ ham, Barry Haddow, Matthias Huck, Philipp Koehn, Shervin Malmasi, Christof Monz, Mathias Muller, Santanu Pal, Matt Post, and Marcos Zampieri. Findings of the 2019 conference on ma- ¨ chine translation (wmt19). In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pp. 1–61, Florence, Italy, August 2019. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/W19-5301.
222
+
223
+ Mauro Cettolo, Jan Niehues, Sebastian Stuker, Luisa Bentivogli, and Marcello Federico. Report on ¨ the 11th iwslt evaluation campaign, iwslt 2014. In Proceedings of the International Workshop on Spoken Language Translation, Hanoi, Vietnam, pp. 57, 2014.
224
+
225
+ Yen-Chun Chen, Zhe Gan, Yu Cheng, Jingzhou Liu, and Jingjing Liu. Distilling the knowledge of bert for text generation. arXiv preprint arXiv:1911.03829, 2019.
226
+
227
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In Advances in neural information processing systems, pp. 3079–3087, 2015.
228
+
229
+ Yuntian Deng, Yoon Kim, Justin Chiu, Demi Guo, and Alexander Rush. Latent alignment and variational attention. In Advances in Neural Information Processing Systems, pp. 9712–9724, 2018.
230
+
231
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. NAACL, 2019. URL https://arxiv. org/pdf/1810.04805.pdf.
232
+
233
+ Sergey Edunov, Myle Ott, Michael Auli, David Grangier, and Marcaurelio Ranzato. Classical structured prediction losses for sequence to sequence learning. NAACL, 2018.
234
+
235
+ Dumitru Erhan, Pierre-Antoine Manzagol, Yoshua Bengio, Samy Bengio, and Pascal Vincent. The difficulty of training deep architectures and the effect of unsupervised pre-training. In Artificial Intelligence and Statistics, pp. 153–160, 2009.
236
+
237
+ Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010.
238
+
239
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1243–1252. JMLR. org, 2017.
240
+
241
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8):1735– 1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx. doi.org/10.1162/neco.1997.9.8.1735.
242
+
243
+ Marcin Junczys-Dowmunt and Roman Grundkiewicz. Ms-uedin submission to the wmt2018 ape shared task: Dual-source transformer for automatic post-editing. EMNLP 2018 THIRD CONFERENCE ON MACHINE TRANSLATION (WMT18), 2018.
244
+
245
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
246
+
247
+ Guillaume Lample and Alexis Conneau. Cross-lingual language model pretraining. NeurIPS, 2019.
248
+
249
+ Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, and Marc’Aurelio Ranzato. Phrase-based & neural unsupervised machine translation. arXiv preprint arXiv:1804.07755, 2018.
250
+
251
+ Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. ICLR, 2017. URL https://arxiv.org/pdf/1605.07648. pdf.
252
+
253
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
254
+
255
+ Lesly Miculicich, Dhananjay Ram, Nikolaos Pappas, and James Henderson. Document-level neural machine translation with hierarchical attention networks. arXiv preprint arXiv:1809.01576, 2018.
256
+
257
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013.
258
+
259
+ Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. EMNLP 2018 third conference on machine translation (WMT18), 2018.
260
+
261
+ 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.
262
+
263
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
264
+
265
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
266
+
267
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openaiassets/research-covers/languageunsupervised/language understanding paper. pdf, 2018.
268
+
269
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8), 2019.
270
+
271
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Edinburgh neural machine translation systems for wmt 16. In Proceedings of the First Conference on Machine Translation, volume 2, pp. 371– 376, 2016a. URL http://www.statmt.org/wmt16/pdf/W16-2323.pdf.
272
+
273
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Improving neural machine translation models with monolingual data. ACL, 2016b. URL https://aclweb.org/anthology/ P16-1009.
274
+
275
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. ACL, 2016c.
276
+
277
+ David So, Quoc Le, and Chen Liang. The evolved transformer. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 5877–5886, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/ so19a.html.
278
+
279
+ Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie-Yan Liu. MASS: Masked sequence to sequence pre-training for language generation. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 5926–5936, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/song19d.html.
280
+
281
+ 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.
282
+
283
+ 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.
284
+
285
+ 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.
286
+
287
+ Yiren Wang, Yingce Xia, Tianyu He, Fei Tian, Tao Qin, ChengXiang Zhai, and Tie-Yan Liu. Multiagent dual learning. ICLR, 2019.
288
+
289
+ Dirk Weissenborn, Douwe Kiela, Jason Weston, and Kyunghyun Cho. Contextualized role interaction for neural machine translation, 2019. URL https://openreview.net/forum?id= ryx3_iAcY7.
290
+
291
+ Felix Wu, Angela Fan, Alexei Baevski, Yann Dauphin, and Michael Auli. Pay less attention with lightweight and dynamic convolutions. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ SkVhlh09tX.
292
+
293
+ Lijun Wu, Fei Tian, Yingce Xia, Yang Fan, Tao Qin, Lai Jian-Huang, and Tie-Yan Liu. Learning to teach with dynamic loss functions. In Advances in Neural Information Processing Systems, pp. 6466–6477, 2018.
294
+
295
+ 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.
296
+
297
+ Yingce Xia, Tianyu He, Xu Tan, Fei Tian, Di He, and Tao Qin. Tied transformers: Neural machine translation with shared encoder and decoder. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 5466–5473, 2019.
298
+
299
+ Jiacheng Yang, Mingxuan Wang, Hao Zhou, Chengqi Zhao, Yong Yu, Weinan Zhang, and Lei Li. Towards making the most of bert in neural machine translation. arXiv preprint arXiv:1908.05672, 2019a. URL https://arxiv.org/pdf/1908.05672.pdf.
300
+
301
+ 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, 2019b.
302
+
303
+ # A EXPERIMENT SETUP
304
+
305
+ # A.1 IWSLT’14 & WMT’14 SETTINGS
306
+
307
+ We mainly follow the scripts below to preprocess the data: https://github.com/pytorch/ fairseq/tree/master/examples/translation .
308
+
309
+ Dataset For the low-resource scenario, we choose IWSLT’14 English German $_ \mathrm { E n D e }$ ), English Spanish $( { \mathrm { E n } } { } { \mathrm { E s } } )$ , IWSLT’17 English French $( \mathrm { E n \to F r } )$ and English Chinese $( \mathrm { E n { \to } Z h }$ ) translation. There are $1 6 0 k$ , $1 8 3 k$ , $2 3 6 k$ , $2 3 5 k$ bilingual sentence pairs for $\mathrm { E n } { } \mathrm { D e }$ , $\mathrm { E n } { } \mathrm { E s }$ , $\mathrm { E n } { } \mathrm { F r }$ and $\mathrm { E n } \to \mathrm { Z h }$ tasks. Following the common practice (Edunov et al., 2018), for $\mathrm { E n } { } \mathrm { D e }$ , we lowercase all words, split $7 k$ sentence pairs from the training dataset for validation and concatenate dev2010, dev2012, tst2010, tst2011, tst2012 as the test set. For other tasks, we do not lowercase the words and use the official validation/test sets of the corresponding years.
310
+
311
+ For rich-resource scenario, we work on WMT’14 En De and $\mathrm { E n \to F r }$ , whose corpus sizes are $4 . 5 M$ and $3 6 M$ respectively. We concatenate newstest2012 and newstest2013 as the validation set and use newstest2014 as the test set.
312
+
313
+ We apply BPE (Sennrich et al., 2016c) to split words into sub-units. The numbers of BPE merge operation for IWSLT tasks, WMT’14 En De and $\mathrm { E n } { } \mathrm { F r }$ are $1 0 k$ , $3 2 k$ and $4 0 k$ respectively. We merge the source and target language sentences for all tasks to build the vocabulary except $\mathrm { E n } \to \mathrm { Z h }$ .
314
+
315
+ Model Configuration For IWSLT tasks, we use the transformer iwslt de en setting with dropout ratio 0.3. In this setting, the embedding dimension, FFN layer dimension and number of layers are 512, 1024 and 6. For WMT’ $1 4 \mathrm { E n } { } \mathrm { D e }$ and $\mathrm { E n \to F r }$ , we use transformer big setting (short for transformer vaswani wmt en de big) with dropout 0.3 and 0.1 respectively. In this setting, the aforementioned three parameters are 1024, 4096 and 6 respectively.
316
+
317
+ Evaluation We use multi-bleu.perl4 to evaluate IWSLT’14 En De and WMT translation tasks for fair comparison with previous work. For the remaining tasks, we use a more advance implementation of BLEU score, detokenized sacreBLEU for evaluation5.
318
+
319
+ # A.2 DETAILED EXPERIMENT SETTING IN SECTION 3
320
+
321
+ The IWSLT’14 English-to-German data and model configuration is introduced in Section A.1.
322
+
323
+ For the training stategy, we use Adam (Kingma & Ba, 2014) to optimize the network with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 8$ and weight-decay $= \ 0 . 0 0 0 1$ . The learning rate scheduler is inverse sqrt, where warmup-init- $- \mathtt { l r } = 1 0 ^ { - \bar { 7 } }$ , warmup-updates $= 4 0 0 0$ and $\mathtt { m a x - l r } = 0 . 0 0 0 5$ .
324
+
325
+ # A.3 DETAILED MODEL CONFIGURATION IN UNSUPERVISED NMT
326
+
327
+ We leverage one Transformer model with GELU activation function to work on translations of two directions, where each language is associated with a language tag. The embedding dimension, FFN layer dimension and number of layer are 1024, 4096 and 6. The BERT is initialized by the pretrained XLM model provided by (Lample & Conneau, 2019).
328
+
329
+ # B MORE EXPERIMENT RESULTS
330
+
331
+ # B.1 MORE RESULTS ON PRELIMINARY EXPLORATION OF LEVERAGING BERT
332
+
333
+ We use XLM to initialize the model for WMT’14 English German translation task, whose training corpus is relative large. We eventually obtain 28.09 after 90 epochs, which is still underperform the baseline, 29.12 as we got. Similar problem is also reported in https://github.com/ facebookresearch/XLM/issues/32. We leave the improvement of supervised NMT with XLM as future work.
334
+
335
+ # Part I: A different way to deal with multiple attention models
336
+
337
+ Junczys-Dowmunt & Grundkiewicz (2018) proposed a new way to handle multiple attention models. Instead of using Eqn.(2), the input is processed by self-attention, encoder-decoder attention and BERT-decoder attention sequentially. Formally,
338
+
339
+ $$
340
+ \begin{array} { r l } & { \hat { s } _ { t } ^ { l } = \mathsf { a t t n } _ { S } \big ( s _ { t } ^ { l - 1 } , S _ { < t + 1 } ^ { l - 1 } , S _ { < t + 1 } ^ { l - 1 } \big ) ; } \\ & { \bar { s } _ { t } ^ { l } = \mathsf { a t t n } _ { E } \big ( \hat { s } _ { t } ^ { l } , H _ { E } ^ { L } , H _ { E } ^ { L } \big ) ; } \\ & { \tilde { s } _ { t } ^ { l } = \mathsf { a t t n } _ { B } \big ( \bar { s } _ { t } ^ { l } , H _ { B } , H _ { B } \big ) ; } \\ & { s _ { t } ^ { l } = \mathrm { F F N } \big ( \tilde { s } _ { t } ^ { l } \big ) . } \end{array}
341
+ $$
342
+
343
+ The BLEU score is 29.35 for this setting, not as good as our proposed method.
344
+
345
+ # Part II: More results on IWSLT’14 E $ $ De translation
346
+
347
+ Since our BERT-fused model contains two stacked encoders, we carry out two groups of additional baselines:
348
+
349
+ (1) Considering that stacking the BERT and encoder can be seen as a deeper model, we also train another two NMT models with deeper encoders, one with 18 layers (since $\mathbf { B E R T _ { b a s e } }$ consists of 12 layers) and the other with 12 layers (which achieved best validation performance ranging from 6 to 18 layers).
350
+
351
+ (2) We also compare the results of our approach with ensemble methods. To get an $M$ -model ensemble, we independently train $M$ models with different random seeds $M \in \mathbb { Z } _ { + } ,$ ). We ensemble both standard Transformers and our BERT-fused models, which are denoted as $M$ -model ensemble (standard) and $M$ -model ensemble (BERT-fused) respectively. Please note that when we aggregate multiple BERT-fused models, we only need to store one replica of the BERT model because the BERT part is not optimized.
352
+
353
+ Table 8: More ablation study on IWSLT’14 En→De.
354
+
355
+ <table><tr><td>Algorithm</td><td>BLEU</td></tr><tr><td>Standard Transformer BERT-fused model</td><td>28.57 30.45</td></tr><tr><td>12-layer encoder 18-layer encoder</td><td>29.27 28.92</td></tr><tr><td>2-model ensemble (standard) 3-model ensemble (standard) 4-model ensemble (standard)</td><td>29.71 30.08 30.18</td></tr><tr><td>2-model ensemble (BERT-fused) 3-model ensemble (BERT-fused) 4-model ensemble (BERT-fused)</td><td>31.09 31.45 31.85</td></tr></table>
356
+
357
+ The results are shown in Table 8. We have the following observations:
358
+
359
+ 1. Adding more layers can indeed boost the baseline, but still not as good as BERT-fused model. According to our experiments, when increasing the number of layers to 12, we achieve the best BLEU score, 29.27.
360
+ 2. We also compare our results to ensemble methods. Indeed, ensemble significantly boost the baseline by more than one point. However, even if using ensemble of four models, the BLEU score is still lower than our BERT-fused model (30.18 v.s. 30.45), which shows the effectiveness of our method.
361
+
362
+ We want to point out that our method is intrinsically different from ensemble. Ensemble approaches usually refer to “independently” train several different models for the same task, and then aggregate the output of each model to get the eventually task. In BERT-fused model, although we include a pre-trained BERT into our model, there is still only one model serving for the translation task.
363
+
364
+ In this sense, we can also combine our BERT-fused model with ensemble. Our approach benefits from ensemble too. When ensembling two models, we can achieve 31.09 BLEU score. When adding the number of models to four, we eventually achieve 31.85 BLEU score, which is 1.67 point improvement over the ensemble of standard Transformer.
365
+
366
+ # Part III: More results on IWSLT’14 De En translation
367
+
368
+ We report the ensemble results on IWSLT’ $1 4 { \mathrm { ~ D e } } \to { \mathrm { E n } }$ translation in Table 9. We can get similar conclusion compared to that of IWSLT’14 En De.
369
+
370
+ Table 9: More ablation study on IWSLT’14 De→En.
371
+
372
+ <table><tr><td>Algorithm</td><td>BLEU</td></tr><tr><td>Standard Transformer BERT-fused model</td><td>34.67 36.11</td></tr><tr><td>2-model ensemble (standard) 3-model ensemble (standard) 4-model ensemble (standard)</td><td>35.92 36.40 36.54</td></tr><tr><td>2-model ensemble (BERT-fused) 3-model ensemble (BERT-fused) 4-model ensemble (BERT-fused)</td><td>37.42 37.70 37.71</td></tr></table>
373
+
374
+ The ablation study on more languages is shown in Table 10. Our method achieves the best results compared to all baselines.
375
+
376
+ B.3 MORE RESULTS ON FEEDING BERT OUTPUT TO NMT MODULE
377
+ Table 10: BLEU scores of IWSLT translation tasks.
378
+
379
+ <table><tr><td>Algorithm</td><td>En→De</td><td>De→En</td><td>En→Es</td><td>En→Zh</td><td>En→Fr</td></tr><tr><td>Standard Transformer</td><td>28.57</td><td>34.64</td><td>39.0</td><td>26.3</td><td>35.9</td></tr><tr><td>Feed BERT feature into embedding</td><td>29.67</td><td>34.90</td><td>39.5</td><td>28.1</td><td>37.3</td></tr><tr><td>Feed BERT feature into all layers of encoder</td><td>29.61</td><td>34.84</td><td>39.9</td><td>28.1</td><td>37.4</td></tr><tr><td>Our BERT-fused model</td><td>30.45</td><td>36.11</td><td>41.4</td><td>28.2</td><td>38.7</td></tr></table>
380
+
381
+ # B.4 MORE BASELINES OF IWSLT’14 GERMAN-TO-ENGLISH TRANSLATION
382
+
383
+ We summarize the BLEU scores on IWSLT’14 De En of existed works and our BERT-fused model approach in Table 11.
384
+
385
+ Table 11: Previous results of IWSLT’14 De→En.
386
+
387
+ <table><tr><td>Approach</td><td>BLEU</td></tr><tr><td>Multi-agent dual learning (Wang et al., 2019)</td><td>35.56</td></tr><tr><td>Tied-Transformer (Xia et al., 2019)</td><td>35.52</td></tr><tr><td>Loss to teach (Wu et al., 2018)</td><td>34.80</td></tr><tr><td>Role-interactive layer (Weissenborn et al., 2019)</td><td>34.74</td></tr><tr><td>Variational attention (Deng et al., 2018)</td><td>33.68</td></tr><tr><td>Our BERT-fused model</td><td>36.11</td></tr></table>
388
+
389
+ # B.5 COMPARISON WITH BACK TRANSLATION
390
+
391
+ When using unlabeled data to boost machine learning systems, one of the most notable approaches is back translation (briefly, BT) (Sennrich et al., 2016b): We first train a reversed translation model, use the obtained model to translate the unlabeled data in the target domain back to source domain, obtain a synthetic dataset where the source data is back-translated and finally train the forward model on the augmented dataset.
392
+
393
+ Our method has two main differences with BT method.
394
+
395
+ 1. In BT, the monolingual data from the target side is leveraged. In our proposed approach, we use a BERT of the source language, which indirectly leverages the monolingual data from the source side. In this way, our approach and BT are complementary to each other. In Section 5.4, we have already verified that our method can further improve the results of standard BT on Romanian-to-English translation. 2. To use BT, we have to train a reversed translation model and then back translate the monolingual data, which is time-cost due to the decoding process. In BERT-fused model, we only need to download a pre-trained BERT model, incorporate it into our model and continue training. Besides, the BERT module is fixed during training.
396
+
397
+ On IWSLT’14, we also implement BT on wikipedia data, which is a subset of the corpus of training BERT. The model used for back translation are standard Transformer baselines introduced in Section 5, whose BLEU scores are 28.57 and 34.64 respectively. We back translate 1M, 2M, 5M, 15M and 25M randomly selected German sentences.
398
+
399
+ The results are reported in Table 12. The rows started with BT(·) represent the results of BT, and the numbers in the brackets are the number of sentences for back translation.
400
+
401
+ Table 12: BLEU scores IWSLT’14 En De by BT.
402
+
403
+ <table><tr><td>Algorithm</td><td>En→De</td></tr><tr><td>Standard Transformer BERT-fused model</td><td>28.57 30.45</td></tr><tr><td>BT (1M)</td><td>29.42</td></tr><tr><td>BT (2M)</td><td>29.76</td></tr><tr><td>BT (5M)</td><td>29.10</td></tr><tr><td>BT (15M)</td><td>28.26</td></tr><tr><td>BT (25M)</td><td>27.34</td></tr></table>
404
+
405
+ IWSLT dataset is a collection of spoken language, and the bilingual training corpus is small $( 1 6 0 k )$ . In Wikipedia, the sentences are relatively formal compared to the spoken language, which is outof-domain of spoken languages. We can see that when using 1M or 2M monolingual data for BT, the BLEU scores can indeed improve from 28.57 to 29.42/29.76. However, simply adding more wikipedia data for BT does not result in more improvement. There is even a slight drop when adding more than 15M monolingual sentences. However, our BERT-fused model can achieve better performances than BT with wikipedia data.
406
+
407
+ # C COMPARISON OF INFERENCE TIME
408
+
409
+ Table 13: Comparisons on inference time (seconds), $\cdot _ { + } ,$ is the increased ratio of inference time.
410
+
411
+ <table><tr><td>Dataset</td><td>Transformer</td><td>Ours</td><td>(+)</td></tr><tr><td>IWSLT&#x27;14 En-→De</td><td>70</td><td>97</td><td>38.6%</td></tr><tr><td>IWSLT&#x27;14 De-→En</td><td>69</td><td>103</td><td>49.3%</td></tr><tr><td>WMT&#x27;14 En-→De</td><td>67</td><td>99</td><td>47.8%</td></tr><tr><td>WMT&#x27;14 En→Fr</td><td>89</td><td>128</td><td>43.8%</td></tr></table>
412
+
413
+ We compare the inference time of our approach to the baselines. The results are shown in Table 13, where from the second column to the last column, the numbers are the inference time of standard Transformer, BERT-fused model, and the increase of inference time.
414
+
415
+ Indeed, introducing BERT to encode the input brings additional inference time, resulting in about $40 \%$ to $49 \%$ increase. But considering the significant improvement of BLEU score, it is acceptable of such extra cost. We will study how to reduce inference time in the future.
416
+
417
+ # D DOWNLOAD LINK OF PRE-TRAINED BERT MODELS
418
+
419
+ We leverage the pre-trained models provided by PyTorch-Transformers6.
420
+
421
+ For IWSLT’14 tasks, we choose $\mathbf { B E R T _ { b a s e } }$ model with 12 layers and hidden dimension 768.
422
+
423
+ 1. IWSLT14 $\mathrm { E n \{ D e , E s , F r , Z h \} }$ , we choose bert-base-uncased.
424
+ 2. IWSLT14 $_ \mathrm { D e \to E r }$ , we choose bert-base-german-cased.
425
+
426
+ For WMT14 ${ \mathrm { E n } } { } \{ \mathrm { F r , D e } \}$ , we choose bert-large-uncased, which is a $\mathbf { B E R T _ { l a r g e } }$ model with 24 layers and hidden dimension 1024.
427
+
428
+ For WMT16 $\mathrm { R o } { } \mathrm { E n }$ , we choose bert-base-multilingual-cased, because there is no BERT specially trained for the Romanian.
429
+
430
+ For unsupervised $\mathrm { E n } { } ]$ Fr and unsupervised $\mathrm { E n } { } \mathrm { R o }$ , we choose xlm-mlm-enfr1024 and xlm-mlm-enro1024 respectively.
431
+
432
+ The download links are summarized as follows:
433
+
434
+ • bert-base-uncased: https://s3.amazonaws.com/models.huggingface.co/ bert/bert-base-uncased.tar.gz.
435
+ • bert-large-uncased: https://s3.amazonaws.com/models.huggingface. co/bert/bert-large-uncased.tar.gz.
436
+ • bert-base-multilingual-cased: https://s3.amazonaws.com/models. huggingface.co/bert/bert-base-multilingual-cased.tar.gz.
437
+ bert-base-german-cased: https://int-deepset-models-bert.s3. eu-central-1.amazonaws.com/pytorch/bert-base-german-cased. tar.gz.
438
+ • xlm-mlm-enfr1024: https://s3.amazonaws.com/models.huggingface. co/bert/xlm-mlm-enfr-1024-pytorch_model.bin.
439
+ • xlm-mlm-enro1024: https://s3.amazonaws.com/models.huggingface. co/bert/xlm-mlm-enro-1024-pytorch_model.bin.
440
+
441
+ # E DETAILS OF THE NOTATIONS
442
+
443
+ Let att $\scriptstyle \mathrm { { 1 } } ( q , K , V )$ denote the attention layer, where $q , K$ and $V$ indicate query, key and value respectively. Here $q$ is a $d _ { q }$ -dimensional vector $\ l { d } \in \mathbb { Z } ,$ ), $K$ and $V$ are two sets with $| K | = | V |$ . Each $k _ { i } ~ \in ~ K$ and $v _ { i } ~ \in ~ V$ are also $d _ { k } / d _ { v }$ -dimensional $( d _ { q } , d _ { k }$ and $d _ { v }$ can be different) vectors, $i \in [ | K | ]$ . The attention model works as follows:
444
+
445
+ $$
446
+ \mathrm { a t } \mathrm { t n } ( q , K , V ) = \sum _ { i = 1 } ^ { | V | } \alpha _ { i } W _ { v } v _ { i } , \alpha _ { i } = \frac { \exp \big ( ( W _ { q } q ) ^ { T } ( W _ { k } k _ { i } ) \big ) } { Z } , Z = \sum _ { i = 1 } ^ { | K | } \exp ( ( W _ { q } q ) ^ { T } ( W _ { k } k _ { i } ) ) ,
447
+ $$
448
+
449
+ where $W _ { q }$ , $W _ { k }$ and $W _ { v }$ are the parameters to be learned. In Vaswani et al. (2017), attn is implemented as a multi-head attention model and we omit the details here to increase readability. Following Vaswani et al. (2017), we define the non-linear transformation layer as
450
+
451
+ $$
452
+ \mathrm { F F N } ( { \boldsymbol { x } } ) = W _ { 2 } \operatorname* { m a x } ( W _ { 1 } { \boldsymbol { x } } + b _ { 1 } , 0 ) + b _ { 2 } ,
453
+ $$
454
+
455
+ where $x$ is the input; $W _ { 1 } , \thinspace W _ { 2 } , \thinspace b _ { 1 } , \thinspace b _ { 2 }$ are the parameters to be learned; max is an element-wise operator. Layer normalization is also applied following Transformer (Vaswani et al., 2017).
md/train/Hyx4knR9Ym/Hyx4knR9Ym.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/J28lNO4p3ki/J28lNO4p3ki.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # STEM: A Stochastic Two-Sided Momentum Algorithm Achieving Near-Optimal Sample and Communication Complexities for Federated Learning
2
+
3
+ Prashant Khanduri University of Minnesota khand095@umn.edu
4
+
5
+ Pranay Sharma Carnegie Mellon University pranaysh@andrew.cmu.edu
6
+
7
+ Haibo Yang The Ohio State University yang.5952@buckeyemail.osu.edu
8
+
9
+ Mingyi Hong⇤ University of Minnesota mhong@umn.edu
10
+
11
+ Jia Liu The Ohio State University liu@ece.osu.edu
12
+
13
+ Ketan Rajawat Indian Institute of Technology Kanpur ketan@iitk.ac.in
14
+
15
+ Pramod K. Varshney Syracuse University varshney@syr.edu
16
+
17
+ # Abstract
18
+
19
+ Federated Learning (FL) refers to the paradigm where multiple worker nodes (WNs) build a joint model by using local data. Despite extensive research, for a generic non-convex FL problem, it is not clear, how to choose the WNs’ and the server’s update directions, the minibatch sizes, and the number of local updates, so that the WNs use the minimum number of samples and communication rounds to achieve the desired solution. This work addresses the above question and considers a class of stochastic algorithms where the WNs perform a few local updates before communication. We show that when both the WN’s and the server’s directions are chosen based on certain stochastic momentum estimator, the algorithm requires $\tilde { \mathcal O } ( \epsilon ^ { - 3 / 2 } )$ samples and $\tilde { \mathcal { O } } ( \epsilon ^ { - 1 } )$ communication rounds to compute an $\epsilon$ -stationary solution. To the best of our knowledge, this is the first FL algorithm that achieves such near-optimal sample and communication complexities simultaneously. Further, we show that there is a trade-off curve between the number of local updates and the minibatch sizes, on which the above sample and communication complexities can be maintained. Finally, we show that for the classical FedAvg (a.k.a. Local SGD, which is a momentum-less special case of the STEM), a similar trade-off curve exists, albeit with worse sample and communication complexities. Our insights on this trade-off provides guidelines for choosing the four important design elements for FL algorithms, the number of local updates, WNs’ and server’s update directions, and minibatch sizes to achieve the best performance.
20
+
21
+ # 1 Introduction
22
+
23
+ In Federated Learning (FL), multiple worker nodes (WNs) collaborate with the goal of learning a joint model, by only using local data. Therefore it has become popular for machine learning problems where datasets are massively distributed [1]. In FL, the data is often collected at or off-loaded to multiple WNs which in collaboration with a server node (SN) jointly aim to learn a centralized model [2, 3]. The local WNs share the computational load and since the data is local to each WN, FL also provides some level of data privacy $\mathbb { \lVert \rVert }$ . A classical distributed optimization problem that $K$ WNs aim to solve:
24
+
25
+ ![](images/8b109c70673d05d4fb4863253d56729a5c2b37b6a73924b30a5e660d7b6d1078.jpg)
26
+ Figure 1: The 3D surface in (a) plots the communication complexity of the proposed STEM for different minibatch sizes and number of local updates. The surface is generated such that each point represents STEM with a particular choice of $( b , I )$ , so that it requires $\tilde { \mathcal { O } } ( \epsilon ^ { - 3 / 2 } )$ samples to achieve $\epsilon$ -stationarity. Plot (b) shows the optimal trade off between the minibatch sizes and the number of local updates at each WN (i.e., achieving the lowest communication and sample complexities). Both plots are generated for an accuracy of $\epsilon = 1 0 ^ { - 3 }$ and all the constants dependent on system parameters (variance of stochastic gradients, heterogeneity parameter, optimality gap, Lipschitz constants, etc.) are assumed to be 1. Fed STEM is a special case of STEM where $\mathcal { O } ( 1 )$ minibatch is used; Minibatch STEM is a special case of STEM where $\mathcal { O } ( 1 )$ local updates are used.
27
+
28
+ $$
29
+ \operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } \bigg \{ f ( x ) : = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } f ^ { ( k ) } ( x ) : = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \mathbb { E } _ { \xi ^ { ( k ) } \sim \mathcal { D } ^ { ( k ) } } \big [ f ^ { ( k ) } ( x ; \xi ^ { ( k ) } ) \big ] \bigg \} .
30
+ $$
31
+
32
+ where $f ^ { ( k ) } : \mathbb { R } ^ { d } \mathbb { R }$ denotes the smooth (possibly non-convex) objective function and $\xi ^ { ( k ) } \sim \mathcal { D } ^ { ( k ) }$ represents the sample/s drawn from distribution $\mathcal { D } ^ { ( k ) }$ at the $k ^ { \mathrm { { t h } } }$ WN with $k \in [ K ]$ . When the distributions $\mathcal { D } ^ { ( k ) }$ are different across the WNs, it is referred to as the heterogeneous data setting.
33
+
34
+ The optimization performance of non-convex FL algorithms is typically measured by the total number of samples accessed (cf. Definition $2 . 2 )$ and the total rounds of communication (cf. Definition $2 . 3 )$ required by each WN to achieve an $\epsilon$ -stationary solution (cf. Definition $2 . 1 )$ . To minimize the sample and the communication complexities, FL algorithms rely on the following four key design elements: (i) the WNs’ local model update directions, (ii) Minibatch size to compute each local direction, (iii) the number of local updates before WNs share their parameters, and (iv) the SN’s update direction. How to find effective FL algorithms by (optimally) designing these parameters has received significant research interest recently.
35
+
36
+ Contributions. The main contributions of this work are listed below:
37
+
38
+ 1) We propose the Stochastic Two-Sided Momentum (STEM) algorithm, that utilizes certain momentum-assisted stochastic gradient directions for both the WNs and SN updates. We show that there exists an optimal trade off between the minibatch sizes and number of local updates, such that on the trade-off curve STEM requires $\underline { { \tilde { \mathcal { O } } } } ( \epsilon ^ { - 3 / 2 } ) \underline { { \left[ \frac { 2 } { } \right] } }$ samples and $\tilde { \mathcal { O } } ( \epsilon ^ { - 1 } )$ communication rounds to reach an $\epsilon$ -stationary solution; see Figure $\bigstar$ for an illustration. These complexity results are the best achievable for first-order stochastic FL algorithms (under certain assumptions, cf. Assumption $\bigstar \bigstar$ ; see $\pm \boxed { 5 } \boxed { 8 } \parallel$ and $\mathbb { B } \mathbb { n o }$ , as well as Remark $\checkmark$ of this paper for discussions regarding optimality. To the best of our knowledge, STEM is the first algorithm which – (i) simultaneously achieves the optimal sample and communication complexities for FL and (ii) can optimally trade off the minibatch sizes and the number of local updates.
39
+
40
+ 2) A momentum-less special case of our STEM result further reveals some interesting insights of the classical FedAvg algorithm (a.k.a. the Local SGD) [11–13]. Specifically, we show that for FedAvg, there also exists a trade-off between the minibatch sizes and the number of local updates, such that it requires $\mathcal { O } ( \epsilon ^ { - 2 } )$ samples and $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ communication rounds to achieve an $\epsilon$ -stationary solution.
41
+
42
+ <table><tr><td>Algorithm</td><td>Work</td><td>Sample</td><td>Comm.</td><td>Minibatch (b)</td><td>Local Updates (I) /round</td></tr><tr><td>FedAvg</td><td>国园 国国</td><td>0(€-2)</td><td>0(c-3/2) 0(c-2)</td><td>0(1) 0(1) 2(1-v)</td><td>0(c-1/2) 0(1) 3v</td></tr><tr><td>SCAFFOLD*</td><td>this work 国</td><td>0(c-2)</td><td>O(e-3/2) 0(c-2)</td><td>O(c 4-v) 0(1)</td><td>O(c−2(4-D)) 0(1)</td></tr><tr><td>FedPD/FedProx*</td><td>四/□</td><td>O(c-2)</td><td>0(e-1)</td><td>0(1)</td><td>0(e-1)</td></tr><tr><td>MIME†/FedGLOMO</td><td>/8</td><td>0(c-3/2)</td><td>O(€-3/2)</td><td>0(1)</td><td>0(1)</td></tr><tr><td>STEM Fed STEM Minibatch STEM*</td><td> this work</td><td>O(€-3/2)</td><td>O(e-1)</td><td>( 0(1) O(e-1/2)</td><td>O(∈−(3)) O(∈-1/2) 0(1)</td></tr></table>
43
+
44
+ Table 1: Comparison of FedAvg and STEM with different FL algorithms for various choices of the minibatch sizes $( b )$ and the number of per node local updates between two rounds of communication $( I )$ . $^ \circ \nu \in [ 0 , 1 ]$ trades off $^ { b }$ and $I$ ; $\nu = 1$ (resp. $\nu = 0$ ) uses multiple (resp. $\mathcal { O } ( 1 ) .$ ) local updates and $\mathcal { O } ( 1 )$ (resp. multiple) samples. Fed STEM and Minibatch STEM are two variants of the proposed STEM. ‡The data heterogeneity assumption is weaker than Assumption $2$ (please see $\bigstar \bigstar$ for details). †Requires bounded Hessian dissimilarity to model data heterogeneity across WNs. ⇤Guarantees for Minibatch STEM with $I = 1$ and SCAFFOLD are independent of the data heterogeneity.
45
+
46
+ Collectively, our insights on the trade-offs provide practical guidelines for choosing different design elements for FL algorithms.
47
+
48
+ Related Works. FL algorithms were first proposed in the form of FedAvg [11], where the local update directions at each WN were chosen to be the SGD updates. Earlier works analyzed these algorithms in the homogeneous data setting [19–25], while many recent studies have focused on designing new algorithms to deal with heterogeneous data settings, as well as problems where the local loss functions are non-convex [9, 10, 12–16, 18, 26–32]. In $\bar { \mathbb { E } 2 } \mathbb { I }$ , the authors showed that Parallel Restarted SGD (Local SGD or FedAvg [11]) achieves linear speed up while requiring $\mathcal { O } ( \epsilon ^ { - 2 } )$ samples and $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ rounds of communication to reach an $\epsilon$ -stationary solution. In $[ \bar { \lVert { 4 } } ]$ , a Momentum SGD was proposed, which achieved the same sample and communication complexities as Parallel Restarted SGD $\mathbb { \lVert 1 2 \rVert }$ , without requiring that the second moments of the gradients be bounded. Further, it was shown that under the homogeneous data setting, the communication complexity can be improved to $\mathcal { O } ( \epsilon ^ { - 1 } )$ while maintaining the same sample complexity. The works in $\boxed { 1 5 } , \boxed { 1 6 }$ conducted tighter analysis for FedAvg with partial WN participation with $\mathcal { O } ( 1 )$ local updates and batch sizes. Their analysis showed that FedAvg’s sample and communication complexities are both $\mathcal { O } ( \epsilon ^ { - 2 } )$ . Additionally, SCAFFOLD was proposed in $\bar { \| 1 5 \| }$ , which utilized variance reduction based local update directions $\pmb { \mathbb { B 3 } }$ to achieve the same sample and communication complexities as FedAvg. Similarly, VRL-SGD proposed in $\left[ \left[ 2 9 \right] \right]$ also utilized variance reduction and showed improved communication complexity of $\mathcal { O } ( \epsilon ^ { - 1 } )$ , while requiring the same computations as FedAvg. Importantly, both SCAFFOLD and VRL-SGD’s guarantees were independent of the data heterogeneity. The FedProx proposed in $\mathbb { \ m }$ used a penalty based method to improve the communication complexity of FedAvg (i.e., the Parallel Restarted and Momentum SGD [14, $\mathbb { L } 2 \mathbb { I }$ ) to $\mathcal { O } ( \epsilon ^ { - 1 } )$ . FedProx used a gradient similarity assumption to model data heterogeneity which can be stringent for many practical applications. This assumption was relaxed by FedPD proposed in $\pmb { \mathbb { B } }$ .
49
+
50
+ Recently, the works [17, 18] proposed to utilize hybrid momentum gradient estimators [7, 8]. The MIME algorithm $\mathbb { \lVert 1 7 \rVert }$ matched the optimal sample complexity (under certain smoothness assumptions) of $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ of the centralized non-convex stochastic optimization algorithms [5–8]. Similarly, Fed-GLOMO $[ \overline { { 1 8 } } ]$ achieved the same sample complexity while employing compression to further reduce communication. Both MIME and Fed-GLOMO required $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ communication rounds to achieve an $\epsilon$ -stationary solution. Please see Table $^ 1$ for a summary of the above discussion.
51
+
52
+ The comparison of Local SGD (FedAvg) to Minibatch SGD for convex and strongly convex problems with homogeneous data setting was first conducted in $\mathbb { \lVert 1 9 \rVert }$ and later extended to heterogeneous setting in $\mathbb { \lVert \rVert 3 \rVert }$ . It was shown that Minibatch SGD almost always dominates the Local SGD. In contrast, it was shown in $\pmb { \Vert 2 4 \Vert }$ that Local SGD dominates Minibatch SGD in terms of generalization performance. Although existing FL results are rich, but they are somehow ad hoc and there is a lack of principled understanding of the algorithms. We note that the proposed STEM algorithmic framework provides a theoretical framework that unifies all existing $\mathrm { F L }$ results on sample and communication complexities.
53
+
54
+ Notations. The expected value of a random variable $X$ is denoted by $\mathbb { E } [ X ]$ and its expectation conditioned on an Event $A$ is denoted as $\mathbb { E } [ X | \mathrm { E v e n t ~ } A ]$ . We denote by $\mathbb { R }$ (and $\mathbb { R } ^ { d }$ ) the real line (and the $d$ -dimensional Euclidean space). The set of natural numbers is denoted by $\mathbb { N }$ . Given a positive integer $K \in \mathbb N$ , we denote $[ K ] \triangleq \{ 1 , 2 , \dots , K \}$ . Notation $\| \cdot \|$ denotes the $\ell _ { 2 }$ -norm and $\langle \cdot , \cdot \rangle$ the Euclidean inner product. For a discrete set $\boldsymbol { B }$ , $| B |$ denotes the cardinality of the set. Uniform distribution over a discrete set $\{ 1 , \ldots , T \}$ is denoted as ${ \dot { \mathcal { U } } } \{ 1 , \dots , T \}$ .
55
+
56
+ # 2 Preliminaries
57
+
58
+ Before we proceed to the algorithms, we make the following assumptions about problem $( 1 )$ .
59
+
60
+ Assumption 1 (Sample Gradient Lipschitz Smoothness). The stochastic functions $f ^ { ( k ) } ( \cdot , \xi ^ { ( k ) } )$ with $\xi ^ { ( k ) } \sim \mathcal { D } ^ { ( k ) }$ for all $k \in [ K ]$ , satisfy the mean squared smoothness property, i.e, we have
61
+
62
+ $$
63
+ \begin{array} { r } { \mathbb { E } \| \nabla f ^ { ( k ) } ( x ; \xi ^ { ( k ) } ) - \nabla f ^ { ( k ) } ( y ; \xi ^ { ( k ) } ) \| ^ { 2 } \leq L ^ { 2 } \| x - y \| ^ { 2 } \mathrm { ~ f o r ~ a l l ~ } x , y \in \mathbb { R } ^ { d } . } \end{array}
64
+ $$
65
+
66
+ Assumption 2 (Unbiased gradient and Variance Bounds). (i) Unbiased Gradient. The stochastic gradients computed at each WN are unbiased
67
+
68
+ $$
69
+ \mathbb { E } [ \nabla f ^ { ( k ) } ( x ; \xi ^ { ( k ) } ) ] = \nabla f ^ { ( k ) } ( x ) , \forall \xi ^ { ( k ) } \sim \mathcal { D } ^ { ( k ) } , \forall k \in [ K ] .
70
+ $$
71
+
72
+ (ii) Intra- and inter- node Variance Bound. The following bounds hold:
73
+
74
+ $$
75
+ \begin{array} { r } { \mathbb { \tilde { z } } \| \nabla f ^ { ( k ) } ( x ; \xi ^ { ( k ) } ) - \nabla f ^ { ( k ) } ( x ) \| ^ { 2 } \leq \sigma ^ { 2 } , \| \nabla f ^ { ( k ) } ( x ) - \nabla f ^ { ( \ell ) } ( x ) \| ^ { 2 } \leq \zeta ^ { 2 } , \forall \xi ^ { ( k ) } \sim \mathcal { D } ^ { ( k ) } , \forall k , \ell \in [ K ] . } \end{array}
76
+ $$
77
+
78
+ Note that Assumption $\boxed { 1 }$ is stronger than directly assuming $f ^ { ( k ) }$ ’s are Lipschitz smooth (which we will refer to as the averaged gradient Lipschitz smooth condition), but it is still a rather standard assumption in SGD analysis. For example it has been used in analyzing centralized SGD algorithms such as SPIDER $ { \mathbb { I } }$ , SNVRG $\pmb { \Vert 6 \Vert }$ , STORM $\mathbb { [ [ \big ] ] }$ (and many others) as well as in FL algorithms such as MIME $ { \mathbb { I } } ^ { [ 1 2 ] }$ and Fed-GLOMO $ { \mathbb { I } } { \mathrm { 1 8 } } { \Vert }$ . The second relation in Assumption $2 \cdot$ (ii) quantifies the data heterogeneity, and we call $\zeta > 0$ as the heterogeneity parameter. This is a typical assumption required to evaluate the performance of FL algorithms. If data distributions across individual WNs are identical, i.e., $\mathcal { D } ^ { ( k ) } \stackrel { = } { = } \mathcal { D } ^ { ( \ell ) }$ for all $k , \ell \in [ K ]$ then we have $\zeta = 0$ .
79
+
80
+ Next, we define the $\epsilon$ -stationary solution for non-convex optimization problems, as well as quantify the computation and communication complexities to achieve an $\epsilon$ -stationary point.
81
+
82
+ Definition 2.1 $\epsilon$ -Stationary Point). A point $x$ is called $\epsilon$ -stationary if $\| \nabla f ( x ) \| ^ { 2 } \leq \epsilon$ . Moreover, a stochastic algorithm is said to achieve an $\epsilon$ -stationary point in $t$ iterations if $\begin{array} { r } { \ddot { \mathbb { E } } [ \| \nabla f ( x _ { t } ) \| ^ { 2 } ] \le \epsilon . } \end{array}$ where the expectation is over the stochasticity of the algorithm until time instant $t$ .
83
+
84
+ Definition 2.2 (Sample complexity). We assume an Incremental First-order Oracle (IFO) framework $\textcircled { \lVert { 3 4 } \rVert }$ where, given a sample $\xi ^ { ( k ) } \sim \mathcal { D } ^ { ( k ) }$ at the $k ^ { \mathrm { { t h } } }$ node and iterate $x$ , the oracle returns $( f ^ { ( k ) } ( x ; \xi ^ { ( k ) } ) , \nabla f ^ { ( k ) } ( x ; \xi ^ { ( k ) } ) )$ . Each access to the oracle is counted as a single IFO operation. We measure the sample (and computational) complexity in terms of the total number of calls to the IFO by all WNs to achieve an $\epsilon$ -stationary point given in Definition 2.1.
85
+
86
+ Definition 2.3 (Communication complexity). We define a communication round as a one back-andforth sharing of parameters between the WNs and the SN. Then the communication complexity is defined to be the total number of communication rounds between any WN and the SN required to achieve an $\epsilon$ -stationary point given in Definition 2.1.
87
+
88
+ # 3 The STEM algorithm and the trade-off analysis
89
+
90
+ In this section, we discuss the proposed algorithm and present the main results. The key in the algorithm design is to carefully balance all the four design elements mentioned in Sec. $^ { 1 , }$ so that sufficient and useful progress can be made between two rounds of communication.
91
+
92
+ Let us discuss the key steps of STEM, listed in Algorithm $^ { 1 . }$ In Step 10, each node locally updates its model parameters using the local direction $d _ { t } ^ { k }$ , computed by using $b$ stochastic gradients at two
93
+
94
+ 1: Input: Parameters: $c > 0$ , the number of local updates $I$ , batch size $b$ , stepsizes $\{ \eta _ { t } \}$ .
95
+ 2: Initialize: Iterate $\begin{array} { r } { x _ { 1 } ^ { ( k ) } = \bar { x } _ { 1 } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } x _ { 1 } ^ { ( k ) } } \end{array}$ , descent direction $\begin{array} { r } { d _ { 1 } ^ { ( k ) } = \bar { d } _ { 1 } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } d _ { 1 } ^ { ( k ) } } \end{array}$
96
+ with $\begin{array} { r } { d _ { 1 } ^ { ( k ) } = \frac { 1 } { B } \sum _ { \xi _ { 1 } ^ { ( k ) } \in \mathcal { B } _ { 1 } ^ { ( k ) } } \nabla f ^ { ( k ) } ( x _ { 1 } ^ { ( k ) } ; \xi _ { 1 } ^ { ( k ) } ) } \end{array}$ and $| B _ { 1 } ^ { ( k ) } | = B$ for $k \in [ K ]$ .
97
+ 3: Perform: $x _ { 2 } ^ { ( k ) } = x _ { 1 } ^ { k } - \eta _ { 1 } d _ { 1 } ^ { ( k ) }$ , $\forall k \in [ K ]$
98
+ 4: for $t = 1$ to $T$ do
99
+ 5: for $k = 1$ to $K$ do #at the WN
100
+ 6: $\mathcal { d } _ { t + 1 } ^ { ( k ) } = \frac { 1 } { b } \sum _ { \xi _ { t + 1 } ^ { ( k ) } \in \mathcal { B } _ { t + 1 } ^ { ( k ) } } ^ { \pi \Delta } \nabla f ^ { ( k ) } ( x _ { t + 1 } ^ { ( k ) } ; \xi _ { t + 1 } ^ { ( k ) } ) + \left( 1 - a _ { t + 1 } \right) \bigg ( d _ { t } ^ { ( k ) } - \frac { 1 } { b } \sum _ { \xi _ { t + 1 } ^ { ( k ) } \in \mathcal { B } _ { t + 1 } ^ { ( k ) } } \nabla f ^ { ( k ) } ( x _ { t } ^ { ( k ) } ; \xi _ { t + 1 } ^ { ( k ) } ) \bigg )$
101
+ where we choose $| B _ { t + 1 } ^ { ( k ) } | = b$ , and $a _ { t + 1 } = c \cdot \eta _ { t } ^ { 2 }$ ;
102
+ 7: 8: if $t$ $I = 0$ #at the SN
103
+ $\begin{array} { r } { d _ { t + 1 } ^ { ( k ) } = \bar { d } _ { t + 1 } : = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } d _ { t + 1 } ^ { ( k ) } } \end{array}$
104
+ 9: 10: e $\begin{array} { r l } & { x _ { t + 2 } ^ { ( k ) ^ { \bot } } : = \bar { x } _ { t + 1 } - \eta _ { t + 1 } \bar { d } _ { t + 1 } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } x _ { t + 1 } ^ { ( k ) } - \eta _ { t + 1 } \bar { d } _ { t + 1 } } \end{array}$ $x _ { t + 2 } ^ { ( k ) } = x _ { t + 1 } ^ { ( k ) } - \eta _ { t + 1 } d _ { t + 1 } ^ { ( k ) }$ #server-side momentum
105
+ 11: end if
106
+ 12: end for
107
+ 13: end for
108
+ 14: Return: $\scriptstyle { \bar { x } } _ { a }$ where $a \sim \mathcal { U } \{ 1 , . . . , T \}$ .
109
+
110
+ consecutive iterates $x _ { t + 1 } ^ { ( k ) }$ and $x _ { t } ^ { ( k ) }$ . After every $I$ local steps, the WNs share their current local models $\{ x _ { t + 1 } ^ { ( k ) } \} _ { k = 1 } ^ { K }$ and directions $\{ d _ { t + 1 } ^ { ( k ) } \} _ { k = 1 } ^ { K }$ with the SN. The SN aggregates these quantities, and performs a server-side momentum step, before returning $\bar { x } _ { t + 1 }$ and $\bar { d } _ { t + 1 }$ to all the WNs. Because both the WNs and the SN perform momentum based updates, we call the algorithm a stochastic two-sided momentum algorithm. The key parameters are: $b$ the minibatch size, $I$ the local update steps between two communication rounds, $\eta _ { t }$ the stepsizes, and $a _ { t }$ the momentum parameters.
111
+
112
+ One key technical innovation of our algorithm design is to identify the most suitable way to incorporate momentum based directions in FL algorithms. Although the momentum-based gradient estimator itself is not new and has been used in the literature before (see e.g., in $\mathbb { \left[ \bigstar \bigstar \right] }$ and $\overline { { \mathbb { D } \mathbb { Z } \mathbb { G } \mathbb { S } } }$ to improve the sample complexities of centralized and decentralized stochastic optimization problems, respectively), it is by no means clear if and how it can contribute to improve the communication complexity of FL algorithms. We show that in the FL setting, the local directions together with the local models have to be aggregated by the SN so to avoid being influenced too much by the local data. More importantly, besides the WNs, the SN also needs to perform updates using the (aggregated) momentum directions. Finally, such two-sided momentum updates have to be done carefully with the correct choice of minibatch size $b$ , and the number of local updates $I$ . Overall, it is the judicious choice of all these design elements that results in the optimal sample and communication complexities.
113
+
114
+ Next, we present the convergence guarantees of the STEM algorithm.
115
+
116
+ # 3.1 Main results: convergence guarantees for STEM
117
+
118
+ In this section, we analyze the performance of STEM. We first present our main result, and then provide discussions about a few parameter choices. In the next subsection, we discuss a special case of STEM related to the classical FedAvg and minibatch SGD algorithms.
119
+
120
+ Theorem 3.1. Under the Assumptions 1 and 2, suppose the stepsize sequence is chosen as:
121
+
122
+ $$
123
+ \eta _ { t } = \frac { \bar { \kappa } } { ( w _ { t } + \sigma ^ { 2 } t ) ^ { 1 / 3 } } ,
124
+ $$
125
+
126
+ where we define :
127
+
128
+ $$
129
+ \bar { \kappa } = \frac { ( b K ) ^ { 2 / 3 } \sigma ^ { 2 / 3 } } { L } , \quad w _ { t } = \operatorname * { m a x } \bigg \{ 2 \sigma ^ { 2 } , 4 0 9 6 L ^ { 3 } I ^ { 3 } \bar { \kappa } ^ { 3 } - \sigma ^ { 2 } t , \frac { c ^ { 3 } \bar { \kappa } ^ { 3 } } { 4 0 9 6 L ^ { 3 } I ^ { 3 } } \bigg \} .
130
+ $$
131
+
132
+ Further, let us set $\begin{array} { r } { c = \frac { 6 4 L ^ { 2 } } { b K } + \frac { \sigma ^ { 2 } } { 2 4 \bar { \kappa } ^ { 3 } L I } = L ^ { 2 } \bigg ( \frac { 6 4 } { b K } + \frac { 1 } { 2 4 ( b K ) ^ { 2 } I } \bigg ) } \end{array}$ and set the initial batch size as $B = b I$ ; set the local updates $I$ and minibatch size b as follows:
133
+
134
+ $$
135
+ I = \mathcal { O } \big ( ( T / K ^ { 2 } ) ^ { \nu / 3 } \big ) , \quad b = \mathcal { O } \big ( ( T / K ^ { 2 } ) ^ { 1 / 2 - \nu / 2 } \big )
136
+ $$
137
+
138
+ where $\nu$ satisfies $\nu \in [ 0 , 1 ]$ . Then for STEM the following holds:
139
+
140
+ (i) For $\scriptstyle { \bar { x } } _ { a }$ chosen according to Algorithm $\boldsymbol { l } ,$ we have:
141
+
142
+ $$
143
+ \mathbb { E } \Vert \nabla f ( \bar { x } _ { a } ) \Vert ^ { 2 } = \mathcal { O } \Bigg ( \frac { f ( \bar { x } _ { 1 } ) - f ^ { * } } { K ^ { 2 \nu / 3 } T ^ { 1 - \nu / 3 } } \Bigg ) + \tilde { \mathcal { O } } \Bigg ( \frac { \sigma ^ { 2 } } { K ^ { 2 \nu / 3 } T ^ { 1 - \nu / 3 } } \Bigg ) + \tilde { \mathcal { O } } \Bigg ( \frac { \zeta ^ { 2 } } { K ^ { 2 \nu / 3 } T ^ { 1 - \nu / 3 } } \Bigg ) .
144
+ $$
145
+
146
+ (ii) For any $\nu \in [ 0 , 1 ]$ , we have
147
+
148
+ Sample Complexity: The sample complexity of STEM is $\tilde { \mathcal { O } } ( \epsilon ^ { - 3 / 2 } )$ . This implies that each WN requires at most $\tilde { \mathcal { O } } ( K ^ { - 1 } \epsilon ^ { - 3 / 2 } )$ gradient computations, thereby achieving linear speedup with the number of WNs present in the network.
149
+
150
+ Communication Complexity: The communication complexity of STEM is $\tilde { \mathcal { O } } ( \epsilon ^ { - 1 } )$ .
151
+
152
+ The proof of this result is relegated to the Supplemental Material. A few remarks are in order.
153
+
154
+ Remark 1 (Near-Optimal sample and communication complexities). Theorem $3 . 1$ suggests that when $I$ and $b$ are selected appropriately, then STEM achieves $\tilde { \mathcal { O } } ( \epsilon ^ { - 3 / 2 } )$ and $\tilde { \mathcal { O } } ( \overline { { \epsilon ^ { - 1 } } } )$ sample and communication complexities. Taking them separately, these complexity bounds are the best achievable by the existing FL algorithms (upto logarithmic factors regardless of sample or batch Lipschitz smooth assumption) $[ [ 3 5 ] ]$ ; see Table $1 .$ We note that the $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ complexity is the best possible that can be achieved by centralized SGD with the sample Lipschitz gradient assumption; see $ { \mathbb { I } } ^ { { \left[ 5 \right] } }$ . On the other hand, the $\bar { \mathcal { O } } ( \epsilon ^ { - 1 } )$ complexity bound is also likely to be the optimal, since in $\mathbb { P }$ the authors showed that even when the local steps use a class of (deterministic) first-order algorithms, $\mathcal { O } ( \epsilon ^ { - 1 } )$ is the best achievable communication complexity. The only difference is that $\bigstar \bigstar$ does not explicitly assume the inter-node variance bound (i.e., the second relation in Assumption $2 \cdot$ -(ii)). We leave the precise characterization of the communication lower bound with inter-node variance as future work. □
155
+
156
+ Remark 2 (Large Batch Sizes and/or Local Updates). At first glance, it may seem that the requirement of STEM to compute large mini-batches and/or local updates (cf. Table $^ { 1 ) }$ to achieve this (near) optimal performance is a drawback, however, we note that it is in fact an advantage of STEM that it allows the WNs to perform larger number of local updates (or compute large minibatches) without communicating often. This follows from the fact that irrespective of the number of local updates (or batch sizes) STEM achieves near-optimal communication complexity while attaining optimal overall sample complexity. Moreover, note that even with $b = I = \mathcal { O } ( 1 )$ (i.e., $b$ and $I$ are chosen as constants), STEM achieves the same (optimal) sample and communication complexities as achieved by FedGLOMO [18] and MIME [17]. We further note that to the best of our knowledge the algorithms that achieve the communication complexity of $\mathcal { O } ( \epsilon ^ { - 1 } )$ either require the number of local updates or the batch-sizes that depend on the solution accuracy $\epsilon$ . For example, FedProx $\mathbb { I O } ]$ , FedPD $\bigstar \bigstar$ , and FedDyn $\pmb { \Vert 3 6 \Vert }$ rely on solving the “local problems" to achieve an $\epsilon$ -accuracy, which implies that the number of local updates (or the batch sizes) implicitly depends on the desired solution accuracy $\epsilon$ , as is the case for STEM. Similarly, as shown in $\bar { \mathbb { E } 2 } \mathbb { I }$ and $\bar { \textregistered 4 } \bar { 1 }$ the communication complexity of FedAvg and its momentum version can be improved from $\mathcal { O } ( \epsilon ^ { - 2 } )$ to $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ when the number of local updates (or batch size) is chosen as $\mathcal { O } ( \epsilon ^ { - 1 / 2 } )$ (cf. Section $3 . 2$ for a more detailed discussion).
157
+
158
+ Remark 3 (The Optimal Batch Sizes and Local Updates Trade-off). The parameter $\nu \in [ 0 , 1 ]$ is used to balance the local minibatch sizes $b$ , and the number of local updates $I$ . Eqs. in $\textcircled { 3 }$ suggest that when $\nu$ increases from 0 to 1, $b$ decreases and $I$ increases. Specifically, if $\nu = 1$ , then $b$ is a constant but $I = \mathcal { O } ( T ^ { 1 / 3 } / K ^ { 2 / 3 } )$ . In this case, each WN chooses a small minibatch while executing multiple local updates, and STEM resembles a FedAvg (a.k.a. Local SGD) algorithm but with double-sided momentum update directions, and is referred to as Fed STEM. In contrast, if $\nu = 0$ , then $b = \mathcal { O } ( T ^ { 1 / 2 } / K )$ but $I$ is a constant. In this case, each WN chooses a large batch size while executing only a few, or even one, local updates, and STEM resembles the Minibatch SGD, but again with different update directions, and is referred to as Minibatch STEM. Such a trade-off can be seen in Fig. 1b. Due to space limitation, these two special cases will be precisely stated in the supplementary materials as corollaries of Theorem 3.1. □
159
+
160
+ # Algorithm 2 The FedAvg Algorithm
161
+
162
+ 1: Input: $\{ \eta _ { t } \} _ { t = 0 } ^ { T } ; I$ , the # of local updates per communication round; $b$ , the minibatch sizes.
163
+ 2: for $t = 1$ to $T$ do
164
+ 3: 4: 5: for $\begin{array} { r l } & { \mathcal { \kappa } _ { t } ^ { = } \stackrel { \mathrm { ~ L ~ U ~ O ~ } \Lambda } { = } \mathbf { 0 } } \\ & { d _ { t } ^ { ( k ) } = \frac { 1 } { b } \sum _ { \xi _ { t } ^ { ( k ) } \in \mathcal { B } _ { t } ^ { ( k ) } } \nabla f ^ { ( k ) } ( x _ { t } ^ { ( k ) } ; \xi _ { t } ^ { ( k ) } ) \mathrm { ~ w i t h ~ } | \mathcal { B } _ { t } ^ { ( k ) } | = b } \\ & { x _ { t + 1 } ^ { ( k ) } = x _ { t } ^ { ( k ) } - \eta _ { t } d _ { t } ^ { ( k ) } } \\ & { \mathbf { i f } t \operatorname* { m o d } I = 0 \mathbf { \Lambda } \mathbf { t h e n } } \\ & { ~ x _ { t + 1 } ^ { ( k ) } = \bar { x } _ { t + 1 } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } x _ { t + 1 } ^ { ( k ) } } \\ & { \mathbf { e n d } \mathbf { \Phi } \mathbf { i f } } \end{array}$ $k = 1$ $K$
165
+ 6:
166
+ 7:
167
+ 8:
168
+ 9: end for
169
+ 10: end for
170
+ 11: Return: $\scriptstyle { \bar { x } } _ { a }$ where $a \sim \mathcal { U } \{ 1 , . . . , T \}$ .
171
+
172
+ Remark 4 (The Sub-Optimal Batch Sizes and Local Updates Trade-off). From our proof (Theorem $\left| \overline { { \mathbf { C . 1 0 } } } \right|$ included in the supplemental material), we can see that STEM requires $\bar { \tilde { O } } ( \operatorname* { m a x } \big \{ ( b \cdot$ $I ) \epsilon ^ { - 1 } , K ^ { - 1 } \epsilon ^ { - 3 / 2 } \rbrace )$ samples and $\tilde { \mathcal { O } } \big ( \operatorname* { m a x } \big \{ \epsilon ^ { - 1 } , ( b \cdot I ) ^ { - 1 } K ^ { - 1 } \epsilon ^ { - 3 / 2 } \big \} \big )$ and communication rounds. According to the above expressions, if $b \cdot I$ increases beyond $\mathcal { O } ( K ^ { - 1 } \epsilon ^ { - 1 / 2 } )$ , then the sample complexity will increase from the optimal $\tilde { \mathcal { O } } ( \epsilon ^ { - 3 / 2 } )$ ; otherwise, the optimal sample complexity $\tilde { \mathcal O } ( \epsilon ^ { - 3 / 2 } )$ is maintained. On the other hand, if $b \cdot I$ decreases beyond $\mathcal { O } ( K ^ { - 1 } \epsilon ^ { - 1 / 2 } )$ , the communication complexity increases from $\tilde { \mathcal { O } } ( \epsilon ^ { - 1 } )$ . For instance, if we choose $b = \mathcal { O } ( 1 )$ and $I = { \mathcal { O } } ( 1 )$ the communication complexity becomes $\tilde { \mathcal { O } } ( \epsilon ^ { - 3 / 2 } )$ while the optimal sample complexity $\tilde { \mathcal { O } } ( \epsilon ^ { - 3 / 2 } )$ is maintained. This trade-off is illustrated in Figure $\boxed { 1 \mathrm { a } }$ where we maintain the optimal sample complexity, while changing $b$ and $I$ to generate the trade-off surface. □
173
+
174
+ Remark 5 (Data Heterogeneity). The term $\begin{array} { r } { \tilde { \mathcal { O } } \biggl ( \frac { \zeta ^ { 2 } } { K ^ { 2 \nu / 3 } T ^ { 1 - \nu / 3 } } \biggr ) } \end{array}$ in the gradient bound $\textcircled{4}$ captures the effect of the heterogeneity of data across WNs, where $\zeta$ is the parameter characterizing the intra-node variance and has been defined in Assumption $\bigstar$ (ii). Highly heterogeneous data with large $\zeta ^ { 2 }$ can adversely impact the performance of STEM. Note that such a dependency on $\zeta$ also appears in other existing FL algorithms, such as $[ \bigcirc , \bigcirc , \bigcirc , \bigcirc , \bigcirc ]$ . However, there is one special case of STEM that does not depend on the parameter $\zeta$ . This is the case where $I = 1$ , i.e., the minibatch SGD counterpart of STEM where only a single local iteration is performed between two communication rounds. We have the following corollary. □
175
+
176
+ Corollary 1 (Minibatch STEM). Under Assumptions $\bigstar \bigstar \bigstar | \bigstar |$ , and choose the algorithm parameters as in Theorem $3 . I .$ At each WN, choose $I = 1$ , $b = ( T / K ^ { 2 } ) ^ { 1 / 2 }$ , and the initial batch size $B = \boldsymbol { b } \cdot \boldsymbol { I }$ . Then STEM satisfies:
177
+
178
+ (i) For $\bar { x } _ { a }$ chosen according to Algorithm $\boldsymbol { l } ,$ we have
179
+
180
+ $$
181
+ \mathbb { E } \| \nabla f ( \bar { x } _ { a } ) \| ^ { 2 } = \mathcal { O } \Big ( \frac { f ( \bar { x } _ { 1 } ) - f ^ { * } } { T } \Big ) + \tilde { \mathcal { O } } \Big ( \frac { \sigma ^ { 2 } } { T } \Big ) .
182
+ $$
183
+
184
+ (ii) Minibatch STEM achieves $\tilde { \mathcal O } ( \epsilon ^ { - 3 / 2 } )$ sample and $\tilde { \mathcal { O } } ( \epsilon ^ { - 1 } )$ communication complexity.
185
+
186
+ Next, we show that FedAvg also exhibits a trade-off similar to that of STEM but with worse sample and communication complexities.
187
+
188
+ # 3.2 Special cases: The FedAvg algorithm
189
+
190
+ We briefly discuss another interesting special case of STEM, where the local momentum update is replaced by the conventional SGD (i.e., $a _ { t } = 1 , ~ \forall ~ t )$ , while the server does not perform the momentum update (i.e., $\bar { d } _ { t } = 0 , \forall t )$ . This is essentially the classical FedAvg algorithm, just that it balances the number of local updates $I$ and the minibatch size $b$ . We show that this algorithm also exhibits a trade-off between $b$ and $I$ and on the trade-off curve it achieves $\mathcal { O } ( \epsilon ^ { - 2 } )$ sample complexity and $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ communication complexity.
191
+
192
+ <table><tr><td>Algorithm</td><td> Training Acc.</td><td>Testing Acc.</td></tr><tr><td>FedAvg</td><td>78.2</td><td>74.1</td></tr><tr><td>FedProx</td><td>79.2</td><td>74.8</td></tr><tr><td>FedDyn</td><td>68.9</td><td>66.0</td></tr><tr><td>SCAFFOLD</td><td>71.9</td><td>74.0</td></tr><tr><td>MIME</td><td>82.6</td><td>76.8</td></tr><tr><td>FedGLOMO</td><td>76.1</td><td>72.8</td></tr><tr><td> STEM</td><td>80.1</td><td>78.8</td></tr></table>
193
+
194
+ (a) Mild heterogeneity, $b = 6 4$ , and $I = 7$ .
195
+
196
+ <table><tr><td>Algorithm</td><td>Training Acc.</td><td>Testing Acc.</td></tr><tr><td>FedAvg</td><td>73.6</td><td>75.4</td></tr><tr><td>FedProx</td><td>80.0</td><td>75.2</td></tr><tr><td>FedDyn</td><td>76.1</td><td>71.3</td></tr><tr><td>SCAFFOLD</td><td>72.5</td><td>73.7</td></tr><tr><td>MIME</td><td>61.5</td><td>58.6</td></tr><tr><td>FedGLOMO</td><td>10.0</td><td>10.0</td></tr><tr><td>STEM</td><td>81.1</td><td>78.5</td></tr></table>
197
+
198
+ (b) Moderate heterogeneity, $b = 8$ , and $I = 6 1$
199
+
200
+ Table 2: Training and testing accuracy of different algorithms on CIFAR-10 dataset for different batch-sizes, number of local updates, and heteregeneity settings.
201
+
202
+ Theorem 3.2 (The FedAvg Algorithm). Under Assumptions 1 and 2, suppose the stepsize is chosen as: $\begin{array} { r } { \eta = \sqrt { \frac { b K } { T } } } \end{array}$ ; Let us set:
203
+
204
+ $$
205
+ I = \mathcal { O } \big ( ( T / K ^ { 3 } ) ^ { \nu / 4 } \big ) , \quad b = \mathcal { O } \big ( ( T / K ^ { 3 } ) ^ { 1 / 3 - \nu / 3 } \big )
206
+ $$
207
+
208
+ where $\nu \in [ 0 , 1 ]$ is a constant. Then for FedAvg with $T \geq 8 1 L ^ { 2 } I ^ { 2 } b K$ , the following holds
209
+
210
+ (i) For $\scriptstyle { \bar { x } } _ { a }$ chosen according to Algorithm $\perp$ we have
211
+
212
+ $$
213
+ \mathbb { E } \Vert \nabla f ( \bar { x } _ { a } ) \Vert ^ { 2 } = \mathcal { O } \Bigg ( \frac { f ( \bar { x } _ { 1 } ) - f ^ { * } } { K ^ { \nu / 2 } T ^ { 2 / 3 - \nu / 6 } } \Bigg ) + \mathcal { O } \Bigg ( \frac { \sigma ^ { 2 } } { K ^ { \nu / 2 } T ^ { 2 / 3 - \nu / 6 } } \Bigg ) + \mathcal { O } \Bigg ( \frac { \zeta ^ { 2 } } { K ^ { \nu / 2 } T ^ { 2 / 3 - \nu / 6 } } \Bigg ) .
214
+ $$
215
+
216
+ (ii) For any choice of $\nu \in [ 0 , 1 ]$ we have:
217
+
218
+ Sample Complexity: The sample complexity of FedAvg is $\mathcal { O } ( \epsilon ^ { - 2 } )$ . This implies that each WN requires at most $\tilde { \mathcal { O } } ( K ^ { - 1 } \epsilon ^ { - 2 } )$ gradient computations, thereby achieving linear speedup with the number of WNs in the network.
219
+
220
+ Communication Complexity: The communication complexity of FedAvg is $\mathcal { O } ( \epsilon ^ { - 3 / 2 } )$ .
221
+
222
+ Note that the requirement on $T$ being lower bounded is only relevant for theoretical purposes, a similar requirement was also imposed in $[ \mathbb { 1 4 } ]$ to prove convergence. Again, the parameter $\nu \in [ 0 , 1 ]$ in the statement of Theorem $3 . 2$ balances $I$ and $b$ at each WN while maintaining state-of-the-art sample and communication complexities; please see Table $^ 1$ for a comparison of those bounds with existing FedAvg bounds. For $\nu = 1$ , FedAvg (cf. Theorem $\textcircled { 3 . 2 }$ reduces to FedAvg proposed in [12, 14] and for $\nu = 0$ , the algorithm can be viewed as a large batch FedAvg with constant local updates [15, 16]. Note that similar to STEM, it is known that for $I = 1$ , the Minibatch SGD’s performance is independent of the heterogeneity parameter, $\zeta \equiv \mathbb { I I } 3 \mathbb { I }$ . We also point out that if Algorithm $^ 1$ uses Nesterov’s or Polyak’s momentum $[ \textcircled { 1 4 } ]$ at local WNs instead of the recursive momentum estimator we get the same guarantees as in Theorem $3 . 2 .$
223
+
224
+ In summary, this section established that once the WN’s and the SN’s update directions (SGD in FedAvg and momentum based directions in STEM) are fixed, there exists a sequence of optimal choices of the number of local updates $I$ , and the batch sizes $b$ , which guarantees the best possible sample and communication complexities for the particular algorithm. The trade-off analysis presented in this section provides some useful guidelines for how to best select $b$ and $I$ in practice. Our subsequent numerical results will also verify that if $b$ or $I$ are not chosen judiciously, then the practical performance of the algorithms can degrade significantly.
225
+
226
+ # 4 Numerical results
227
+
228
+ In this section, we validate the proposed STEM algorithm and compare its performance with the de facto standard FedAvg [11], and the algorithms stated in Table $^ { 1 . }$ Note that instead of FedPD we include the performance comparison with FedDyn $\pmb { \mathbb { B } } 6 \|$ since they are known to be very closely related. The goal of our experiments are three-fold: (1) To show that STEM performs on par, if not better, compared to other algorithms in different heterogeneity settings, (2) there are multiple ways to reach the desired solution accuracy, one can either choose a large batch size and perform only a few local updates or select a smaller batch size and perform multiple local updates, and finally, (3) if the local updates and the batch sizes are not chosen appropriately, the WNs might need to perform excessive computations to achieve the desired solution accuracy, thereby slowing down convergence.
229
+
230
+ Table 3: Training and testing accuracy on CIFAR-10 dataset for high heterogeneity, $b =$ 128 and $I = 6$ .
231
+
232
+ <table><tr><td>Algorithm</td><td>Training Acc.</td><td>Testing Acc.</td></tr><tr><td>FedAvg</td><td>57.6</td><td>57.1</td></tr><tr><td>FedProx</td><td>59.1</td><td>58.5</td></tr><tr><td>FedDyn</td><td>51.2</td><td>51.3</td></tr><tr><td>SCAFFOLD</td><td>53.1</td><td>54.7</td></tr><tr><td>MIME</td><td>56.1</td><td>55.1</td></tr><tr><td>FedGLOMO</td><td>56.8</td><td>56.1</td></tr><tr><td> STEM</td><td>58.5</td><td>57.4</td></tr></table>
233
+
234
+ Table 4: Training and testing accuracy on Shakespeare dataset.
235
+
236
+ <table><tr><td>Algorithm</td><td>Training Acc.</td><td>Testing Acc.</td></tr><tr><td>FedAvg</td><td>40.1</td><td>39.2</td></tr><tr><td>FedProx</td><td>43.5</td><td>43.2</td></tr><tr><td>FedDyn</td><td>43.7</td><td>43.2</td></tr><tr><td>SCAFFOLD</td><td>40.3</td><td>41.3</td></tr><tr><td>MIME</td><td>32.1</td><td>32.1</td></tr><tr><td>FedGLOMO</td><td>40.3</td><td>40.1</td></tr><tr><td> STEM</td><td>44.5</td><td>43.8</td></tr></table>
237
+
238
+ ![](images/1a3649642909a08bbdd852d92b8ec00817216ffd484e8ea8263d27aa9fb977f4.jpg)
239
+ Figure 2: Training loss and the testing accuracy for classification on MNIST data set against the number of samples accessed at each WN for moderate heterogeneity setting with $b = 8$ .
240
+
241
+ Data and Parameter Settings: We compare the algorithms for image classification tasks on CIFAR10 and MNIST data sets with 100 WNs, and for next character prediction task on Shakespeare dataset $\pmb { \Vert 3 7 } \Vert$ with 143 WNs in the network. For both CIFAR-10 and MNIST, each WN implements a two-hidden-layer convolutional neural network (CNN) architecture followed by three linear layers for CIFAR-10 and two for MNIST. For CIFAR-10 (and MNIST) datset, we consider three settings with mild, moderate and high heterogeneity. For all the three settings, the data is partitioned into disjoint sets among the WNs. In the mild heterogeneity setting, the WNs have access to partitioned data from all the classes. In the moderate (resp. high) heterogeneity setting the data is partitioned such that each WN can access data from only 5 (resp. 2) out of 10 classes. For CIFAR-10 (resp. MNIST), each WN has access to 490 (resp. 540) samples for training and 90 (resp. 80) samples for testing purposes.
242
+
243
+ We also compare the performance of algorithms on a popular FL benchmarking dataset, Shakespeare dataset $ { \mathbb { I } } ^ { \smash { \sum } }$ . For this task, we adopt the settings from $\dot { \left[ \left| 1 0 \right| \right] }$ and utilize a 2-Layer LSTM network with 100 hidden units and an 8-D embedding layer at each WN. Each WN has access to 3616 samples on average, and the samples are randomly split into an $80 \%$ training set and a $20 \%$ testing set. We randomly sample 10 nodes out of 143 for the training purpose. All the experiments are implemented on a single NVIDIA Quadro RTX 5000 GPU. More details are provided in appendix.
244
+
245
+ For the proposed STEM algorithm, recall that the step-size is $\eta _ { t } = \bar { \kappa } / ( w _ { t } + \sigma ^ { 2 } t ) ^ { 1 / 3 }$ with momentum parameter defined as $a _ { t } = { c } \eta _ { t } ^ { 2 }$ . The step-size is used to update the iterates while the momentum parameter is used to construct the stochastic gradient estimate (cf. Algorithm 1 and Theorem $\boxed { 3 . 1 }$ . For the experiments, we set $w _ { t } = \sigma ^ { 2 } = 1$ and $c \doteq \bar { c } / \bar { \kappa } ^ { 2 }$ and tune for $\bar { \kappa } \in [ 1 0 ^ { - 1 } , \overline { { 1 0 } } ^ { - 2 } ]$ for the CIFAR-10 dataset and for ${ \bar { \kappa } } \in \{ 1 0 ^ { 1 } , 1 0 ^ { 0 } , 1 0 ^ { - 1 } , 1 0 ^ { - 2 } \}$ for the Shakespeare dataset. For both the datasets we tune for $\bar { c }$ in the range [1, 10]. For FedProx $[ \equiv ]$ and FedDyn $\lVert \bar { 3 6 } \rVert$ we choose the regularization constant to be 0.1. The momentum parameters for FedGLOMO $\pm \textcircled { 1 8 } \textcircled { 1 }$ and MIME $\mathbb { \lVert 1 7 \rVert }$ are set based on the choices given in the respective papers. Specifically, for FedGLOMO we choose the parameter $\beta _ { k } = 0 . 2$ and design the momentum gradient using a damping factor given in Appendix A.4 of FedGLOMO $\mathbb { \left[ \left[ 8 \right] \right] }$ . Moreover, for MIME we choose the momentum parameter as 0.9. For the rest of the algorithms (including FedAvg and SCAFFOLD), the step-size is tuned from the set $\{ 1 0 ^ { 1 } , 1 0 ^ { 0 } , 1 0 ^ { - 1 } , \hat { 1 0 } ^ { - 2 } \}$ .
246
+
247
+ Discussion: We evaluate the training and testing performance of STEM against multiple algorithms for different heterogeneity settings, minibatch sizes, and number of local updates. In Tables $\bigstar$ $\boxed { 2 \mathbf { b } }$ and $\bigstar ,$ we compare the training and testing accuracy of STEM to that of other algorithms on the CIFAR-10 dataset. Specific, heterogeneity settings, the choices of minibatches, and number of local updates are stated along with the tables. Note that STEM performs uniformly well under all the conditions. Moreover, note from Table $\bigstar$ that FedGLOMO diverges once the number of local updates are high. Also, note from Table $\textcircled { 3 }$ that FedProx and STEM adapt well to high heterogeneity. Finally, with the next set of experiments we emphasize the importance of choosing $b$ and $I$ carefully. In Figure $\bigstar ,$ we compare the training and testing performance of STEM, FedAvg and SCAFFOLD, against the number of samples accessed at each WN for the classification task on MNIST dataset with moderate heterogeneity. We fix $b = 8$ and conduct experiments under two settings, one with $I = 6 7$ , and the other with $I = 5 3 6$ local updates at each WN. Note that although a large number of local updates might lead to fewer communication rounds but it can make the sample complexity extremely high as is demonstrated by Figure $2 .$ For example, Figure $\bigtriangledown$ shows that to reach testing accuracy of $9 6 - 9 7 \%$ with $I = 6 7$ , STEM requires approximately $5 0 0 0 - 6 0 0 0$ samples, in contrast with $I = 5 3 6$ it requires more than 25000 samples at each WN. Similar behavior can be observed if we fix $I > 1$ and increase the local batch sizes. This implies not choosing the local updates and the batch sizes judiciously might lead to increased sample complexity. Additional experiments are included in the supplementary material to further evaluate the performance of the proposed algorithms.
248
+
249
+ # Conclusion
250
+
251
+ In this work, we proposed a novel algorithm STEM, for distributed stochastic non-convex optimization with applications to FL. We showed that STEM reaches an $\epsilon$ -stationary point with $\tilde { \mathcal O } ( \epsilon ^ { - 3 / 2 } )$ sample complexity while achieving linear speed-up with the number of WNs. Moreover, the algorithm achieves a communication complexity of $\tilde { \mathcal { O } } ( \epsilon ^ { - 1 } )$ . We established a (optimal) trade-off that allows interpolation between varying choices of local updates and the batch sizes at each WN while maintaining (near optimal) sample and communication complexities. We showed that FedAvg (a.k.a LocalSGD) also exhibits a similar trade-off while achieving worse complexities. Our results provide guidelines to carefully choose the number of local updates, update directions, and minibatch sizes to achieve the best performance. The future directions of this work include developing lower bounds on communication complexity that establishes the tightness of the analysis conducted in this work.
252
+
253
+ # Acknowledgement
254
+
255
+ We thank the anonymous reviewers for their valuable comments and suggestions. The work of Prashant Khanduri and Mingyi Hong was supported by NSF grant CMMI-1727757, AFOSR grant 19RT0424 and ARO grant W911NF-19-1-0247. The work of Mingyi Hong was also supported by an IBM Faculty Research award. The work of Jia Liu has been supported in part by NSF grants CAREER CNS-2110259, CNS-2112471, CNS-2102233, CCF-2110252, ECCS-2140277, and a Google Faculty Research Award.
256
+
257
+ References
258
+ [1] J. Konecnˇ y, H. B. McMahan, D. Ramage, and P. Richtárik, “Federated optimization: Distributed \` machine learning for on-device intelligence,” arXiv preprint arXiv:1610.02527, 2016.
259
+ [2] M. Li, D. G. Andersen, A. J. Smola, and K. Yu, “Communication efficient distributed machine learning with the parameter server,” in Advances in Neural Information Processing Systems 27, Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger, Eds. Curran Associates, Inc., 2014, pp. 19–27.
260
+ [3] J. Dean, G. Corrado, R. Monga, K. Chen, M. Devin, M. Mao, M. Ranzato, A. Senior, P. Tucker, K. Yang et al., “Large scale distributed deep networks,” in Advances in neural information processing systems, 2012, pp. 1223–1231.
261
+ [4] T. Léauté and B. Faltings, “Protecting privacy through distributed computation in multi-agent decision making,” Journal of Artificial Intelligence Research, vol. 47, pp. 649–695, 2013.
262
+ [5] 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, 2018, pp. 689–699.
263
+ [6] D. Zhou, P. Xu, and Q. Gu, “Stochastic nested variance reduction for nonconvex optimization,” arXiv preprint arXiv:1806.07811, 2018.
264
+ [7] A. Cutkosky and F. Orabona, “Momentum-based variance reduction in non-convex SGD,” in Advances in Neural Information Processing Systems 32. Curran Associates, Inc., 2019, pp. 15 236–15 245.
265
+ [8] Q. Tran-Dinh, N. H. Pham, D. T. Phan, and L. M. Nguyen, “Hybrid stochastic gradient descent algorithms for stochastic nonconvex optimization,” arXiv preprint arXiv:1905.05920, 2019.
266
+ [9] X. Zhang, M. Hong, S. Dhople, W. Yin, and Y. Liu, “Fedpd: A federated learning framework with adaptivity to non-iid data,” IEEE Transactions on Signal Processing, pp. 1–1, 2021.
267
+ [10] T. Li, A. K. Sahu, M. Zaheer, M. Sanjabi, A. Talwalkar, and V. Smith, “Federated optimization in heterogeneous networks,” arXiv preprint arXiv:1812.06127, 2018.
268
+ [11] B. McMahan, E. Moore, D. Ramage, S. Hampson, and B. A. y Arcas, “Communication-efficient learning of deep networks from decentralized data,” in Artificial Intelligence and Statistics. PMLR, 2017, pp. 1273–1282.
269
+ [12] H. Yu, S. Yang, and S. Zhu, “Parallel restarted sgd with faster convergence and less communication: Demystifying why model averaging works for deep learning,” in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 33, no. 01, 2019, pp. 5693–5700.
270
+ [13] B. Woodworth, K. K. Patel, and N. Srebro, “Minibatch vs local sgd for heterogeneous distributed learning,” arXiv preprint arXiv:2006.04735, 2020.
271
+ [14] H. Yu, R. Jin, and S. Yang, “On the linear speedup analysis of communication efficient momentum sgd for distributed non-convex optimization,” in International Conference on Machine Learning. PMLR, 2019, pp. 7184–7193.
272
+ [15] S. P. Karimireddy, S. Kale, M. Mohri, S. Reddi, S. Stich, and A. T. Suresh, “Scaffold: Stochastic controlled averaging for federated learning,” in International Conference on Machine Learning. PMLR, 2020, pp. 5132–5143.
273
+ [16] H. Yang, M. Fang, and J. Liu, “Achieving linear speedup with partial worker participation in non-iid federated learning,” arXiv preprint arXiv:2101.11203, 2021.
274
+ [17] S. P. Karimireddy, M. Jaggi, S. Kale, M. Mohri, S. J. Reddi, S. U. Stich, and A. T. Suresh, “Mime: Mimicking centralized stochastic algorithms in federated learning,” arXiv preprint arXiv:2008.03606, 2020.
275
+ [18] R. Das, A. Hashemi, S. Sanghavi, and I. S. Dhillon, “Improved convergence rates for non-convex federated learning with compression,” arXiv preprint arXiv:2012.04061, 2020.
276
+ [19] B. Woodworth, K. K. Patel, S. U. Stich, Z. Dai, B. Bullins, H. B. McMahan, O. Shamir, and N. Srebro, “Is local sgd better than minibatch sgd?” arXiv preprint arXiv:2002.07839, 2020.
277
+ [20] H. Yu and R. Jin, “On the computation and communication complexity of parallel sgd with dynamic batch sizes for stochastic non-convex optimization,” in International Conference on Machine Learning. PMLR, 2019, pp. 7174–7183.
278
+ [21] J. Wang and G. Joshi, “Cooperative sgd: A unified framework for the design and analysis of local-update sgd algorithms,” Journal of Machine Learning Research, vol. 22, no. 213, pp. 1–50, 2021.
279
+ [22] A. Khaled, K. Mishchenko, and P. Richtárik, “Better communication complexity for local sgd,” arXiv, 2019.
280
+ [23] S. U. Stich, “Local sgd converges fast and communicates little,” arXiv preprint arXiv:1805.09767, 2018.
281
+ [24] T. Lin, S. U. Stich, K. K. Patel, and M. Jaggi, “Don’t use large mini-batches, use local sgd,” in International Conference on Learning Representations, 2020.
282
+ [25] F. Zhou and G. Cong, “On the convergence properties of a k-step averaging stochastic gradient descent algorithm for nonconvex optimization,” in Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI-18, 7 2018, pp. 3219–3227.
283
+ [26] F. Sattler, S. Wiedemann, K.-R. Müller, and W. Samek, “Robust and communication-efficient federated learning from non-iid data,” IEEE transactions on neural networks and learning systems, vol. 31, no. 9, pp. 3400–3413, 2019.
284
+ [27] Y. Zhao, M. Li, L. Lai, N. Suda, D. Civin, and V. Chandra, “Federated learning with non-iid data,” arXiv preprint arXiv:1806.00582, 2018.
285
+ [28] J. Wang, V. Tantia, N. Ballas, and M. Rabbat, “Slowmo: Improving communication-efficient distributed sgd with slow momentum,” arXiv preprint arXiv:1910.00643, 2019.
286
+ [29] X. Liang, S. Shen, J. Liu, Z. Pan, E. Chen, and Y. Cheng, “Variance reduced local sgd with lower communication complexity,” arXiv preprint arXiv:1912.12844, 2019.
287
+ [30] P. Sharma, P. Khanduri, S. Bulusu, K. Rajawat, and P. K. Varshney, “Parallel restarted SPIDER – communication efficient distributed nonconvex optimization with optimal computation complexity,” arXiv preprint arXiv:1912.06036, 2019.
288
+ [31] S. J. Reddi, S. Kale, and S. Kumar, “On the convergence of adam and beyond,” arXiv preprint arXiv:1904.09237, 2019.
289
+ [32] A. Koloskova, N. Loizou, S. Boreiri, M. Jaggi, and S. Stich, “A unified theory of decentralized sgd with changing topology and local updates,” in International Conference on Machine Learning. PMLR, 2020, pp. 5381–5393.
290
+ [33] R. Johnson and T. Zhang, “Accelerating stochastic gradient descent using predictive variance reduction,” in Advances in Neural Information Processing Systems 26. Curran Associates, Inc., 2013, pp. 315–323.
291
+ [34] L. Bottou, F. E. Curtis, and J. Nocedal, “Optimization methods for large-scale machine learning,” SIAM Review, vol. 60, no. 2, pp. 223–311, 2018.
292
+ [35] Y. Drori and O. Shamir, “The complexity of finding stationary points with stochastic gradient descent,” in International Conference on Machine Learning. PMLR, 2020, pp. 2658–2667.
293
+ [36] D. A. E. Acar, Y. Zhao, R. Matas, M. Mattina, P. Whatmough, and V. Saligrama, “Federated learning based on dynamic regularization,” in International Conference on Learning Representations, 2020.
294
+ [37] S. Caldas, S. M. K. Duddu, P. Wu, T. Li, J. Konecnˇ ý, H. B. McMahan, V. Smith, and A. Talwalkar, “Leaf: A benchmark for federated settings,” 2019.
md/train/J4gRj6d5Qm/J4gRj6d5Qm.md ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting
2
+
3
+ Haixu Wu, Jiehui Xu, Jianmin Wang, Mingsheng Long $( \boxtimes )$ School of Software, BNRist, Tsinghua University, China {whx20,xjh20}@mails.tsinghua.edu.cn, {jimwang,mingsheng}@tsinghua.edu.cn
4
+
5
+ # Abstract
6
+
7
+ Extending the forecasting time is a critical demand for real applications, such as extreme weather early warning and long-term energy consumption planning. This paper studies the long-term forecasting problem of time series. Prior Transformerbased models adopt various self-attention mechanisms to discover the long-range dependencies. However, intricate temporal patterns of the long-term future prohibit the model from finding reliable dependencies. Also, Transformers have to adopt the sparse versions of point-wise self-attentions for long series efficiency, resulting in the information utilization bottleneck. Going beyond Transformers, we design Autoformer as a novel decomposition architecture with an Auto-Correlation mechanism. We break with the pre-processing convention of series decomposition and renovate it as a basic inner block of deep models. This design empowers Autoformer with progressive decomposition capacities for complex time series. Further, inspired by the stochastic process theory, we design the Auto-Correlation mechanism based on the series periodicity, which conducts the dependencies discovery and representation aggregation at the sub-series level. Auto-Correlation outperforms self-attention in both efficiency and accuracy. In long-term forecasting, Autoformer yields stateof-the-art accuracy, with a $38 \%$ relative improvement on six benchmarks, covering five practical applications: energy, traffic, economics, weather and disease. Code is available at this repository: https://github.com/thuml/Autoformer.
8
+
9
+ # 1 Introduction
10
+
11
+ Time series forecasting has been widely used in energy consumption, traffic and economics planning, weather and disease propagation forecasting. In these real-world applications, one pressing demand is to extend the forecast time into the far future, which is quite meaningful for the long-term planning and early warning. Thus, in this paper, we study the long-term forecasting problem of time series, characterizing itself by the large length of predicted time series. Recent deep forecasting models [41, 17, 20, 28, 23, 29, 19, 35] have achieved great progress, especially the Transformer-based models. Benefiting from the self-attention mechanism, Transformers obtain great advantage in modeling long-term dependencies for sequential data, which enables more powerful big models [7, 11].
12
+
13
+ However, the forecasting task is extremely challenging under the long-term setting. First, it is unreliable to discover the temporal dependencies directly from the long-term time series because the dependencies can be obscured by entangled temporal patterns. Second, canonical Transformers with self-attention mechanisms are computationally prohibitive for long-term forecasting because of the quadratic complexity of sequence length. Previous Transformer-based forecasting models [41, 17, 20] mainly focus on improving self-attention to a sparse version. While performance is significantly improved, these models still utilize the point-wise representation aggregation. Thus, in the process of efficiency improvement, they will sacrifice the information utilization because of the sparse point-wise connections, resulting in a bottleneck for long-term forecasting of time series.
14
+
15
+ To reason about the intricate temporal patterns, we try to take the idea of decomposition, which is a standard method in time series analysis [1, 27]. It can be used to process the complex time series and extract more predictable components. However, under the forecasting context, it can only be used as the pre-processing of past series because the future is unknown [15]. This common usage limits the capabilities of decomposition and overlooks the potential future interactions among decomposed components. Thus, we attempt to go beyond pre-processing usage of decomposition and propose a generic architecture to empower the deep forecasting models with immanent capacity of progressive decomposition. Further, decomposition can ravel out the entangled temporal patterns and highlight the inherent properties of time series [15]. Benefiting from this, we try to take advantage of the series periodicity to renovate the point-wise connection in self-attention. We observe that the sub-series at the same phase position among periods often present similar temporal processes. Thus, we try to construct a series-level connection based on the process similarity derived by series periodicity.
16
+
17
+ Based on the above motivations, we propose an original Autoformer in place of the Transformers for long-term time series forecasting. Autoformer still follows residual and encoder-decoder structure but renovates Transformer into a decomposition forecasting architecture. By embedding our proposed decomposition blocks as the inner operators, Autoformer can progressively separate the long-term trend information from predicted hidden variables. This design allows our model to alternately decompose and refine the intermediate results during the forecasting procedure. Inspired by the stochastic process theory [8, 24], Autoformer introduces an Auto-Correlation mechanism in place of self-attention, which discovers the sub-series similarity based on the series periodicity and aggregates similar sub-series from underlying periods. This series-wise mechanism achieves $\mathcal { O } ( L \log L )$ complexity for length- $L$ series and breaks the information utilization bottleneck by expanding the point-wise representation aggregation to sub-series level. Autoformer achieves the state-of-the-art accuracy on six benchmarks. The contributions are summarized as follows:
18
+
19
+ • To tackle the intricate temporal patterns of the long-term future, we present Autoformer as a decomposition architecture and design the inner decomposition block to empower the deep forecasting model with immanent progressive decomposition capacity. • We propose an Auto-Correlation mechanism with dependencies discovery and information aggregation at the series level. Our mechanism is beyond previous self-attention family and can simultaneously benefit the computation efficiency and information utilization. • Autoformer achieves a $38 \%$ relative improvement under the long-term setting on six benchmarks, covering five real-world applications: energy, traffic, economics, weather and disease.
20
+
21
+ # 2 Related Work
22
+
23
+ # 2.1 Models for Time Series Forecasting
24
+
25
+ Due to the immense importance of time series forecasting, various models have been well developed. Many time series forecasting methods start from the classic tools [32, 9]. ARIMA [6, 5] tackles the forecasting problem by transforming the non-stationary process to stationary through differencing. The filtering method is also introduced for series forecasting [18, 10]. Besides, recurrent neural networks (RNNs) models are used to model the temporal dependencies for time series [36, 26, 40, 22]. DeepAR [28] combines autoregressive methods and RNNs to model the probabilistic distribution of future series. LSTNet [19] introduces convolutional neural networks (CNNs) with recurrent-skip connections to capture the short-term and long-term temporal patterns. Attention-based RNNs [39, 30, 31] introduce the temporal attention to explore the long-range dependencies for prediction. Also, many works based on temporal convolution networks (TCN) [34, 4, 3, 29] attempt to model the temporal causality with the causal convolution. These deep forecasting models mainly focus on the temporal relation modeling by recurrent connections, temporal attention or causal convolution.
26
+
27
+ Recently, Transformers [35, 38] based on the self-attention mechanism shows great power in sequential data, such as natural language processing [11, 7], audio processing [14] and even computer vision [12, 21]. However, applying self-attention to long-term time series forecasting is computationally prohibitive because of the quadratic complexity of sequence length $L$ in both memory and time. LogTrans [20] introduces the local convolution to Transformer and proposes the LogSparse attention to select time steps following the exponentially increasing intervals, which reduces the complexity to $\mathcal { O } ( L ( \log L ) ^ { 2 } )$ . Reformer [17] presents the local-sensitive hashing (LSH) attention and reduces the complexity to $\mathcal { O } ( L \log L )$ . Informer [41] extends Transformer with KL-divergence based ProbSparse attention and also achieves $\mathcal { O } ( L \log L )$ complexity. Note that these methods are based on the vanilla Transformer and try to improve the self-attention mechanism to a sparse version, which still follows the point-wise dependency and aggregation. In this paper, our proposed Auto-Correlation mechanism is based on the inherent periodicity of time series and can provide series-wise connections.
28
+
29
+ # 2.2 Decomposition of Time Series
30
+
31
+ As a standard method in time series analysis, time series decomposition [1, 27] deconstructs a time series into several components, each representing one of the underlying categories of patterns that are more predictable. It is primarily useful for exploring historical changes over time. For the forecasting tasks, decomposition is always used as the pre-processing of historical series before predicting future series [15, 2], such as Prophet [33] with trend-seasonality decomposition and N-BEATS [23] with basis expansion and DeepGLO [29] with matrix decomposition. However, such pre-processing is limited by the plain decomposition effect of historical series and overlooks the hierarchical interaction between the underlying patterns of series in the long-term future. This paper takes the decomposition idea from a new progressive dimension. Our Autoformer harnesses the decomposition as an inner block of deep models, which can progressively decompose the hidden series throughout the whole forecasting process, including both the past series and the predicted intermediate results.
32
+
33
+ # 3 Autoformer
34
+
35
+ The time series forecasting problem is to predict the most probable length- $O$ series in the future given the past length- ${ \mathbf { \nabla } } \cdot { I }$ series, denoting as input-I-predict- $O$ . The long-term forecasting setting is to predict the long-term future, i.e. larger $O$ . As aforementioned, we have highlighted the difficulties of long-term series forecasting: handling intricate temporal patterns and breaking the bottleneck of computation efficiency and information utilization. To tackle these two challenges, we introduce the decomposition as a builtin block to the deep forecasting model and propose Autoformer as a decomposition architecture. Besides, we design the Auto-Correlation mechanism to discover the period-based dependencies and aggregate similar sub-series from underlying periods.
36
+
37
+ # 3.1 Decomposition Architecture
38
+
39
+ We renovate Transformer [35] to a deep decomposition architecture (Figure 1), including the inner series decomposition block, Auto-Correlation mechanism, and corresponding Encoder and Decoder.
40
+
41
+ Series decomposition block To learn with the complex temporal patterns in long-term forecasting context, we take the idea of decomposition [1, 27], which can separate the series into trend-cyclical and seasonal parts. These two parts reflect the long-term progression and the seasonality of the series respectively. However, directly decomposing is unrealizable for future series because the future is just unknown. To tackle this dilemma, we present a series decomposition block as an inner operation of Autoformer (Figure 1), which can extract the long-term stationary trend from predicted intermediate hidden variables progressively. Concretely, we adapt the moving average to smooth out periodic fluctuations and highlight the long-term trends. For length- $L$ input series $\breve { \mathcal { X } } \in \mathbb { R } ^ { L \times d }$ , the process is:
42
+
43
+ $$
44
+ \begin{array} { r l } & { \mathcal { X } _ { \mathrm { t } } = \mathrm { A v g P o o l } ( \mathrm { P a d d i n g } ( \mathcal { X } ) ) } \\ & { \mathcal { X } _ { \mathrm { s } } = \mathcal { X } - \mathcal { X } _ { \mathrm { t } } , } \end{array}
45
+ $$
46
+
47
+ where $\boldsymbol { \mathcal { X } } _ { \mathrm { s } } , \boldsymbol { \mathcal { X } } _ { \mathrm { t } } \in \mathbb { R } ^ { L \times d }$ denote the seasonal and the extracted trend-cyclical part respectively. We adopt the $\operatorname { A v g P o o l } ( \cdot )$ for moving average with the padding operation to keep the series length unchanged. We use $\mathcal { X } _ { \mathrm { s } } , \mathcal { X } _ { \mathrm { t } } = \mathrm { S e r i e s D e c o m p } ( \mathcal { X } )$ to summarize above equations, which is a model inner block.
48
+
49
+ Model inputs The inputs of encoder part are the past $I$ time steps $\mathcal { X } _ { \mathrm { e n } } \in \mathbb { R } ^ { I \times d }$ . As a decomposition architecture (Figure 1), the input of Autoformer decoder contains both the seasonal part $\chi _ { \mathrm { d e s } } \in$ $\mathbb { R } ^ { ( \frac { I } { 2 } + O ) \times d }$ and trend-cyclical part $\chi _ { \mathrm { d e t } } \in \mathbb { R } ^ { ( \frac { I } { 2 } + O ) \times d }$ to be refined. Each initialization consists of two parts: the component decomposed from the latter half of encoder’s input $\mathcal { X } _ { \mathrm { e n } }$ with length $\frac { I } { 2 }$ to provide recent information, placeholders with length $O$ filled by scalars. It’s formulized as follows:
50
+
51
+ $$
52
+ \begin{array} { r l } & { \mathcal { X } _ { \mathrm { e n s } } , \mathcal { X } _ { \mathrm { e n t } } = \mathrm { S e r i e s D e c o m p } ( \mathcal { X } _ { \mathrm { e n } \frac { I } { 2 } : I } ) } \\ & { \qquad \mathcal { X } _ { \mathrm { d e s } } = \mathrm { C o n c a t } ( \mathcal { X } _ { \mathrm { e n s } } , \mathcal { X } _ { 0 } ) } \\ & { \qquad \mathcal { X } _ { \mathrm { d e t } } = \mathrm { C o n c a t } ( \mathcal { X } _ { \mathrm { e n t } } , \mathcal { X } _ { \mathrm { M e a n } } ) , } \end{array}
53
+ $$
54
+
55
+ ![](images/1ebb1575216e8696f19f85fe903bb441210d41e8973469f64d31b9ac1d64fa43.jpg)
56
+ Figure 1: Autoformer architecture. The encoder eliminates the long-term trend-cyclical part by series decomposition blocks (blue blocks) and focuses on seasonal patterns modeling. The decoder accumulates the trend part extracted from hidden variables progressively. The past seasonal information from encoder is utilized by the encoder-decoder Auto-Correlation (center green block in decoder).
57
+
58
+ where $\chi _ { \mathrm { e n s } } , \chi _ { \mathrm { e n t } } \in \mathbb { R } ^ { \frac { I } { 2 } \times d }$ denote the seasonal and trend-cyclical parts of $\mathcal { X } _ { \mathrm { e n } }$ respectively, and $\mathcal { X } _ { 0 } , \mathcal { X } _ { \mathrm { M e a n } } \in \mathbb { R } ^ { O \times d }$ denote the placeholders filled with zero and the mean of $\mathcal { X } _ { \mathrm { e n } }$ respectively.
59
+
60
+ Encoder As shown in Figure 1, the encoder focuses on the seasonal part modeling. The output of the encoder contains the past seasonal information and will be used as the cross information to help the decoder refine prediction results. Suppose we have $N$ encoder layers. The overall equations for $l$ -th encoder layer are summarized as $\mathcal { X } _ { \mathrm { e n } } ^ { \hat { l } ^ { \mathrm { ~ \tiny ~ \cdot ~ } } } = \mathrm { E n c o d e r } ( \mathcal { X } _ { \mathrm { e n } } ^ { l - 1 } )$ . Details are shown as follows:
61
+
62
+ $$
63
+ \begin{array} { r l } & { S _ { \mathrm { e n } } ^ { l , 1 } , \ l _ { - } = \mathrm { S e r i e s D e c o m p } \Big ( \mathrm { A u t o - C o r r e l a t i o n } ( \mathcal { X } _ { \mathrm { e n } } ^ { l - 1 } ) + \mathcal { X } _ { \mathrm { e n } } ^ { l - 1 } \Big ) } \\ & { S _ { \mathrm { e n } } ^ { l , 2 } , \ l _ { - } = \mathrm { S e r i e s D e c o m p } \Big ( \mathrm { F e e d F o r w a r d } ( S _ { \mathrm { e n } } ^ { l , 1 } ) + S _ { \mathrm { e n } } ^ { l , 1 } \Big ) , } \end{array}
64
+ $$
65
+
66
+ where $\underline { { { \bf \Pi } } } ^ { 6 6 } \underline { { { \bf \Pi } } } ^ { 5 9 }$ is the eliminated trend part. $\mathcal { X } _ { \mathrm { e n } } ^ { l } = S _ { \mathrm { e n } } ^ { l , 2 } , l \in \{ 1 , \cdots , N \}$ denotes the output of $l$ -th encoder layer and $\mathcal { X } _ { \mathrm { e n } } ^ { 0 }$ is the embedded $\mathcal { X } _ { \mathrm { e n } }$ . $S _ { \mathrm { e n } } ^ { l , i }$ , $i \in \{ 1 , 2 \}$ represents the seasonal component after the -th series decomposition block in the $l$ -th layer respectively. We will give detailed description of Auto-Correlation $( \cdot )$ in the next section, which can seamlessly replace the self-attention.
67
+
68
+ Decoder The decoder contains two parts: the accumulation structure for trend-cyclical components and the stacked Auto-Correlation mechanism for seasonal components (Figure 1). Each decoder layer contains the inner Auto-Correlation and encoder-decoder Auto-Correlation, which can refine the prediction and utilize the past seasonal information respectively. Note that the model extracts the potential trend from the intermediate hidden variables during the decoder, allowing Autoformer to progressively refine the trend prediction and eliminate interference information for period-based dependencies discovery in Auto-Correlation. Suppose there are $M$ decoder layers. With the latent variable $\chi _ { \mathrm { e n } } ^ { N }$ from the encoder, the equations of $l$ -th decoder layer can be summarized as $\mathcal { X } _ { \mathrm { d e } } ^ { l } =$ $\mathrm { D e c o d e r } ( \mathcal { X } _ { \mathrm { d e } } ^ { l - 1 } , \mathcal { X } _ { \mathrm { e n } } ^ { N } )$ . The decoder can be formalized as follows:
69
+
70
+ $$
71
+ \begin{array} { r l } & { S _ { \mathrm { d e } } ^ { l , 1 } , \mathcal { T } _ { \mathrm { d e } } ^ { l , 1 } = \mathrm { S e r i e s D e c o m p } \left( \mathrm { A u t o - C o r r e l a t i o n } ( \mathcal { X } _ { \mathrm { d e } } ^ { l - 1 } ) + \mathcal { X } _ { \mathrm { d e } } ^ { l - 1 } \right) } \\ & { S _ { \mathrm { d e } } ^ { l , 2 } , \mathcal { T } _ { \mathrm { d e } } ^ { l , 2 } = \mathrm { S e r i e s D e c o m p } \left( \mathrm { A u t o - C o r r e l a t i o n } ( S _ { \mathrm { d e } } ^ { l , 1 } , \mathcal { X } _ { \mathrm { e n } } ^ { N } ) + S _ { \mathrm { d e } } ^ { l , 1 } \right) } \\ & { S _ { \mathrm { d e } } ^ { l , 3 } , \mathcal { T } _ { \mathrm { d e } } ^ { l , 3 } = \mathrm { S e r i e s D e c o m p } \left( \mathrm { F e e d F o r w a r d } ( S _ { \mathrm { d e } } ^ { l , 2 } ) + S _ { \mathrm { d e } } ^ { l , 2 } \right) } \\ & { \qquad \mathcal { T } _ { \mathrm { d e } } ^ { l } = \mathcal { T } _ { \mathrm { d e } } ^ { l - 1 } + \mathcal { W } _ { l , 1 } \ast \mathcal { T } _ { \mathrm { d e } } ^ { l , 1 } + \mathcal { W } _ { l , 2 } \ast \mathcal { T } _ { \mathrm { d e } } ^ { l , 2 } + \mathcal { W } _ { l , 3 } \ast \mathcal { T } _ { \mathrm { d e } } ^ { l , 3 } , } \end{array}
72
+ $$
73
+
74
+ where $\mathcal { X } _ { \mathrm { d e } } ^ { l } = { S } _ { \mathrm { d e } } ^ { l , 3 } , l \in \{ 1 , \cdots , M \}$ denotes the output of $l$ -th decoder layer. $\mathcal { X } _ { \mathrm { d e } } ^ { 0 }$ is embedded from $\mathcal { X } _ { \mathrm { d e s } }$ de de for deep transform and $\mathcal { T } _ { \mathrm { d e } } ^ { 0 } = \mathcal { X } _ { \mathrm { d e t } }$ is for accumulatio . $S _ { \mathrm { d e } } ^ { l , i } , T _ { \mathrm { d e } } ^ { l , i } , i \in \{ 1 , 2 , 3 \}$ represent the $i$ $l$ -th layer respectively. $\mathcal { W } _ { l , i } , i \in \{ 1 , 2 , 3 \}$ represents the projector for the $i$ -th extracted trend $\mathcal { T } _ { \mathrm { d e } } ^ { l , i }$ .
75
+
76
+ ![](images/611e264868072bea6977edb6f802f5f63a12c602deabbfe382df58f997963cca.jpg)
77
+ Figure 2: Auto-Correlation (left) and Time Delay Aggregation (right). We utilize the Fast Fourier Transform to calculate the autocorrelation $\mathcal { R } ( \tau )$ , which reflects the time-delay similarities. Then the similar sub-processes are rolled to the same index based on selected delay $\tau$ and aggregated by $\mathcal { R } ( \tau )$ .
78
+
79
+ The final prediction is the sum of the two refined decomposed components, as $\mathcal { W } _ { S } \ast \mathcal { X } _ { \mathrm { d e } } ^ { M } + \mathcal { T } _ { \mathrm { d e } } ^ { M }$ where is to project the deep transformed seasonal component to the target dimension.
80
+
81
+ # 3.2 Auto-Correlation Mechanism
82
+
83
+ As shown in Figure 2, we propose the Auto-Correlation mechanism with series-wise connections to expand the information utilization. Auto-Correlation discovers the period-based dependencies by calculating the series autocorrelation and aggregates similar sub-series by time delay aggregation.
84
+
85
+ Period-based dependencies It is observed that the same phase position among periods naturally provides similar sub-processes. Inspired by the stochastic process theory [8, 24], for a real discretetime process $\{ \mathcal { X } _ { t } \}$ , we can obtain the autocorrelation $\mathcal { R } _ { \mathcal { X } \mathcal { X } } ( \tau )$ by the following equations:
86
+
87
+ $$
88
+ \mathcal { R } _ { \mathcal { X } \mathcal { X } } ( \tau ) = \operatorname* { l i m } _ { L \infty } \frac { 1 } { L } \sum _ { t = 1 } ^ { L } \mathcal { X } _ { t } \mathcal { X } _ { t - \tau } .
89
+ $$
90
+
91
+ $\mathcal { R } _ { \mathcal { X } \mathcal { X } } ( \tau )$ reflects the time-delay similarity between $\{ \mathcal { X } _ { t } \}$ and its $\tau$ lag series $\{ \mathcal { X } _ { t - \tau } \}$ . As shown in Figure 2, we use the autocorrelation $\mathcal { R } ( \tau )$ as the unnormalized confidence of estimated period length $\tau$ . Then, we choose the most possible $k$ period lengths $\tau _ { 1 } , \cdots , \tau _ { k }$ . The period-based dependencies are derived by the above estimated periods and can be weighted by the corresponding autocorrelation.
92
+
93
+ 1Time delay aggregation The period-based dependencies connect the sub-series among estimated 1periods. Thus, we present the time delay aggregation block (Figure 2), which can roll the series based on selected time delay $\tau _ { 1 } , \cdots , \tau _ { k }$ . This operation can align similar sub-series that are at the same phase position of estimated periods, which is different from the point-wise dot-product aggregation in self-attention family. Finally, we aggregate the sub-series by softmax normalized confidences.
94
+
95
+ For the single head situation and time series $\mathcal { X }$ with length- $L$ , after the projector, we get query $\mathcal { Q }$ , key $\kappa$ and value $\nu$ . Thus, it can replace self-attention seamlessly. The Auto-Correlation mechanism is:
96
+
97
+ $$
98
+ \begin{array} { r l } & { \qquad \tau _ { 1 } , \cdots , \tau _ { k } = \underset { \tau \in \{ 1 , \cdots , L \} } { \mathrm { a r g } \mathrm { T o p k } } ( \mathcal { R } _ { \mathcal { Q } , \mathcal { K } } ( \tau ) ) } \\ & { \qquad \widehat { \mathcal { R } } _ { \mathcal { Q } , \mathcal { K } } ( \tau _ { 1 } ) , \cdots , \widehat { \mathcal { R } } _ { \mathcal { Q } , \mathcal { K } } ( \tau _ { k } ) = \mathrm { S o f t M a x } ( \mathcal { R } _ { \mathcal { Q } , \mathcal { K } } ( \tau _ { 1 } ) , \cdots , \mathcal { R } _ { \mathcal { Q } , \mathcal { K } } ( \tau _ { k } ) ) } \\ & { \mathrm { A u t o - C o r r e l a t i o n } ( \mathcal { Q } , \mathcal { K } , \mathcal { V } ) = \underset { i = 1 } { \overset { k } { \sum } } \mathrm { R o l l } ( \mathcal { V } , \tau _ { i } ) \widehat { \mathcal { R } } _ { \mathcal { Q } , \mathcal { K } } ( \tau _ { i } ) , } \end{array}
99
+ $$
100
+
101
+ where ar $\boldsymbol { \mathrm { \xi ^ { 2 } } } \mathrm { T o p k } ( \cdot )$ is to get the arguments of the Topk autocorrelations and let $k = \lfloor c \times \log L \rfloor$ , $c$ is a hyper-parameter. $\mathcal { R } _ { \mathcal { Q } , \kappa }$ is autocorrelation between series $\mathcal { Q }$ and $\kappa$ . $\mathrm { R o l l } ( \mathcal { X } , \tau )$ represents the operation to $\mathcal { X }$ with time delay $\tau$ , during which elements that are shifted beyond the first position are re-introduced at the last position. For the encoder-decoder Auto-Correlation (Figure 1), $\kappa , \nu$ are from the encoder $\chi _ { \mathrm { e n } } ^ { N }$ and will be resized to length- $O$ , $\mathcal { Q }$ is from the previous block of the decoder.
102
+
103
+ ![](images/b3a1dd188e9913684d89e9998ab12a2c0b4d1275bd0f7f003ea51f10541c2ec2.jpg)
104
+ Figure 3: Auto-Correlation vs. self-attention family. Full Attention [35] (a) adapts the fully connection among all time points. Sparse Attention [17, 41] (b) selects points based on the proposed similarity metrics. LogSparse Attention [20] (c) chooses points following the exponentially increasing intervals. Auto-Correlation (d) focuses on the connections of sub-series among underlying periods.
105
+
106
+ For the multi-head version used in Autoformer, with hidden variables of $d _ { \mathrm { m o d e l } }$ channels, $h$ heads, the query, key and value for $i$ -th head are $\mathcal { Q } _ { i } , \mathcal { K } _ { i } , \mathcal { V } _ { i } \in \mathbb { R } ^ { L \times \frac { d _ { \mathrm { m o d e l } } } { h } }$ , $i \in \{ 1 , \cdots , h \}$ . The process is:
107
+
108
+ $$
109
+ \begin{array} { r l } & { \mathrm { M u l t i H e a d } ( \mathcal { Q } , K , \mathcal { V } ) = \mathcal { W } _ { \mathrm { o u t p u t } } * \mathrm { C o n c a t } ( \mathrm { h e a d } _ { 1 } , \cdot \cdot \cdot , \mathrm { h e a d } _ { h } ) } \\ & { \quad \quad \quad \mathrm { w h e r e ~ h e a d } _ { i } = \mathrm { A u t o - C o r r e l a t i o n } ( \mathcal { Q } _ { i } , K _ { i } , \mathcal { V } _ { i } ) . } \end{array}
110
+ $$
111
+
112
+ Efficient computation For period-based dependencies, these dependencies point to sub-processes at the same phase position of underlying periods and are inherently sparse. Here, we select the most possible delays to avoid picking the opposite phases. Because we aggregate ${ \mathcal { O } } ( \log L )$ series whose length is $L$ , the complexity of Equations 6 and 7 is $\mathcal { O } ( L \log L )$ . For the autocorrelation computation (Equation 5), given time series $\{ \mathcal { X } _ { t } \}$ , $\mathcal { R } _ { \mathcal { X } \mathcal { X } } ( \tau )$ can be calculated by Fast Fourier Transforms (FFT) based on the Wiener–Khinchin theorem [37]:
113
+
114
+ $$
115
+ \begin{array} { r l } & { \displaystyle \mathcal { S } _ { \mathcal { X } \mathcal { X } } ( f ) = \mathcal { F } \left( \mathcal { X } _ { t } \right) \mathcal { F } ^ { * } \left( \mathcal { X } _ { t } \right) = \int _ { - \infty } ^ { \infty } \mathcal { X } _ { t } e ^ { - i 2 \pi t f } \mathrm { d } t \overline { { \int _ { - \infty } ^ { \infty } \mathcal { X } _ { t } e ^ { - i 2 \pi t f } \mathrm { d } t } } } \\ & { \displaystyle \mathcal { R } _ { \mathcal { X } \mathcal { X } } ( \tau ) = \mathcal { F } ^ { - 1 } \left( S _ { \mathcal { X } \mathcal { X } } ( f ) \right) = \int _ { - \infty } ^ { \infty } S _ { \mathcal { X } \mathcal { X } } ( f ) e ^ { i 2 \pi f \tau } \mathrm { d } f , } \end{array}
116
+ $$
117
+
118
+ where $\tau \in \{ 1 , \cdots , L \}$ , $\mathcal { F }$ denotes the FFT and ${ \mathcal { F } } ^ { - 1 }$ is its inverse. $^ *$ denotes the conjugate operation and $\mathcal { S } _ { \mathcal { X X } } ( f )$ is in the frequency domain. Note that the series autocorrelation of all lags in $\{ 1 , \cdots , L \}$ can be calculated at once by FFT. Thus, Auto-Correlation achieves the $\mathcal { O } ( L \log L )$ complexity.
119
+
120
+ Auto-Correlation vs. self-attention family Different from the point-wise self-attention family, Auto-Correlation presents the series-wise connections (Figure 3). Concretely, for the temporal dependencies, we find the dependencies among sub-series based on the periodicity. In contrast, the self-attention family only calculates the relation between scattered points. Though some selfattentions [20, 41] consider the local information, they only utilize this to help point-wise dependencies discovery. For the information aggregation, we adopt the time delay block to aggregate the similar sub-series from underlying periods. In contrast, self-attentions aggregate the selected points by dot-product. Benefiting from the inherent sparsity and sub-series-level representation aggregation, Auto-Correlation can simultaneously benefit the computation efficiency and information utilization.
121
+
122
+ # 4 Experiments
123
+
124
+ We extensively evaluate the proposed Autoformer on six real-world benchmarks, covering five mainstream time series forecasting applications: energy, traffic, economics, weather and disease.
125
+
126
+ Datasets Here is a description of the six experiment datasets: (1) ETT [41] dataset contains the data collected from electricity transformers, including load and oil temperature that are recorded every
127
+
128
+ Table 1: Multivariate results with different prediction lengths $O \in \{ 9 6 , 1 9 2 , 3 3 6 , 7 2 0 \}$ . We set the input length $I$ as 36 for ILI and 96 for the others. A lower MSE or MAE indicates a better prediction.
129
+
130
+ <table><tr><td colspan="2"></td><td colspan="2">Models Autoformer</td><td colspan="2">Informer[41]</td><td colspan="2">LogTrans[20]</td><td colspan="2">Reformer[17]</td><td colspan="2">LSTNet[19]</td><td colspan="2">LSTM[13]</td><td colspan="2">TCN[3]</td></tr><tr><td colspan="2">Metric</td><td>MSE</td><td>MAE</td><td>MSE</td><td>MAE</td><td>MSE</td><td>MAE</td><td>MSE</td><td>MAE</td><td>MSE MAE</td><td></td><td>MSE MAE</td><td></td><td>MSE</td><td>MAE</td></tr><tr><td rowspan="2">T</td><td rowspan="2">96 192 336</td><td rowspan="2">0.255 0.281 0.339</td><td rowspan="2">0.339 0.340</td><td rowspan="2">0.365 0.533</td><td rowspan="2">0.453 0.563</td><td rowspan="2">0.768 0.989</td><td rowspan="2">0.642 0.757</td><td rowspan="2">0.658</td><td rowspan="2">0.619</td><td rowspan="2">3.142 3.154</td><td rowspan="2">1.365 1.369</td><td rowspan="2">2.041 2.249</td><td rowspan="2">1.073 1.112</td><td rowspan="2">3.041 3.072</td><td rowspan="2"></td><td rowspan="2">1.330 1.339</td></tr><tr><td>1.078 0.827 1.549</td></tr><tr><td></td><td>720 96</td><td>0.422 0.201</td><td>0.372 0.419</td><td>1.363 3.379</td><td>0.887 1.388</td><td>3.048</td><td>1.334</td><td>0.872 1.328</td><td>2.631</td><td>0.972 1.242</td><td>3.160 3.171</td><td>1.369 1.368 2.720</td><td>2.568</td><td>1.238 1.287</td><td>3.105 3.135</td><td>1.348 1.354</td></tr><tr><td>erneera</td><td>192 336</td><td>0.222</td><td>0.317 0.334</td><td>0.274 0.296</td><td>0.368 0.386</td><td>0.258 0.266</td><td>0.357 0.368</td><td></td><td>0.312 0.348</td><td>0.402 0.433</td><td>0.680 0.645 0.725</td><td>0.676</td><td>0.375 0.442</td><td>0.437 0.473</td><td>0.985 0.996</td><td>0.813 0.821</td></tr><tr><td></td><td>720</td><td>0.231 0.254</td><td>0.338 0.361</td><td>0.300 0.373</td><td>0.394 0.439</td><td>0.280 0.283</td><td></td><td>0.380 0.376</td><td>0.350 0.340</td><td>0.433 0.420</td><td>0.828 0.957</td><td>0.727 0.811</td><td>0.439 0.980</td><td>0.473 0.814</td><td>1.000 1.438</td><td>0.824 0.784</td></tr><tr><td>uepeg</td><td>96 192</td><td>0.197</td><td>0.323</td><td>0.847</td><td>0.752</td><td>0.968</td><td>0.812</td><td></td><td>1.065</td><td>0.829</td><td>1.551</td><td>1.058 1.453</td><td></td><td>1.049 3.004</td><td></td><td>1.432</td></tr><tr><td></td><td>336</td><td>0.300 0.509</td><td>0.369 0.524</td><td>1.204</td><td>0.895</td><td>1.040</td><td>0.851</td><td></td><td>1.188</td><td>0.906</td><td>1.477</td><td>1.028</td><td>1.846</td><td>1.179</td><td>3.048</td><td>1.444</td></tr><tr><td></td><td>720</td><td>1.447</td><td>0.941</td><td>1.672 2.478</td><td>1.036 1.310</td><td>1.659 1.941</td><td>1.081 1.127</td><td>1.357 1.510</td><td></td><td>0.976 1.016</td><td>1.507 2.285</td><td>1.031 1.243</td><td>2.136 2.984</td><td>1.231</td><td>3.113</td><td>1.459</td></tr><tr><td></td><td>96</td><td>0.613</td><td>0.388</td><td>0.719</td><td>0.391</td><td>0.684</td><td>0.384</td><td>0.732</td><td></td><td>0.423</td><td></td><td></td><td></td><td>1.427</td><td>3.150</td><td>1.458</td></tr><tr><td>[Tjeee</td><td>192</td><td>0.616</td><td>0.382</td><td>0.696</td><td>0.379</td><td>0.685</td><td>0.390</td><td>0.733</td><td>0.420</td><td></td><td>1.107 1.157</td><td>0.685 0.706</td><td>0.843 0.847</td><td>0.453 0.453</td><td>1.438 1.463</td><td>0.784 0.794</td></tr><tr><td></td><td>336 720</td><td>0.622</td><td>0.337</td><td>0.777</td><td>0.420</td><td>0.733</td><td>0.408</td><td>0.742</td><td>0.420</td><td></td><td>1.216</td><td>0.730</td><td>0.853</td><td>0.455</td><td>1.479</td><td>0.799</td></tr><tr><td></td><td></td><td>0.660</td><td>0.408</td><td>0.864</td><td>0.472</td><td>0.717</td><td>0.396</td><td>0.755</td><td></td><td>0.423</td><td>1.481</td><td>0.805</td><td>1.500</td><td>0.805</td><td>1.499</td><td>0.804</td></tr><tr><td>waaeee</td><td>96</td><td>0.266</td><td>0.336</td><td>0.300</td><td>0.384</td><td>0.458</td><td>0.490</td><td>0.689</td><td></td><td>0.596</td><td>0.594</td><td>0.587</td><td>0.369</td><td>0.406</td><td>0.615</td><td>0.589</td></tr><tr><td></td><td>192 336</td><td>0.307</td><td>0.367</td><td>0.598</td><td>0.544</td><td>0.658</td><td>0.589</td><td>0.752</td><td></td><td>0.638</td><td>0.560</td><td>0.565</td><td>0.416</td><td>0.435</td><td>0.629</td><td>0.600</td></tr><tr><td></td><td>720</td><td>0.359</td><td>0.395</td><td>0.578</td><td>0.523</td><td>0.797</td><td>0.652</td><td>0.639</td><td></td><td>0.596</td><td>0.597</td><td>0.587</td><td>0.455</td><td>0.454</td><td>0.639</td><td>0.608</td></tr><tr><td></td><td></td><td>0.419</td><td>0.428</td><td>1.059</td><td>0.741</td><td>0.869</td><td>0.675</td><td>1.130</td><td></td><td>0.792</td><td>0.618</td><td>0.599</td><td>0.535</td><td>0.520</td><td>0.639</td><td>0.610</td></tr><tr><td></td><td>24</td><td>3.483</td><td></td><td>5.764</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></td><td>36</td><td></td><td>1.287</td><td></td><td>1.677</td><td>4.480</td><td>1.444</td><td></td><td>4.400</td><td>1.382</td><td>6.026</td><td>1.770</td><td>5.914</td><td>1.734</td><td>6.624</td><td>1.830</td></tr><tr><td>Ⅱ</td><td>48</td><td>3.103</td><td>1.148</td><td>4.755</td><td>1.467</td><td>4.799</td><td>1.467</td><td></td><td>4.783</td><td>1.448</td><td>5.340</td><td>1.668</td><td>6.631</td><td>1.845</td><td>6.858</td><td>1.879</td></tr><tr><td></td><td></td><td>2.669</td><td>1.085</td><td>4.763</td><td>1.469</td><td>4.800</td><td>1.468</td><td></td><td>4.832</td><td>1.465</td><td>6.080</td><td>1.787</td><td>6.736</td><td>1.857</td><td>6.968</td><td></td></tr><tr><td></td><td>60</td><td></td><td>1.125</td><td>5.264</td><td>1.564</td><td>5.278</td><td></td><td>1.560</td><td>4.882</td><td>1.483</td><td>5.548</td><td>1.720 6.870</td><td></td><td>1.879</td><td>7.127</td><td>1.892 1.918</td></tr><tr><td></td><td></td><td>2.770</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></table>
131
+
132
+ \* ETT means the ETTm2. See supplementary materials for the full benchmark of ETTh1, ETTh2, ETTm1.
133
+
134
+ 15 minutes between July 2016 and July 2018. (2) Electricity1 dataset contains the hourly electricity consumption of 321 customers from 2012 to 2014. (3) Exchange [19] records the daily exchange rates of eight different countries ranging from 1990 to 2016. (4) Traffic2 is a collection of hourly data from California Department of Transportation, which describes the road occupancy rates measured by different sensors on San Francisco Bay area freeways. (5) Weather3 is recorded every 10 minutes for 2020 whole year, which contains 21 meteorological indicators, such as air temperature, humidity, etc. (6) $I L I ^ { 4 }$ includes the weekly recorded influenza-like illness (ILI) patients data from Centers for Disease Control and Prevention of the United States between 2002 and 2021, which describes the ratio of patients seen with ILI and the total number of the patients. We follow standard protocol and split all datasets into training, validation and test set in chronological order by the ratio of 6:2:2 for the ETT dataset and 7:1:2 for the other datasets.
135
+
136
+ Implementation details Our method is trained with L2 loss, using the ADAM [16] optimizer with an initial learning rate of $1 0 ^ { - 4 }$ . Batch size is set to 32. The training process is early stopped within 10 epochs. All experiments are repeated three times, implemented in PyTorch [25] and conducted on a single NVIDIA TITAN RTX 24GB GPUs. The hyper-parameter $c$ of Auto-Correlation is in the range of 1 to 3 to trade off performance and efficiency. See supplementary materials for standard deviations and sensitivity analysis. Autoformer contains 2 encoder layers and 1 decoder layer.
137
+
138
+ Baselines We include 10 baseline methods. For the multivariate setting, we select three latest stateof-the-art transformer-based models: Informer [41], Reformer [17], LogTrans [20], two RNN-based models: LSTNet [19], LSTM [13] and CNN-based TCN [3] as baselines. For the univariate setting, we include more competitive baselines: N-BEATS[23], DeepAR [28], Prophet [33] and ARMIA [1].
139
+
140
+ Table 2: Univariate results with different prediction lengths $O \in \{ 9 6 , 1 9 2 , 3 3 6 , 7 2 0 \}$ on typical datasets. We set the input length $I$ as 96. A lower MSE or MAE indicates a better prediction.
141
+
142
+ <table><tr><td colspan="2">Models Autoformer N-BEATS[23] Informer[41] LogTrans[20] Reformer[17] DeepAR[28] Prophet[33] ARIMA[1]</td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td><td colspan="2"></td></tr><tr><td colspan="2">Metric1</td><td>MSE MAE MSE</td><td></td><td>MAE</td><td>MSE MAE</td><td>MSE</td><td>MAE</td><td>MSE</td><td>MAE</td><td>MSE MAE</td><td></td><td>MSE MAE MSE MAE</td><td></td></tr><tr><td rowspan="4"></td><td>96</td><td>0.065 0.189</td><td>0.082</td><td>0.219</td><td>0.088 0.225</td><td>0.082</td><td>0.217</td><td>0.131</td><td>0.288</td><td>0.099</td><td>0.237</td><td></td><td>0.287 0.456 0.211 0.362</td></tr><tr><td>192</td><td>0.118 0.256 0.120</td><td></td><td>0.268</td><td>0.132 0.283</td><td>0.133</td><td>0.284</td><td>0.186</td><td>0.354</td><td>0.154</td><td>0.310</td><td>0.312 0.483 0.261 0.406</td><td></td></tr><tr><td>336</td><td>0.1540.305 0.226</td><td>0.370</td><td>0.180</td><td></td><td>0.336 0.201</td><td>0.361</td><td>0.220</td><td>0.381</td><td>0.277</td><td>0.428</td><td>0.331 0.474 0.317 0.448</td><td></td></tr><tr><td>720</td><td>0.182 0.335 0.188</td><td></td><td>0.338 0.300</td><td></td><td>0.435 0.268</td><td>0.407</td><td>0.267</td><td>0.430</td><td></td><td></td><td>0.332 0.468 0.5340.593 0.366 0.487</td><td></td></tr><tr><td>aepeg</td><td>96</td><td>0.241 0.387 0.156</td><td>0.299</td><td>0.591(</td><td></td><td>0.615 0.279</td><td>0.441</td><td>1.327</td><td>0.944</td><td></td><td></td><td></td><td>0.417 0.515 0.828 0.762 0.112 0.245</td></tr><tr><td></td><td>192</td><td>0.273 0.403 0.669</td><td>0.665</td><td>1.183</td><td></td><td>0.912 1.950</td><td>1.048</td><td>1.258</td><td>0.924</td><td></td><td></td><td></td><td>0.813 0.735 0.909 0.974 0.304 0.404</td></tr><tr><td></td><td>336</td><td>0.508 0.539 0.611</td><td>0.605</td><td></td><td>1.367 0.984 2.438</td><td></td><td>1.262</td><td>2.179</td><td>1.296</td><td></td><td></td><td></td><td>1.331 0.962 1.304 0.988 0.736 0.598</td></tr><tr><td></td><td>720</td><td>0.991 0.768 1.111</td><td>0.860</td><td>1.872</td><td></td><td>1.072 2.010</td><td>1.247</td><td>1.280</td><td>0.953</td><td></td><td></td><td>1.894 1.181 3.238 1.566 1.871 0.935</td><td></td></tr></table>
143
+
144
+ # 4.1 Main Results
145
+
146
+ To compare performances under different future horizons, we fix the input length and evaluate models with a wide range of prediction lengths: 96, 192, 336, 720. This setting precisely meets the definition of long-term forecasting. Here are results on both the multivariate and univariate settings.
147
+
148
+ Multivariate results As for the multivariate setting, Autoformer achieves the consistent state-ofthe-art performance in all benchmarks and all prediction length settings (Table 1). Especially, under the input-96-predict-336 setting, compared to previous state-of-the-art results, Autoformer gives $74 \%$ $1 . 3 3 4 { } 0 . 3 3 9 _ { . }$ ) MSE reduction in ETT, $18 \%$ $0 . 2 8 0 { } 0 . 2 3 1$ ) in Electricity, $61 \%$ ( $1 . 3 5 7 { } 0 . 5 0 9 \rangle$ in Exchange, $15 \%$ $( 0 . 7 3 3 { } 0 . 6 2 2 )$ in Traffic and $21 \%$ $( 0 . 4 5 5 { } 0 . 3 5 9 )$ ) in Weather. For the input36-predict-60 setting of ILI, Autoformer makes $43 \%$ $4 . 8 8 2 { } 2 . 7 7 0$ ) MSE reduction. Overall, Autoformer yields a $38 \%$ averaged MSE reduction among above settings. Note that Autoformer still provides remarkable improvements in the Exchange dataset that is without obvious periodicity. See supplementary materials for detailed showcases. Besides, we can also find that the performance of Autoformer changes quite steadily as the prediction length $O$ increases. It means that Autoformer retains better long-term robustness, which is meaningful for real-world practical applications, such as weather early warning and long-term energy consumption planning.
149
+
150
+ Univariate results We list the univariate results of two typical datasets in Table 2. Under the comparison with extensive baselines, our Autoformer still achieves state-of-the-art performance for the long-term forecasting tasks. In particular, for the input-96-predict-336 setting, our model achieves $14 \%$ $0 . 1 8 0 { } 0 . 1 4 5$ MSE reduction on the ETT dataset with obvious periodicity. For the Exchange dataset without obvious periodicity, Autoformer surpasses other baselines by $17 \%$ $( 0 . 6 1 1 { } 0 . 5 0 8 )$ and shows greater long-term forecasting capacity. Also, we find that ARIMA [1] performs best in the input-96-predict-96 setting of the Exchange dataset but fails in the long-term setting. This situation of ARIMA can be benefited from its inherent capacity for non-stationary economic data but is limited by the intricate temporal patterns of real-world series.
151
+
152
+ # 4.2 Ablation studies
153
+
154
+ Table 3: Ablation of decomposition in multivariate ETT with MSE metric. Ours adopts our progressive architecture into other models. Sep employs two models to forecast pre-decomposed seasonal and trend-cyclical components separately. Promotion is the MSE reduction compared to Origin.
155
+
156
+ <table><tr><td rowspan="2">Input-96</td><td colspan="3">Transformer[35]</td><td colspan="3">Informer[41]</td><td colspan="3">LogTrans[17]</td><td colspan="3">Reformer[20]</td><td colspan="2">Promotion</td></tr><tr><td>Predict-O| Origin</td><td>Sep</td><td>Ours</td><td>Origin</td><td>Sep</td><td>Ours</td><td>Origin</td><td>Sep</td><td>Ours</td><td></td><td>Origin Sep</td><td>Ours</td><td>Sep</td><td>Ours</td></tr><tr><td>96</td><td>0.604</td><td>0.311</td><td>0.204</td><td>0.365</td><td>0.490</td><td>0.354</td><td>0.768</td><td>0.862</td><td>0.231</td><td>0.658</td><td>0.445</td><td>0.218</td><td>0.069</td><td>0.347</td></tr><tr><td>192</td><td></td><td>1.060 0.760(</td><td>0.266</td><td>0.533</td><td>0.658</td><td>0.432</td><td>0.989</td><td>0.533</td><td>0.378</td><td>1.078</td><td></td><td>0.510 0.336</td><td></td><td>0.300 0.562</td></tr><tr><td>336</td><td>1.413</td><td>0.665</td><td>0.375</td><td>1.363</td><td>1.469</td><td>0.481</td><td>1.334</td><td>0.762</td><td>0.362</td><td>1.549</td><td>1.028</td><td>0.366</td><td>0.434</td><td>1.019</td></tr><tr><td>720</td><td>2.672</td><td>3.200</td><td>0.537</td><td>3.379</td><td>2.766</td><td>0.822</td><td>3.048</td><td>2.601</td><td>0.539</td><td>2.631</td><td>2.845</td><td>0.502</td><td></td><td>0.079 2.332</td></tr></table>
157
+
158
+ Decomposition architecture With our proposed progressive decomposition architecture, other models can gain consistent promotion, especially as the prediction length $O$ increases (Table 3). This verifies that our method can generalize to other models and release the capacity of other dependencies learning mechanisms, alleviate the distraction caused by intricate patterns. Besides, our architecture outperforms the pre-processing, although the latter employs a bigger model and more parameters. Especially, pre-decomposing may even bring negative effect because it neglects the interaction of components during long-term future, such as Transformer [35] predict-720, Informer [41] predict-336.
159
+
160
+ Auto-Correlation vs. self-attention family As shown in Table 4, our proposed Auto-Correlation achieves the best performance under various input- ${ \mathbf { \nabla } } J$ -predict- $O$ settings, which verifies the effectiveness of series-wise connections comparing to point-wise self-attentions (Figure 3). Furthermore, we can also observe that Auto-Correlation is memory efficiency from the last column of Table 4, which can be used in long sequence forecasting, such as input-336-predict-1440.
161
+
162
+ Table 4: Comparison of Auto-Correlation and self-attention in the multivariate ETT. We replace the Auto-Correlation in Autoformer with different self-attentions. The “-” indicates the out-of-memory.
163
+
164
+ <table><tr><td rowspan="2" colspan="2">Input Length I Prediction Length O</td><td colspan="3">96</td><td colspan="3">192</td><td colspan="3">336</td></tr><tr><td>336</td><td>720</td><td>1440</td><td>336</td><td>720</td><td>1440</td><td>336</td><td>720</td><td>1440</td></tr><tr><td>Auto- Correlation</td><td>MSE MAE</td><td>0.339 0.372</td><td>0.422 0.419</td><td>0.555 0.496</td><td>0.355 0.392</td><td>0.429 0.430</td><td>0.503 0.484</td><td>0.361 0.406</td><td>0.425 0.440</td><td>0.574 0.534</td></tr><tr><td>Full Attention[35]</td><td>MSE MAE</td><td>0.375 0.425</td><td>0.537 0.502</td><td>0.667 0.589</td><td>0.450 0.470</td><td>0.554 0.533</td><td>- -</td><td>0.501 0.485</td><td>0.647 0.491</td><td>1 =</td></tr><tr><td>LogSparse Attention[20]</td><td>MSE MAE</td><td>0.362 0.413</td><td>0.539 0.522</td><td>0.582 0.529</td><td>0.420 0.450</td><td>0.552 0.513</td><td>0.958 0.736</td><td>0.474 0.474</td><td>0.601 0.524</td><td>- =</td></tr><tr><td>LSH Attention[17]</td><td>MSE MAE</td><td>0.366 0.404</td><td>0.502 0.475</td><td>0.663 0.567</td><td>0.407 0.421</td><td>0.636 0.571</td><td>1.069 0.756</td><td>0.442 0.476</td><td>0.615 0.532</td><td>1 -</td></tr><tr><td>ProbSparse Attention[41]</td><td>MSE MAE</td><td>0.481 0.472</td><td>0.822 0.559</td><td>0.715 0.586</td><td>0.404 0.425</td><td>1.148 0.654</td><td>0.732 0.602</td><td>0.417 0.434</td><td>0.631 0.528</td><td>1.133 0.691</td></tr></table>
165
+
166
+ # 4.3 Model Analysis
167
+
168
+ Time series decomposition As shown in Figure 4, without our series decomposition block, the forecasting model cannot capture the increasing trend and peaks of the seasonal part. By adding the series decomposition blocks, Autoformer can aggregate and refine the trend-cyclical part from series progressively. This design also facilitates the learning of the seasonal part, especially the peaks and troughs. This verifies the necessity of our proposed progressive decomposition architecture.
169
+
170
+ ![](images/226af42008cf294d2ad17509100d9847b1a2e1adc1ae3b98a6fc44cc7d5195f9.jpg)
171
+ Figure 4: Visualization of learned seasonal gradually add the decomposition blocks in $\mathcal { X } _ { \mathrm { d e } } ^ { M }$ and trend-cyclical der from left to rig $\mathcal { T } _ { \mathrm { d e } } ^ { M }$ of the last decoder layer. Wehis case is from ETT dataset under input-96-predict-720 setting. For clearness, we add the linear growth to raw data additionally.
172
+
173
+ Dependencies learning The marked time delay sizes in Figure 5(a) indicate the most likely periods. Our learned periodicity can guide the model to aggregate the sub-series from the same or neighbor phase of periods by $\mathrm { R o l l } ( \mathcal { X } , \tau _ { i } )$ , $i \in \{ 1 , \cdots , 6 \}$ . For the last time step (declining stage), AutoCorrelation fully utilizes all similar sub-series without omissions or errors compared to self-attentions. This verifies that Autoformer can discover the relevant information more sufficiently and precisely.
174
+
175
+ Complex seasonality modeling As shown in Figure 6, the lags that Autoformer learns from deep representations can indicate the real seasonality of raw series. For example, the learned lags of the daily recorded Exchange dataset present the monthly, quarterly and yearly periods (Figure 6 (b)). For the hourly recorded Traffic dataset (Figure 6 (c)), the learned lags show the intervals as 24-hours and 168-hours, which match the daily and weekly periods of real-world scenarios. These results show that Autoformer can capture the complex seasonalities of real-world series from deep representations and further provide a human-interpretable prediction.
176
+
177
+ ![](images/1f8ff11071d73f33cde0d525eb867796c34772cd0e34d9f2c2266d99a710dd8f.jpg)
178
+ Figure 5: Visualization of learned dependencies. For clearness, we select the top-6 time delay sizes $\tau _ { 1 } , \cdots , \tau _ { 6 }$ of Auto-Correlation and mark them in raw series (red lines). For self-attentions, top-6 similar points with respect to the last time step (red stars) are also marked by orange points.
179
+
180
+ ![](images/487dd7c7362dd1bad3b32de704db93d0e84eac245cf0c6717299a42cde5d4a6b.jpg)
181
+ Figure 6: Statistics of learned lags. For each time series in the test set, we count the top 10 lags learned by decoder for the input-96-predict-336 task. Figure (a)-(d) are the density histograms.
182
+
183
+ Efficiency analysis We compare the running memory and time among Auto-Correlation-based and self-attention-based models (Figure 7) during the training phase. The proposed Autoformer shows $\mathcal { O } ( L \log L )$ complexity in both memory and time and achieves better long-term sequences efficiency.
184
+
185
+ ![](images/9945f941aa3e41c082433f9479d4023d07440ec79228f1bcc87357764c332377.jpg)
186
+ Figure 7: Efficiency Analysis. For memory, we replace Auto-Correlation with self-attention family in Autoformer and record the memory with input 96. For running time, we run the Auto-Correlation or self-attentions $1 0 ^ { 3 }$ times to get the execution time per step. The output length increases exponentially.
187
+
188
+ # 5 Conclusions
189
+
190
+ This paper studies the long-term forecasting problem of time series, which is a pressing demand for real-world applications. However, the intricate temporal patterns prevent the model from learning reliable dependencies. We propose the Autoformer as a decomposition architecture by embedding the series decomposition block as an inner operator, which can progressively aggregate the longterm trend part from intermediate prediction. Besides, we design an efficient Auto-Correlation mechanism to conduct dependencies discovery and information aggregation at the series level, which contrasts clearly from the previous self-attention family. Autoformer can naturally achieve $\mathcal { O } ( L \log L )$ complexity and yield consistent state-of-the-art performance in extensive real-world datasets.
191
+
192
+ # Acknowledgments and Disclosure of Funding
193
+
194
+ This work was supported by the National Natural Science Foundation of China under Grants 62022050 and 62021002, Beijing Nova Program under Grant Z201100006820041, China’s Ministry of Industry and Information Technology, the MOE Innovation Plan and the BNRist Innovation Fund.
195
+
196
+ # References
197
+
198
+ [1] O. Anderson and M. Kendall. Time-series. 2nd edn. J. R. Stat. Soc. (Series D), 1976. [2] Reza Asadi and Amelia C Regan. A spatio-temporal decomposition based deep neural network for time series forecasting. Appl. Soft Comput., 2020. [3] Shaojie Bai, J Zico Kolter, and Vladlen Koltun. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271, 2018. [4] Anastasia Borovykh, Sander Bohte, and Cornelis W Oosterlee. Conditional time series forecasting with convolutional neural networks. arXiv preprint arXiv:1703.04691, 2017. [5] G. E. P. Box and Gwilym M. Jenkins. Time series analysis, forecasting and control. 1970. [6] George EP Box and Gwilym M Jenkins. Some recent advances in forecasting and control. J. R. Stat. Soc. (Series-C), 1968.
199
+ [7] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020. [8] Chris Chatfield. The analysis of time series: an introduction. 1981. [9] Renyi Chen and Molei Tao. Data-driven prediction of general hamiltonian dynamics via learning exactlysymplectic maps. ICML, 2021.
200
+ [10] Emmanuel de Bézenac, Syama Sundar Rangapuram, Konstantinos Benidis, Michael Bohlke-Schneider, Richard Kurle, Lorenzo Stella, Hilaf Hasson, Patrick Gallinari, and Tim Januschowski. Normalizing kalman filters for multivariate time series analysis. In NeurIPS, 2020.
201
+ [11] J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
202
+ [12] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
203
+ [13] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Comput., 1997.
204
+ [14] Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Ian Simon, Curtis Hawthorne, Noam Shazeer, Andrew M. Dai, Matthew D. Hoffman, Monica Dinculescu, and Douglas Eck. Music transformer. In ICLR, 2019.
205
+ [15] Rob J Hyndman and George Athanasopoulos. Forecasting: principles and practice. 2018.
206
+ [16] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
207
+ [17] Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In ICLR, 2020.
208
+ [18] Richard Kurle, Syama Sundar Rangapuram, Emmanuel de Bézenac, Stephan Günnemann, and Jan Gasthaus. Deep rao-blackwellised particle filters for time series forecasting. In NeurIPS, 2020.
209
+ [19] Guokun Lai, Wei-Cheng Chang, Yiming Yang, and Hanxiao Liu. Modeling long-and short-term temporal patterns with deep neural networks. In SIGIR, 2018.
210
+ [20] Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In NeurIPS, 2019.
211
+ [21] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, 2021.
212
+ [22] Danielle C Maddix, Yuyang Wang, and Alex Smola. Deep factors with gaussian processes for forecasting. arXiv preprint arXiv:1812.00098, 2018.
213
+ [23] Boris N Oreshkin, Dmitri Carpov, Nicolas Chapados, and Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable time series forecasting. ICLR, 2019.
214
+ [24] Athanasios Papoulis and H Saunders. Probability, random variables and stochastic processes. 1989.
215
+ [25] Adam Paszke, S. Gross, Francisco Massa, A. Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Z. Lin, N. Gimelshein, L. Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019.
216
+ [26] Syama Sundar Rangapuram, Matthias W Seeger, Jan Gasthaus, Lorenzo Stella, Yuyang Wang, and Tim Januschowski. Deep state space models for time series forecasting. In NeurIPS, 2018.
217
+ [27] Cleveland Robert, C William, and Terpenning Irma. STL: A seasonal-trend decomposition procedure based on loess. J. Off. Stat, 1990.
218
+ [28] David Salinas, Valentin Flunkert, Jan Gasthaus, and Tim Januschowski. DeepAR: Probabilistic forecasting with autoregressive recurrent networks. Int. J. Forecast., 2020.
219
+ [29] Rajat Sen, Hsiang-Fu Yu, and Inderjit S. Dhillon. Think globally, act locally: A deep neural network approach to high-dimensional time series forecasting. In NeurIPS, 2019.
220
+ [30] Shun-Yao Shih, Fan-Keng Sun, and Hung-yi Lee. Temporal pattern attention for multivariate time series forecasting. Mach. Learn., 2019.
221
+ [31] Huan Song, Deepta Rajan, Jayaraman Thiagarajan, and Andreas Spanias. Attend and diagnose: Clinical time series analysis using attention models. In AAAI, 2018.
222
+ [32] Antti Sorjamaa, Jin Hao, Nima Reyhani, Yongnan Ji, and Amaury Lendasse. Methodology for long-term prediction of time series. Neurocomputing, 2007.
223
+ [33] Sean J Taylor and Benjamin Letham. Forecasting at scale. Am. Stat., 2018.
224
+ [34] Aäron van den Oord, S. Dieleman, H. Zen, K. Simonyan, Oriol Vinyals, A. Graves, Nal Kalchbrenner, A. Senior, and K. Kavukcuoglu. Wavenet: A generative model for raw audio. In SSW, 2016.
225
+ [35] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
226
+ [36] Ruofeng Wen, Kari Torkkola, Balakrishnan Narayanaswamy, and Dhruv Madeka. A multi-horizon quantile recurrent forecaster. NeurIPS, 2017.
227
+ [37] Norbert Wiener. Generalized harmonic analysis. Acta Math, 1930.
228
+ [38] Sifan Wu, Xi Xiao, Qianggang Ding, Peilin Zhao, Ying Wei, and Junzhou Huang. Adversarial sparse transformer for time series forecasting. In NeurIPS, 2020.
229
+ [39] Q. Yao, D. Song, H. Chen, C. Wei, and G. W. Cottrell. A dual-stage attention-based recurrent neural network for time series prediction. In IJCAI, 2017.
230
+ [40] Rose Yu, Stephan Zheng, Anima Anandkumar, and Yisong Yue. Long-term forecasting using tensor-train rnns. arXiv preprint arXiv:1711.00073, 2017.
231
+ [41] Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In AAAI, 2021.
md/train/JHcqXGaqiGn/JHcqXGaqiGn.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/K9uApq7iyyI/K9uApq7iyyI.md ADDED
@@ -0,0 +1,500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ResMLP: Feedforward networks for image classification with data-efficient training
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ We present ResMLP, an architecture built entirely upon multi-layer perceptrons for image classification. It is a simple residual network that alternates (i) a linear layer in which image patches interact, independently and identically across channels, and (ii) a two-layer feed-forward network in which channels interact independently per patch. When trained with a modern training strategy using heavy data-augmentation and optionally distillation, it attains surprisingly good accuracy/complexity tradeoffs on ImageNet. We also train ResMLP models in a self-supervised setup, to further remove priors from employing a labelled dataset. Finally, by adapting our model to machine translation we achieve surprisingly good results.
11
+
12
+ We will share our code based on the Timm library and pre-trained models.
13
+
14
+ # 11 1 Introduction
15
+
16
+ 12 Recently, the transformer architecture [60], adapted from its original use in natural language pro
17
+ 13 cessing with only minor changes, has achieved performance competitive with the state of the art on
18
+ 14 ImageNet-1k [50] when pre-trained with a sufficiently large amount of data [16]. Retrospectively,
19
+ 15 this achievement is yet another step towards less priors: convolutional neural networks had removed
20
+ 16 a lot of hand-made choices compared to hand-designed pre-CNN approaches, moving the paradigm
21
+ 17 of hard-wired features to hand-designed architectural choices. Vision transformers avoid making
22
+ 18 assumptions inherent to convolutional architectures and noticeably the translation invariance.
23
+ 19 What these recent transformer-based works suggest is that longer training schedules, more parameters,
24
+ 20 more data [16] and/or more regularization [56], are sufficient to recover the important priors for tasks
25
+ 21 as complex as ImageNet classification. See also our discussion of related work in Section 4. This
26
+ 22 concurs with recent studies [2, 15] that better disentangle the benefits from the architectures from
27
+ 23 those of the training scheme.
28
+ 24 In this paper, we push this trend further, and propose Residual Multi-Layer Perceptrons (ResMLP):
29
+ 25 a purely multi-layer perceptron (MLP) based architecture for image classification. We outline our
30
+ 26 architecture in Figure 1 and detail it further in Section 2. It is intended to be simple: it takes image
31
+ 27 patches as input, projects them with a linear layer, and sequentially updates them in turn with two
32
+ 28 residual operations: (i) a simple linear layer that provides interaction between the patches, which
33
+ 29 is applied to all channels independently; and (ii) an MLP with a single hidden layer, which is
34
+ 30 independently applied to all patches. At the end of the network, the patches are average pooled, and
35
+ 31 fed to a linear classifier.
36
+ 32 This architecture is strongly inspired by the vision transformers (ViT) [16], yet it is much simpler
37
+ 33 in several ways: we do not use any form of attention, only linear layers along with the GELU
38
+ 34 non-linearity [25]. Since our architecture is much more stable to train than transformers, we do not
39
+ 35 need batch-specific or cross-channel normalizations such as BatchNorm, GroupNorm or LayerNorm.
40
+ 36 Our training procedure mostly follows the one initially introduced for DeiT [56] and CaiT [57].
41
+ 37 Due to its linear nature, the patch interactions in our model can be easily visualised and interpreted.
42
+ 38 While the interaction pattern learned in the first layer is very similar to a small convolutional filter,
43
+ 39 we observe more subtle interactions across patches in deeper layers. These include some form of
44
+ 40 axial filters, and long-range interactions early in the network.
45
+
46
+ ![](images/abb017542f27a5fed6ae93c2da8dd9eea31072f0baaa1cd9b7e27ffed8ccf434.jpg)
47
+ Figure 1: The ResMLP architecture: After linearly projecting the image patches, our network alternately processes them by (1) a communication layer between vectors implemented as a linear layer; (2) a two-layer residual perceptron. We denote by A the Affine element-wise transformation, and by T the transposition.
48
+
49
+ 41 In summary, in this paper, we show that
50
+
51
+ • despite their simplicity, Residual Multi-Layer Perceptrons reach surprisingly good accuracy/complexity trade-offs with ImageNet-1k training only1, without requiring normalization based on batch or channel statistics;
52
+
53
+ • these models benefit significantly from distillation methods [56]; they are also compatible with modern self-supervised learning methods based on data augmentation, such as DINO [6];
54
+
55
+ • thank to its design where patch embeddings simply “communicate” through a linear layer, we can make observations on the spatial interaction that the network learns across layers;
56
+
57
+ • we adapt ResMLP to machine translation, and again obtain surprisingly good results.
58
+
59
+ # 50 2 Method
60
+
61
+ 51 Our model, depicted in Figure 1, is inspired by the ViT model, from which we adopt the columnar
62
+ 52 structure with fixed-resolution feature maps. We proceed two drastic simplifications. We refer the
63
+ 53 reader to Dosovitskiy et al. [16] for more details about the ViT architecture.
64
+ 54 The overall ResMLP architecture. Our model, denoted by ResMLP, takes a grid of $N \times N$ non
65
+ 55 overlapping patches as input, where the patch size is typically equal to $1 6 \times 1 6$ . The patches are then
66
+ 56 independently passed through a linear layer to form a set of $\overline { { N ^ { 2 } d } }$ -dimensional embeddings.
67
+ 57 The resulting set of $N ^ { 2 }$ embeddings are fed to a sequence of Residual Multi-Layer Perceptron layers
68
+ 58 to produce a set of $N ^ { 2 } d .$ -dimensional output embeddings. These output embeddings are then averaged
69
+ 59 as a $d$ -dimension vector to represent the image, which is fed to a linear classifier to predict the label
70
+ 60 associated with the image. Training uses the cross-entropy loss.
71
+ 61 The Residual Multi-Perceptron Layer. Our network is a sequence of layers that all have the same
72
+ 62 structure: a linear sublayer followed by a feedforward sublayer. Similar to the Transformer layer,
73
+ 63 each sublayer is paralleled with a skip-connection [23]. We do not apply Layer Normalization [1]
74
+ 64 because training is stable without it when using the following Affine transformation:
75
+
76
+ $$
77
+ \begin{array} { r } { \mathbb { A } \mathbb { f } \mathbb { f } _ { \alpha , \beta } ( \mathbf { x } ) = \mathbb { D } \mathrm { i } \mathtt { a } \mathbb { g } ( \pmb { \alpha } ) \mathbf { x } + \beta , } \end{array}
78
+ $$
79
+
80
+ 65 where $_ { \pmb { \alpha } }$ and $\beta$ are learnable weight vectors. This operation simply rescales and shifts the input
81
+ 66 element-wise. Moreover, it has no cost at inference time, as it can absorbed in the adjacent linear
82
+ 67 layer. Note, when writing $\operatorname { \mathbb { A } f f } ( \mathbf { X } )$ the operation is applied independently to each column of $\mathbf { X }$ .
83
+ 68 While similar to BatchNorm [30] and Layer Normalization [1], the Aff operator does not depend on
84
+ 69 any batch statistics. Therefore, it is closer to the recent LayerScale method [57], which improves the
85
+ 70 optimization of deep transformers when initializing $_ { \pmb { \alpha } }$ to a small value. Note, LayerScale does not
86
+ 71 have a bias term.
87
+ 72 We apply this transformation twice for each residual block. As as a pre-normalization Aff replaces
88
+ 73 the LayerNormalization, and avoids using channel-wise statistics. Here, we initialize $\alpha = 1$ , and
89
+ 74 $\beta = { \bf 0 }$ . As a post-processing of the residual block, Aff implements LayerScale and therefore we
90
+ 75 follow the same small value initialization for $_ { \pmb { \alpha } }$ as in [57] for the post-normalization.
91
+ 76 Finally, we follow the same structure for the feedforward sublayer as in the Transformer; we only
92
+ 77 replace the ReLU non-linearity by a GELU function [25].
93
+ 78 Overall, our Multi-layer perceptron takes a set of $N ^ { 2 } \ d .$ -dimensional input features stacked in a
94
+ 79 $d \times N ^ { 2 }$ matrix $\mathbf { X }$ , and outputs a set of $N ^ { 2 }$ $d$ -dimension output features, stacked in a matrix $\mathbf { Y }$ with
95
+ 80 the following set of transformations:
96
+
97
+ $$
98
+ \begin{array} { r c l } { \mathbf { Z } } & { = } & { \mathbf { X } + \mathbb { A } \mathbb { f } \mathbb { f } \left( \left( \mathbf { A } \mathbb { A } \mathbb { f } \mathbb { f } \left( \mathbf { X } \right) ^ { \top } \right) ^ { \top } \right) , } \\ { \mathbf { Y } } & { = } & { \mathbf { Z } + \mathbb { A } \mathbb { f } \mathbb { f } \left( \mathbf { C } \mathbb { G } \mathbb { E } \mathbb { L } \mathbb { U } \left( \mathbf { B } \mathbb { A } \mathbb { f } \mathbb { f } \left( \mathbf { Z } \right) \right) \right) , } \end{array}
99
+ $$
100
+
101
+ 81 where A, $\mathbf { B }$ and $\mathbf { C }$ are the main learnable weight matrices of the layer. The dimensions of the
102
+ 82 parameter matrix $\mathbf { A }$ are $N ^ { 2 } \times N ^ { 2 }$ , i.e., this sublayer exchanges information across all the locations,
103
+ 83 while the feedforward sublayer works per location. As a consequence, the intermediate activation
104
+ 84 matrix $\mathbf { Z }$ has the same dimensions as the matrices $\mathbf { X }$ and $\mathbf { Y }$ . Finally, the weight matrices $\mathbf { B }$ and $\mathbf { C }$
105
+ 85 have the same dimensions as in a Transformer layer, which are $4 d { \times } d$ and $d \times 4 d$ , respectively.
106
+ 86 The main difference compared to a Transformer layer is that we replace the self-attention by the
107
+ 87 linear interaction defined in Eq. (2). While self-attention computes a convex combination of other
108
+ 88 features with coefficients that are data dependent, the linear interaction layer in Eq. (2) computes
109
+ 89 a general linear combination using learned coefficients that are not data dependent. As compared
110
+ 90 to a convolutional layers which have local support and share weights across space, our linear
111
+ 91 patch interaction layer offers a global support and does not share weights, moreover it is applied
112
+ 92 independently across channels.
113
+ 93 Relationship to the Vision Transformer. Our model can be regarded as a drastic simplification of
114
+ 94 the ViT model by Dosovitskiy et al. [16]. We depart from this model as follows:
115
+
116
+ • We do not include any self-attention block. Instead we have a linear patch interaction layer without any non-linearity.
117
+
118
+ • We do not have the extra “class” token that is typically used in these models to aggregate information via attention. Instead, we simply use average pooling. We do, however, also consider a specific aggregation layer as a variant, which we describe in the next paragraph.
119
+
120
+ • We do not include any form of positional embedding: the linear communication module between patches implicitly takes into account the patch position.
121
+
122
+ • Instead of pre-LayerNormalization, we use a simple learnable affine transform, thus avoiding any form of batch and channel-wise statistics.
123
+
124
+ 104 Class-MLP. As an alternative to average pooling, we also experimented with an adaptation of the
125
+ 105 class-attention introduced in CaiT [57]. In CaiT, this consists of two layers that have the same
126
+ 106 structure as the transformer, but in which only the class token is updated based on the frozen patch
127
+ 107 embeddings. We translate this method to our architecture, except that, after aggregating the patches
128
+ 108 with a linear layer, we replace the attention-based interaction between the class and patch embeddings
129
+ 109 by simple linear layers, still keeping the patch embeddings frozen. This increases the performance, at
130
+ 110 the expense of adding some parameters and computational cost. We refer to this pooling variant as
131
+ 111 “class-MLP”, since the purpose of these few layers is to replace average pooling.
132
+
133
+ # 112 3 Experiments
134
+
135
+ 113 In this section, we present experimental results for our ResMLP architecture for image classification.
136
+ 114 We also study the impact of the different components in a series of ablations. We consider three
137
+ 115 training paradigms in our experiments:
138
+ 6 • Supervised learning: We train ResMLP from labeled images with a softmax classifier and cross
139
+ 7 entropy loss. This paradigm is the main focus of our work.
140
+
141
+ Table 1: Comparison between architectures on ImageNet classification. We compare different architectures based on convolutional networks, Transformers and feedforward networks with comparable FLOPs and number of parameters. We report Top-1 accuracy on the validation set of ImageNet-1k with different measure of complexity: throughput, FLOPs, number of parameters and peak memory usage. All the models use $2 2 4 \times 2 2 4$ images as input. By default the Transformers and feedforward networks uses $1 4 \times 1 4$ patches of size $1 6 \times 1 6$ , see Table 3 for the detailed specification of our main models. The throughput is measured on a single V100-32GB GPU with batch size fixed to 32. For reference, we include the state of the art with ImageNet training only.
142
+
143
+ <table><tr><td></td><td>Arch.</td><td>#params (x106)</td><td>throughput (im/s)</td><td>FLOPS (x109)</td><td>Peak Mem (MB)</td><td>Top-1 Acc.</td></tr><tr><td rowspan="2">State of the art</td><td>CaiT-M48↑448Y [57]</td><td>356</td><td>5.4</td><td>329.6</td><td>5477.8</td><td>86.5</td></tr><tr><td>NfNet-F6 SAM [5]</td><td>438</td><td>16.0</td><td>377.3</td><td>5519.3</td><td>86.5</td></tr><tr><td rowspan="6">Convolutional networks</td><td>EfficientNet-B3 [53]</td><td>12</td><td>661.8</td><td>1.8</td><td>1174.0</td><td>81.1</td></tr><tr><td>EfficientNet-B4 [53]</td><td>19</td><td>349.4</td><td>4.2</td><td>1898.9</td><td>82.6</td></tr><tr><td>EfficientNet-B5 [53]</td><td>30</td><td>169.1</td><td>9.9</td><td>2734.9</td><td>83.3</td></tr><tr><td>RegNetY-4GF[47]</td><td>21</td><td>861.0</td><td>4.0</td><td>568.4</td><td>80.0</td></tr><tr><td>RegNetY-8GF[47]</td><td>39</td><td>534.4</td><td>8.0</td><td>841.6</td><td>81.7</td></tr><tr><td>RegNetY-16GF[47]</td><td>84</td><td>334.7</td><td>16.0</td><td>1329.6</td><td>82.9</td></tr><tr><td rowspan="3">Transformer networks</td><td>DeiT-S [56]</td><td>22</td><td>940.4</td><td>4.6</td><td>217.2</td><td>79.8</td></tr><tr><td>DeiT-B [56]</td><td>86</td><td>292.3</td><td>17.5</td><td>573.7</td><td>81.8</td></tr><tr><td>CaiT-XS24 [57]</td><td>27</td><td>447.6</td><td>5.4</td><td>245.5</td><td>81.8</td></tr><tr><td rowspan="3">Feedforward networks</td><td>ResMLP-S12</td><td>15</td><td>1415.1</td><td>3.0</td><td>179.5</td><td>76.6</td></tr><tr><td>ResMLP-S24</td><td>30</td><td>715.4</td><td>6.0</td><td>235.3</td><td>79.4</td></tr><tr><td>ResMLP-B24</td><td>116</td><td>231.3</td><td>23.0</td><td>663.0</td><td>81.0</td></tr></table>
144
+
145
+ • Self-supervised learning: We train the ResMLP architecture without labels. We consider the DINO method of Caron et al. [6] that trains a network by distilling knowledge from previous instances of the same network, leading to a form of self-distillation without labels.
146
+
147
+ • Knowledge distillation: We employ the knowledge distillation procedure proposed by Touvron et al. [56] to guide the supervised training of ResMLP with a convnet.
148
+
149
+ # 123 3.1 Experimental setting
150
+
151
+ Datasets. We train our models on the ImageNet-1k dataset [50], that contains 1.2M images evenly spread over 1,000 object categories. In the absence of an available test set for this benchmark, we follow the standard practice in the community by reporting performance on the validation set. This is not ideal since the validation set was originally designed to select hyper-parameters. Comparing methods on this set may not be conclusive enough because an improvement in performance may not be caused by better modeling, but by a better selection of hyper-parameters. To mitigate this risk, we report additional results in transfer learning and on two alternative versions of ImageNet that have been built to have distinct validation and test sets, namely the ImageNet-real [3] and ImageNet-v2 [49] datasets. We also report a few data-points when training on ImageNet-21k. Our hyper-parameters are mostly adopted from Touvron et al. [56, 57].
152
+
153
+ 134 Hyper-parameter settings. In the case of supervised learning, we train our network with the Lamb
154
+ 135 optimizer [63] with a learning rate of $5 \times 1 0 ^ { - 3 }$ and weight decay 0.2. We initialize the LayerScale
155
+ 136 parameters as a function of the depth by following CaiT [57]. The rest of the hyper-parameters follow
156
+ 137 the default setting used in DeiT [56]. For the knowledge distillation paradigm, we use the same
157
+ 138 RegNety-16GF [48] as in DeiT with the same training schedule. The majority of our models take two
158
+ 139 days to train on eight V100-32GB GPUs.
159
+
160
+ # 3.2 Main Results
161
+
162
+ In this section, we compare our architecture to models with more conventional network architectures of comparable size and throughput on ImageNet.
163
+
164
+ 43 Comparison with Transformers and convnets in a supervised setting. In Table 1, we compare
165
+ 44 ResMLP with different convolutional and Transformer architectures. For completeness, we report
166
+ 145 the best-published numbers obtained with a model trained on ImageNet alone. As expected, in
167
+ 146 terms of the trade-off between accuracy, FLOPs, and throughput, ResMLP is not as efficient as
168
+ 147 convolutional networks or Transformers. However, their accuracy is encouraging: we compare them
169
+ 148 with architectures that have benefited from years of research and careful optimization towards these
170
+ 149 trade-offs. Overall, our results suggest that the structural constraints imposed by the layer design do
171
+ 150 not have a drastic influence on performance, especially when training models with enough data and
172
+ 151 recent advances in training and regularization.
173
+ 152 Self-supervised pre-training of ResMLP. We explore the possibility of training ResMLP using
174
+ 153 DINO, a recent self-supervised learning approach [6]. We pre-train ResMLP-S12 models with this
175
+ 154 approach during 300 epochs. We report our results in Table 2. As expected given the supervised
176
+ 155 classification results, the accuracies obtained with ResMLP are less good than with ViT. Nevertheless,
177
+ 156 the performance is surprisingly high for a pure MLP architecture and competitive with Convnet in
178
+ 157 knn evaluation. We hope that these result will serve as a baseline for future work.
179
+ 158 After self-supervised pre-training, we also fine-tune the network on ImageNet using ground truth
180
+ 159 labels. This pre-training substantially improves the accuracy, when comparing with the same model
181
+ 160 ResMLP-S24 solely trained with labels (top-1 acc. of $7 9 . 9 \%$ on ImageNet-val instead of $7 9 . 4 \%$ for
182
+ 161 ResMLP-S24, with the same total number of epochs). Results on ImageNet-v2 suggest that it reduces
183
+ 162 overfitting $6 8 . 6 \%$ on ImageNet-v2, vs $6 7 . 9 \%$ with supervised training only).
184
+ 163 Improving models with knowledge distillation. We study our model when training following the
185
+ 164 knowledge distillation approach of Touvron et al. [56]. In their work, the authors show the impact of
186
+ 165 training a ViT model by distilling it from a RegNet. In this experiment, we explore if ResMLP also
187
+ 166 benefits from this procedure and summarize our results in Table 3 (Blocks “Baseline models” and
188
+ 167 “Training”). We observe that similar to DeiT models, ResMLP greatly benefits from distilling from a
189
+ 168 convnet. This result concurs with the observations made by d’Ascoli et al. [13], who used convnets
190
+ 169 to initialize feedforward networks. Even though our setting differs from theirs in scale, the problem
191
+ 170 of overfitting for feedforward networks is still present on ImageNet. The additional regularization
192
+ 171 obtained from the distillation is a possible explanation for this improvement.
193
+ 172 Visualisation. Because they are linear, our patch interaction layers from Eq. (2) are easily inter
194
+ 173 pretable. In Figure 2 we visualise the rows of the interaction matrices A as $N \times N$ images, for our
195
+ 174 ResMLP-S24 model. The early layers show convolution-like patterns: the learned weights resemble
196
+ 175 shifted versions of each other and have local support. Interestingly, in many layers, the support also
197
+ 176 extends along both axes, most prominently seen in layer seven. The last seven layers of the network
198
+ 177 are different: they consist of a spike for the patch itself and a diffuse response across other patches
199
+ 178 with larger or smaller magnitude; see layer 20.
200
+
201
+ Table 2: Self-supervised learning with DINO [6]. Classification accuracy on ImageNet-1k val. ResMLPs evaluated with linear and $k$ -NN evaluation on ImageNet are comparable to convnets but inferior to ViT.
202
+
203
+ <table><tr><td>Models</td><td>ResNet-50</td><td>ViT-S/16</td><td>ViT-S/8</td><td>ViT-B/16</td><td>ResMLP-S12</td><td>ResMLP-S24</td></tr><tr><td>Params. (×106)</td><td>25</td><td>22</td><td>22</td><td>87</td><td>15</td><td>30</td></tr><tr><td>FLOPS (×109)</td><td>4.1</td><td>4.6</td><td>22.4</td><td>17.5</td><td>3.0</td><td>6.0</td></tr><tr><td>Linear</td><td>75.3</td><td>77.0</td><td>79.7</td><td>78.2</td><td>67.5</td><td>72.8</td></tr><tr><td>k-NN</td><td>67.5</td><td>74.5</td><td>78.3</td><td>76.1</td><td>62.6</td><td>69.4</td></tr></table>
204
+
205
+ # 179 3.3 Visualization & analysis of the linear interaction between patches
206
+
207
+ 180 Measuring sparsity of the weights. The visualizations described above suggest that the linear
208
+ 181 communication layers are sparse. We analyze this quantitatively in more detail in Figure 3. We
209
+ 182 measure the sparsity of the matrix A, and compare it to the sparsity of $\mathbf { B }$ and $\mathbf { C }$ from the per-patch
210
+ 183 MLP. Since there are no exact zeros, we measure the rate of components whose absolute value is
211
+ 184 lower than $5 \%$ of the maximum value. Note, discarding the small values is analogous to the case
212
+ 185 where we normalize the matrix by its maximum and use a finite-precision representation of weights.
213
+ 186 For instance, with a 4-bits representation of weight, one would typically round to zero all weights
214
+ 187 whose absolute value is below $6 . 2 5 \%$ of the maximum value.
215
+ 188 The measurements in Figure 3 show that all three matrices are sparse, with the layers implementing
216
+ 189 the patch communication being significantly more so. This suggests that they may be compatible with
217
+ 190 parameter pruning, or better, with modern quantization techniques that induce sparsity at training
218
+ 191 time, such as Quant-Noise [20] and DiffQ [19]. The sparsity structure, in particular in earlier layers,
219
+ 192 see Figure. 2, hints that we could implement the patch interaction linear layer with a convolution. We
220
+ 193 provide some results for convolutional variants in our ablation study. Further research on network
221
+ 194 compression is beyond the scope of this paper, yet we believe it worth investigating in the future.
222
+ 195 Communication across patches if we remove the linear interaction layer (linear none), we
223
+ 196 obtain substantially lower accuracy ( $- 2 0 \%$ top-1 acc.) for a “bag-of-patches” approach. We have tried
224
+ 197 several alternatives for the linear patch interaction layer, which are presented in Table 3 (block “patch
225
+ 198 communication”). Amongst them, using the same MLP structure as for patch processing (linear
226
+ 199 MLP), which we analyze in more details in the supplementary material. The simpler choice of a
227
+ 200 single linear square layer led to a better accuracy/performance trade-off – considering that the MLP
228
+ 201 variant requires compute halfway between ResMLP-S12 and ResMLP-S24 – and requires fewer
229
+ 202 parameters than a residual MLP block.
230
+ 203 The visualization in Figure 2 indicates that many linear interaction layers look like convolutions. In
231
+ 204 our ablation, we replaced the linear layer with different types of $3 \times 3$ convolutions. The depth-wise
232
+ 205 convolution does not implement interaction across channels – as our linear patch communication
233
+ 206 layer – and yields similar performance at a comparable number of parameters and FLOPs. While
234
+ 207 full $3 \times 3$ convolutions yield best results, they come with roughly double the number of parameters
235
+
236
+ ![](images/1a5c45d9a0efc551807e3e5b32b664add8eacee830756aaeaa0f33c734b6d1d1.jpg)
237
+ Figure 2: Visualisation of the linear layers in ResMLP-S24. For each layer we visualise the rows of the matrix A as a set of $1 4 \times 1 4$ pixel images, for sake of space we only show the rows corresponding to the $6 \times 6$ central patches. We observe patterns in the linear layers that share similarities with convolutions. In appendix B we provide comparable visualizations for all layers of a ResMLP-S12 model.
238
+
239
+ ![](images/b5f35749759ac14eaf9aeb24d25e43c14d1a40bfe0b0669024fbc8482b3a3fe3.jpg)
240
+ Figure 3: Sparsity of linear interaction layers. For each layer (linear and MLP), we show the rate of components whose absolute value is lower than $5 \%$ of the maximum. Linear interaction layers are sparser than the matrices involved in the per-patch MLP.
241
+
242
+ ![](images/60d9f8bbf12c5cd094917c6d04868c6e5af73178211cc8057c5716ff70c22b03.jpg)
243
+ Figure 4: Top-1 accuracy on ImageNet-V2 vs. ImageNet-val. ResMLPs tend to overfit slightly more under identical training method. This is partially alleviated with by introducing more regularization (more data or distillation, see e.g., ResMLP-B24/8-distil).
244
+
245
+ Table 3: Ablation. Our default configurations are presented in the three first rows. By default we train during 400 epochs. The “old-fashioned” is similar to what was employed for ResNet [23]: SGD, 90-epochs waterfall schedule, same augmentations up to variations due to library used.
246
+
247
+ <table><tr><td rowspan="2">Ablation</td><td rowspan="2">Model</td><td rowspan="2">Patch size</td><td rowspan="2">Params ×106</td><td rowspan="2">FLOPs ×109</td><td rowspan="2">Variant</td><td colspan="3">top-1 acc.on ImageNet</td></tr><tr><td>val</td><td>real[3]</td><td>v2 [49]</td></tr><tr><td rowspan="3">Baseline models</td><td>ResMLP-S12</td><td>16</td><td>15.4</td><td>3.0</td><td>12 layers, working dimension 384</td><td>76.6</td><td>83.3</td><td>64.4</td></tr><tr><td>ResMLP-S24</td><td>16</td><td>30.0</td><td>6.0</td><td>24 layers, working dimension 384</td><td>79.4</td><td>85.3</td><td>67.9</td></tr><tr><td>ResMLP-B24</td><td>16</td><td>115.7</td><td>23.0</td><td>24 layers, working dimension 768</td><td>81.0</td><td>86.1</td><td>69.0</td></tr><tr><td>Normalization</td><td>ResMLP-S12</td><td>16</td><td>15.4</td><td>3.0</td><td>Aff →Layernorm</td><td>77.7</td><td>84.1</td><td>65.7</td></tr><tr><td>Pooling</td><td>ResMLP-S12</td><td>16</td><td>17.7</td><td>3.0</td><td>average pooling →Class-MLP</td><td>77.5</td><td>84.0</td><td>66.1</td></tr><tr><td rowspan="5">Patch communication</td><td>ResMLP-S12</td><td>16</td><td>14.9</td><td>2.8</td><td>linear→ none</td><td>56.5</td><td>63.4</td><td>43.1</td></tr><tr><td>ResMLP-S12</td><td>16</td><td>18.6</td><td>4.3</td><td>linear→MLP</td><td>77.3</td><td>84.0</td><td>65.7</td></tr><tr><td>ResMLP-S12</td><td>16</td><td>30.8</td><td>6.0</td><td>linear → conv 3x3</td><td>77.3</td><td>84.4</td><td>65.7</td></tr><tr><td>ResMLP-S12</td><td>16</td><td>14.9</td><td>2.8</td><td>linear →conv 3x3 depth-wise</td><td>76.3</td><td>83.4</td><td>64.6</td></tr><tr><td>ResMLP-S12</td><td>16</td><td>16.7</td><td>3.2</td><td>linear→conv 3x3 depth-separable</td><td>77.0</td><td>84.0</td><td>65.5</td></tr><tr><td rowspan="3">Patch size</td><td>ResMLP-S12/14</td><td>14</td><td>15.6</td><td>4.0</td><td>patch size 16×16-→14×14</td><td>76.9</td><td>83.7</td><td>65.0</td></tr><tr><td>ResMLP-S12/8</td><td>8</td><td>22.1</td><td>14.0</td><td>patch size 16×16-8×8</td><td>79.1</td><td>85.2</td><td>67.2</td></tr><tr><td>ResMLP-B24/8</td><td>8</td><td>129.1</td><td>100.2</td><td> patch size 16×16-&gt;8 ×8</td><td>81.0</td><td>85.7</td><td>68.6</td></tr><tr><td rowspan="7">Training</td><td>ResMLP-S12</td><td>16</td><td>15.4</td><td>3.0</td><td>old-fashioned (90 epochs)</td><td>69.2</td><td>76.0</td><td>56.1</td></tr><tr><td>ResMLP-S12</td><td>16</td><td>15.4</td><td>3.0</td><td>pre-trained SSL (DINO)</td><td>76.5</td><td>83.6</td><td>64.5</td></tr><tr><td>ResMLP-S12</td><td>16</td><td>15.4</td><td>3.0</td><td>distillation</td><td>77.8</td><td>84.6</td><td>66.0</td></tr><tr><td>ResMLP-S24</td><td>16</td><td>30.0</td><td>6.0</td><td> pre-trained SSL (DINO)</td><td>79.9</td><td>85.9</td><td>68.6</td></tr><tr><td>ResMLP-S24</td><td>16</td><td>30.0</td><td>6.0</td><td>distillation</td><td>80.8</td><td>86.6</td><td>69.8</td></tr><tr><td>ResMLP-B24/8</td><td>8</td><td>129.1</td><td>100.2</td><td>distillation</td><td>83.6</td><td>88.4</td><td>73.4</td></tr><tr><td>ResMLP-B24/8</td><td>8</td><td>129.1</td><td>100.2</td><td>pre-trained ImageNet-21k (60 epochs)</td><td>84.4</td><td>88.9</td><td>74.2</td></tr></table>
248
+
249
+ and FLOPs. Interestingly, the depth-separable convolutions combine accuracy close to that of full $3 \times 3$ convolutions with a number of parameters and FLOPs comparable to our linear layer. This suggests that convolutions on low-resolution feature maps at all layers is an interesting alternative to the common pyramidal design of convnets, where early layers operate at higher resolution and smaller feature dimension.
250
+
251
+ # 3.4 Ablation studies
252
+
253
+ Table 3 reports the ablation study of our base network and a summary of our preliminary exploratory studies. We discuss the ablation below and give more detail about early experiments in Appendix A.
254
+
255
+ Control of overfitting. Since MLPs are subject to overfitting, we show in Fig. 4 a control experiment to probe for problems with generalization. We explicitly analyze the differential of performance between the ImageNet-val and the distinct ImageNet-V2 test set. The relative offsets between curves reflect to which extent models are overfitted to ImageNet-val w.r.t. hyper-parameter selection. The degree of overfitting of our MLP-based model is overall neutral or slightly higher to that of other transformer-based architectures or convnets with same training procedure.
256
+
257
+ Normalization & activation. Our network configuration does not contain any batch normalizations. Instead, we use the affine per-channel transform Aff. This is akin to Layer Normalization [1], typically used in transformers, except that we avoid to collect any sort of statistics, since we do no need it it for convergence. In preliminary experiments with pre-norm and post-norm [24], we observed that both choices converged. Pre-normalization in conjunction with Batch Normalization could provide an accuracy gain in some cases, see Appendix A.
258
+
259
+ We choose to use a GELU [25] function. In Appendix A we also analyze the activation function: ReLU [22] also gives a good performance, but it was a bit more unstable in some settings. We did not manage to get good results with SiLU [25] and HardSwish [28].
260
+
261
+ Pooling. Replacing average pooling with Class-MLP, see Section 2, brings a significant gain for a negligible computational cost. We do not include it by default to keep our models more simple.
262
+
263
+ Patch size. Smaller patches significantly increase the performance, but also increase the number of flops (see Block "Patch size" in Table 3). Smaller patches benefit more to larger models, but only with an improved optimization scheme involving more regularization (distillation) or more data.
264
+
265
+ 6 Training. Consider the Block “Training’ in Table 3. ResMLP significantly benefits from modern training procedures such as those used in DeiT. For instance, the DeiT training procedure improves
266
+
267
+ <table><tr><td>Architecture</td><td>FLOPs</td><td>Res.</td><td>CIFAR10</td><td>CIFAR100</td><td>Flowers102</td><td>Cars</td><td>iNat18</td><td>iNat19</td></tr><tr><td>EfficientNet-B7 [53]</td><td>37.0B</td><td>600</td><td>98.9</td><td>91.7</td><td>98.8</td><td>94.7</td><td>1</td><td>1</td></tr><tr><td>ViT-B/16 [16]</td><td>55.5B</td><td>384</td><td>98.1</td><td>87.1</td><td>89.5</td><td>1</td><td>1</td><td>1</td></tr><tr><td>ViT-L/16 [16]</td><td>190.7B</td><td>384</td><td>97.9</td><td>86.4</td><td>89.7</td><td></td><td></td><td></td></tr><tr><td>Deit-B/16 [56]</td><td>17.5B</td><td>224</td><td>99.1</td><td>90.8</td><td>98.4</td><td>92.1</td><td>73.2</td><td>77.7</td></tr><tr><td>ResNet50 [58]</td><td>4.1B</td><td>224</td><td>1</td><td>1</td><td>96.2</td><td>90.0</td><td>68.4</td><td>73.7</td></tr><tr><td>Grafit/ResNet50 [58]</td><td>4.1B</td><td>224</td><td>1</td><td>1</td><td>97.6</td><td>92.7</td><td>68.5</td><td>74.6</td></tr><tr><td>ResMLP-S12</td><td>3.0B</td><td>224</td><td>98.1</td><td>87.0</td><td>97.4</td><td>84.6</td><td>60.2</td><td>71.0</td></tr><tr><td>ResMLP-S24</td><td>6.0B</td><td>224</td><td>98.7</td><td>89.5</td><td>97.9</td><td>89.5</td><td>64.3</td><td>72.5</td></tr></table>
268
+
269
+ Table 4: Evaluation on transfer learning. Classification accuracy (top-1) of models trained on ImageNet-1k for transfer to datasets covering different domains. The ResMLP architecture takes $2 2 4 \times 2 2 4$ images during training and transfer, while ViTs and EfficientNet-B7 work with higher resolutions, see “Res.” column.
270
+
271
+ 238 the performance of ResMLP-S12 by $7 . 4 \%$ compared to the training employed for ResNet $[ 2 3 ]$ .
272
+ 239 This is in line with recent work pointing out the importance of the training strategy over the model
273
+ 240 choice [2, 48]. Pre-training on more data and distillation also improve the performance of ResMLP,
274
+ 241 especially for the bigger models, e.g., distillation improves the accuracy of ResMLP-B24/8 by $2 . 6 \%$ .
275
+
276
+ Other analysis. In our early exploration, we evaluated several alternative design choices. As in transformers, we could use positional embeddings mixed with the input patches. In our experiments we did not see any benefit from using these features, see Appendix A. This observation suggests that our linear patch interaction layer provides sufficient spatial communication, and referencing absolute positions obviates the need for any form of positional encoding.
277
+
278
+ # 3.5 Transfer learning
279
+
280
+ We evaluate the quality of features obtained from a ResMLP architecture when transferring them to other domains. The goal is to assess if the features generated from a feedforward network are more prone to overfitting on the training data distribution. We adopt the typical setting where we pre-train a model on ImageNet-1k and fine-tune it on the training set associated with a specific domain. We report the performance with different architectures on various image benchmarks in Table 4, namely CIFAR-10 and CIFAR-100 [34], Flowers-102 [42], Stanford Cars [33] and iNaturalist [27]. We refer the reader to the corresponding references for a more detailed description of the datasets. We observe that the performance of our ResMLP is competitive with the existing architectures, showing that pretraining feedforward models with enough data and regularization via data augmentation greatly reduces their tendency to overfit on the original distribution. Interestingly, this regularization also prevents them from overfitting on the training set of smaller dataset during the fine-tuning stage.
281
+
282
+ # 3.6 Machine translation
283
+
284
+ We also evaluate the ResMLP transpose-mechanism to replace the self-attention in the encoder and decoder of a neural machine translation system. We train models on the WMT 2014 English-German and English-French tasks, following the setup from Ott et al. [45]. We consider models of dimension 512, with a hidden MLP size of 2048, and with 6 or 12 layers. Note that the current state of the art employs much larger models: our 6 layers model is more comparable to the base transformer model from Vaswani et al. [60], which serves as a baseline, along with pre-transformer architectures such as Recurrent and convolutional neural networks. We use Adagrad with learning rate 0.2, $3 2 \mathrm { k }$ steps of linear warmup, label smoothing 0.1, dropout rate 0.15 for en-de and 0.1 for en-fr. We initialize the LayerScale parameter to 0.2. We generate translations with the beam search algorithm, with a beam of size 4. As shown in Table 5, the results are at least on par with other architectures:
285
+
286
+ Table 5: Machine translation on WMT 2014 translation tasks. We report tokenized BLEU on newstest2014.
287
+
288
+ <table><tr><td>Models</td><td>GNMT[61]</td><td></td><td>ConvS2S [21]Transf. (base)[60]</td><td>ResMLP-6</td><td>ResMLP-12</td></tr><tr><td>EN-DE</td><td>24.6</td><td>25.2</td><td>27.3</td><td>26.4</td><td>26.8</td></tr><tr><td>EN-FR</td><td>39.9</td><td>40.5</td><td>38.1</td><td>40.3</td><td>40.6</td></tr></table>
289
+
290
+ 2Interestingly, if trained with this “old-fashion” setting, ResMLP-S12 outperforms AlexNet [35] by a margin.
291
+
292
+ We review the research on applying Fully Connected Network (FCN) for computer vision problems as well as other architectures that shares common modules with our model.
293
+
294
+ Fully-connected network for images. Many studies have shown that FCNs are competitive with convnets for the tasks of digit recognition [11, 51], keyword spotting [7] and handwritting recognition [4]. Several works [37, 40, 59] have questioned if FCNs are also competitive on natural image datasets, such as CIFAR-10 [34]. More recently, d’Ascoli et al. [13] have shown that a FCN initialized with the weights of a pretrained convnet achieves performance that are superior than the original convnet. Neyshabur [41] further extend this line of work by achieving competitive performance by training an FCN from scratch but with a regularizer that constrains the models to be close to a convnet. These studies have been conducted on small scale datasets with the purpose of studying the impact of architectures on generalization in terms of sample complexity [18] and energy landscape [31]. In our work, we show that, in the larger scale setting of ImageNet, FCNs can attain surprising accuracy without any constraint or initialization inspired by convnets.
295
+
296
+ Finally, the application of FCN networks in computer vision have also emerged in the study of the properties of networks with infinite width [43], or for inverse scattering problems [32]. More interestingly, the Tensorizing Network [44] is an approximation of very large FCN that shares similarity with our model, in that they intend to remove prior by approximating even more general tensor operations, i.e., not arbitrarily marginalized along some pre-defined sharing dimensions. However, their method is designed to compress the MLP layers of a standard convnets.
297
+
298
+ Other architectures with similar components. Our FCN architecture shares several components with other architectures, such as convnets [35, 36] or transformers [60]. A fully connected layer is equivalent to a convolution layer with a $1 \times 1$ receptive field, and several work have explored convnet architectures with small receptive fields. For instance, the VGG model [52] uses $3 \times 3$ convolutions, and later, other architectures such as the ResNext [62] or the Xception [10] mix $1 \times 1$ and $3 \times 3$ convolutions. In contrast to convnets, in our model interaction between patches is obtained via a linear layer that is shared across channels, and that relies on absolute rather than relative positions.
299
+
300
+ More recently, transformers have emerged as a promising architecture for computer vision [9, 17, 46, 56, 66]. In particular, our architecture takes inspiration from the structure used in the Vision Transformer (ViT) [17], and as consequence, shares many components. Our model takes a set of non-overlapping patches as input and passes them through a series of MLP layers that share the same structure as ViT, replacing the self-attention layer with a linear patch interaction layer. Both layers have a global field-of-view, unlike convolutional layers. Whereas in self-attention the weights to aggregate information from other patches are data dependent through queries and keys, in ResMLP the weights are not data dependent and only based on absolute positions of patches. In our implementation we follow the improvements of DeiT [56] to train vision transformers, use the skip-connections from ResNets [23] with pre-normalization of the layers [8, 24].
301
+
302
+ 307 Finally, our work questions the importance of self-attention in existing architectures. Similar ob
303
+ 308 servations have been made in natural language processing. Notably, Synthesizer [54] shows that
304
+ 309 dot-product self-attention can be replaced by a feedforward network, with competitive performance
305
+ 310 on sentence representation benchmarks. As opposed to our work, Synthesizer does use data dependent
306
+ 311 weights, but in contrast to transformers the weights are determined from the queries only.
307
+
308
+ # 312 5 Conclusion
309
+
310
+ In this paper we have shown that a simple residual architecture, whose residual blocks consist of a one-hidden layer feed-forward network and a linear patch interaction layer, achieves an unexpectedly high performance on ImageNet classification benchmarks, provided that we adopt a modern training strategy such as those recently introduced for transformer-based architectures. Thanks to their simple structure, with linear layers as the main mean of communication between patches, we can vizualize the filters learned by this simple MLP. While some of the layers are similar to convolutional filters, we also observe sparse long-range interactions as early as the second layer of the network. We hope that our model free of spatial priors will contribute to further understanding of what networks with less priors learn, and potentially guide the design choices of future networks without the pyramidal design prior adopted by most convolutional neural networks.
311
+
312
+ 324 [1] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint
313
+ 325 arXiv:1607.06450, 2016. 2, 7
314
+ 326 [2] Irwan Bello, W. Fedus, Xianzhi Du, E. D. Cubuk, A. Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret
315
+ 327 Zoph. Revisiting ResNets: Improved training and scaling strategies. arXiv preprint arXiv:2103.07579,
316
+ 328 2021. 1, 8
317
+ 329 [3] Lucas Beyer, Olivier J. Hénaff, Alexander Kolesnikov, Xiaohua Zhai, and Aaron van den Oord. Are we
318
+ 330 done with ImageNet? arXiv preprint arXiv:2006.07159, 2020. 4, 7
319
+ 331 [4] Théodore Bluche. Deep neural networks for large vocabulary handwritten text recognition. PhD thesis,
320
+ 332 Université Paris-Sud, 2015. 9
321
+ 333 [5] A. Brock, Soham De, S. L. Smith, and K. Simonyan. High-performance large-scale image recognition
322
+ 334 without normalization. arXiv preprint arXiv:2102.06171, 2021. 4
323
+ 335 [6] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand
324
+ 336 Joulin. Emerging properties in self-supervised vision transformers. arXiv preprint arXiv:2104.14294,
325
+ 337 2021. 2, 4, 5
326
+ 338 [7] Clément Chatelain. Extraction de séquences numériques dans des documents manuscrits quelconques.
327
+ 339 PhD thesis, Université de Rouen, 2006. 9
328
+ 340 [8] Mia Xu Chen, Orhan Firat, Ankur Bapna, Melvin Johnson, Wolfgang Macherey, George Foster, Llion Jones,
329
+ 341 Niki Parmar, Mike Schuster, Zhifeng Chen, et al. The best of both worlds: Combining recent advances in
330
+ 342 neural machine translation. In Annual Meeting of the Association for Computational Linguistics, 2018. 9
331
+ 343 [9] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse
332
+ 344 transformers. arXiv preprint arXiv:1904.10509, 2019. 9
333
+ 345 [10] François Chollet. Xception: Deep learning with depthwise separable convolutions. In Conference on
334
+ 346 Computer Vision and Pattern Recognition, 2017. 9
335
+ 347 [11] Dan Claudiu Cire¸san, Ueli Meier, Luca Maria Gambardella, and Jürgen Schmidhuber. Deep big multilayer
336
+ 348 perceptrons for digit recognition. In Neural networks: tricks of the trade, pages 581–598. Springer, 2012. 9
337
+ 349 [12] Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. RandAugment: Practical automated data
338
+ 350 augmentation with a reduced search space. arXiv preprint arXiv:1909.13719, 2019. VI
339
+ 351 [13] Stéphane d’Ascoli, Levent Sagun, Joan Bruna, and Giulio Biroli. Finding the needle in the haystack with
340
+ 352 convolutions: on the benefits of architectural bias. In NeurIPS, 2019. 5, 9
341
+ 353 [14] Xiaohan Ding, Xiangyu Zhang, Jungong Han, and Guiguang Ding. RepMLP: Re-parameterizing con
342
+ 354 volutions into fully-connected layers for image recognition. arXiv preprint arXiv:2105.01883, 2021.
343
+ 355 2
344
+ 356 [15] Piotr Dollár, Mannat Singh, and Ross Girshick. Fast and accurate model scaling. arXiv preprint
345
+ 357 arXiv:2103.06877, 2021. 1
346
+ 358 [16] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas
347
+ 359 Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is
348
+ 360 worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning
349
+ 361 Representations, 2021. 1, 2, 3, 8
350
+ 362 [17] Alexey Dosovitskiy, Jost Tobias Springenberg, Martin A. Riedmiller, and Thomas Brox. Discriminative
351
+ 363 unsupervised feature learning with convolutional neural networks. In NeurIPS, 2014. 9
352
+ 364 [18] Simon S Du, Yining Wang, Xiyu Zhai, Sivaraman Balakrishnan, Ruslan Salakhutdinov, and Aarti Singh.
353
+ 365 How many samples are needed to estimate a convolutional neural network? In NeurIPS, 2018. 9
354
+ 366 [19] Alexandre Défossez, Yossi Adi, and Gabriel Synnaeve. Differentiable model compression via pseudo
355
+ 367 quantization noise. arXiv preprint arXiv:2104.09987, 2021. 6
356
+ 368 [20] Angela Fan, Pierre Stock, Benjamin Graham, Edouard Grave, Rémi Gribonval, Hervé Jégou, and Armand
357
+ 369 Joulin. Training with quantization noise for extreme model compression. In International Conference on
358
+ 370 Learning Representations, 2021. 6
359
+ 371 [21] Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional sequence
360
+ 372 to sequence learning. In Doina Precup and Yee Whye Teh, editors, Proceedings of the 34th International
361
+ 373 Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pages
362
+ 374 1243–1252. PMLR, 06–11 Aug 2017. 8
363
+ 375 [22] Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In International
364
+ 376 Conference on Machine Learning, 2011. 7
365
+ 377 [23] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition.
366
+ 378 In Conference on Computer Vision and Pattern Recognition, 2016. 2, 7, 8, 9, V
367
+ 379 [24] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks.
368
+ 380 arXiv preprint arXiv:1603.05027, 2016. 7, 9
369
+ 381 [25] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (GELUs). arXiv preprint arXiv:1606.08415,
370
+ 382 2016. 1, 3, 7
371
+ 383 [26] Elad Hoffer, Tal Ben-Nun, Itay Hubara, Niv Giladi, Torsten Hoefler, and Daniel Soudry. Augment your
372
+ 384 batch: Improving generalization through instance repetition. In Conference on Computer Vision and
373
+ 385 Pattern Recognition, 2020. VI
374
+ 386 [27] Grant Van Horn, Oisin Mac Aodha, Yang Song, Alexander Shepard, Hartwig Adam, Pietro Perona,
375
+ 387 and Serge J. Belongie. The iNaturalist species classification and detection dataset. arXiv preprint
376
+ 388 arXiv:1707.06642, 2017. 8
377
+ 389 [28] A. Howard, Mark Sandler, G. Chu, Liang-Chieh Chen, B. Chen, M. Tan, W. Wang, Y. Zhu, R. Pang, V.
378
+ 390 Vasudevan, Quoc V. Le, and H. Adam. Searching for MobileNetV3. International Conference on Computer
379
+ 391 Vision, 2019. 7
380
+ 392 [29] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q. Weinberger. Deep networks with stochastic
381
+ 393 depth. In European Conference on Computer Vision, 2016. VI
382
+ 394 [30] S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal
383
+ 395 covariate shift. In International Conference on Machine Learning, 2015. 2
384
+ 396 [31] Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter
385
+ 397 Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In International
386
+ 398 Conference on Learning Representations, 2017. 9
387
+ 399 [32] Yuehaw Khoo and Lexing Ying. Switchnet: a neural network model for forward and inverse scattering
388
+ 400 problems. SIAM Journal on Scientific Computing, 41(5):A3182–A3201, 2019. 9
389
+ 401 [33] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained
390
+ 402 categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13),
391
+ 403 2013. 8
392
+ 404 [34] A. Krizhevsky. Learning multiple layers of features from tiny images. Master’s thesis, University of
393
+ 405 Toronto, 2009. 8, 9
394
+ 406 [35] A. Krizhevsky, I. Sutskever, and G. Hinton. ImageNet classification with deep convolutional neural
395
+ 407 networks. In NeurIPS, 2012. 8, 9
396
+ 408 [36] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to
397
+ 409 document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. 9
398
+ 410 [37] Zhouhan Lin, Roland Memisevic, and Kishore Konda. How far can we go without convolution: Improving
399
+ 411 fully-connected networks. arXiv preprint arXiv:1511.02580, 2015. 9
400
+ 412 [38] Hanxiao Liu, Zihang Dai, David R. So, and Quoc V. Le. Pay attention to MLPs. arXiv preprint
401
+ 413 arXiv:2105.08050, 2021. 2
402
+ 414 [39] Luke Melas-Kyriazi. Do you even need attention? A stack of feed-forward layers does surprisingly well
403
+ 415 on ImageNet. arXiv preprint arXiv:2105.02723, 2021. 2
404
+ 416 [40] Decebal Constantin Mocanu, Elena Mocanu, Peter Stone, Phuong H Nguyen, Madeleine Gibescu, and
405
+ 417 Antonio Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by
406
+ 418 network science. Nature communications, 9(1):1–12, 2018. 9
407
+ 419 [41] Behnam Neyshabur. Towards learning convolutions from scratch. In NeurIPS, 2020. 9
408
+ 420 [42] M-E. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In
409
+ 421 Proceedings of the Indian Conference on Computer Vision, Graphics and Image Processing, 2008. 8
410
+ 422 [43] Roman Novak, Lechao Xiao, Jaehoon Lee, Yasaman Bahri, Greg Yang, Jiri Hron, Daniel A Abolafia,
411
+ 423 Jeffrey Pennington, and Jascha Sohl-Dickstein. Bayesian deep convolutional networks with many channels
412
+ 424 are Gaussian processes. In International Conference on Learning Representations, 2019. 9
413
+ 425 [44] Alexander Novikov, Dmitrii Podoprikhin, Anton Osokin, and Dmitry P Vetrov. Tensorizing neural networks.
414
+ 426 In Neurips, 2015. 9
415
+ 427 [45] Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. In ACL,
416
+ 428 pages 1–9. Association for Computational Linguistics, 2018. 8
417
+ 429 [46] Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin
418
+ 430 Tran. Image transformer. In International Conference on Machine Learning, 2018. 9
419
+ 431 [47] Filip Radenovic, Giorgos Tolias, and Ondrej Chum. Fine-tuning CNN image retrieval with no human ´
420
+ 432 annotation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(7):1655 – 1668, 2018. 4
421
+ 433 [48] Ilija Radosavovic, Raj Prateek Kosaraju, Ross B. Girshick, Kaiming He, and Piotr Dollár. Designing
422
+ 434 network design spaces. Conference on Computer Vision and Pattern Recognition, 2020. 4, 8
423
+ 435 [49] B. Recht, Rebecca Roelofs, L. Schmidt, and V. Shankar. Do ImageNet classifiers generalize to ImageNet?
424
+ 436 In International Conference on Machine Learning, 2019. 4, 7
425
+ 437 [50] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang,
426
+ 438 Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet large
427
+ 439 scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015. 1, 4
428
+ 440 [51] Patrice Y Simard, David Steinkraus, John C Platt, et al. Best practices for convolutional neural networks
429
+ 441 applied to visual document analysis. In ICDAR, 2003. 9
430
+ 442 [52] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In
431
+ 443 International Conference on Learning Representations, 2015. 9
432
+ 444 [53] Mingxing Tan and Quoc V. Le. EfficientNet: Rethinking model scaling for convolutional neural networks.
433
+ 445 arXiv preprint arXiv:1905.11946, 2019. 4, 8
434
+ 446 [54] Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking
435
+ 447 self-attention in transformer models. arXiv preprint arXiv:2005.00743, 2020. 9
436
+ 448 [55] Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner,
437
+ 449 Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. MLP-Mixer: An
438
+ 450 all-MLP architecture for vision. arXiv preprint arXiv:2105.01601, 2021. 2
439
+ 451 [56] Hugo Touvron, M. Cord, M. Douze, F. Massa, Alexandre Sablayrolles, and H. Jégou. Training data-efficient
440
+ 452 image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. 1, 2, 4, 5, 8,
441
+ 453 9, I, V
442
+ 454 [57] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper
443
+ 455 with image transformers. arXiv preprint arXiv:2103.17239, 2021. 2, 3, 4, I
444
+ 456 [58] Hugo Touvron, Alexandre Sablayrolles, M. Douze, M. Cord, and H. Jégou. Grafit: Learning fine-grained
445
+ 457 image representations with coarse labels. arXiv preprint arXiv:2011.12982, 2020. 8
446
+ 458 [59] Gregor Urban, Krzysztof J Geras, Samira Ebrahimi Kahou, Ozlem Aslan, Shengjie Wang, Rich Caruana,
447
+ 459 Abdelrahman Mohamed, Matthai Philipose, and Matt Richardson. Do deep convolutional nets really need
448
+ 460 to be deep and convolutional? In International Conference on Learning Representations, 2017. 9
449
+ 461 [60] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz
450
+ 462 Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017. 1, 8, 9
451
+ 463 [61] Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim
452
+ 464 Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging
453
+ 465 the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. 8
454
+ 466 [62] Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transfor
455
+ 467 mations for deep neural networks. In Conference on Computer Vision and Pattern Recognition, 2017.
456
+ 468 9
457
+ 469 [63] Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song,
458
+ 470 James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large batch optimization for deep learning: Training
459
+ 471 BERT in 76 minutes. In International Conference on Learning Representations, 2020. 4
460
+ 472 [64] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo.
461
+ 473 CutMix: Regularization strategy to train strong classifiers with localizable features. arXiv preprint
462
+ 474 arXiv:1905.04899, 2019. VI
463
+ 475 [65] Hongyi Zhang, Moustapha Cissé, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk
464
+ 476 minimization. arXiv preprint arXiv:1710.09412, 2017. VI
465
+ 477 [66] Hengshuang Zhao, Jiaya Jia, and Vladlen Koltun. Exploring self-attention for image recognition. In
466
+ 478 Conference on Computer Vision and Pattern Recognition, 2020. 9
467
+ 479 [67] Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation.
468
+ 480 In AAAI, 2020. VI
469
+
470
+ 1. For all authors...
471
+
472
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
473
+ (b) Did you describe the limitations of your work? [Yes]
474
+ (c) Did you discuss any potential negative societal impacts of your work? [No] We only use MLPs for image classification. There is already other system much more powerful therefore the impact is negligible
475
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
476
+
477
+ 2. If you are including theoretical results...
478
+
479
+ (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]
480
+
481
+ 3. If you ran experiments...
482
+
483
+ (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 provide code in appendix
484
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
485
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Because it’s too expensive in computational resources. But for some experiments we run multiple times and we have $\sim 0 . 1$ as standard deviation
486
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] The majority of our experiments take 2 days on 8 GPUs V100-32GB
487
+
488
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
489
+
490
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
491
+ (b) Did you mention the license of the assets? [No] But license can be found with the references we mention
492
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
493
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] We only use datasets that are widely used in computer vision such as ImageNet or CIFAR
494
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We only use datasets that are widely used in computer vision such as ImageNet or CIFAR
495
+
496
+ 5. If you used crowdsourcing or conducted research with human subjects...
497
+
498
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
499
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
500
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/KBnXrODoBW/KBnXrODoBW.md ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pay Attention to MLPs
2
+
3
+ Hanxiao Liu, Zihang Dai, David R. So, Quoc V. Le Google Research, Brain Team {hanxiaol,zihangd,davidso,qvl}@google.com
4
+
5
+ # Abstract
6
+
7
+ Transformers [1] have become one of the most important architectural innovations in deep learning and have enabled many breakthroughs over the past few years. Here we propose a simple network architecture, gMLP, based on MLPs with gating, and show that it can perform as well as Transformers in key language and vision applications. Our comparisons show that self-attention is not critical for Vision Transformers, as $\mathrm { g M L P }$ can achieve the same accuracy. For BERT, our model achieves parity with Transformers on pretraining perplexity and is better on some downstream NLP tasks. On finetuning tasks where gMLP performs worse, making the $\mathrm { g M L P }$ model substantially larger can close the gap with Transformers. In general, our experiments show that gMLP can scale as well as Transformers over increased data and compute.
8
+
9
+ # 1 Introduction
10
+
11
+ Transformers [1] have enabled many breakthroughs in natural language processing (e.g., [2, 3, 4, 5, 6]) and have been shown to work well for computer vision (e.g., [7, 8, 9, 10]). Thanks to this success, Transformers have largely replaced LSTM-RNN [11] as the default architecture in NLP, and have become an appealing alternative to ConvNets [12, 13, 14, 15, 16, 17] in computer vision.
12
+
13
+ The Transformer architecture combines two important concepts: (1) a recurrent-free architecture which computes the representations for each individual token in parallel, and (2) multi-head selfattention blocks which aggregate spatial information across tokens. On one hand, the attention mechanism [18] introduces the inductive bias that the spatial interactions should be dynamically parameterized based on the input representations. On the other hand, it is known that MLPs with static parameterization can represent arbitrary functions [19]. It therefore remains an open question whether the inductive bias in self-attention is essential to the remarkable effectiveness of Transformers.
14
+
15
+ Here we study the necessity of self-attention modules in key language and vision applications of Transformers. Specifically, we propose an MLP-based alternative to Transformers without self-attention, which simply consists of channel projections and spatial projections with static parameterization. We experiment with several design choices for this architecture and find spatial projections work well when they are linear and paired with multiplicative gating (Figure 1). We name the model gMLP because it is built out of basic MLP layers with gating.
16
+
17
+ We apply $\mathrm { g M L P }$ to image classification and obtain strong results on ImageNet. $\mathrm { g M L P }$ achieves comparable performance with DeiT [8], namely Vision Transformer (ViT) [7] with improved regularization, in a similar training setup. With $66 \%$ less parameters, a gMLP model is $3 \%$ more accurate than MLP-Mixer [20]. Together with Tolstikhin et al. [20], Melas-Kyriazi [21], Touvron et al. [22] and Ding et. al. [23], our results question the necessity of self-attention layers in Vision Transformers.
18
+
19
+ We apply gMLP to masked language modeling (MLM) in the BERT [2] setup, one of the most wellestablished applications of Transformers, and find that it is as good as Transformers at minimizing perplexity during pretraining. Our experiments indicate that perplexity is only correlated with model capacity and is insensitive to the presence of self-attention. As capacity increases, we observe that
20
+
21
+ def gmlp_block(x, d_model, d_ffn): shortcut $=$ x $\mathrm { ~ x ~ } =$ norm(x, axis="channel") $\mathrm { ~ x ~ } =$ proj(x, d_ffn, axis="channel") $\mathrm { ~ x ~ } =$ gelu(x) $\mathrm { ~ x ~ } =$ spatial_gating_unit(x) $\mathrm { ~ x ~ } =$ proj(x, d_model, axis $= ^ { 1 1 }$ channel") return $\texttt { x + }$ shortcut
22
+
23
+ ![](images/018d82d7640366b577f21adb6e4e6c60f398a8eb4976b569ff0a2114a750edde.jpg)
24
+ Figure 1: Overview of the $\mathrm { g M L P }$ architecture with Spatial Gating Unit (SGU). The model consists of a stack of $L$ blocks with identical structure and size. All projection operations are linear and “ $\odot$ ” refers to element-wise multiplication (linear gating). The input and output protocols follow BERT for NLP and ViT for vision. Unlike Transformers, gMLPs do not require positional encodings, nor is it necessary to mask out the paddings during NLP finetuning.
25
+
26
+ def spatial_gating_unit $\mathbf { \Psi } ( \mathbf { x } )$ : u, $\tt { v } =$ split(x, axis="channel") $\tt { v } =$ norm(v, axis="channel") n = get_dim(v, axis $\mathrel { \mathop : } = \mathrel { \mathop : }$ spatial") v = proj(v, n, axis="spatial", init_bias $\mathrel { \mathop : } = 1$ ) return u ∗ v
27
+
28
+ both pretraining and finetuning metrics for gMLPs improve as quickly as for Transformers. This is remarkable because it indicates ${ \mathrm { g M L P s } }$ scale just as well as Transformers despite the absence of self-attention, and any performance gap can always be offset by training a larger model with increased data and compute. With a standard 256-batch size $\times \ 1 \mathbf { M }$ -step training setup as in original BERT, a large $\mathrm { g M L P }$ model achieves $8 7 . 7 \%$ accuracy on MNLI and $8 2 . 1 \%$ F1 on SQuAD v2.0. Note, these are better than the $\mathbf { B E R T _ { l a r g e } }$ results reported in Devlin et al. [2] obtained using Transformers.
29
+
30
+ For BERT’s finetuning, Transformers can be more practically advantageous over gMLPs on tasks that require cross-sentence alignment (e.g., by $0 . 8 \%$ on MNLI-m in the 300M-param regime), even with similar pretraining perplexity. This problem can be addressed by making gMLPs substantially larger— $3 \times$ as large as Transformers. A more practical solution is to blend in only a tiny bit of selfattention—a single-head self-attention with size up to 128 is sufficient to make $\mathrm { g M L P s }$ outperform Transformers on all NLP tasks we evaluated with even better parameter efficiency. The improvement is sometimes very significant (e.g., $+ 4 . 4 \%$ on SQuAD $\mathrm { v } 2 . 0$ over $\mathbf { B E R T _ { l a r g e } }$ ).
31
+
32
+ Overall, the surprising effectiveness of gMLPs in both vision and NLP domains suggests that selfattention is not a necessary ingredient for scaling up machine learning models, although it can be a useful addition depending on the task. With increased data and compute, models with simpler spatial interaction mechanisms such as $\mathrm { g M L P }$ can be as powerful as Transformers and the capacity allocated to self-attention can be either removed or substantially reduced.
33
+
34
+ # 2 Model
35
+
36
+ Our model, gMLP, consists of a stack of $L$ blocks with identical size and structure. Let $\ b { X } \in \mathbb { R } ^ { n \times d }$ be the token representations with sequence length $n$ and dimension $d$ . Each block is defined as:
37
+
38
+ $$
39
+ Z = \sigma ( X U ) , \qquad \tilde { Z } = s ( Z ) , \qquad Y = \tilde { Z } V
40
+ $$
41
+
42
+ where $\sigma$ is an activation function such as GeLU [24]. $U$ and $V$ define linear projections along the channel dimension—the same as those in the FFNs of Transformers (e.g., their shapes are $7 6 8 \times 3 0 7 2$ and $3 0 7 2 \times 7 6 8$ for $\mathbf { B E R T _ { b a s e } }$ ). Shortcuts, normalizations and biases are omitted for brevity.
43
+
44
+ A key ingredient in the aforementioned formulation is $s ( \cdot )$ , a layer which captures spatial interactions (see below). When $s$ is an identity mapping, the above transformation degenerates to a regular FFN, where individual tokens are processed independently without any cross-token communication. One of our major focuses is therefore to design a good $s$ capable of capturing complex spatial interactions across tokens. The overall block layout is inspired by inverted bottlenecks [25] which define $s ( \cdot )$ as a spatial depthwise convolution. Note, unlike Transformers, our model does not require position embeddings because such information will be captured in $s ( \cdot )$ .
45
+
46
+ Our model uses exactly the same input and output protocols as BERT (for NLP) and ViT (for vision). For example, when finetuning on language tasks, we concatenate together multiple text segments followed by paddings, and the predictions are deduced from the last-layer representation of a reserved <cls> symbol. Although many of these protocols were introduced for Transformers and hence can be suboptimal for gMLPs, strictly following them helps avoid confounding factors in our experiments and makes our layers more compatible with existing Transformer implementations.
47
+
48
+ # 2.1 Spatial Gating Unit
49
+
50
+ To enable cross-token interactions, it is necessary for the layer $s ( \cdot )$ to contain a contraction operation over the spatial dimension. The simplistic option would be a linear projection:
51
+
52
+ $$
53
+ f _ { W , b } ( Z ) = W Z + b
54
+ $$
55
+
56
+ where $W \in \mathbb { R } ^ { n \times n }$ is a matrix for which the size is the same as the sequence length, $n$ , and $b$ refers token-specific biases. For example, if the padded input sequence has 128 tokens, the shape for $W$ will be $1 2 8 \times 1 2 8$ . Unlike self-attention where $W ( Z )$ is dynamically generated from $Z$ , the spatial projection matrix $W$ here in Equation (2) is independent from the input representations.
57
+
58
+ In this work, we formulate layer $s ( \cdot )$ as the output of linear gating:
59
+
60
+ $$
61
+ s ( Z ) = Z \odot f _ { W , b } ( Z )
62
+ $$
63
+
64
+ where $\odot$ denotes element-wise multiplication. For training stability, we find it critical to initialize $W$ as near-zero values and $b$ as ones, meaning that $f _ { W , b } ( Z ) \approx { \bf 1 }$ and therefore $s ( Z ) \approx Z$ at the beginning of training. This initialization ensures each gMLP block behaves like a regular FFN at the early stage of training, where each token is processed independently, and only gradually injects spatial information across tokens during the course of learning.
65
+
66
+ We further find it effective to split $Z$ into two independent parts $( Z _ { 1 } , Z _ { 2 } )$ along the channel dimension for the gating function and for the multiplicative bypass:
67
+
68
+ $$
69
+ s ( Z ) = Z _ { 1 } \odot f _ { W , b } ( Z _ { 2 } )
70
+ $$
71
+
72
+ We also normalize the input to $f _ { W , b }$ which empirically improves stability of large NLP models. This gives us the unit illustrated in Figure 1, which we refer to as the Spatial Gating Unit (SGU) in the rest of the paper. In Table 3, we provide ablation studies to compare SGU with several other variants of $s ( \cdot )$ , showing that it works better and narrows the performance gap with self-attention.
73
+
74
+ Connections to Existing Layers. The overall formulation of SGU resembles Gated Linear Units (GLUs) [26, 27, 28] as well as earlier works including Highway Networks [29] and LSTM-RNNs [11]. A key distinction is that our gating is computed based on a projection over the spatial (cross-token) dimension rather than the channel (hidden) dimension. SGU is also related to Squeeze-and-Excite (SE) blocks [30] in terms of element-wise multiplication. However, different from SE blocks, SGU does not contain cross-channel projections at all, nor does it enforce permutation invariance (a key feature for content-based attentive modules) due to its static parameterization for the spatial transformation. The spatial projection in SGU could in theory learn to express superficial depthwise convolutions—unlike typical depthwise convolutions with channel-specific filters, SGU learns only a single transformation shared across channels. Finally, we note SGUs offer an alternative mechanism to capture high-order relationships other than self-attention. Specifically, the output for Equation (3) contains up to 2nd-order interactions (e.g., $z _ { i } z _ { j }$ ) whereas output for self-attention (assuming no nonlinearity) contains up to 3rd-order interactions (e.g., $q _ { i } k _ { j } v _ { k } )$ . In terms of computation cost, SGU has $n ^ { 2 } e / 2$ multiply-adds which is comparable to the $2 n ^ { 2 } d$ of dot-product self-attention.1 Both are linear over the input channel size and quadratic over the sequence length $n$ .
75
+
76
+ # 3 Image Classification
77
+
78
+ Here we examine $\mathrm { g M L P }$ in the vision domain by applying it to the image classification task on ImageNet [31] without using extra data. We compare our MLP-like models with recent attentive models based on vanilla Transformers, including Vision Transformer (ViT) [7], DeiT [8] (ViT with improved regularization), and several other representative convolutional networks.
79
+
80
+ Table 1 summarizes the configurations of our gMLP image classification models. The input and output protocols follow ViT/B16 where the raw image is converted into $1 6 \times 1 6$ patches at the stem. The depth and width are chosen so that the models are comparable with ViT/DeiT in capacity. Like Transformers, we find gMLPs tend to drastically overfit the training data. We therefore apply a similar regularization recipe as the one used in DeiT.2 To avoid extensive tuning, we adjust only the strengths of stochastic depth [32] as we move from smaller to larger models in Table 1. All the other hyperparameters remain shared across our three models. See Appendix A.1 for details.
81
+
82
+ Table 1: Architecture specifications of $\mathrm { g M L P }$ models for vision.
83
+
84
+ <table><tr><td></td><td>#L</td><td>dmodel</td><td>dffn</td><td>Params (M)</td><td>FLOPs (B)</td><td>Survival Prob</td></tr><tr><td>gMLP-Ti</td><td>30</td><td>128</td><td>768</td><td>5.9</td><td>2.7</td><td>1.00</td></tr><tr><td>gMLP-S</td><td>30</td><td>256</td><td>1536</td><td>19.5</td><td>8.9</td><td>0.95</td></tr><tr><td>gMLP-B</td><td>30</td><td>512</td><td>3072</td><td>73.4</td><td>31.6</td><td>0.80</td></tr></table>
85
+
86
+ Our ImageNet results are summarized in Table 1 and Figure 2.3 It is interesting to see that gMLPs are comparable with DeiT [8], namely ViT [7] trained using improved regularization. The results suggest that models without self-attention can be as data-efficient as Transformers for image classification. In fact, when the models are properly regularized, their accuracies seem better correlated with capacity instead of the presence of self-attention. Moreover, the accuracy-parameter/FLOPs tradeoff of gMLPs surpasses all concurrently proposed MLP-like architectures [20, 21, 22], which we attribute to the effectiveness of our Spatial Gating Unit (see Table 3 in the next section for an ablation). We also note while ${ \mathrm { g M L P s } }$ are competitive with vanilla Transformers, their performance is behind the best existing ConvNet models (e.g., [33, 34]) or hybrid models (e.g., [35, 36, 37, 38, 10]).
87
+
88
+ Table 2: ImageNet-1K results without extra data.
89
+
90
+ <table><tr><td rowspan="2">Model</td><td>ImageNet Top-1 (%)*</td><td>Input Resolution</td><td>Params (M)</td><td>MAdds (B)</td></tr><tr><td colspan="4">ConvNets</td></tr><tr><td>ResNet-152 [16]</td><td>78.3</td><td>224</td><td>60</td><td>11.3</td></tr><tr><td>RegNetY-8GF[39]</td><td>81.7</td><td>224</td><td>39</td><td>8.0</td></tr><tr><td>EfficientNet-B0 [17]</td><td>77.1</td><td>224</td><td>5</td><td>0.39</td></tr><tr><td>EfficientNet-B3[17]</td><td>81.6</td><td>300</td><td>12</td><td>1.8</td></tr><tr><td>EfficientNet-B7 [17]</td><td>84.3</td><td>600</td><td>66</td><td>37.0</td></tr><tr><td>NFNet-F0 [33]</td><td>83.6</td><td>192</td><td>72</td><td>12.4</td></tr><tr><td></td><td colspan="4">Transformers</td></tr><tr><td>ViT-B/16 [7]</td><td>77.9</td><td>384</td><td>86</td><td>55.4</td></tr><tr><td>ViT-L/16 [7]</td><td>76.5</td><td>384</td><td>307</td><td>190.7</td></tr><tr><td>DeiT-Ti [8] (ViT+reg)</td><td>72.2</td><td>224</td><td>5</td><td>1.3</td></tr><tr><td>DeiT-S [8](ViT+reg)</td><td>79.8</td><td>224</td><td>22</td><td>4.6</td></tr><tr><td>DeiT-B [8] (ViT+reg)</td><td>81.8</td><td>224</td><td>86</td><td>17.5</td></tr><tr><td></td><td colspan="4">MLP-like†</td></tr><tr><td>Mixer-B/16 [20]</td><td>76.4</td><td>224</td><td>59</td><td>12.7</td></tr><tr><td>Mixer-B/16 (our setup)</td><td>77.3</td><td>224</td><td>59</td><td>12.7</td></tr><tr><td>Mixer-L/16 [20]</td><td>71.8</td><td>224</td><td>207</td><td>44.8</td></tr><tr><td>ResMLP-12 [22]</td><td>76.6</td><td>224</td><td>15</td><td>3.0</td></tr><tr><td>ResMLP-24 [22]</td><td>79.4</td><td>224</td><td>30</td><td>6.0</td></tr><tr><td>ResMLP-36[22]</td><td>79.7</td><td>224</td><td>45</td><td>8.9</td></tr><tr><td>gMLP-Ti (ours)</td><td>72.3</td><td>224</td><td>6</td><td>1.4</td></tr><tr><td>gMLP-S (ours)</td><td>79.6</td><td>224</td><td>20</td><td>4.5</td></tr><tr><td>gMLP-B (ours)</td><td>81.6</td><td>224</td><td>73</td><td>15.8</td></tr></table>
91
+
92
+ \* Standard deviation across multiple independent runs is around 0.1. † Tokenization & embedding process at the stem can be viewed as a convolution.
93
+
94
+ Figure 3 visualizes the spatial projection matrices in gMLP-B. Remarkably, the spatial weights after learning exhibit both locality and spatial invariance. In other words, each spatial projection matrix effectively learns to perform convolution with a data-driven, irregular (non-square) kernel shape.
95
+
96
+ ![](images/4ce114a6aa7138cbd566c0e0b5ee0dbdefe6fbfc6e3bb7bd0ddb7399d3c6d83b.jpg)
97
+ Figure 2: ImageNet accuracy vs model capacity.
98
+
99
+ ![](images/e9c6f27dad6f981df32081593ce223c652c9c19a1ac8f3a7e6353aba3fdced9b.jpg)
100
+ Figure 3: Spatial projection weights in gMLPB. Each row shows the filters (reshaped into 2D) for a selected set of tokens in the same layer.
101
+
102
+ # 4 Masked Language Modeling with BERT
103
+
104
+ Here we conduct empirical studies over the masked language modeling (MLM) task. The input/output protocol for both pretraining and finetuning follows BERT [2]. Different from Transformer-based models, we do not use positional encodings. We also find it unnecessary to mask out <pad> tokens in gMLP blocks during finetuning as the model can quickly learn to ignore them. For ablations and case studies, all models are trained with batch size 2048, max length 128 for 125K steps over the RealNews-like subset of C4 [5]. For main results, models are trained with batch size 256, max length 512 for 1M steps over the full English C4 dataset. See Appendix A.2 for details.
105
+
106
+ Our preliminary MLM experiments show that gMLPs always learn Toeplitz-like matrices as the spatial weights (Appendix C). This means ${ \mathrm { g M L P s } }$ are able to learn the notion of shift invariance from data, a property naturally implied by the MLM task where any offset of the input sequence does not affect the slot filling outcome. In this case, the learned $f _ { W , b } ( \cdot )$ acts like a 1-d convolution whose kernel size equals the entire sequence length (unlike depthwise convolution with channel-specific filters, here the same $W$ is shared across channels). In the following MLM experiments, we restrict $W$ to be a Toeplitz matrix to avoid redundant model parameterization (since $W$ will be Toeplitz-like regardless after learning). Note this constraint is empirically quality-neutral.
107
+
108
+ # 4.1 Ablation: The Importance of Gating in gMLP for BERT’s Pretraining
109
+
110
+ In Table 3 below, we establish baselines for our ablation studies. These include:
111
+
112
+ 1. BERT with a Transformer architecture and learnable absolute position embeddings.
113
+ 2. BERT with a Transformer architecture and T5-style learnable relative position biases [5]. The biases are both layer- and head-specific as we find this yields the best results.
114
+ 3. Same as above, but we remove all content-dependent terms inside the softmax and only retain the relative positional biases. This baseline is a straightforward variant of Transformers without self-attention, which can also be viewed as a Random Synthesizer [40].
115
+ 4. MLP-Mixer [20] which replaces the multi-head self-attention module in Transformers with a two-layer spatial MLP. This model was developed for image classification and here we investigate it on MLM tasks using the same training setup with BERT and gMLP.
116
+
117
+ We compare these baselines against several versions of ${ \mathrm { g M L P s } }$ with similar sizes in Table 3. Note that Multiplicative, Split (last row) is the Spatial Gating Unit we describe in the method section and use in the rest of the paper. First, SGU outperforms other variants in perplexity. Secondly and remarkably, gMLP with SGU also achieves perplexity comparable to Transformer. Note the difference between the strongest baseline (perplexity ${ = } 4 . 2 6 $ ) and ours (perplexity ${ = } 4 . 3 5$ ) is insignificant relative to the perplexity change when the models are scaled (see Table 4 in the next section). Spatial projection weights learned by ${ \mathrm { g M L P s } }$ are visualized in Figure 4.
118
+
119
+ Table 3: MLM validation perplexities of Transformer baselines and four versions of ${ \mathrm { g M L P s } }$ . $f$ refers to the spatial linear projection in Equation (2) with input normalization. The MLP-Mixer baseline model has $_ { \mathrm { L } = 2 4 }$ layers with $d _ { \mathrm { m o d e l } } = 7 6 8$ , $d _ { \mathrm { s p a t i a l } } { = } 3 8 4$ and $d _ { \mathrm { f f n } } { = } 3 0 7 2$ . Each gMLP model has $_ { \mathrm { L } = 3 6 }$ layers with $d _ { \mathrm { m o d e l } } = 5 1 2$ and $d _ { \mathrm { f f n } } = 3 0 7 2$ . No positional encodings are used for Mixer or gMLPs.
120
+
121
+ <table><tr><td>Model</td><td>Perplexity*</td><td>Params (M)</td></tr><tr><td>BERTbase</td><td>4.37</td><td>110</td></tr><tr><td>BERTbase + rel pos</td><td>4.26</td><td>110</td></tr><tr><td>BERTbase + rel pos - attn</td><td>5.64</td><td>96</td></tr><tr><td>MLP-Mixer</td><td>5.34</td><td>112</td></tr><tr><td>Linear gMLP,s(Z)= f(Z)</td><td>5.14</td><td>92</td></tr><tr><td>Additive gMLP,s(Z)= Z+ f(Z)</td><td>4.97</td><td>92</td></tr><tr><td>Multiplicative gMLP,s(Z) = Z f(Z)</td><td>4.53</td><td>92</td></tr><tr><td>Multiplicative,Split gMLP,s(Z) = Z1 f(Z2),Z= Zi||Z2</td><td>4.35</td><td>102</td></tr></table>
122
+
123
+ Standard deviation across multiple independent runs is around 0.01.
124
+
125
+ ![](images/731fe5bbb1001c5b9f64529e6e9ed073521439ba52c88469a01d1124d0dfaa34.jpg)
126
+ Figure 4: Visualization of the spatial filters in $\mathrm { g M L P }$ learned on the MLM task. For each layer in the model we plot the row in $W$ associated with the token in the middle of the sequence. The $\mathbf { X }$ -axis of each subplot has a length of 128 which equal the number of tokens in the sequence. The learned filters appear to be smooth and have several types: forward-looking (e.g., 1st in 2nd row), backward-looking (e.g., 5th in 2nd row) and bi-directional (e.g., 2nd last in the last row).
127
+
128
+ # 4.2 Case Study: The Behavior of $\mathbf { g } \mathbf { M L P }$ as Model Size Increases
129
+
130
+ In Table 4, we investigate the scaling properties of Transformers and gMLPs in BERT as their model capacity grows. Specifically, we scale the depth of these models by a factor of $\{ 0 . 5 , 1 , 2 , 4 \} \times$ and report the their pretraining MLM perplexities on the validation set as well as finetuning results on the dev sets of two tasks in GLUE [41]. Note each individual Transformer layer is effectively two consecutive blocks: one for self-attention and one for FFN. In the table below we use the notation of $1 2 + 1 2$ to refer to 12 of self-attention blocks plus 12 of FFN blocks in the Transformer baselines.
131
+
132
+ Table 4: Pretraining and dev-set finetuning results over increased model capacity. We use the relative positional encoding scheme for Transformers which performs the best in Table 3.
133
+
134
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>#L</td><td rowspan=1 colspan=2>Params (M) Perplexity</td><td rowspan=1 colspan=1>SST-2 MNLI-m</td></tr><tr><td rowspan=1 colspan=1>TransformergMLP</td><td rowspan=1 colspan=1>6+618</td><td rowspan=1 colspan=1>6759</td><td rowspan=1 colspan=1>4.915.25</td><td rowspan=1 colspan=1>90.4 81.591.2 77.7</td></tr><tr><td rowspan=1 colspan=1>TransformergMLP</td><td rowspan=1 colspan=1>12+1236</td><td rowspan=1 colspan=1>110102</td><td rowspan=1 colspan=1>4.264.35</td><td rowspan=1 colspan=1>91.3 83.392.3 80.9</td></tr><tr><td rowspan=1 colspan=1>TransformergMLP</td><td rowspan=1 colspan=1>24+2472</td><td rowspan=1 colspan=1>195187</td><td rowspan=1 colspan=1>3.833.79</td><td rowspan=1 colspan=1>92.1 85.293.5 82.8</td></tr><tr><td rowspan=1 colspan=1>TransformergMLP</td><td rowspan=1 colspan=1>48+48144</td><td rowspan=1 colspan=1>365357</td><td rowspan=1 colspan=1>3.473.43</td><td rowspan=1 colspan=1>92.8 86.395.1 84.6</td></tr></table>
135
+
136
+ The results above show that a deep enough gMLP is able to match and even outperform the perplexity of Transformers with comparable capacity.4 In addition, the perplexity-parameter relationships for both architecture families approximately follow a power law (left of Figure 5). This implies the empirical scaling laws originally observed for Transformer-based language models [42] might be broadly applicable across different model families.
137
+
138
+ ![](images/03ebb35b54fcbc8c3b3a364ab001ed17abb00c96397df6daed10ed232e24238b.jpg)
139
+ Figure 5: Scaling properties with respect to perplexity and finetuning accuracies. The figures show that for pretraining, gMLPs are equally good at optimizing perplexity as Transformers. For finetuning, the two model families exhibit comparable scalability despite task-specific offsets.
140
+
141
+ Table 4 also leads to an interesting observation that the pretraining perplexities across different model families are not equal in terms of finetuning. While gMLPs outperform Transformers on SST-2, they are worse on MNLI. The results imply that the finetuning performance for NLP tasks is a function of not only the perplexity but also the inductive bias in the architecture. Figure 5 shows that despite the architecture-specific discrepancies between pretraining and finetuning, gMLPs and Transformers exhibit comparable scalability (slope) on both finetuning tasks. This means one can always offset the gap by enlarging the model capacity. In other words, the results indicate that model scalability with respect to downstream metrics can be independent from the presence of self-attention.
142
+
143
+ # 4.3 Ablation: The Usefulness of Tiny Attention in BERT’s Finetuning
144
+
145
+ So far we have found that self-attention is not a required component to achieve strong MLM perplexity or scalability. At the meantime, we also identified NLP finetuning tasks where gMLPs transfer less well than Transformers (Table 4). The fact that our MLP-like model is advantageous on SST-2 but worse on MNLI is particularly informative—the former is a single-sentence task whereas the latter involves sentence pairs (premise and hypothesis) [43]. We suspect the role of self-attention during finetuning is related to cross-sentence alignment.
146
+
147
+ To isolate the effect of self-attention, we experiment with a hybrid model where a tiny self-attention block is attached to the gating function of gMLP (Figure 6). Since gMLP itself is already capable in capturing spatial relationships, we hypothesize that this extra self-attention module does not have to be heavy, and that its presence is more relevant than its capacity. A typical tiny attention module in our experiments has only a single head with size 64, significantly smaller than a typical multi-head self-attention in Transformers with 12 heads and a total size of 768. In the following, we refer to the hybrid model, namely $\mathrm { g M L P }$ with a tiny self-attention, as aMLP (“a” for attention).
148
+
149
+ # Pseudo-code for the tiny attention module
150
+
151
+ def tiny_attn(x, d_out, d_attn=64): qkv $=$ proj(x, 3 ∗ d_attn, axis="channel") q, k, v $=$ split(qkv, 3, axis="channel") $\kappa =$ einsum("bnd,bmd−>bnm", q, k) a = softmax(w $^ *$ rsqrt(d_attn)) x = einsum("bnm,bmd−>bnd", a, v) return proj(x, d_out, axis="channel")
152
+
153
+ ![](images/e228c75c14097e90bf3596da75b5d6c0ccbec039247e6155396cb13236ea093c.jpg)
154
+ Figure 6: Hybrid spatial gating unit with a tiny self-attention module. We use the normalized input of the $\mathrm { g M L P }$ block (endpoint after the input normalization and right before the channel expansion) as the input to the tiny self-attention. For SGU we have ${ d _ { \mathrm { o u t } } = d _ { \mathrm { f f n } } / 2 }$ due to the channel split.
155
+
156
+ In Figure 7, we investigate the transferability of MLM models via the calibration plots between their pretraining perplexities and finetuning metrics. Models evaluated include $\mathbf { B E R T _ { b a s e } }$ , gMLP and its hybrid version aMLP with a 64-d single-head self-attention (Figure 6). The data points were collected by varying the model depth by $\{ 0 . 5 , 1 , 2 \} \times$ or data by $\{ 1 , 2 , 4 , 8 \} \times$ . It can be seen that gMLPs transfer better to SST-2 than Transformers regardless of the presence of self-attention, While gMLP performs worse on MNLI, attaching a tiny bit of self-attention is sufficient to close the gap. In Appendix D we visualize the tiny self-attention modules in aMLP over MNLI examples, showing that they are primarily responsible for the alignment between sentence pairs.
157
+
158
+ ![](images/263412114ce248c9b9dccbc4dbdcbba36ac2aa648dce820d76c34069690a0cd1.jpg)
159
+ Figure 7: Transferability from MLM pretraining perpexity to finetuning accuracies on GLUE. aMLP refers to $\mathrm { g M L P }$ enhanced with a 64-d single-head self-attention, as illustrated in Figure 6. In contrast, each self-attention module in the BERT baseline contains 12 heads with a total size of 768.
160
+
161
+ In Figure 8 we put together the scaling properties of the three models, showing that aMLP $\mathrm { ( g M L P + }$ tiny attention) consistently outperforms Transformer on both finetuning tasks.
162
+
163
+ ![](images/395d749d892cbad8add03840c7c07a237a2c72cef704c6aff4263e86c3de1d09.jpg)
164
+ Figure 8: Comparing the scaling properties of Transformers, $\mathrm { g M L P s }$ and aMLPs (with 64-d, singlehead attention). Results were obtained using the same setup in Section 4.2.
165
+
166
+ # 4.4 Main Results for MLM in the BERT Setup
167
+
168
+ Below we present pretraining and finetuning results in the full BERT setup. Different from ablation and case studies, here we use the full English C4 dataset and adopt a common MLM setup with batch size 256, max length 512 and 1M training steps. For fair comparison, we adjust the depth and width of $\mathrm { g M L P s }$ to ensure comparable model capacity with the Transformer baselines. The model specifications are given in Table 5 and hyperparameters are detailed in Appendix A.2. For finetuning, we report the dev-set performance for SST-2 and MNLI in GLUE [41] and each result entry was obtained by taking the median of five independent runs. In addition, we report finetuning results on SQuAD [44, 45] to test the models’ ability in reasoning over a longer context.
169
+
170
+ Results are presented in Table 6. Consistent with our findings earlier in Section 4.1 and Section 4.2, gMLPs are competitive with Transformers in terms of perplexity, especially in the larger scale setup. There are several observations related to the finetuning results:
171
+
172
+ First, on finetuning tasks where gMLPs underperform Transformers, the performance gap tends to narrow as the model capacity increases. For example, while $\mathrm { g M L P }$ performs worse by $8 . 5 \%$ on SQuAD-v2.0 in the base scale, the performance gap relative to the baseline decreases to $2 . 7 \%$ at the larger scale. Notably, our ${ \mathrm { g M L P } } _ { \mathrm { l a r g e } }$ achieves $8 9 . 5 \%$ F1 on SQuAD-v1.1 without any self-attention or dynamic spatial parameterization [28], which is well above the $8 8 . 5 \%$ reported for $\mathbf { B E R T _ { b a s e } }$ in Devlin et al. [2] and is only $1 . 4 \%$ away from the original result for $\mathbf { B E R T _ { l a r g e } }$ . We also include one additional data point by scaling up $\mathrm { g M L P }$ even further. The resulting model, $\mathrm { g } \mathrm { \bar { M } L P _ { \mathrm { x l a r g e } } }$ , outperforms $\mathbf { B E R T _ { l a r g e } }$ on SQuAD- $\mathbf { \nabla } \cdot \mathbf { v } 2 . 0 $ —a difficult task involving question-answer pairs—without any self-attention. While this is not a fair comparison due to different model sizes, it is an existence proof that MLP-like models can be competitive with Transformers on challenging NLP tasks.
173
+
174
+ Table 5: Model specifications in the full BERT setup.
175
+
176
+ <table><tr><td></td><td>Params (M)</td><td>FLOPs (B)</td><td>#L</td><td>dmodel</td><td>dffn</td></tr><tr><td rowspan="3">BERTbase gMLPbase aMLPbase</td><td>110</td><td>100.8</td><td>12+12</td><td>768</td><td>3072</td></tr><tr><td>130</td><td>158.0</td><td>48</td><td>512</td><td>3072</td></tr><tr><td>109</td><td>128.9</td><td>36</td><td>512</td><td>3072</td></tr><tr><td rowspan="3">BERTlarge gMLPlarge aMLPlarge</td><td>336</td><td>341.2</td><td>24+24</td><td>1024</td><td>4096</td></tr><tr><td>365</td><td>430.1</td><td>96</td><td>768</td><td>3072</td></tr><tr><td>316</td><td>370.3</td><td>72</td><td>768</td><td>3072</td></tr><tr><td> gMLPxlarge</td><td>941</td><td>1091.3</td><td>144</td><td>1024</td><td>4096</td></tr></table>
177
+
178
+ Table 6: Pretraining perplexities and dev-set results for finetuning. “ours” indicates models trained using our setup. We report accuracies for SST-2 and MNLI, and F1 scores for SQuAD v1.1/2.0.
179
+
180
+ <table><tr><td rowspan="2"></td><td rowspan="2">Perplexity</td><td rowspan="2">SST-2</td><td rowspan="2">MNLI (m/mm)</td><td colspan="2">SQuAD</td><td rowspan="2">Attn Size</td><td rowspan="2">Params (M)</td></tr><tr><td>v1.1</td><td>v2.0</td></tr><tr><td>BERTbase [2]</td><td>1</td><td>92.7</td><td>84.4/-</td><td>88.5</td><td>76.3</td><td>768 (64 × 12)</td><td>110</td></tr><tr><td>BERTbase (ours)</td><td>4.17</td><td>93.8</td><td>85.6/85.7</td><td>90.2</td><td>78.6</td><td>768 (64 × 12)</td><td>110</td></tr><tr><td>gMLPbase</td><td>4.28</td><td>94.2</td><td>83.7/84.1</td><td>86.7</td><td>70.1</td><td>1</td><td>130</td></tr><tr><td>aMLPbase</td><td>3.95</td><td>93.4</td><td>85.9/85.8</td><td>90.7</td><td>80.9</td><td>64</td><td>109</td></tr><tr><td>BERTlarge [2]</td><td>1</td><td>93.7</td><td>86.6/-</td><td>90.9</td><td>81.8</td><td>1024 (64 × 16)</td><td>336</td></tr><tr><td>BERTlarge (ours)</td><td>3.35</td><td>94.3</td><td>87.0/87.4</td><td>92.0</td><td>81.0</td><td>1024 (64 × 16)</td><td>336</td></tr><tr><td>gMLPlarge</td><td>3.32</td><td>94.8</td><td>86.2/86.5</td><td>89.5</td><td>78.3</td><td>1</td><td>365</td></tr><tr><td>aMLPlarge</td><td>3.19</td><td>94.8</td><td>88.4/88.4</td><td>92.2</td><td>85.4</td><td>128</td><td>316</td></tr><tr><td>gMLPxlarge</td><td>2.89</td><td>95.6</td><td>87.7/87.7</td><td>90.9</td><td>82.1</td><td>1</td><td>941</td></tr></table>
181
+
182
+ Furthermore, we show that blending in a tiny single-head self-attention of size either 64 or 128 is sufficient to make gMLPs outperform Transformers of similar capacity, sometimes by a significant margin. For example, our hybrid model $\mathrm { a M L P _ { l a r g e } }$ achieves $4 . 4 \%$ higher F1 than Transformers on SQuAD-v2.0. The results suggest that the capacity in the multi-head self-attention of Transformers can be largely redundant, and that the majority of its functionalities can be captured by the spatial gating unit in gMLPs. The results also imply that the inductive biases in the spatial gating unit of gMLPs and the tiny attention are complementary to each other. While the benefits of architectural inductive bias may vanish over increased compute, tiny attention does improve the practical value of gMLPs in the regime that we investigate in this work.
183
+
184
+ # 5 Conclusion
185
+
186
+ Since the seminal work of Vaswani et al. [1], Transformers have been widely adopted across NLP and computer vision. This adoption has enabled many impressive results especially in NLP. To date, it is still unclear what empowers such success: is it the feedforward nature of Transformers or is it the multi-head self-attention layers in Transformers?
187
+
188
+ Our work suggests a simpler alternative to the multi-head self-attention layers in Transformers. We show that gMLPs, a simple variant of MLPs with gating, can be competitive with Transformers in terms of BERT’s pretraining perplexity and ViT’s accuracy. gMLPs are also comparable with Transformers in terms of the scalability over increased data and compute. As for BERT finetuning, we find gMLPs can achieve appealing results on challenging tasks such as SQuAD without self-attention, and can significantly outperform Transformers in certain cases. We also find the inductive bias in Transformer’s multi-head self-attention useful on downstream tasks that require cross-sentence alignment. However in those cases, making gMLP substantially larger closes the gap with Transformers. More practically, blending a small single-head self-attention into gMLP allows for an even better architecture without the need for increasing model size.
189
+
190
+ # Acknowledgements
191
+
192
+ We thank Gabriel Bender, Neil Houlsby, Thang Luong, Niki Parmar, Hieu Pham, Jascha SohlDickstein, Noam Shazeer, Ilya Sutskever, Jakob Uszkoreit and Ashish Vaswani for their feedback.
193
+
194
+ # References
195
+
196
+ [1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017.
197
+ [2] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2018.
198
+ [3] Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems, 2019.
199
+ [4] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. [5] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 2020.
200
+ [6] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. In Advances in Neural Information Processing Systems, 2020.
201
+ [7] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. [8] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
202
+ [9] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
203
+ [10] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021.
204
+ [11] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 1997.
205
+ [12] Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Computation, 1989.
206
+ [13] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in Neural Information Processing Systems, 2012.
207
+ [14] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
208
+ [15] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015.
209
+ [16] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
210
+ [17] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In ICML, 2019.
211
+ [18] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
212
+ [19] Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
213
+ [20] Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
214
+ [21] Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet. arXiv preprint arXiv:2105.02723, 2021.
215
+ [22] Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021.
216
+ [23] Xiaohan Ding, Xiangyu Zhang, Jungong Han, and Guiguang Ding. Repmlp: Reparameterizing convolutions into fully-connected layers for image recognition. arXiv preprint arXiv:2105.01883, 2021.
217
+ [24] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
218
+ [25] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In CVPR, 2018.
219
+ [26] Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In ICML, 2017.
220
+ [27] Noam Shazeer. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020.
221
+ [28] Felix Wu, Angela Fan, Alexei Baevski, Yann N Dauphin, and Michael Auli. Pay less attention with lightweight and dynamic convolutions. In ICLR, 2019.
222
+ [29] Rupesh Kumar Srivastava, Klaus Greff, and Jürgen Schmidhuber. Highway networks. arXiv preprint arXiv:1505.00387, 2015.
223
+ [30] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In CVPR, 2018.
224
+ [31] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
225
+ [32] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In ECCV, 2016.
226
+ [33] Andrew Brock, Soham De, Samuel L Smith, and Karen Simonyan. High-performance largescale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021.
227
+ [34] Mingxing Tan and Quoc V Le. Efficientnetv2: Smaller models and faster training. In ICML, 2021.
228
+ [35] Irwan Bello. Lambdanetworks: Modeling long-range interactions without attention. In ICLR, 2021.
229
+ [36] Ashish Vaswani, Prajit Ramachandran, Aravind Srinivas, Niki Parmar, Blake Hechtman, and Jonathon Shlens. Scaling local self-attention for parameter efficient visual backbones. In CVPR, 2021.
230
+ [37] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. arXiv preprint arXiv:2101.11605, 2021.
231
+ [38] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv preprint arXiv:2103.15808, 2021.
232
+ [39] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In CVPR, 2020.
233
+ [40] Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking self-attention in transformer models. arXiv preprint arXiv:2005.00743, 2020.
234
+ [41] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019.
235
+ [42] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
236
+ [43] Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL, 2017.
237
+ [44] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In EMNLP, 2016.
238
+ [45] Pranav Rajpurkar, Robin Jia, and Percy Liang. Know what you don’t know: Unanswerable questions for squad. In ACL, 2018.
239
+ [46] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
240
+ [47] Mingxing Tan, Ruoming Pang, and Quoc V Le. Efficientdet: Scalable and efficient object detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10781–10790, 2020.
241
+ [48] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
242
+ [49] Josh Beal, Eric Kim, Eric Tzeng, Dong Huk Park, Andrew Zhai, and Dmitry Kislyuk. Toward transformer-based object detection. arXiv preprint arXiv:2012.09958, 2020.
md/train/OJiM1R3jAtZ/OJiM1R3jAtZ.md ADDED
@@ -0,0 +1,450 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AWAC: ACCELERATING ONLINE REINFORCEMENTLEARNING WITH OFFLINE DATASETS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Reinforcement learning provides an appealing formalism for learning control policies from experience. However, the classic active formulation of reinforcement learning necessitates a lengthy active exploration process for each behavior, making it difficult to apply in real-world settings. If we can instead allow reinforcement learning to effectively use previously collected data to aid the online learning process, where the data could be expert demonstrations or more generally any prior experience, we could make reinforcement learning a substantially more practical tool. While a number of recent methods have sought to learn offline from previously collected data, it remains exceptionally difficult to train a policy with offline data and improve it further with online reinforcement learning. In this paper we systematically analyze why this problem is so challenging, and propose an algorithm that combines sample-efficient dynamic programming with maximum likelihood policy updates, providing a simple and effective framework that is able to leverage large amounts of offline data and then quickly perform online fine-tuning of reinforcement learning policies. We show that our method enables rapid learning of skills with a combination of prior demonstration data and online experience across a suite of difficult dexterous manipulation and benchmark tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Learning models that generalize effectively to complex open-world settings, from image recognition (Krizhevsky et al., 2012) to natural language processing (Devlin et al., 2019), relies on large, high-capacity models and large, diverse, and representative datasets. Leveraging this recipe for reinforcement learning (RL) has the potential to yield real-world generalization for control applications such as robotics. However, while deep RL algorithms enable the use of large models, the use of large datasets for real-world RL has proven challenging. Most RL algorithms collect new data online every time a new policy is learned, which limits the size and diversity of the datasets for RL. In the same way that powerful models in computer vision and NLP are often pre-trained on large, general-purpose datasets and then fine-tuned on task-specific data, RL policies that generalize effectively to open-world settings will need to be able to incorporate large amounts of prior data effectively into the learning process, while still collecting additional data online for the task at hand.
12
+
13
+ For data-driven reinforcement learning, offline datasets consist of trajectories of states, actions and associated rewards. This data can potentially come from demonstrations for the desired task (Schaal, 1997; Atkeson & Schaal, 1997), suboptimal policies (Gao et al., 2018), demonstrations for related tasks (Zhou et al., 2019), or even just random exploration in the environment. Depending on the quality of the data that is provided, useful knowledge can be extracted about the dynamics of the world, about the task being solved, or both. Effective data-driven methods for deep reinforcement learning should be able to use this data to pre-train offline while improving with online fine-tuning.
14
+
15
+ Since this prior data can come from a variety of sources, we would like to design an algorithm that does not utilize different types of data in any privileged way. For example, prior methods that incorporate demonstrations into RL directly aim to mimic these demonstrations (Nair et al., 2018), which is desirable when the demonstrations are known to be optimal, but imposes strict requirements on the type of offline data, and can cause undesirable bias when the prior data is not optimal. While prior methods for fully offline RL provide a mechanism for utilizing offline data (Fujimoto et al., 2019; Kumar et al., 2019), as we will show in our experiments, such methods generally are not effective for fine-tuning with online data as they are often too conservative. In effect, prior methods require us to choose: Do we assume prior data is optimal or not? Do we use only offline data, or only online data? To make it feasible to learn policies for open-world settings, we need algorithms that learn successfully in any of these cases.
16
+
17
+ In this work, we study how to build RL algorithms that are effective for pre-training from offpolicy datasets, but also well suited to continuous improvement with online data collection. We systematically analyze the challenges with using standard off-policy RL algorithms (Haarnoja et al., 2018; Kumar et al., 2019; Abdolmaleki et al., 2018) for this problem, and introduce a simple actor critic algorithm that elegantly bridges data-driven pre-training from offline data and improvement with online data collection. Our method, which uses dynamic programming to train a critic but a supervised learning style update to train a constrained actor, combines the best of supervised learning and actor-critic algorithms. Dynamic programming can leverage off-policy data and enable sample-efficient learning. The simple supervised actor update implicitly enforces a constraint that mitigates the effects of distribution shift when learning from offline data (Fujimoto et al., 2019; Kumar et al., 2019), while avoiding overly conservative updates.
18
+
19
+ We evaluate our algorithm on a wide variety of robotic control and benchmark tasks across three simulated domains: dexterous manipulation, tabletop manipulation, and MuJoCo control tasks. Our algorithm, Advantage Weighted Actor Critic (AWAC), is able to quickly learn successful policies on difficult tasks with high action dimension and binary sparse rewards, significantly better than prior methods for off-policy and offline reinforcement learning. Moreover, AWAC can utilize different types of prior data without any algorithmic changes: demonstrations, suboptimal data, or random exploration data. The contribution of this work is not just another RL algorithm, but a systematic study of what makes offline pre-training with online fine-tuning unique compared to the standard RL paradigm, which then directly motivates a simple algorithm, AWAC, to address these challenges.
20
+
21
+ # 2 PRELIMINARIES
22
+
23
+ We consider the standard reinforcement learning notation, with states s, actions a, policy $\pi ( \mathbf { a } | \mathbf { s } )$ , rewards $r ( \mathbf { s } , \mathbf { a } )$ , and dynamics $p ( \mathbf { s } ^ { \prime } | \mathbf { s } , \mathbf { a } )$ . The discounted return is defined as $\begin{array} { r } { R _ { t } = \sum _ { i = t } ^ { T } \gamma ^ { i } r ( \mathbf { s } _ { i } , \mathbf { a } _ { i } ) } \end{array}$ , for a discount factor $\gamma$ and horizon $T$ which may be infinite. The objective of an $\mathrm { R L }$ agent is to maximize the expected discounted return $J ( \pi ) { \stackrel { } { = } } \mathrm { { \mathbb E } } _ { p _ { \pi } ( \tau ) } [ R _ { 0 } ]$ under the distribution induced by the policy. The optimal policy can be learned directly by policy gradient, estimating $\nabla J ( \pi )$ (Williams, 1992), but this is often ineffective due to high variance of the estimator. Many algorithms attempt to reduce this variance by making use of the value function $V ^ { \pi } ( \mathbf { s } ) = \mathbb { E } _ { p _ { \pi } ( \tau ) } [ R _ { t } ] \mathbf { s }$ , action-value function $Q ^ { \pi } ( \mathbf { s } , \mathbf { a } ) = \mathbb { E } _ { p _ { \pi } ( \tau ) } [ R _ { t } | \mathbf { s } , \mathbf { a } ]$ , or advantage $A ^ { \pi } ( \mathbf { s } , \mathbf { a } ) = Q ^ { \pi } ( \mathbf { s } , \mathbf { a } ) - V ^ { \pi } ( \mathbf { s } )$ . The action-value function for a policy can be written recursively via the Bellman equation:
24
+
25
+ $$
26
+ \begin{array} { r } { Q ^ { \pi } ( \mathbf { s } , \mathbf { a } ) = r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { p ( \mathbf { s } ^ { \prime } \mid \mathbf { s } , \mathbf { a } ) } [ V ^ { \pi } ( \mathbf { s } ^ { \prime } ) ] = r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { p ( \mathbf { s } ^ { \prime } \mid \mathbf { s } , \mathbf { a } ) } [ \mathbb { E } _ { \pi ( \mathbf { a } ^ { \prime } \mid \mathbf { s } ^ { \prime } ) } [ Q ^ { \pi } ( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } ) ] ] . } \end{array}
27
+ $$
28
+
29
+ Instead of estimating policy gradients directly, actor-critic algorithms maximize returns by alternating between two phases (Konda $\&$ Tsitsiklis, 2000): policy evaluation and policy improvement. During the policy evaluation phase, the critic $Q ^ { \pi } ( \mathbf { s } , \mathbf { a } )$ is estimated for the current policy $\pi$ . This can be accomplished by repeatedly applying the Bellman operator $\boldsymbol { B }$ , corresponding to the right-hand side of Equation 1, as defined below:
30
+
31
+ $$
32
+ \begin{array} { r } { B ^ { \pi } Q ( \mathbf { s } , \mathbf { a } ) = r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { p ( \mathbf { s } ^ { \prime } \mid \mathbf { s } , \mathbf { a } ) } [ \mathbb { E } _ { \pi ( \mathbf { a } ^ { \prime } \mid \mathbf { s } ^ { \prime } ) } [ Q ^ { \pi } ( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } ) ] ] . } \end{array}
33
+ $$
34
+
35
+ By iterating according to $Q ^ { k + 1 } = B ^ { \pi } Q ^ { k }$ , $Q ^ { k }$ converges to $Q ^ { \pi }$ (Sutton & Barto, 1998). With function approximation, we cannot apply the Bellman operator exactly, and instead minimize the Bellman error with respect to Q-function parameters $\phi _ { k }$ :
36
+
37
+ $$
38
+ \phi _ { k } = \arg \operatorname* { m i n } _ { \phi } \mathbb { E } _ { \mathcal { D } } [ ( Q _ { \phi } ( \mathbf { s } , \mathbf { a } ) - y ) ^ { 2 } ] , y = r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } } [ Q _ { \phi _ { k - 1 } } ( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } ) ] .
39
+ $$
40
+
41
+ During policy improvement, the actor $\pi$ is typically updated based on the current estimate of $Q ^ { \pi }$ . A commonly used technique (Lillicrap et al., 2016; Fujimoto et al., 2018; Haarnoja et al., 2018) is to update the actor $\pi _ { \boldsymbol { \theta } _ { k } } ( \mathbf { a } | \mathbf { s } )$ via likelihood ratio or pathwise derivatives to optimize the following objective, such that the expected value of the Q-function $Q ^ { \pi }$ is maximized:
42
+
43
+ $$
44
+ \theta _ { k } = \underset { \theta } { \arg \operatorname* { m a x } } \mathbb { E } _ { \mathbf { s } \sim \mathcal { D } } [ \mathbb { E } _ { \pi _ { \theta } ( \mathbf { a } | \mathbf { s } ) } [ Q _ { \phi _ { k } } ( \mathbf { s } , \mathbf { a } ) ] ]
45
+ $$
46
+
47
+ Actor-critic algorithms are widely used in deep RL (Mnih et al., 2016; Lillicrap et al., 2016; Haarnoja et al., 2018; Fujimoto et al., 2018). With a Q-function estimator, they can in principle utilize off-policy data when used with a replay buffer for storing prior transition tuples, which we will denote $\beta$ , to sample previous transitions, although we show that this by itself is insufficient for our problem setting.
48
+
49
+ ![](images/bbef2df79cb430c48f9e041b069bca905014e51b8392f3e3f8ee5d4025aa8770.jpg)
50
+ Figure 1: We study learning policies by offline learning on a prior dataset $\mathcal { D }$ and then fine-tuning with online interaction. The prior data could be obtained via prior runs of RL, expert demonstrations, or any other source of transitions. Our method, advantage weighted actor critic (AWAC) is able to learn effectively from offline data and fine-tune in order to reach expert-level performance after collecting a limited amount of interaction data. Videos and data are available at sites.google.com/view/awac-anonymous
51
+
52
+ # 3 CHALLENGES IN OFFLINE RL WITH ONLINE FINE-TUNING
53
+
54
+ In this section, we study the unique challenges that exist when pre-training using offline data, followed by fine-tuning with online data collection. We first describe the problem, and then analyze what makes this problem difficult for prior methods.
55
+
56
+ Problem definition. A static dataset of transitions, $\mathcal { D } = \{ ( \mathbf { s } , \mathbf { a } , \mathbf { s } ^ { \prime } , r ) _ { j } \}$ , is provided to the algorithm at the beginning of training. This dataset can be sampled from an arbitrary policy or mixture of policies, and may even be collected by a human expert. This definition is general and encompasses many scenarios, such as learning from demonstrations, random data, prior RL experiments, or even from multi-task data. Given the dataset $\mathcal { D }$ , our goal is to leverage $\mathcal { D }$ for pre-training and use some online interaction to learn the optimal policy $\pi ^ { * } ( \mathbf { a } | \mathbf { s } )$ , with as few interactions with the environment as possible (depicted in Fig 1). This setting is representative of many real-world RL settings, where prior data is available and the aim is to learn new skills efficiently. We first study existing algorithms empirically in this setting on the HalfCheetah-v2 Gym environment1. The prior dataset consists of 15 demonstrations from an expert policy and 100 suboptimal trajectories sampled from a behavioral clone of these demonstrations. All methods for the remainder of this paper incorporate the prior dataset, unless explicitly labeled “scratch”.
57
+
58
+ 3.1) Data Efficiency. One of the simplest ways to utilize prior data such as demonstrations for RL is to pre-train a policy with imitation learning, and fine-tune with on-policy RL (Gupta et al., 2019; Rajeswaran et al., 2018). This approach has two drawbacks: (1) prior data may not be optimal; (2) on-policy fine-tuning is data inefficient as it does not reuse the prior data in the RL stage. In our setting, data efficiency is vital. To this end, we require algorithms that are able to reuse arbitrary offpolicy data during online RL for data-efficient fine-tuning. We find that algorithms that use on-policy fine-tuning (Rajeswaran et al., 2018; Gupta et al., 2019), or Monte-Carlo return estimation (Peters & Schaal, 2007; Wang et al., 2018; Peng et al., 2019) are generally much less efficient than off-policy actor-critic algorithms, which iterate between improving $\pi$ and estimating $Q ^ { \pi }$ via Bellman backups. This can be seen from the results in Figure 2 plot 1, where on-policy methods like DAPG (Rajeswaran et al., 2018) and Monte-Carlo return methods like AWR (Peng et al., 2019) and MARWIL (Wang et al., 2018) are an order of magnitude slower than off-policy actor-critic methods. Actor-critic methods, shown in Figure 2 plot 2, can in principle use off-policy data. However, as we will discuss next, naïvely applying these algorithms to our problem suffers from a different set of challenges.
59
+
60
+ 3.2) Bootstrap Error in Offline Learning with Actor-Critic Methods. When standard off-policy actor-critic methods are applied to this problem setting, they perform poorly, as shown in the second plot in Figure 2: despite having a prior dataset in the replay buffer, these algorithms do not benefit significantly from offline training. We evaluate soft actor critic (Haarnoja et al., 2018), a state-of-theart actor-critic algorithm for continuous control. Note that “SAC-scratch,” which does not receive the prior data, performs similarly to “SACfD-prior,” which does have access to the prior data, indicating that the off-policy RL algorithm is not actually able to make use of the off-policy data for pre-training. Moreover, even if the SAC is policy is pre-trained by behavior cloning, labeled “SACfD-pretrain”, we still observe an initial decrease in performance, and performance similar to learning from scratch.
61
+
62
+ This challenge can be attributed to off-policy bootstrapping error accumulation, as observed in several prior works (Sutton & Barto, 1998; Kumar et al., 2019; Wu et al., 2020; Levine et al., 2020;
63
+
64
+ ![](images/0f629f76d75942812dc48411f75d99a122f416749807b9f4b0e77175161a8bdc.jpg)
65
+ Figure 2: Analysis of prior methods on HalfCheetah-v2 using offline RL with online fine-tuning. (1) On-policy methods (DAPG, AWR, MARWIL) learn relatively slowly, even with access to prior data. We present our method, AWAC, as an example of how off-policy RL methods can learn much faster. (2) Variants of soft actorcritic (SAC) with offline training (performed before timestep 0) and fine-tuning. We see a “dip” in the initial performance, even if the policy is pretrained with behavioral cloning. (3) Offline RL method BEAR (Kumar et al., 2019) on offline training and fine-tuning, including a “loose” variant of BEAR with a weakened constraint. Standard offline RL methods fine-tune slowly, while the “loose” BEAR variant experiences a similar dip as SAC. (4) We show that the fit of the behavior models $\hat { \pi } _ { \beta }$ used by these offline methods degrades as new data is added to the buffer during fine-tuning, potentially explaining their poor fine-tuning performance.
66
+
67
+ Fujimoto et al., 2019). In actor-critic algorithms, the target value $Q ( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } )$ , with $\mathbf { a } ^ { \prime } \sim \pi$ , is used to update $Q ( \mathbf { s } , \mathbf { a } )$ . When $\mathbf { a } ^ { \prime }$ is outside of the data distribution, $Q ( \mathbf { s } ^ { \prime } , \mathbf { \bar { a } } ^ { \prime } )$ will be inaccurate, leading to accumulation of error on static datasets.
68
+
69
+ Offline RL algorithms (Fujimoto et al., 2019; Kumar et al., 2019; Wu et al., 2020) propose to address this issue by explicitly adding constraints on the policy improvement update (Equation 4) to avoid bootstrapping on out-of-distribution actions, leading to a policy update of this form:
70
+
71
+ $$
72
+ \arg \operatorname* { m a x } _ { \boldsymbol { \theta } } \mathbb { E } _ { \mathbf { s } \sim \mathcal { D } } [ \mathbb { E } _ { \pi _ { \boldsymbol { \theta } } ( \mathbf { a } | \mathbf { s } ) } [ Q _ { \boldsymbol { \phi } _ { k } } ( \mathbf { s } , \mathbf { a } ) ] ] \mathrm { ~ s . t . ~ } D ( \pi _ { \boldsymbol { \theta } } , \pi _ { \boldsymbol { \beta } } ) \leq \epsilon .
73
+ $$
74
+
75
+ Here, $\pi _ { \theta }$ is the actor being updated, and $\pi _ { \beta } ( a | s )$ represents the (potentially unknown) distribution from which all of the data seen so far (both offline data and online data) was generated. In the case of a replay buffer, $\pi _ { \beta }$ corresponds to a mixture distribution over all past policies. Typically, $\pi _ { \beta }$ is not known, especially for offline data, and must be estimated from the data itself. Many offline RL algorithms (Kumar et al., 2019; Fujimoto et al., 2019; Siegel et al., 2020) explicitly fit a parametric model to samples for the distribution $\pi _ { \beta }$ via maximum likelihood estimation, where samples from $\pi _ { \beta }$ are obtained simply by sampling uniformly from the data seen thus far: $\hat { \pi } _ { \beta } =$ $\begin{array} { r } { \operatorname* { m a x } _ { \hat { \pi } _ { \beta } } \ { \mathbb E } _ { { \mathbf s } , { \mathbf a } \sim \pi _ { \beta } } \big [ \log \hat { \pi } _ { \beta } ( { \mathbf a } | { \mathbf s } ) \big ] } \end{array}$ . After estimating $\hat { \pi } _ { \beta }$ , prior methods implement the constraint given in Equation 5 in various ways, including penalties on the policy update (Kumar et al., 2019; Wu et al., 2020) or architecture choices for sampling actions for policy training (Fujimoto et al., 2019; Siegel et al., 2020). As we will see next, the requirement for accurate estimation of $\hat { \pi } _ { \beta }$ makes these methods difficult to use with online fine-tuning.
76
+
77
+ 3.3) Excessively Conservative Online Learning. While offline RL algorithms with constraints (Kumar et al., 2019; Fujimoto et al., 2019; Wu et al., 2020) perform well offline, they struggle to improve with fine-tuning, as shown in the third plot in Figure 2. We see that the purely offline RL performance (at $^ { 6 6 } 0 \mathrm { K } ^ { 5 }$ in Fig. 2) is much better than the standard off-policy methods shown in Section 3.2. However, with additional iterations of online fine-tuning, the performance increases very slowly (as seen from the slope of the BEAR curve in Fig 2). What causes this phenomenon?
78
+
79
+ This can be attributed to challenges in fitting an accurate behavior model as data is collected online during fine-tuning. In the offline setting, behavior models must only be trained once via maximum likelihood, but in the online setting, the behavior model must be updated online to track incoming data. Training density models online (in the “streaming” setting) is a challenging research problem (Ramapuram et al., 2017), made more difficult by a potentially complex multi-modal behavior distribution induced by the mixture of online and offline data. To understand this, we plot the log likelihood of learned behavior models on the dataset during online and offline training for the HalfCheetah task. As we can see in the plot, the accuracy of the behavior models $( \log \pi _ { \beta }$ on the y-axis) reduces during online fine-tuning, indicating that it is not fitting the new data well during online training. When the behavior models are inaccurate or unable to model new data well, constrained optimization becomes too conservative, resulting in limited improvement with fine-tuning. This analysis suggests that, in order to address our problem setting, we require an off-policy RL algorithm that constrains the policy to prevent offline instability and error accumulation, but not so conservatively that it prevents online fine-tuning due to imperfect behavior modeling. Our proposed algorithm, which we discuss in the next section, accomplishes this by employing an implicit constraint, which does not require any explicit modeling of the behavior policy.
80
+
81
+ # 4 ADVANTAGE WEIGHTED ACTOR CRITIC: A SIMPLE ALGORITHM FORFINE-TUNING FROM OFFLINE DATASETS
82
+
83
+ In this section, we will describe the advantage weighted actor-critic (AWAC) algorithm, which trains an off-policy critic and an actor with an implicit policy constraint. We will show AWAC mitigates the challenges outlined in Section 3. AWAC follows the design for actor-critic algorithms as described in Section 2, with a policy evaluation step to learn $Q ^ { \pi }$ and a policy improvement step to update $\pi$ . AWAC uses off-policy temporal-difference learning to estimate $Q ^ { \pi }$ in the policy evaluation step, and a policy improvement update that is able to obtain the benefits of offline RL algorithms at training from prior datasets, while avoiding the overly conservative behavior described in Section 3.3. We describe the policy improvement step in AWAC below, and then summarize the entire algorithm.
84
+
85
+ Policy improvement for AWAC proceeds by learning a policy that maximizes the value of the critic learned in the policy evaluation step via TD bootstrapping. If done naively, this can lead to the issues described in Section 3.3, but we can avoid the challenges of bootstrap error accumulation by restricting the policy distribution to stay close to the data observed thus far during the actor update, while maximizing the value of the critic. At iteration $k$ , AWAC therefore optimizes the policy to maximize the estimated Q-function $Q ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } )$ at every state, while constraining it to stay close to the actions observed in the data, similar to prior offline RL methods, though this constraint will be enforced differently. Note from the definition of the advantage in Section 2 that optimizing $Q ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } )$ is equivalent to optimizing $A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } )$ . We can therefore write this optimization as:
86
+
87
+ $$
88
+ \pi _ { k + 1 } = \underset { \pi \in \Pi } { \mathrm { a r g } \mathrm { m a x } } ~ \mathbb { E } _ { \mathbf { a } \sim \pi ( \cdot | \mathbf { s } ) } [ A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) ] \mathrm { ~ s . t . ~ } D _ { \mathrm { K L } } ( \pi ( \cdot | \mathbf { s } ) | | \pi _ { \beta } ( \cdot | \mathbf { s } ) ) \leq \epsilon .
89
+ $$
90
+
91
+ As we saw in Section 3.2, enforcing the constraint by incorporating an explicit learned behavior model (Kumar et al., 2019; Fujimoto et al., 2019; Wu et al., 2020; Siegel et al., 2020) leads to poor fine-tuning performance. Instead, we enforce the constraint implicitly, without learning a behavior model. We first derive the solution to the constrained optimization in Equation 6 to obtain a nonparametric closed form for the actor. This solution is then projected onto the parametric policy class without any explicit behavior model. The analytic solution to Equation 6 can be obtained by enforcing the KKT conditions (Peters & Schaal, 2007; Peters et al., 2010; Peng et al., 2019). The Lagrangian is:
92
+
93
+ $$
94
+ \begin{array} { r } { \mathcal { L } ( \pi , \lambda ) = \mathbb { E } _ { \mathbf { a } \sim \pi ( \cdot | \mathbf { s } ) } [ A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) ] + \lambda ( \epsilon - D _ { \mathrm { K L } } ( \pi ( \cdot | \mathbf { s } ) | | \pi _ { \beta } ( \cdot | \mathbf { s } ) ) ) , } \end{array}
95
+ $$
96
+
97
+ and the closed form solution to this problem is $\begin{array} { r } { \pi ^ { * } ( { \bf a } | { \bf s } ) \propto \pi _ { \beta } ( { \bf a } | { \bf s } ) \exp \left( \frac { 1 } { \lambda } A ^ { \pi _ { k } } ( { \bf s } , { \bf a } ) \right) } \end{array}$ . When using function approximators, such as deep neural networks as we do, we need to project the non-parametric solution into our policy space. For a policy $\pi _ { \theta }$ with parameters $\theta$ , this can be done by minimizing the KL divergence of $\pi _ { \theta }$ from the optimal non-parametric solution $\pi ^ { * }$ under the data distribution $\rho _ { \pi _ { \beta } } ( \mathbf { s } )$ :
98
+
99
+ $$
100
+ \underset { \theta } { \arg \operatorname* { m i n } } \ \underset { \rho _ { \pi _ { \beta } } ( \mathbf { s } ) } { \mathbb { E } } \big [ D _ { \mathrm { K L } } \big ( \pi ^ { * } ( \cdot | \mathbf { s } ) | | \pi _ { \theta } ( \cdot | \mathbf { s } ) \big ) \big ] = \underset { \theta } { \arg \operatorname* { m i n } } \ \underset { \rho _ { \pi _ { \beta } } ( \mathbf { s } ) } { \mathbb { E } } \bigg [ \underset { \pi ^ { * } ( \cdot | \mathbf { s } ) } { \mathbb { E } } \big [ - \log \pi _ { \theta } ( \cdot | \mathbf { s } ) \big ] \bigg ]
101
+ $$
102
+
103
+ Note that the parametric policy could be projected with either direction of KL divergence. Choosing the reverse $\mathrm { K L }$ results in explicit penalty methods (Wu et al., 2020) that rely on evaluating the density of a learned behavior model. Instead, by using forward KL, we can compute the policy update by sampling directly from $\beta$ :
104
+
105
+ $$
106
+ \theta _ { k + 1 } = \arg \operatorname* { m a x } _ { \theta } \underset { \mathbf { s } , \mathbf { a } \sim \boldsymbol { \beta } } { \mathbb { E } } \left[ \log \pi _ { \theta } ( \mathbf { a } | \mathbf { s } ) \exp \left( \frac { 1 } { \lambda } A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) \right) \right] .
107
+ $$
108
+
109
+ This actor update amounts to weighted maximum likelihood (i.e., supervised learning), where the targets are obtained by re-weighting the state-action pairs observed in the current dataset by the predicted advantages from the learned critic, without explicitly learning any parametric behavior model, simply sampling $( s , a )$ from the replay buffer $\beta$ . See Appendix A.2 for a more detailed derivation and Appendix A.3 for specific implementation details.
110
+
111
+ Avoiding explicit behavior modeling. Note that the update in Equation 9 completely avoids any modeling of the previously observed data $\beta$ with a parametric model. By avoiding any explicit learning of the behavior model AWAC is far less conservative than methods which fit a model $\hat { \pi } _ { \beta }$ explicitly, and better incorporates new data during online fine-tuning, as seen from our results in Section 6. This derivation is related to AWR (Peng et al., 2019), with the main difference that AWAC uses an off-policy Q-function $Q ^ { \pi }$ to estimate the advantage, which greatly improves efficiency and even final performance (see results in Section 6.1). The update also resembles ABM-MPO, but ABM-MPO does require modeling the behavior policy which, as discussed in Section 3.3, can lead to poor fine-tuning. In Section 6.1, AWAC outperforms ABM-MPO on a range of challenging tasks.
112
+
113
+ Policy evaluation. During policy evaluation, we estimate the action-value $Q ^ { \pi } ( \mathbf { s } , \mathbf { a } )$ for the current policy $\pi$ , as described in Section 2. We utilize a temporal difference learning scheme for policy evaluation (Haarnoja et al., 2018; Fujimoto et al., 2018), minimizing the Bellman error as described in Equation 2. This enables us to learn very efficiently from off-policy data. This is particularly important in our problem setting to effectively use the offline dataset, and allows us to significantly outperform alternatives using Monte-Carlo evaluation or $\mathrm { T D } ( \lambda )$ to estimate returns (Peng et al., 2019).
114
+
115
+ Algorithm summary. The full AWAC algorithm for offline RL with online fine-tuning is summarized in Algorithm 1. In a practical implementation, we can parameterize the actor and the critic by neural networks and perform SGD updates from Eqn. 9 and Eqn. 3. Specific details are provided in Appendix A.3. AWAC ensures data efficiency with off-policy critic estimation via bootstrapping, and avoids offline bootstrap error with a constrained actor update. By avoiding explicit modeling of the behavior policy, AWAC avoids overly conservative updates.
116
+
117
+ # Algorithm 1 Advantage Weighted AC
118
+
119
+ 1: Dataset $\overline { { \mathcal { D } = \{ ( \mathbf { s } , \mathbf { a } , \mathbf { s } ^ { \prime } , r ) _ { j } \} } }$
120
+ 2: Initialize buffer $\beta = D$
121
+ 3: Initialize $\pi _ { \theta }$ , $Q _ { \phi }$
122
+ 4: for iteration $i = 1 , 2 , \dots \mathbf { d o }$
123
+ 5: Sample batch $( \mathbf { s } , \mathbf { a } , \mathbf { s } ^ { \prime } , r ) \sim \beta$
124
+ 6: Update $\phi$ according to Eqn. 3
125
+ 7: Update $\theta$ according to Eqn. 9
126
+ 8: if $i >$ num_offline_steps then
127
+ 9: $\begin{array} { l } { \tau _ { 1 } , . . . , \tau _ { K } \sim p _ { \pi _ { \theta } } ( \tau ) } \\ { \beta \beta \cup \{ \tau _ { 1 } , . . . , \tau _ { K } \} } \end{array}$
128
+ 10:
129
+ 11: end if
130
+ 12: end for
131
+
132
+ While AWAC is certainly quite related to several prior works, we note that there are key differences that make it particularly amenable to the problem setting we are considering - offline RL with online fine-tuning, that none of the other methods are really able to tackle. As we show in our experimental analysis with direct comparisons to prior work, every one of the design decisions being made in this work are important for algorithm performance. As compared to AWR (Peng et al., 2019), AWAC uses TD bootstrapping for significantly more efficient and even asymptotically better performance. As compared to offline RL techniques like ABM (Siegel et al., 2020), MPO (Abdolmaleki et al., 2018), BEAR (Kumar et al., 2019) or BCQ (Fujimoto et al., 2019) this work is able to avoid the need for any behavior modeling, thereby enabling the online fine-tuning part of the problem much better. As shown in Fig 3, when these seemingly ablations are made to AWAC, the algorithm performs significantly worse.
133
+
134
+ # 5 RELATED WORK
135
+
136
+ Off-policy RL algorithms are designed to reuse off-policy data during training, and have been studied extensively (Konda & Tsitsiklis, 2000; Degris et al., 2012; Mnih et al., 2016; Haarnoja et al., 2018; Fujimoto et al., 2018; Bhatnagar et al., 2009; Peters & Schaal, 2008a; Zhang et al., 2019; Wawrzynski, 2009; Balduzzi & Ghifary, 2015). While standard off-policy methods are able to benefit from including data seen during a training run, as we show in Section 3.2 they struggle when training from previously collected offline data from other policies, due to error accumulation with distribution shift (Fujimoto et al., 2019; Kumar et al., 2019). Offline RL methods aim to address this issue, often by constraining the actor updates to avoid excessive deviation from the data distribution (Lange et al., 2012; Thomas & Brunskill, 2016; Hallak et al., 2015; 2016; Hallak & Mannor, 2017; Agarwal et al., 2019; Kumar et al., 2019; Fujimoto et al., 2019; Fakoor et al., 2019; Nachum et al., 2019; Siegel et al., 2020; Levine et al., 2020; Zhang et al., 2020). One class of these methods utilize importance sampling (Thomas & Brunskill, 2016; Zhang et al., 2020; Nachum et al., 2019; Degris et al., 2012; Jiang & Li, 2016; Hallak & Mannor, 2017). Another class of methods perform offline reinforcement learning via dynamic programming, with an explicit constraint to prevent deviation from the data distribution (Lange et al., 2012; Kumar et al., 2019; Fujimoto et al., 2019; Wu et al., 2020; Jaques et al., 2019). While these algorithms perform well in the purely offline settings, we show in Section 3.3 that such methods tend to be overly conservative, and therefore may not learn efficiently when fine-tuning with online data collection. In contrast, our algorithm AWAC is comparable to these algorithms for offline pre-training, but learns much more efficiently during subsequent fine-tuning.
137
+
138
+ ![](images/dc95e9ee3e9e8f7a7a8fc57f523828dde009fc7403afddda26bacd248160c39d.jpg)
139
+ Figure 3: Comparative evaluation on the dexterous manipulation tasks. These tasks are difficult due to their high action dimensionality and reward sparsity. We see that AWAC is able to learn these tasks with little online data collection required (100K samples $\approx 1 6$ minutes of equivalent real-world interaction time). Meanwhile, most prior methods are not able to solve the harder two tasks: door opening and object relocation.
140
+
141
+ Prior work has also considered the special case of learning from demonstration data. One class of algorithms initializes the policy via behavioral cloning from demonstrations, and then fine-tunes with reinforcement learning (Peters & Schaal, 2008b; Ijspeert et al., 2002; Theodorou et al., 2010; Kim et al., 2013; Rajeswaran et al., 2018; Gupta et al., 2019; Zhu et al., 2019). Most such methods use on-policy fine-tuning, which is less sample-efficient than off-policy methods that perform value function estimation. Other prior works have incorporated demonstration data into the replay buffer using off-policy RL methods (Vecerík et al., 2017; Nair et al., 2017). We show in Section 3.2 that ˇ these strategies can result in a large dip in performance during online fine-tuning, due to the inability to pre-train an effective value function from offline data. In contrast, our work shows that using supervised learning style policy updates can allow for better bootstrapping from demonstrations as compared to Vecerík et al. (2017) and Nair et al. (2017). ˇ
142
+
143
+ Our method builds on algorithms that implement a maximum likelihood objective for the actor, based on an expectation-maximization formulation of RL (Peters & Schaal, 2007; Neumann & Peters, 2008; Theodorou et al., 2010; Peters et al., 2010; Peng et al., 2019; Abdolmaleki et al., 2018; Wang et al., 2018). Most closely related to our method in this respect are the algorithms proposed by Peng et al. (2019) (AWR) and Siegel et al. (2020) (ABM). Unlike AWR, which estimates the value function of the behavior policy, $V ^ { \pi _ { \beta } }$ via Monte-Carlo estimation or $\mathrm { T D } - \lambda$ , our algorithm estimates the Q-function of the current policy $Q ^ { \pi }$ via bootstrapping, enabling much more efficient learning, as shown in our experiments. Unlike ABM, our method does not require learning a separate function approximator to model the behavior policy $\pi _ { \beta }$ , and instead directly samples the dataset. As we discussed in Section 3.3, modeling $\pi _ { \beta }$ can be a major challenge for online fine-tuning. While these distinctions may seem somewhat subtle, they are important and we show in our experiments that they result in a large difference in algorithm performance. Finally, our work goes beyond the analysis in prior work, by studying the issues associated with pre-training and fine-tuning in Section 3. Concurrently to our work, Wang et al. (2020) proposed critic regularized regression for offline RL, which uses off-policy Q-learning and an equivalent policy update. In contrast to this concurrent work, we specifically study the offline pretraining online fine-tuning problem, analyze why other methods are ineffective in this setting, and show that our approach achieves substantially better results.
144
+
145
+ # 6 EXPERIMENTAL EVALUATION
146
+
147
+ In our experiments, we first compare our method against prior methods in the offline training and fine-tuning setting. We show that we can learn difficult, high-dimensional, sparse reward dexterous manipulation problems from human demonstrations and off-policy data. We then evaluate our method with suboptimal prior data generated by a random controller. Finally, we study why prior methods struggle in this setting by analyzing their performance on benchmark MuJoCo tasks, and conduct further experiments to understand where the difficulty lies (also shown in Section 3).
148
+
149
+ 6.1) Comparative Evaluation Learning From Prior Data. We aim to study tasks representative of the difficulties of real-world robot learning, where offline learning and online fine-tuning are most relevant. We begin our analysis with a set of challenging sparse reward dexterous manipulation tasks proposed by Rajeswaran et al. (2018). These tasks involve complex manipulation skills using a 28-DoF five-fingered hand in the MuJoCo simulator (Todorov et al., 2012) shown in Figure 3: in-hand rotation of a pen, opening a door by unlatching the handle, and picking up a sphere and relocating it to a target location. These environments exhibit many challenges: high dimensional action spaces, complex manipulation physics with many intermittent contacts, and randomized hand and object positions. The reward functions in these environments are binary 0-1 rewards for task completion. 2 Rajeswaran et al. (2018) provide 25 human demonstrations for each task, which are not fully optimal but do solve the task. Since this dataset is small, we generated another 500 trajectories of interaction data by constructing a behavioral cloned policy, and then sampling from this policy.
150
+
151
+ First, we compare our method on these dexterous manipulation tasks against prior methods for off-policy learning, offline learning, and bootstrapping from demonstrations. Specific implementation details are discussed in Appendix A.5. The results are shown in Fig. 3. Our method is able to leverage the prior data to quickly attain good performance, and the efficient off-policy actor-critic component of our approach fine-tunes much more quickly than demonstration augmented policy gradient (DAPG), the method proposed by Rajeswaran et al. (2018). For example, our method solves the pen task in 120K timesteps, the equivalent of just 20 minutes of online interaction. While the baseline comparisons and ablations are able to make some amount of progress on the pen task, alternative off-policy RL and offline RL algorithms are largely unable to solve the door and relocate task in the time-frame considered. We find that the design decisions to use off-policy critic estimation allow AWAC to significantly outperform AWR (Peng et al., 2019) while the implicit behavior modeling allows AWAC to significantly outperform ABM (Siegel et al., 2020), although ABM does make some progress. Rajeswaran et al. (2018) show that DAPG can solve variants of these tasks with more well-shaped rewards, but still requires considerably more samples.
152
+
153
+ Additionally, we evaluated all methods on the Gym MuJoCo locomotion benchmarks, similarly providing demonstrations as offline data. Due to space constraints, the results plots for these experiments are included in Appendix A.1. These tasks are substantially easier than the sparse reward manipulation tasks described above, and a number of prior methods also perform well. However, our method matches or exceeds the best prior method in all cases, whereas no other single prior method attains good performance on all of the tasks.
154
+
155
+ 6.2) Fine-Tuning from Random Policy Data. An advantage of using off-policy RL for reinforcement learning is that we can also incorporate suboptimal data, rather than demonstrations. In this experiment, we evaluate on a simulated tabletop pushing environment with a Sawyer robot pictured in Fig 3 and described further in Appendix A.4. To study the potential to learn from suboptimal data, we use an off-policy dataset of 500 trajectories generated by a random process. The task is to push an object to a target location in a $4 0 \mathrm { c m } \mathrm { x } 2 0 \mathrm { c m }$ goal space. The results are shown in Figure 4. We see that while many methods begin at the same initial performance, AWAC learns the fastest online and is actually able to make use of the offline dataset effectively.
156
+
157
+ ![](images/70ff058010690ec5be42b2370a086753b4d7af63ce0b7933026e108dd920cb26.jpg)
158
+ Figure 4: Comparison of fine-tuning from an initial dataset of suboptimal data on a Sawyer robot pushing task.
159
+
160
+ # 7 DISCUSSION AND FUTURE WORK
161
+
162
+ We have discussed in detail the challenges existing RL methods face when fine-tuning from prior datasets, and proposed an algorithm, AWAC, that is effective in this setting. The key insight in AWAC is that enforcing a policy update constraint implicitly on actor-critic methods results in a stable learning algorithm amenable for off-policy learning. With an informative action-value estimate, the policy is weighted towards high-advantage actions in the data, resulting in policy improvement without conservative updates. A direction of future work we plan to pursue is applying AWAC to solve difficult robotic tasks in the real world. More than just speeding up individual runs, incorporating prior data into the learning process enables continuously accumulating data by saving environment interactions of the robot - for instance, runs of RL with varying hyperparameters. We hope that this enables a wider array of robotic applications than previously possible.
163
+
164
+ # REFERENCES
165
+
166
+ Abbas Abdolmaleki, Jost Tobias Springenberg, Yuval Tassa, Remi Munos, Nicolas Heess, and Martin Riedmiller. Maximum a Posteriori Policy Optimisation. In International Conference on Learning Representations (ICLR), pp. 1–19, 2018.
167
+
168
+ Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An Optimistic Perspective on Offline Reinforcement Learning. In International Conference on Machine Learning (ICML), 2019.
169
+
170
+ Christopher G Atkeson and Stefan Schaal. Robot Learning From Demonstration. In International Conference on Machine Learning (ICML), 1997.
171
+
172
+ David Balduzzi and Muhammad Ghifary. Compatible value gradients for reinforcement learning of continuous deep policies. CoRR, abs/1509.03005, 2015.
173
+
174
+ Shalabh Bhatnagar, Richard S. Sutton, Mohammad Ghavamzadeh, and Mark Lee. Natural actor-critic algorithms. Autom., 45(11):2471–2482, 2009. doi: 10.1016/j.automatica.2009.07.008.
175
+
176
+ Thomas Degris, Martha White, and Richard S. Sutton. Off-Policy Actor-Critic. In International Conference on Machine Learning (ICML), 2012.
177
+
178
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Association for Compuational Linguistics (ACL), 2019.
179
+
180
+ Rasool Fakoor, Pratik Chaudhari, and Alexander J Smola. P3O: Policy-on Policy-off Policy Optimization. In Conference on Uncertainty in Artificial Intelligence (UAI), 2019.
181
+
182
+ Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4RL: Datasets for Deep Data-Driven Reinforcement Learning. 2020.
183
+
184
+ Scott Fujimoto, Herke van Hoof, and David Meger. Addressing Function Approximation Error in Actor-Critic Methods. International Conference on Machine Learning (ICML), 2018.
185
+
186
+ Scott Fujimoto, David Meger, and Doina Precup. Off-Policy Deep Reinforcement Learning without Exploration. In International Conference on Machine Learning (ICML), 2019.
187
+
188
+ Yang Gao, Huazhe Xu, Ji Lin, Fisher Yu, Sergey Levine, and Trevor Darrell. Reinforcement learning from imperfect demonstrations. CoRR, abs/1802.05313, 2018.
189
+
190
+ Abhishek Gupta, Vikash Kumar, Corey Lynch, Sergey Levine, and Karol Hausman. Relay Policy Learning: Solving Long-Horizon Tasks via Imitation and Reinforcement Learning. In Conference on Robot Learning (CoRL), 2019.
191
+
192
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor. In International Conference on Machine Learning, 2018.
193
+
194
+ Assaf Hallak and Shie Mannor. Consistent On-Line Off-Policy Evaluation. In International Conference on Machine Learning (ICML), 2017.
195
+
196
+ Assaf Hallak, Francois Schnitzler, Timothy Mann, and Shie Mannor. Off-policy Model-based Learning under Unknown Factored Dynamics. In International Conference on Machine Learning (ICML), 2015.
197
+
198
+ Assaf Hallak, Aviv Tamar, Rémi Munos, and Shie Mannor. Generalized Emphatic Temporal Difference Learning: Bias-Variance Analysis. In Association for the Advancement of Artificial Intelligence (AAAI), 2016.
199
+
200
+ Auke Jan Ijspeert, Jun Nakanishi, and Stefan Schaal. Learning Attractor Landscapes for Learning Motor Primitives. In Advances in Neural Information Processing Systems (NIPS), pp. 1547–1554, 2002. ISBN 1049-5258.
201
+
202
+ Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Àgata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind W. Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. CoRR, abs/1907.00456, 2019.
203
+
204
+ Nan Jiang and Lihong Li. Doubly Robust Off-policy Value Evaluation for Reinforcement Learning. In International Conference on Machine Learning (ICML), 2016.
205
+
206
+ Beomjoon Kim, Amir-Massoud Farahmand, Joelle Pineau, and Doina Precup. Learning from Limited Demonstrations. In Advances in Neural Information Processing Systems (NIPS), 2013.
207
+
208
+ Vijay R Konda and John N Tsitsiklis. Actor-Critic Algorithms. In Advances in Neural Information Processing Systems (NeurIPS), 2000.
209
+
210
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems (NIPS), pp. 1097–1105, 2012.
211
+
212
+ Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing Off-Policy Q-Learning via Bootstrapping Error Reduction. In Neural Information Processing Systems (NeurIPS), 2019.
213
+
214
+ Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative Q-Learning for Offline Reinforcement Learning. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
215
+
216
+ Sascha Lange, Thomas Gabel, and Martin A. Riedmiller. Batch reinforcement learning. In Marco Wiering and Martijn van Otterlo (eds.), Reinforcement Learning, volume 12 of Adaptation, Learning, and Optimization, pp. 45–73. Springer, 2012. doi: 10.1007/978-3-642-27645-3\_2.
217
+
218
+ Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline Reinforcement Learning: Tutorial, Review, and Perspectives on Open Problems. Technical report, 2020.
219
+
220
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. In International Conference on Learning Representations (ICLR), 2016. ISBN 0-7803-3213-X. doi: 10.1613/jair.301.
221
+
222
+ Volodymyr Mnih, Adrià Puigdomènech Badia, Mehdi Mirza, Alex Graves, Tim Harley, Timothy P Lillicrap, David Silver, and Koray Kavukcuoglu. Asynchronous Methods for Deep Reinforcement Learning. In International Conference on Machine Learning (ICML), 2016.
223
+
224
+ Ofir Nachum, Yinlam Chow, Bo Dai, and Lihong Li. DualDICE: Behavior-Agnostic Estimation of Discounted Stationary Distribution Corrections. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
225
+
226
+ Ashvin Nair, Dian Chen, Pulkit Agrawal, Phillip Isola, Pieter Abbeel, Jitendra Malik, Sergey Levine, Dian Chen, Phillip Isola, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Combining SelfSupervised Learning and Imitation for Vision-Based Rope Manipulation. In IEEE International Conference on Robotics and Automation (ICRA), 2017. ISBN 9781509046331. doi: 10.1109/ ICRA.2017.7989247.
227
+
228
+ Ashvin Nair, Bob Mcgrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming Exploration in Reinforcement Learning with Demonstrations. In IEEE International Conference on Robotics and Automation (ICRA), 2018.
229
+
230
+ Gerhard Neumann and Jan Peters. Fitted Q-iteration by Advantage Weighted Regression. In Advances in Neural Information Processing Systems (NeurIPS), 2008.
231
+
232
+ Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-Weighted Regression: Simple and Scalable Off-Policy Reinforcement Learning. 2019.
233
+
234
+ Jan Peters and Stefan Schaal. Reinforcement Learning by Reward-weighted Regression for Operational Space Control. In International Conference on Machine Learning, 2007.
235
+
236
+ Jan Peters and Stefan Schaal. Natural actor-critic. Neurocomputing, 71(7-9):1180–1190, 2008a. doi: 10.1016/j.neucom.2007.11.026.
237
+
238
+ Jan Peters and Stefan Schaal. Reinforcement learning of motor skills with policy gradients. Neural Networks, 21(4):682–697, 2008b. ISSN 08936080. doi: 10.1016/j.neunet.2008.02.003.
239
+
240
+ Jan Peters, Katharina Mülling, and Yasemin Altün. Relative Entropy Policy Search. In AAAI Conference on Artificial Intelligence, pp. 1607–1612, 2010.
241
+
242
+ Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, John Schulman, Emanuel Todorov, and Sergey Levine. Learning Complex Dexterous Manipulation with Deep Reinforcement Learning and Demonstrations. In Robotics: Science and Systems, 2018.
243
+
244
+ Jason Ramapuram, Magda Gregorova, and Alexandros Kalousis. Lifelong Generative Modeling. Neurocomputing, 2017.
245
+
246
+ Stefan Schaal. Learning from demonstration. In Advances in Neural Information Processing Systems (NeurIPS), number 9, pp. 1040–1046, 1997. ISBN 1558604863. doi: 10.1016/j.robot.2004.03.001.
247
+
248
+ Noah Y. Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning, 2020.
249
+
250
+ Richard S Sutton and Andrew G Barto. Reinforcement Learning: An Introduction. 1998.
251
+
252
+ Evangelos A Theodorou, Jonas Buchli, and Stefan Schaal. A Generalized Path Integral Control Approach to Reinforcement Learning. Journal of Machine Learning Research (JMLR), 11:3137– 3181, 2010.
253
+
254
+ Philip S. Thomas and Emma Brunskill. Data-efficient off-policy policy evaluation for reinforcement learning. 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. 2139–2148. JMLR.org, 2016.
255
+
256
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. MuJoCo: A physics engine for model-based control. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 5026–5033, 2012. ISBN 9781467317375. doi: 10.1109/IROS.2012.6386109.
257
+
258
+ Matej Vecerík, Todd Hester, Jonathan Scholz, Fumin Wang, Olivier Pietquin, Bilal Piot, Nicolas ˇ Heess, Thomas Rothörl, Thomas Lampe, and Martin Riedmiller. Leveraging Demonstrations for Deep Reinforcement Learning on Robotics Problems with Sparse Rewards. CoRR, abs/1707.0, 2017.
259
+
260
+ Qing Wang, Jiechao Xiong, Lei Han, Peng Sun, Han Liu, and Tong Zhang. Exponentially Weighted Imitation Learning for Batched Historical Data. In Neural Information Processing Systems (NeurIPS), 2018.
261
+
262
+ Ziyu Wang, Alexander Novikov, Konrad Zołna, Jost Tobias Springenberg, Scott Reed, Bobak Shahriari, Noah Siegel, Josh Merel, Caglar Gulcehre, Nicolas Heess, and Nando De Freitas. Critic Regularized Regression. 2020.
263
+
264
+ Pawel Wawrzynski. Real-time reinforcement learning by sequential actor-critics and experience replay. Neural Networks, 22(10):1484–1497, 2009. doi: 10.1016/j.neunet.2009.05.011.
265
+
266
+ Ronald J Williams. Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning. Machine Learning, pp. 229–256, 1992.
267
+
268
+ Yifan Wu, George Tucker, and Ofir Nachum. Behavior Regularized Offline Reinforcement Learning. 2020.
269
+
270
+ Ruiyi Zhang, Bo Dai, Lihong Li, and Dale Schuurmans. GenDICE: Generalized Offline Estimation of Stationary Values. In International Conference on Learning Representations (ICLR), 2020.
271
+
272
+ Shangtong Zhang, Wendelin Boehmer, and Shimon Whiteson. Generalized off-policy actor-critic. In H. Wallach, H. Larochelle, A. Beygelzimer, F. dÁlché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 2001–2011. Curran Associates, Inc., 2019.
273
+
274
+ Allan Zhou, Eric Jang, Daniel Kappler, Alexander Herzog, Mohi Khansari, Paul Wohlhart, Yunfei Bai, Mrinal Kalakrishnan, Sergey Levine, and Chelsea Finn. Watch, try, learn: Meta-learning from demonstrations and reward. CoRR, abs/1906.03352, 2019.
275
+
276
+ Henry Zhu, Abhishek Gupta, Aravind Rajeswaran, Sergey Levine, and Vikash Kumar. Dexterous Manipulation with Deep Reinforcement Learning: Efficient, General, and Low-Cost. In Proceedings - IEEE International Conference on Robotics and Automation, volume 2019-May, pp. 3651–3657. Institute of Electrical and Electronics Engineers Inc., 2019.
277
+
278
+ # A APPENDIX
279
+
280
+ # A.1 GYM BENCHMARK RESULTS FROM PRIOR DATA
281
+
282
+ In this section, we provide a comparative evaluation on MuJoCo benchmark tasks for analysis. These tasks are simpler, with dense rewards and relatively lower action and observation dimensionality. Thus, many prior methods can make good progress on these tasks. These experiments allow us to understand more precisely which design decisions are crucial. For each task, we collect 15 demonstration trajectories using a pre-trained expert on each task, and 100 trajectories of off-policy data by rolling out a behavioral cloned policy trained on the demonstrations. The same data is made available to all methods. The results are presented in Figure 5. AWAC is consistently the best or on par with the best-performing method. No other single method consistently attains the best results – on HalfCheetah, $\mathrm { S A C } + \mathrm { B C }$ and BRAC are competitive, while on Ant-v2 ABM is competitive with AWAC. We summarize the results according to the challenges in Section 3.
283
+
284
+ Data efficiency. The three methods that do not estimate $Q ^ { \pi }$ are DAPG (Abdolmaleki et al., 2018), AWR (Peng et al., 2019), and MARWIL (Wang et al., 2018). Across all three tasks, we see that these methods are somewhat worse offline than the best performing offline methods, and exhibit steady but very slow improvement during fine-tuning. In robotics, data efficiency is vital, so these algorithms are not good candidates for practical real-world applications.
285
+
286
+ Bootstrap error in offline learning. For SAC (Haarnoja et al., 2018), across all three tasks, we see that the offline performance at epoch 0 is generally poor. Due to the data in the replay buffer, SAC with prior data does learn faster than from scratch, but AWAC is faster to solve the tasks in general. SAC with additional data in the replay buffer is similar to the approach proposed by Vecerík et al. ˇ (2017). $\mathrm { S A C + B C }$ reproduces Nair et al. (2018) but uses SAC instead of DDPG (Lillicrap et al., 2016) as the underlying RL algorithm. We find that these algorithms exhibit a characteristic dip at the start of learning. Although this dip is only present in the early part of the learning curve, a poor initial policy and lack of steady policy improvement can be a safety concern and a significant hindrance in real-world applications. Moreover, recall that in the more difficult dextrous manipulation tasks, these algorithms do not show any significant learning.
287
+
288
+ Conservative online learning. Finally, we consider conservative offline algorithms: ABM (Siegel et al., 2020), BEAR (Kumar et al., 2019), and BRAC (Wu et al., 2020). We found that BRAC performs similarly to SAC for working hyperparameters. BEAR trains well offline – on Ant and Walker2d, BEAR significantly outperforms prior methods before online experience. However, online improvement is slow for BEAR and the final performance across all three tasks is much lower than AWAC. The closest in performance to our method is ABM, which is comparable on Ant-v2, but much slower on other domains.
289
+
290
+ ![](images/b64d8819c2ba2be4df471bcc86f7d5af460f8cac223ff698dda2c5e907357ea4.jpg)
291
+ Figure 5: Comparison of our method and prior methods on standard MuJoCo benchmark tasks. These tasks are much easier than the dexterous manipulation tasks, and allow us to better inspect the performance of methods in the setting of offline pretraining followed by online fine-tuning. $\mathrm { S A C + B C }$ and BRAC perform on par with our method on the HalfCheetah task, and ABM performs on par with our method on the Ant task, while our method outperforms all others on the Walker2D task. Our method matches or exceeds the best prior method in all cases, whereas no other single prior method attains good performance on all of the tasks.
292
+
293
+ # A.2 ALGORITHM DERIVATION DETAILS
294
+
295
+ The full optimization problem we solve, given the previous off-policy advantage estimate $A ^ { \pi _ { k } }$ and buffer distribution $\pi _ { \beta }$ , is given below:
296
+
297
+ $$
298
+ \begin{array} { r l } & { \pi _ { k + 1 } = \underset { \pi \in \Pi } { \arg \operatorname* { m a x } } \mathbb { E } _ { \mathbf { a } \sim \pi ( \cdot | \mathbf { s } ) } [ A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) ] } \\ & { \qquad \mathrm { s . t . } D _ { \mathrm { K L } } ( \pi ( \cdot | \mathbf { s } ) | | \pi _ { \beta } ( \cdot | \mathbf { s } ) ) \leq \epsilon } \\ & { \qquad \displaystyle \int _ { \mathbf { a } } \pi ( \mathbf { a } | \mathbf { s } ) d \mathbf { a } = 1 . } \end{array}
299
+ $$
300
+
301
+ Our derivation follows Peters et al. (2010) and Peng et al. (2019). The analytic solution for the constrained optimization problem above can be obtained by enforcing the KKT conditions. The Lagrangian is:
302
+
303
+ $$
304
+ \mathcal { L } ( \pi , \lambda , \alpha ) = \mathbb { E } _ { \mathbf { a } \sim \pi ( \cdot | \mathbf { s } ) } [ A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) ] + \lambda ( \epsilon - D _ { \mathrm { K L } } ( \pi ( \cdot | \mathbf { s } ) | | \pi _ { \beta } ( \cdot | \mathbf { s } ) ) ) + \alpha ( 1 - \int _ { \mathbf { a } } \pi ( \mathbf { a } | \mathbf { s } ) d \mathbf { a } ) .
305
+ $$
306
+
307
+ Differentiating with respect to $\pi$ gives:
308
+
309
+ $$
310
+ \frac { \partial \mathcal { L } } { \partial \pi } = A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) - \lambda \log \pi _ { \beta } ( \mathbf { a } | \mathbf { s } ) + \lambda \log \pi ( \mathbf { a } | \mathbf { s } ) + \lambda - \alpha .
311
+ $$
312
+
313
+ Setting $\textstyle { \frac { \partial { \mathcal { L } } } { \partial \pi } }$ to zero and solving for $\pi$ gives the closed form solution to this problem:
314
+
315
+ $$
316
+ \pi ^ { * } ( { \bf a } | { \bf s } ) = \frac { 1 } { Z ( { \bf s } ) } \pi _ { \beta } ( { \bf a } | { \bf s } ) \exp \left( \frac { 1 } { \lambda } A ^ { \pi _ { k } } ( { \bf s } , { \bf a } ) \right) ,
317
+ $$
318
+
319
+ Next, we project the solution into the space of parametric policies. For a policy $\pi _ { \theta }$ with parameters $\theta$ , this can be done by minimizing the KL divergence of $\pi _ { \theta }$ from the optimal non-parametric solution $\pi ^ { * }$ under the data distribution $\bar { \rho } _ { \pi _ { \beta } } ( \mathbf { s } )$ :
320
+
321
+ $$
322
+ \underset { \theta } { \arg \operatorname* { m i n } } \ \underset { \rho _ { \pi _ { \beta } } ( \mathbf { s } ) } { \mathbb { E } } \big [ D _ { \mathrm { K L } } \big ( \pi ^ { * } ( \cdot | \mathbf { s } ) | | \pi _ { \theta } ( \cdot | \mathbf { s } ) \big ) \big ] = \underset { \theta } { \arg \operatorname* { m i n } } \ \underset { \rho _ { \pi _ { \beta } } ( \mathbf { s } ) } { \mathbb { E } } \bigg [ \underset { \pi ^ { * } ( \cdot | \mathbf { s } ) } { \mathbb { E } } \big [ - \log \pi _ { \theta } ( \cdot | \mathbf { s } ) \big ] \bigg ]
323
+ $$
324
+
325
+ Note that in the projection step, the parametric policy could be projected with either direction of KL divergence. However, choosing the reverse KL direction has a key advantage: it allows us to optimize $\theta$ as a maximum likelihood problem with an expectation over data $s , a \sim \beta$ , rather than sampling actions from the policy that may be out of distribution for the $\mathrm { Q }$ function. In our experiments we show that this decision is vital for stable off-policy learning.
326
+
327
+ Furthermore, assume discrete policies with a minimum probably density of $\pi _ { \theta } \geq \alpha _ { \theta }$ . Then the upper bound:
328
+
329
+ $$
330
+ \begin{array} { r l } { D _ { \mathrm { K L } } ( \pi ^ { * } | | \pi _ { \theta } ) \leq } & { \displaystyle \frac { 2 } { \alpha _ { \theta } } D _ { \mathrm { T V } } ( \pi ^ { * } , \pi _ { \theta } ) ^ { 2 } } \\ & { \leq \displaystyle \frac { 1 } { \alpha _ { \theta } } D _ { \mathrm { K L } } ( \pi _ { \theta } | | \pi ^ { * } ) } \end{array}
331
+ $$
332
+
333
+ holds by the Pinsker’s inequality, where $D _ { \mathrm { T V } }$ denotes the total variation distance between distributions. Thus minimizing the reverse $\mathrm { K L }$ also bounds the forward KL. Note that we can control the minimum $\alpha$ if desired by applying Laplace smoothing to the policy.
334
+
335
+ # A.3 IMPLEMENTATION DETAILS
336
+
337
+ We implement the algorithm building on top of twin soft actor-critic (Haarnoja et al., 2018), which incorporates the twin Q-function architecture from twin delayed deep deterministic policy gradient (TD3) from Fujimoto et al. (2018). All off-policy algorithm comparisons (SAC, BRAC, MPO, ABM, BEAR) are implemented from the same skeleton. The base hyperparameters are given in Table 2. The policy update is replaced with:
338
+
339
+ $$
340
+ \theta _ { k + 1 } = \underset { \theta } { \arg \operatorname* { m a x } } \quad \underset { \mathbf { s } , \mathbf { a } \sim \beta } { \mathbb { E } } \left[ \log \pi _ { \theta } ( \mathbf { a } | \mathbf { s } ) \frac { 1 } { Z ( \mathbf { s } ) } \exp \left( \frac { 1 } { \lambda } A ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) \right) \right] .
341
+ $$
342
+
343
+ Similar to advantage weight regression (Peng et al., 2019) and other prior work (Neumann & Peters, 2008; Wang et al., 2018; Siegel et al., 2020), we disregard the per-state normalizing constant $\begin{array} { r } { Z ( \mathbf { \check { s } } ) = \int _ { \mathbf { a } } \pi _ { \boldsymbol \theta } ( \mathbf { a } | \mathbf { \check { s } } ) \exp \left( \frac { 1 } { \lambda } \check { A } ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) \right) d \mathbf { a } = \mathbb { E } _ { \mathbf { a } \sim \pi _ { \boldsymbol \theta } ( \cdot | \mathbf { s } ) } [ \check { A } ^ { \pi _ { k } } ( \mathbf { s } , \mathbf { a } ) ] } \end{array}$ We did experiment with estimating this expectation per batch element with $K = 1 0$ samples, but found that this generally made performance worse, perhaps because errors in the estimation of $Z ( \mathbf { s } )$ caused more harm than the benefit the method derived from estimating this value. We report success rate results for variants of our method with and without $Z ( \mathbf { s } )$ estimation in Table 1.
344
+
345
+ While prior work (Neumann & Peters, 2008; Wang et al., 2018; Peng et al., 2019) has generally ignored the omission of $Z ( \mathbf { s } )$ without any specific justification, it is possible to bound this value both above and below using the Cauchy-Schwarz and reverse CauchySchwarz (Polya-Szego) inequalities, as follows. Let $f ( \mathbf { a } ) = \pi ( \mathbf { a } | \mathbf { \dot { s } } )$ and $g ( \mathbf { a } ) = \dot { \exp ( A ( \bar { s } , \mathbf { a } ) / \lambda ) }$ . Note $f ( \mathbf { a } ) > 0$ for stochastic policies
346
+
347
+ <table><tr><td>Env</td><td>Use Z(s)</td><td>Omit Z(s)</td></tr><tr><td>pen</td><td>84%</td><td>98%</td></tr><tr><td>door</td><td>0%</td><td>95%</td></tr><tr><td>relocate</td><td>0%</td><td>54%</td></tr></table>
348
+
349
+ Table 1: Success rates after online fine-tuning (after 800K steps for pen, door and 4M steps for relocate) using AWAC with and without $Z ( \mathbf { s } )$ weight. These results show that although we can estimate $Z ( \mathbf { s } )$ , weighting by $Z ( \mathbf { s } )$ actually results in worse performance.
350
+
351
+ and $g ( \mathbf { a } ) > 0$ . By Cauchy-Schwarz, $\begin{array} { r } { Z ( s ) = \int _ { \mathbf { a } } f ( \mathbf { a } ) g ( \mathbf { a } ) d \mathbf { a } \leq \sqrt { \int _ { \mathbf { a } } f ( \mathbf { a } ) ^ { 2 } d \mathbf { a } \int _ { \mathbf { a } } g ( \mathbf { a } ) ^ { 2 } d \mathbf { a } } = C _ { 1 } } \end{array}$ . To apply Polya-Szego, let $m _ { f }$ and $m _ { g }$ be the minimum of $f$ and $g$ respectively and $M _ { f } , M _ { g }$ be the maximum. Then $\begin{array} { r } { Z ( \mathbf { s } ) \ge 2 ( \sqrt { \frac { M _ { f } M _ { g } } { m _ { f } m _ { g } } + \frac { m _ { f } m _ { g } } { M _ { f } M _ { g } } } ) ^ { - 1 } C _ { 1 } = C _ { 2 } } \end{array}$ mf mgM M )−1C1 = C2. We therefore have C1 ≤ Z(s) ≤ C2, though the bounds are generally not tight.
352
+
353
+ A further, more intuitive argument for why omitting $Z ( \mathbf { s } )$ may be harmless in practice comes from observing that this normalizing factor only affects the relative weight of different states in the training objective, not different actions. The state distribution in $\beta$ already differs from the distribution over states that will be visited by $\pi _ { \theta }$ , and therefore preserving this state distribution is likely to be of limited utility to downstream policy performance. Indeed, we would expect that sufficiently expressive policies would be less affected by small to moderate variability in the state weights. On the other hand, inaccurate estimates of $Z ( \mathbf { s } )$ may throw off the training objective by increasing variance, similar to the effect of degenerate importance weights.
354
+
355
+ The Lagrange multiplier $\lambda$ is treated as a hyperparameter in our method. In this work we use $\lambda = 0 . 3$ for the manipulation environments and $\lambda = 1 . 0$ for the MuJoCo benchmark environments. One could adaptively learn $\lambda$ with a dual gradient descent procedure, but this would require access to $\pi _ { \beta }$ .
356
+
357
+ As rewards for the dextrous manipulation environments are non-positive, we clamp the Q value for these experiments to be at most zero. We find this stabilizes training slightly.
358
+
359
+ # A.4 ENVIRONMENT-SPECIFIC DETAILS
360
+
361
+ We evaluate our method on three domains: dexterous manipulation environments, Sawyer manipulation environments, and MuJoCo benchmark environments. In the following sections we describe specific details.
362
+
363
+ # A.4.1 DEXTEROUS MANIPULATION ENVIRONMENTS
364
+
365
+ These environments are modified from those proposed by Rajeswaran et al. (2018).
366
+
367
+ pen-binary-v0. The task is to spin a pen into a given orientation. The action dimension is 24 and the observation dimension is 45. Let the position and orientation of the pen be denoted by $x _ { p }$ and $x _ { o }$ respectively, and the desired position and orientation be denoted by $d _ { p }$ and $d _ { o }$ respectively. The reward function is $r = \mathbb { 1 } _ { | \underline { { x } } _ { p } - d _ { p } | \leq 0 . 0 7 5 } \mathbb { 1 } _ { | \underline { { x } } _ { o } \cdot d _ { o } | \leq 0 . 9 5 } - 1$ . In Rajeswaran et al. (2018), the episode was terminated when the pen fell out of the hand; we did not include this early termination condition.
368
+
369
+ door-binary-v0. The task is to open a door, which requires first twisting a latch. The action dimension is 28 and the observation dimension is 39. Let $d$ denote the angle of the door. The reward function is $r = 1 _ { d > 1 . 4 } - 1$ .
370
+
371
+ Table 2: Hyper-parameters used for RL experiments.
372
+
373
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Training Batches Per Timestep</td><td>1</td></tr><tr><td>Exploration Noise</td><td>None (stochastic policy)</td></tr><tr><td>RL Batch Size</td><td>1024</td></tr><tr><td>Discount Factor</td><td>0.99</td></tr><tr><td>Reward Scaling</td><td>1</td></tr><tr><td>Replay Buffer Size</td><td>1000000</td></tr><tr><td>Number of pretraining steps</td><td>25000</td></tr><tr><td>Policy Hidden Sizes</td><td>[256,256,256, 256]</td></tr><tr><td>Policy Hidden Activation</td><td>ReLU</td></tr><tr><td>Policy Weight Decay</td><td>10-4</td></tr><tr><td>Policy Learning Rate</td><td>3 ×10-4</td></tr><tr><td>Q Hidden Sizes</td><td>[256, 256,256, 256]</td></tr><tr><td>Q Hidden Activation</td><td>ReLU</td></tr><tr><td>Q Weight Decay</td><td>0</td></tr><tr><td>Q Learning Rate</td><td>3 ×10-4</td></tr><tr><td>Target Network T</td><td>5×10-3</td></tr></table>
374
+
375
+ relocate-binary-v0. The task is to relocate an object to a goal location. The action dimension is 30 and the observation dimension is 39. Let $x _ { p }$ denote the object position and $d _ { p }$ denote the desired position. The reward is $r = \mathbb { 1 } _ { | x _ { p } - d _ { p } | \leq 0 . 1 } - 1$ .
376
+
377
+ # A.4.2 SAWYER MANIPULATION ENVIRONMENT
378
+
379
+ SawyerPush- $\mathbf { \nabla } \cdot \mathbf { v 0 }$ . This environment is included in the Multiworld library. The task is to push a puck to a goal position in a $4 0 \mathrm { c m } \mathrm { x } 2 0 \mathrm { c m }$ , and the reward function is the negative distance between the puck and goal position. When using this environment, we use hindsight experience replay for goal-conditioned reinforcement learning. The random dataset for prior data was collected by rolling out an Ornstein-Uhlenbeck process with $\theta = 0 . 1 5$ and $\sigma = 0 . 3$ .
380
+
381
+ # A.4.3 OFF-POLICY DATA PERFORMANCE
382
+
383
+ The performances of the expert data, behavior cloning (BC) on the expert data (1), and BC on the combined expert $+ \mathrm { B C }$ data (2) are included in Table 3. For Gym benchmarks we report average return, and expert data is collected by a trained SAC policy. For dextrous manipulation tasks we report the success rate, and the expert data consists of human demonstrations provided by Rajeswaran et al. (2018).
384
+
385
+ # A.5 BASELINE IMPLEMENTATION DETAILS
386
+
387
+ We used public implementations of prior methods (DAPG, AWR) when available. We implemented the remaining algorithms in our framework, which also allows us to understand the effects of changing individual components of the method.
388
+
389
+ Table 3: Performance of the off-policy data for each environment. BC (1) indicates BC on the expert data, while BC (2) indicates BC on the combined expert $+ \mathrm { B C }$ data used as off-policy data for pretraining.
390
+
391
+ <table><tr><td rowspan=1 colspan=1>Env</td><td rowspan=1 colspan=1>Expert</td><td rowspan=1 colspan=1>BC (1)</td><td rowspan=1 colspan=1>BC (2)</td></tr><tr><td rowspan=1 colspan=1>cheetah</td><td rowspan=1 colspan=1>9962</td><td rowspan=1 colspan=1>2507</td><td rowspan=1 colspan=1>4524</td></tr><tr><td rowspan=3 colspan=1>walkerantpen</td><td rowspan=1 colspan=1>5062</td><td rowspan=1 colspan=1>2040</td><td rowspan=1 colspan=1>1701</td></tr><tr><td rowspan=1 colspan=1>5207</td><td rowspan=1 colspan=1>687</td><td rowspan=1 colspan=1>1704</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.73</td><td rowspan=1 colspan=1>0.76</td></tr><tr><td rowspan=1 colspan=1>door</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.10</td><td rowspan=1 colspan=1>0.00</td></tr><tr><td rowspan=1 colspan=1>relocate</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.02</td><td rowspan=1 colspan=1>0.01</td></tr></table>
392
+
393
+ In the section, we describe the implementation details. The full overview of algorithms is given in Figure 6.
394
+
395
+ <table><tr><td>Name</td><td>Q</td><td>Policy Objective</td><td>元?</td><td>Constraint</td></tr><tr><td>SAC</td><td>Q</td><td>DKL(πellQ)</td><td>No</td><td>None</td></tr><tr><td>SAC + BC</td><td>Q</td><td>Mixed</td><td>No</td><td>None</td></tr><tr><td>BCQ</td><td></td><td>DKL(πellQ)</td><td>Yes</td><td>Support (e)</td></tr><tr><td>BEAR</td><td></td><td>DKL(πellQ)</td><td>Yes</td><td>Support (MMD)</td></tr><tr><td>AWR</td><td></td><td>DKL(QIπθ)</td><td>No</td><td>Implicit</td></tr><tr><td>MPO</td><td></td><td>DKL(Qlπθ)</td><td>Yes*</td><td>Prior</td></tr><tr><td>ABM-MPO</td><td></td><td>DKL(Q|Iπ)</td><td>Yes</td><td>Learned Prior</td></tr><tr><td>DAPG</td><td></td><td>J(πe)</td><td>No</td><td>None</td></tr><tr><td>BRAC</td><td>Q</td><td>DKL(πellQ)</td><td>Yes</td><td>Explicit KL penalty</td></tr><tr><td>AWAC (Ours)</td><td>Q</td><td>DKL(Q|Iπe)</td><td>No</td><td>Implicit</td></tr></table>
396
+
397
+ Behavior Cloning (BC). This method learns a policy with supervised learning on demonstration data.
398
+
399
+ Soft Actor Critic (SAC). Using the soft actor critic algorithm from (Haarnoja et al., 2018), we follow the exact same procedure as our method in order to incorporate prior data, initializing the policy with behavior cloning on demonstrations and adding all prior data to the replay buffer.
400
+
401
+ Behavior Regularized Actor Critic (BRAC). We implement BRAC as described in (Wu et al., 2020) by adding policy regularization $\log ( \pi _ { \beta } ( a | s ) )$ where $\pi _ { \beta }$ is a behavior policy trained with supervised learning on the replay buffer. We add all prior data to the replay buffer before online training.
402
+
403
+ Advantage Weighted Regression (AWR). Using the advantage weighted regression algorithm from (Peng et al., 2019), we add all prior data to the replay buffer before online training. We use the implementation provided by Peng et al. (2019), with the key difference from our method being that AWR uses $\mathrm { T D } ( \lambda )$ on the replay buffer for policy evaluation.
404
+
405
+ Monotonic Advantage Re-Weighted Imitation Learning (MARWIL). Monotonic advantage reweighted imitation learning was proposed by Wang et al. (2018) for offline imitation learning. MARWIL was not demonstrated in online RL settings, but we evaluate it for offline pretraining followed by online fine-tuning as we do other offline algorithms. Although derived differently, MARWIL and AWR are similar algorithms and only differ in value estimation: MARWIL uses the on-policy single-path advantage estimate $A ( s , a ) \stackrel { . } { = } Q ^ { \pi _ { \beta } } ( s , a ) - V ^ { \pi _ { \beta } } ( s )$ instead of $\mathrm { T D } ( \lambda )$ as in AWR. Thus, we implement MARWIL by modifying the implementation of AWR.
406
+
407
+ Maximum a Posteriori Policy Optimization (MPO). We evaluate the MPO algorithm presented by Abdolmaleki et al. (2018). Due to a public implementation being unavailable, we modify our algorithm to be as close to MPO as possible. In particular, we change the policy update in Advantage Weighted Actor Critic to be:
408
+
409
+ $$
410
+ \theta _ { i } \longleftarrow \underset { \theta _ { i } } { \longleftarrow } \operatorname { a r g m a x } \mathbb { E } _ { s \sim \mathcal { D } , a \sim \pi ( a \mid s ) } \left[ \log \pi _ { \theta _ { i } } ( a \mid s ) \exp ( \frac { 1 } { \beta } Q ^ { \pi _ { \beta } } ( s , a ) ) \right] .
411
+ $$
412
+
413
+ Note that in MPO, actions for the update are sampled from the policy and the Q-function is used instead of advantage for weights. We failed to see offline or online improvement with this implementation in most environments, so we omit this comparison in favor of ABM.
414
+
415
+ Advantage-Weighted Behavior Model (ABM). We evaluate ABM, the method developed in Siegel et al. (2020). As with MPO, we modify our method to implement ABM, as there is no public
416
+
417
+ implementation of the method. ABM first trains an advantage model $\pi _ { \theta _ { \mathrm { a b m } } } ( a | s )$
418
+
419
+ $$
420
+ \theta _ { \mathrm { a b m } } = \underset { \theta _ { i } } { \operatorname { a r g m a x } } \mathbb { E } _ { \tau \sim \mathcal { D } } \left[ \sum _ { t = 1 } ^ { | \tau | } \log \pi _ { \theta _ { \mathrm { a b m } } } ( a _ { t } | s _ { t } ) f ( R ( \tau _ { t : N } ) - \hat { V } ( s ) ) \right] .
421
+ $$
422
+
423
+ where $f$ is an increasing non-negative function, chosen to be $f = 1 _ { + }$ . In place of an advantage computed by empirical returns $R ( \tau _ { t : N } ) - \hat { V } ( s )$ we use the advantage estimate computed per transition by the $Q$ value $Q ( s , a ) - V ( s )$ . This is favorable for running ABM online, as computing $R \big ( \tau _ { t : N } \big ) \ : - \ :$ $\hat { V } ( s )$ is similar to AWR, which shows slow online improvement. We then use the policy update:
424
+
425
+ $$
426
+ \theta _ { i } \longleftarrow \underset { \theta _ { i } } { \longleftarrow } \underset { \theta _ { i } } { \arg \operatorname* { m a x } } ~ \mathbb { E } _ { s \sim \mathcal { D } , a \sim \pi _ { \mathrm { a i m } } ( a | s ) } \left[ \log \pi _ { \theta _ { i } } ( a | s ) \exp \left( \frac { 1 } { \lambda } ( Q ^ { \pi _ { i } } ( s , a ) - V ^ { \pi _ { i } } ( s ) ) \right) \right] .
427
+ $$
428
+
429
+ Additionally, for this method, actions for the update are sampled from a behavior policy trained to match the replay buffer and the value function is computed as $V ^ { \pi } ( s ) = Q ^ { \pi } ( s , a )$ s.t. $a \sim \pi$ .
430
+
431
+ Demonstration Augmented Policy Gradient (DAPG). We directly utilize the code provided in (Rajeswaran et al., 2018) to compare against our method. Since DAPG is an on-policy method, we only provide the demonstration data to the DAPG code to bootstrap the initial policy from.
432
+
433
+ Bootstrapping Error Accumulation Reduction (BEAR). We utilize the implementation of BEAR provided in rlkit. We provide the demonstration and off-policy data to the method together. Since the original method only involved training offline, we modify the algorithm to include an online training phase. In general we found that the MMD constraint in the method was too conservative. As a result, in order to obtain the results displayed in our paper, we swept the MMD threshold value and chose the one with the best final performance after offline training with offline fine-tuning.
434
+
435
+ # A.6 EXTRA BASELINE COMPARISONS (CQL, ALGAEDICE)
436
+
437
+ In this section, we add comparisons to constrained Q-learning (CQL) (Kumar et al., 2020) and AlgaeDICE (Nachum et al., 2019). For CQL, we use the authors’ implementation, modified for additionally online-finetuning instead of only offline training. For AlgaeDICE, we use the publicly available implementation, modified to load prior data and perform 25K pretraining steps before online RL. The results are presented in Figure 7.
438
+
439
+ ![](images/c34118c8a741c3f0837829f3def19ff7e534b76ba15b2244eb2cb29f49f0a6aa.jpg)
440
+ Figure 7: Comparison of our method (AWAC) with CQL and AlgaeDICE. CQL and AWAC perform similarly offline, but CQL does not improve when fine-tuning online. AlgaeDICE does not perform well for offline pretraining.
441
+
442
+ # A.7 ONLINE FINE-TUNING FROM D4RL
443
+
444
+ In this experiment, we evaluate the performance of varied data quality (random, medium, mediumexpert, and expert) datasets included in D4RL (Fu et al., 2020), a dataset intended for offline RL. The results are obtained by first by training offline and then fine-tuning online on each setting for 500,000 additional steps. The performance of BEAR (Kumar et al., 2019) is attached as reference. We attempted to fine-tune BEAR online using the same protocol as AWAC but the performance did not improve and often decreased; thus we report the offline performance. All performances are scaled to 0 to 100, where 0 is the average returns of a random policy and 100 is the average returns of an expert policy (obtained by training online with SAC), as is standard for D4RL.
445
+
446
+ The results are presented in Figure 8. First, we observe that AWAC (offline) is competitive with BEAR, a commonly used offline RL algorithm. Then, AWAC is able to make progress in solving the tasks with online fine-tuning, even when initialized from random data or “medium” quality data, as shown by the performance of AWAC (online). In almost all settings, AWAC (online) is the best performing or tied with BEAR. In four of the six lower quality (random or medium) data settings, AWAC (online) is significantly better than BEAR; it is reasonable that AWAC excels in the lower-quality data regime because there is more room for online improvement, while both offline RL methods often start at high performance when initialized from higher-quality data.
447
+
448
+ <table><tr><td colspan="2"></td><td>AWAC</td><td>AWAC</td><td>BEAR</td></tr><tr><td colspan="2">HalfCheetah</td><td>(offline)</td><td>(online)</td><td>25.5</td></tr><tr><td rowspan="6">Hopper</td><td>random</td><td>2.2</td><td>52.9</td><td></td></tr><tr><td>medium</td><td>37.4</td><td>41.1</td><td>38.6</td></tr><tr><td>medium-expert</td><td>36.8</td><td>41.0</td><td>51.7</td></tr><tr><td>expert random</td><td>78.5 9.6</td><td>105.6</td><td>108.2 9.5</td></tr><tr><td>medium</td><td>72.0</td><td>62.8 91.0</td><td>47.6</td></tr><tr><td>medium-expert</td><td>80.9</td><td></td><td>4.0</td></tr><tr><td rowspan="5">Walker2D</td><td>expert</td><td>85.2</td><td>111.9</td><td>110.3</td></tr><tr><td>random</td><td>5.1</td><td>111.8 11.7</td><td>6.7</td></tr><tr><td>medium</td><td>30.1</td><td>79.1</td><td>33.2</td></tr><tr><td>medium-expert</td><td>42.7</td><td>78.3</td><td>10.8</td></tr><tr><td>expert</td><td>57.0</td><td>103.0</td><td>106.1</td></tr></table>
449
+
450
+ Figure 8: Comparison of our method (AWAC) fine-tuning on varying data quality datasets in D4RL (Fu et al., 2020). AWAC is able to improve its offline performance by further fine-tuning online.
md/train/Oa9RlXNggGy/Oa9RlXNggGy.md ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Does Knowledge Distillation Really Work?
2
+
3
+ Samuel Stanton NYU
4
+
5
+ Pavel Izmailov NYU
6
+
7
+ Polina Kirichenko NYU
8
+
9
+ Alexander A. Alemi Google Research
10
+
11
+ Andrew Gordon Wilson NYU
12
+
13
+ # Abstract
14
+
15
+ Knowledge distillation is a popular technique for training a small student network to emulate a larger teacher model, such as an ensemble of networks. We show that while knowledge distillation can improve student generalization, it does not typically work as it is commonly understood: there often remains a surprisingly large discrepancy between the predictive distributions of the teacher and the student, even in cases when the student has the capacity to perfectly match the teacher. We identify difficulties in optimization as a key reason for why the student is unable to match the teacher. We also show how the details of the dataset used for distillation play a role in how closely the student matches the teacher — and that more closely matching the teacher paradoxically does not always lead to better student generalization.
16
+
17
+ # 1 Introduction
18
+
19
+ Large, deep networks can learn representations that generalize well. While smaller, more efficient networks lack the inductive biases to find these representations from training data alone, they may have the capacity to represent these solutions [e.g., 2, 18, 32, 45]. Influential work on knowledge distillation $\bar { \| 2 2 \| }$ argues that Bucila et al. ˘ [5] “demonstrate convincingly that the knowledge acquired by a large ensemble of models [the teacher] can be transferred to a single small model [the student]”. Indeed this quote encapsulates the conventional narrative of knowledge distillation: a student model learns a high-fidelity representation of a larger teacher, enabled by the teacher’s soft labels.
20
+
21
+ Conversely, in Figure $^ 1$ we show that with modern architectures knowledge distillation can lead to students with very different predictions from their teachers, even when the student has the capacity to perfectly match the teacher. Indeed, it is becoming well-known that in self-distillation the student fails to match the teacher and, paradoxically, student generalization improves as a result [14, 40]. However, when the teacher is a large model (e.g. a deep ensemble) improvements in fidelity translate into improvements in generalization, as we show in Figure $\boxed { 1 } \mathbf { ( b ) }$ . For these large models there is still a significant accuracy gap between student and teacher, so fidelity is aligned with generalization.
22
+
23
+ We will distinguish between fidelity, the ability of a student to match a teacher’s predictions, and generalization, the performance of a student in predicting unseen, in-distribution data. We show that in many cases it is surprisingly difficult to obtain good student fidelity. In Section 5 we investigate the hypothesis that low fidelity is an identifiability problem that can be solved by augmenting the distillation dataset. In Section $6$ we investigate the hypothesis that low fidelity is an optimization problem resulting in a failure of the student to match the teacher even on the original training dataset. We present a summary of our conclusions in Section 7.
24
+
25
+ Does knowledge distillation really work? In short: Yes, in the sense that it often improves student generalization. No, in that knowledge distillation often fails to live up to its name, transferring very limited knowledge from teacher to student.
26
+
27
+ ![](images/b16f411144a106e66a8b6b067f80e336493e1572c29f9021f516793d8553eb0c.jpg)
28
+ Figure 1: Evaluating the fidelity of knowledge distillation. The effect of enlarging the CIFAR-100 distillation dataset with GAN-generated samples. (a): The student and teacher are both single ResNet-56 networks. Student fidelity increases as the dataset grows, but test accuracy decreases. (b): The student is a single ResNet-56 network and the teacher is a 3-component ensemble. Student fidelity again increases as the dataset grows, but test accuracy now slightly increases. The shaded region corresponds to $\mu \pm \sigma$ , estimated over 3 trials.
29
+
30
+ # 2 Related Work
31
+
32
+ Knowledge distillation can improve model efficiency [38, 45], unsupervised domain adaptation [37], improved object detection $\pmb { \Vert }$ , model transparency $\lVert \rVert \bigotimes \rVert$ , and adversarial robustness [15, 42].
33
+
34
+ Seminal work by Bucila et al. ˘ [5] showed that teacher-ensembles with thousands of simple components could be compressed into a single shallow network that matched or outperformed its teacher. Other early work proposed distilling ensembles of shallow networks into a single network [55], an idea which resonates with more recent work on the distillation of deep ensembles [2, 7, 46, 50, 53]. Recently Fakoor et al. [13] developed a data-augmentation scheme for the distillation of large ensembles of simple models for tabular data, achieving impressive results on a wide range of tabular benchmarks. Malinin et al. [35] proposed a method to model the implicit distribution over predictive distributions from which the ensemble component predictive distributions are drawn, rather than just the ensemble model average.
35
+
36
+ Our work focuses explicitly on student fidelity, decoupling our understanding of good fidelity from good generalization. We show that achieving good fidelity is extremely difficult, even with a variety of interventions, and seek to understand, by systematically considering several hypotheses, why knowledge distillation does not produce high fidelity students for modern architectures and datasets. In contrast, the distillation literature focuses largely on improving student generalization, without particularly distinguishing between fidelity and generalization.
37
+
38
+ For example, concurrent work by Beyer et al. [4] does not carefully distinguish generalization and fidelity metrics, but they assert that high student fidelity is conceptually desirable and apparently difficult to achieve when measured as the gap between teacher and student accuracy. As a result their work focuses most heavily on practical modifications to the distillation procedure for the best student top-1 accuracy. In this paper we investigate many of the same prescriptions, including careful treatment of data augmentation (such as showing the teacher and student the exact same input images), the addition of MixUp, and extended training duration. We also find that such interventions do improve student accuracy, but there still remains a large discrepancy between the predictive distributions of the teacher and the student. We also investigate multiple optimizers. While we do not pursue Shampoo $[ [ 1 7 , \mathbb { I } ] ]$ specifically, Beyer et al. $\mathbb { H }$ find similar qualitative results for Shampoo and Adam, besides faster convergence for Shampoo.
39
+
40
+ # 3 Preliminaries
41
+
42
+ We will focus on the supervised classification setting, with input space $\mathcal { X }$ and label space $\mathcal { V }$ , where $| { \mathcal { V } } | = c$ . Let $f : \mathcal { X } \times \Theta \mathbb { R } ^ { c }$ be a classifier parameterized by $\theta \in \Theta$ whose outputs define a categorical predictive distribution over $\mathcal { V }$ , $\hat { p } ( y = i | \mathbf { x } ) = \sigma _ { i } ( f ( \mathbf { x } , \theta ) )$ , where $\sigma _ { i } ( { \bf z } ) : = \dot { \exp ( z _ { i } ) } / \sum _ { j } \exp \bar { ( } z _ { j } )$ is the softmax link function. We will often refer to the outputs of a classifier $\mathbf { z } : = f ( \mathbf { x } , \theta )$ as logits. For convenience, we will use $t$ and $s$ as shorthand for $f _ { \mathrm { t e a c h e r } }$ and $f _ { \mathrm { s t u d e n t } }$ , respectively. When the teacher is an $m$ -component ensemble, the component logits $\left( \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { m } \right)$ , where $\mathbf { z } _ { i } = f _ { i } ( \mathbf { x } , \theta _ { i } )$ , are combined to form the teacher logits: $\begin{array} { r } { \mathbf { z } _ { t } = \log \bar { ( \sum _ { i = 1 } ^ { m } \sigma ( \mathbf { \bar { z } } _ { i } ) / m ) } } \end{array}$ . These combined logits correspond to the predictive distribution of the ensemble model average. The experiments in the main text consider $m \in \{ 1 , 3 , 5 \}$ , and we include results up to $m = 1 2$ in Appendix B.2.1
43
+
44
+ # 3.1 Knowledge Distillation
45
+
46
+ Hinton et al. $\pmb { \mathbb { D } } 2 \mathbf { \mathbb { I } }$ proposed a simple approach to knowledge distillation. The student minimizes a weighted combination of two objectives, $\mathcal { L } _ { s } : = \alpha \mathcal { L } _ { \mathrm { N L L } } + ( 1 - \alpha ) \mathcal { L } _ { \mathrm { K D } }$ , where $\alpha \in [ 0 , 1 )$ . Specifically,
47
+
48
+ $$
49
+ \mathcal { L } _ { \mathrm { N L L } } ( \mathbf { z } _ { s } , \mathbf { y } ) : = - \sum _ { j = 1 } ^ { c } y _ { j } \log \sigma _ { j } ( \mathbf { z } _ { s } ) , ~ \mathcal { L } _ { \mathrm { K D } } ( \mathbf { z } _ { s } , \mathbf { z } _ { t } ) : = - \tau ^ { 2 } \sum _ { j = 1 } ^ { c } \sigma _ { j } \left( \frac { \mathbf { z } _ { t } } { \tau } \right) \log \sigma _ { j } \left( \frac { \mathbf { z } _ { s } } { \tau } \right) .
50
+ $$
51
+
52
+ $\mathcal { L } _ { \mathrm { N L L } }$ is the usual supervised cross-entropy between the student logits $\mathbf { z } _ { s }$ and the one-hot labels $\mathbf { y }$ . Recalling that $\begin{array} { r } { \mathrm { K L } ( p | | q ) = \sum _ { j } p _ { j } ( \log q _ { j } - \log p _ { j } ) } \end{array}$ , we see that $\mathcal { L } _ { \mathrm { N L L } }$ is equivalent (up to a constant) to the KL from the empirical data distribution to the student predictive distribution $( \hat { p } _ { s } )$ . ${ \mathcal { L } } _ { \mathrm { K D } }$ is the added knowledge distillation term that encourages the student to match the teacher. It is the cross-entropy between the teacher and student predictive distributions $\hat { p } _ { t } = \sigma ( \mathbf { z } _ { t } )$ and $\hat { p } _ { s } = \sigma ( { \bf z } _ { s } )$ , both scaled by a temperature hyperparameter $\tau > 0$ . If $\tau = 1$ then ${ \mathcal { L } } _ { \mathrm { K D } }$ is similarly equivalent to the KL from the teacher to the student, $\mathrm { K L } ( \hat { p } _ { t } | | \hat { p } _ { s } )$ . Since we focus on distillation fidelity, we choose $\alpha = 0$ for all experiments in the main text to avoid any confounding from true labels, but we also include a limited ablation of $\alpha$ in Figure $^ { 1 4 }$ in Appendix $\boxed { C . 5 }$ for the curious reader.
53
+
54
+ As $\tau \to + \infty$ , $\nabla _ { \mathbf { z } _ { s } } \mathcal { L } _ { \mathrm { K D } } ( \mathbf { z } _ { s } , \mathbf { z } _ { t } ) \approx \mathbf { z } _ { t } - \mathbf { z } _ { s }$ , and thus in the limit $\nabla _ { \mathbf { z } _ { s } } \mathcal { L } _ { \mathrm { K D } }$ is approximately equivalent to $\nabla _ { \mathbf { z } _ { s } } | | \mathbf { z } _ { t } - \mathbf { z } _ { s } | | _ { 2 } ^ { 2 } / 2$ , assigning equal significance to every class logit, regardless of its contribution to the predictive distribution. In other words $\tau$ determines the “softness” of the teacher labels, which in turn determines the allocation of student capacity. If the student is much smaller than the teacher, the student capacity can be focused on matching the teacher’s top- $k$ predictions, rather than matching the full teacher distribution by choosing a moderate value (e.g. $\tau = 4$ ). In Appendix $\underline { { \mathbf { B . l } } }$ we include further discussion on the interplay of teacher ensemble size, teacher network capacity, and distillation temperature on the student labels.
55
+
56
+ The teacher and student often share at least some training data. It is also common to enlarge the student training data in some way (e.g. incorporating unlabeled examples as in Ba and Caruana $\left[ \left[ 2 \right] \right]$ ). When there is a possibility of confusion, we will refer to the student’s training data as the distillation data to distinguish it from the teacher’s training data.
57
+
58
+ # 3.2 Metrics and Evaluation
59
+
60
+ To measure generalization, we report top-1 accuracy, negative log-likelihood (NLL) and expected calibration error (ECE) $\boxed { 1 1 6 }$ . To measure fidelity, we report the following:
61
+
62
+ $$
63
+ \begin{array} { r l } & { \displaystyle \mathrm { A v e r a g e ~ T o p - 1 ~ A g r e e m e n t : } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } 1 \{ \mathrm { a r g m a x } \sigma _ { j } ( \mathbf { z } _ { t , i } ) = \underset { j } { \mathrm { a r g m a x } } \sigma _ { j } ( \mathbf { z } _ { s , i } ) \} , } \\ & { \displaystyle \mathrm { A v e r a g e ~ P r e d i c t i v e ~ K L : } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathrm { K L } \left( \hat { p } _ { t } ( \mathbf { y } | \mathbf { x } _ { i } ) \parallel \hat { p } _ { s } ( \mathbf { y } | \mathbf { x } _ { i } ) \right) , } \end{array}
64
+ $$
65
+
66
+ Eqn. $\textcircled{2}$ is the average agreement between the student and teacher’s top-1 label. Eqn. $\textcircled{3}$ is the average KL divergence from the predictive distribution of the teacher to that of the student, a measure of fidelity sensitive to all of the labels.
67
+
68
+ While improvements in generalization metrics are relatively easy to understand, interpreting fidelity metrics requires some care. For example, suppose we have three independent models: $f _ { 1 } , f _ { 2 }$ , and $f _ { 3 }$ that respectively achieve $55 \%$ , $7 5 \%$ , and $9 5 \%$ test accuracy. $f _ { 1 }$ and $f _ { 3 }$ can agree on at most $60 \%$ of points, whereas $f _ { 2 }$ and $f _ { 3 }$ agree on at least $70 \%$ , but it would obviously be incorrect to make any claim about $f _ { 2 }$ being a better distillation of $f _ { 3 }$ since each model was trained completely independently. To account for such confounding when evaluating the distillation of a student $s$ from a teacher $t$ , we also evaluate another student $s ^ { \prime }$ distilled through an identical procedure from an independent teacher.
69
+
70
+ By comparing the fidelity of $( t , s )$ and $( t , s ^ { \prime } )$ we can distinguish between a generic improvement in generalization and an improvement specifically to fidelity. If $s$ and $s ^ { \prime }$ have comparable fidelity, then the students agree with the teacher at many points because they generalize well, and not the reverse.
71
+
72
+ # 4 Knowledge Distillation Transfers Knowledge Poorly
73
+
74
+ In this section, we present evidence that we are not able to distill large networks such as a ResNet-56 with high fidelity, and discuss why high fidelity is an important objective.
75
+
76
+ # 4.1 When is knowledge transfer successful?
77
+
78
+ We first consider the easy task of distilling a LeNet-5 teacher into an identical student network as a motivating example. We train the teacher on a random subset of 200 examples from the MNIST training set for 100 epochs, resulting in a $8 4 \%$ to $8 6 \%$ teacher test accuracy across different subsets.2 We then distill the teacher using the full MNIST train dataset with 60,000 examples, as well as $2 5 \%$ , $50 \%$ , and $100 \%$ of the EMNIST train dataset [11]. The EMNIST train set contains 697,932 images.
79
+
80
+ In Figure $2$ we see that knowledge distillation works as expected. With enough examples the student learns to make the same predictions as the teacher (over $9 9 \%$ top-1 test agreement). Notably, in this case, self-distillation does not improve generalization, since the slight difference between the teacher and student accuracy is explained by variance between trials.
81
+
82
+ Now we consider a more challenging task: distilling a ResNet-56 teacher trained on CIFAR-100 into an identical student network (Figure $\mathbb { L } ,$ left). Since no dataset drawn from the same distribution as CIFAR-100 is publicly available, to augment the distillation data, we instead combined samples from an SN-GAN $\textcircled { \ 3 9 }$ pre-trained on CIFAR-100 with the original CIFAR-100 train dataset. Appendix A.3 details the hyperparameters and training procedure for the GAN, teacher, and student.
83
+
84
+ Like the MNIST experiment, as we enlarge the distillation dataset the student fidelity improves. However, in this case the improvement is modest, with the fidelity reaching nowhere near $9 9 \%$ test agreement. Since a ResNet-56 has many more parameters than a LeNet-5, it is possible that the student simply has not seen enough examples to perfectly emulate the teacher, a hypothesis we discuss in more detail in Section $\underline { { \boldsymbol { \mathsf { F . 1 } } } } \big \| .$ Also, like the MNIST experiment, as the distillation dataset grows the student accuracy approaches the teacher’s. Unlike the MNIST experiment, the student test accuracy is higher than the teacher’s when the distillation dataset is small, so increasing fidelity decreases student generalization.
85
+
86
+ ![](images/346544e04a6a5855d2eed11bdd0190beeb1adbb82c1cd34a0f17fe19958b3f37.jpg)
87
+ Figure 2: LeNet-5 self-distillation on MNIST with additional distillation data. The shaded region corresponds to $\mu \pm \sigma$ , estimated over 3 trials.
88
+
89
+ # 4.2 What can self-distillation tell us about knowledge distillation in general?
90
+
91
+ We have seen in Figure $\mathbb { U } ( { \mathrm { a } } )$ that with self-distillation the student can exceed the teacher performance, in accordance with Furlanello et al. [14]. This result is only possible by virtue of failing at the distillation procedure: if the student matched the teacher perfectly then the student could not outperform the teacher. On the other hand, if the teacher generalizes significantly better than an independently trained student, we would expect the benefits of fidelity to dominate other regularization effects associated with not matching the teacher. This setting reflects the original motivation for knowledge distillation, where we wish to faithfully transfer the representation discovered by a large model or ensemble of models into a more efficient student.
92
+
93
+ In Figure $1 ( \mathsf { b } )$ we see that if we move from self-distillation to the distillation of a 3 ResNet-56 teacher ensemble, fidelity becomes positively correlated with generalization. But there is still a significant gap in fidelity, even after the distillation set is enlarged with $5 0 k$ GAN samples. In practice, the gap remains large enough that higher fidelity students do not always have better generalization, and the regularization effects we see in self-distillation do play a role for more broadly understanding student generalization. We will indeed show in Section $\bar { 5 }$ that higher fidelity students do not always generalize better, even if the teacher generalizes much better than the student.
94
+
95
+ ![](images/a6142c0a9a06255373aeb1f38774818c84e68662d3c4d427eee5d2f1eff00a17.jpg)
96
+ Figure 3: Data augmentation and distillation: Test accuracy and teacher-student agreement when distilling a 5-component ResNet-56 teacher ensemble into a ResNet-56 student on CIFAR-100 with varying augmentation policies. The best performing policy is shown in green, results averaged over 3 runs. Additional metrics are reported in Figure $\checkmark$ in Appendix $\boxed { \mathbf { C } }$ Mixup and GAN augmentation provide the best generalization, and Mixup $\tau = 4$ ) provides the best fidelity. The baseline policy (crops and flips) with $\tau = 4$ is a surprisingly strong baseline. The error bars indicate $\pm \sigma$ .
97
+
98
+ # 4.3 If distillation already improves generalization, why care about fidelity?
99
+
100
+ While knowledge distillation does often improve generalization, understanding the relationship between fidelity and generalization, and how to maximize fidelity, is important for several reasons — including better generalization!
101
+
102
+ Better generalization in distilling large teacher models and ensembles. Knowledge distillation was initially motivated as a means to deploy powerful models to small devices or low-latency controllers [e.g., 10, 21, 26, 52, 54]. While in self-distillation generalization and fidelity are in tension, there is often a significant disparity in generalization between large teacher models, including ensembles, and smaller students. We have seen this disparity in Figure $1 \bar { ( \mathbf { b } ) }$ . We additionally show in Figure 10 in Appendix $\mathbf { B . l }$ that as we increase the number of ensemble components, the generalization disparity between teacher and distilled student increases. Improving student fidelity is the most obvious way to close the generalization disparity between student and teacher in these settings. Even if one exclusively cares about student accuracy, fidelity is a key consideration outside self-distillation.
103
+
104
+ Interpretability and reliability. Knowledge distillation has been identified as a means to transfer representations discovered by large black-box models into simpler more interpretable models, for example to provide insights into medical diagnostics, or discovering rules for understanding sentiment in text [e.g., 23, 24, 6, 33, 8]. The ability to perform this transfer could have extraordinary scientific consequences: large models can often discover structure in data that we would not have anticipated a priori. Moreover, we often want to transfer properties such as well-calibrated uncertainties or robustness, which have been well-established for larger models, so that we can safely deploy more efficient models in their place. In both cases, achieving good distillation fidelity is crucial.
105
+
106
+ Understanding. The name knowledge distillation implies we are transferring knowledge from the teacher to the student. For this reason, improved student generalization as a consequence of a distillation procedure is sometimes conflated with fidelity. Decoupling fidelity and generalization, and explicitly studying fidelity, is foundational to understanding how knowledge distillation works and how we can make it more useful across a variety of applications.
107
+
108
+ # 4.4 Possible causes of low distillation fidelity
109
+
110
+ If we are able to match the student model to the teacher on a comprehensive distillation dataset, we expect it to match on the test data as well, achieving high distillation fidelity3. Possible causes of the poor distillation fidelity in our CIFAR-100 experiments include:
111
+
112
+ ![](images/8a2a6126b32fff96f219ed1e9e4115bce416ee0fae8ece2522be6c23d9e96dca.jpg)
113
+ Figure 4: Data recycling and distillation: results on subsampled CIFAR-100. Top: We fix the temperature $( \tau = 4$ ) and vary the number of ensemble components $( m )$ , comparing students distilled on the same dataset as the teacher $( \mathcal { D } _ { 0 } / \mathcal { D } _ { 0 } )$ , a reserved dataset $( \mathcal { D } _ { 0 } / \mathcal { D } _ { 1 } )$ , or both $( \mathcal { D } _ { 0 } / \mathcal { D } _ { 0 } \cup \mathcal { D } _ { 1 } )$ . Distilling on both produces the best result, while distilling on $\mathcal { D } _ { 0 }$ increases accuracy and decreases fidelity, relative to $\mathcal { D } _ { 1 }$ . Bottom: We repeat the experiment, but fix $m = 3$ and vary $\tau$ . The shaded region corresponds to $\mu \pm \sigma$ , estimated over 3 trials.
114
+
115
+ Student capacity – We observe low fidelity even in the self-distillation setting, so we can rule out student capacity as a primary cause, but we also confirm in Figure 12 in Appendix $\mathbb { E . l }$ that increasing the student capacity has very little effect on fidelity in the ensemble-distillation setting.
116
+
117
+ Network architecture – Low fidelity could be specific to ResNet-like architectures, an explanation we rule out by showing similar results with VGG networks [47] in Figure 13 in Appendix C.2.
118
+
119
+ Dataset scale and complexity – we provide similar results in Section C.3 for ImageNet, showing that our findings apply to datasets of larger scale and complexity.
120
+
121
+ Data domain – Similarly in Section ${ \bf C . 4 }$ we observe low distillation fidelity in the context of text classification (sentiment analysis on the IMDB dataset), showing our results are relevant beyond image classification.
122
+
123
+ Identifiability (Section $5$ ) – the distillation data is insufficient to distinguish high-fidelity and lowfidelity students. In other words, matching the teacher predictions on the distillation dataset does not lead to matching predictions on the test data.
124
+
125
+ Optimization (Section 6) – we are unable to solve the distillation optimization problem sufficiently well. The student does not agree with the teacher on test because it does not even agree on train.
126
+
127
+ # 5 Identifiability: Are We Using the Right Distillation Dataset?
128
+
129
+ We investigate whether it is possible to attain the level of fidelity observed with LeNet-5s on MNIST with ResNets on CIFAR-100 by addressing the identifiability problem — have we shown the student enough of the right input-teacher label pairs to define the solution we want?
130
+
131
+ # 5.1 Should we do more data augmentation?
132
+
133
+ Data augmentation is a simple and practical method to increase the support of the distillation data distribution. If identifiability is a primary cause of poor distillation fidelity, using a more extensive data augmentation strategy during distillation should improve fidelity.
134
+
135
+ To test this hypothesis, we evaluated the effect of several augmentation strategies on student fidelity and generalization. In Figure $\textcircled { 3 } ,$ the teacher is a 5-component ensemble of ResNet-56 networks trained on CIFAR-100 with the Baseline augmentation strategy: horizontal flips and random crops.
136
+
137
+ We report the student accuracy and teacher-student agreement for each augmentation strategy, and also include results for Baseline with $\tau = 1$ and $\tau = 4$ to demonstrate the effect of logit tempering.
138
+
139
+ We first observe that the best augmentation policies for generalization, $M i x U p$ , and $G A N \mathbb { H }$ are not the best policies for fidelity. Furthermore, although many augmentation strategies enable slightly higher distillation fidelity compared to Baseline $\tau = 1 .$ ), even the best augmentation policy, Mixup $\tau = 4 ,$ ), only achieves a modest $86 \%$ test agreement. In fact the Baseline $\tau = 4 ,$ ) policy is quite competitive, achieving $8 4 . 5 \%$ test agreement. Many of the augmentation strategies also slightly improve teacher-student KL relative to Baseline $\tau = 4$ ) (see Figure $\textcircled { 1 1 }$
140
+
141
+ In Figure 11 in Appendix ${ \bf B } . 3$ we report all generalization and fidelity metrics for a range of ensemble sizes, as well as the results for the independent student baseline discussed in Section $\underline { { \bar { 3 . 2 } } }$ Often these independent students, taught how to mimic a completely different model, have nearly as good test agreement with the teacher as the student explicitly trained to emulate it. See Appendix $\mathbf { \bar { A } } . 1$ for a detailed description of the augmentation procedures.
142
+
143
+ Should data augmentation be close to the data distribution? In theory, any data augmentation should help with identifiability: if a student matches a teacher on more data, it is more likely to match the teacher elsewhere. However, the Noise and $O O D$ augmentation strategies based on noise and outof-distribution data fail on all metrics, decreasing performance compared to the baseline. In practice, data augmentation has an effect beyond improving identifiability — it has a regularizing effect, making optimization more challenging. We explore this facet of data augmentation in Section 6.
144
+
145
+ The slight improvements to fidelity with extensive augmentations suggest that increasing the support of the distillation dataset can indeed improve distillation fidelity. However, since the benefit is so small compared to heuristics like logit tempering (which does not modify the support at all), it is very unlikely that an insufficient quantity of teacher labels is the primary obstacle to high fidelity.
146
+
147
+ # 5.2 The data recycling hypothesis
148
+
149
+ If simply showing the student more labels does not always significantly improve fidelity, perhaps we are not showing the student the right labels. Additional data augmentation during distillation does give the student more teacher labels to match, but also introduces a distribution shift between the images the teacher was trained on and the images the student is distilling on. Even when the teacher and student have the same augmentation policy, reusing the teacher’s training data for distillation violates the assumptions of empirical risk minimization (ERM) because the distillation data is not an independent draw from the true joint distribution over images and teacher labels. What if there was no augmentation distribution shift, and the student was distilled on a fresh draw from the joint test distribution over images and teacher labels?
150
+
151
+ To investigate the effect of recycling teacher data during distillation we randomly split the CIFAR-100 training dataset $\mathcal { D }$ into two equal parts, $\mathcal { D } _ { 0 }$ and $\mathcal { D } _ { 1 }$ . We train teacher ResNet-56 ensembles on $\mathcal { D } _ { 0 }$ , and then compare $s _ { 0 }$ , a student distilled on the original $\mathcal { D } _ { 0 }$ , $s _ { 1 }$ , a student distilled on the unseen $\mathcal { D } _ { 1 }$ , and $s _ { 0 \cup 1 }$ , a student distilled on both: $\mathcal { D } _ { 0 } \cup \mathcal { D } _ { 1 }$ . Note that the students cannot access the true labels, only those provided by the teacher. We present the results in Figure 4, varying the ensemble size in the top row and the logit temperature in the bottom row.
152
+
153
+ Surprisingly, $s _ { 0 }$ attains higher test accuracy than $s _ { 1 }$ , while showing worse ECE and lower fidelity (measured by test teacher-student agreement and test teacher-student KL). Therefore, the hypothesis that $s _ { 1 }$ should be a higher fidelity distillation of the teacher than $s _ { 0 }$ does hold, but the gain in fidelity does not result in $s _ { 1 }$ best replicating the teacher’s accuracy. The best attributes of $s _ { 0 }$ and $s _ { 1 }$ are combined by $s _ { 0 \cup 1 }$ , which coincides with how unlabeled data is typically used in practice $\pmb { \left. 2 \right. }$ . The reason for this puzzling observation is simply that for the larger teachers fidelity has not improved enough to also improve generalization. In fact, the best teacher-student agreement is only around $8 5 \%$ , no improvement when compared to the results from extensive data augmentation in the last section. We again find that modifying the distillation data can slightly improve fidelity, but the evidence does not support blaming poor distillation fidelity on the wrong choice of distillation data.
154
+
155
+ ![](images/ac9d8cf1ad2151d45710ce595488770dc75dd7b48df44c2e8e14393f25a3bc6d.jpg)
156
+ Figure 5: The train agreement for teacher ensembles $( m \in \{ 1 , 3 , 5 \} )$ ) and student on the distillation data for a ResNet-56 on CIFAR-100 under different augmentation policies. In all panels, increasing the softness of the teacher labels by adding examples not in the teacher train data makes distillation more difficult. Left: agreement for the synthetic GAN-augmentation policy from Figure 1. Middle: agreement from subsampled CIFAR-100 experiment in Figure $4 .$ Right: agreement for some of the augmentation policies in Figure 3. The shaded region is not visible because the variance is very low.
157
+
158
+ # 6 Optimization: Does the Student Match the Teacher on Distillation Data?
159
+
160
+ If poor fidelity is not primarily an identifiability problem from the wrong choice of distillation data, perhaps there is a simpler explanation. Up to this point, we have focused on student fidelity on a held-out test set. Now we turn our attention to student behavior on the distillation data itself. Does the student match the teacher on the data it is trained to match it on?
161
+
162
+ # 6.1 More distillation data lowers train agreement
163
+
164
+ In Figure 1 we presented an experiment distilling ResNet-56 networks on CIFAR-100 augmented with synthetic GAN-generated images. We saw that enlarging the distillation dataset leads to improved teacher-student agreement on test, but the agreement remains relatively low (below $8 0 \%$ ) even for the largest distillation dataset that we considered. In Figure $5$ (left panel), we report the teacher-student agreement for the same experiment, but now on the distillation dataset. We now observe the opposite trend: as the distillation dataset becomes larger, it becomes more challenging for the student to match the teacher. Even when the student has identical capacity to the teacher, the student only achieves $9 5 \%$ agreement with the teacher when we use $5 0 k$ synthetic images for distillation.
165
+
166
+ The drop in train agreement is even more pronounced when we use extensive data augmentation. In Figure ${ \bar { 5 , } }$ right panel, we report the teacher-student agreement on the train set with data augmentation for a subset of augmentation strategies presented in Section $\underline { { \boldsymbol { \mathsf { F . 1 } } } } \big \| .$ We use the CIFAR-100 dataset and the ResNet-56 model for the teachers and the students (for details, see Section $\underline { { \vert 5 . 1 \rangle } }$ . In each case, we measure agreement on the augmented training set that was used during distillation. While for the baseline augmentation strategy, we can achieve almost perfect teacher-student agreement, for heavier augmentations the agreement drops dramatically. For the Rotation, Vertical Flip and Color Jitter augmentations, the agreement is between $8 0 \%$ and $9 0 \%$ for all the considered teacher sizes. For Combined Augs, the combination of these three augmentation strategies, the agreement drops even further, to just $6 0 \%$ in self-distillation!
167
+
168
+ Our intuition about how knowledge distillation should work largely hinges on the assumption that after distillation the student matches the teacher on the distillation set. However, the results presented in this section suggest that in practice the optimization method is unable to achieve high fidelity even on the distillation dataset when extensive data augmentation or synthetic data is used. The inability to solve the optimization problem undermines distillation: in order to find a student that would match the teacher on all inputs, we need to at least be able to find a student that would match the teacher on all of the distillation data.
169
+
170
+ Optimization and the train-test fidelity gap. Notably, despite having the lowest train agreement, the Combined Augs policy results in better test agreement than other polices with better train agreement (Figure $3 )$ ). This result highlights a fundamental trade-off in knowledge distillation: the student needs many teacher labels match the teacher on test, but introducing examples not in the teacher train data makes matching the teacher on the distillation data very difficult.
171
+
172
+ ![](images/1548c429dc0ad80cae5a1fd8ff926d15a7672780d4723132d08c3a676d55517f.jpg)
173
+ Figure 6: Optimization and distillation: self-distillation with ResNet-20s with LayerNorm on CIFAR-100. (a): Final train agreement for SGD and Adam optimizers. Training longer improves agreement, but it remains below $8 5 \%$ even after $5 k$ epochs. (b): Final train loss and agreement when the initialization is a convex combination of teacher and random weights, $\theta _ { s } = \lambda \theta _ { t } + \mathbf { \bar { ( } 1 - } \lambda ) \theta _ { r }$ . (c): Projections of the distillation loss surface on the plane intersecting $\theta _ { t }$ , the initial student weights, and the final student weights for different $\lambda$ . When $\lambda$ is small, the student converges to a suboptimal solution with low agreement. The uncertainty regions correspond to $\mu \pm \sigma$ , estimated over 3 trials.
174
+
175
+ # 6.2 Why is train agreement so low?
176
+
177
+ A simplified distillation experiment. To simplify our exploration, we focus on self-distillation of a ResNet-20 on CIFAR-100. We use the Baseline data augmentation strategy, as we found that a ResNet-20 student is unable to match the teacher on train even with basic augmentation. We also replace the BatchNorm layers $\mathbb { \left. \overline { { 2 5 } } \right. }$ in ResNet-20 with LayerNorm $\pmb { \left[ \sqrt { 3 } \right] }$ , because we found that with BatchNorm layers even when the teacher and the student have identical weights, they can make different predictions due to differences in the activation statistics accumulated by the BatchNorm layers. Layer normalization does not collect any activation statistics, so the student will match the teacher as long as the weights coincide.
178
+
179
+ Can we solve the optimization problem better? We verify that the distillation fidelity cannot be significantly improved by training longer or with a different optimizer. By default, in our experiments we use stochastic gradient descent (SGD) with momentum, train the student for 300 epochs, and use a weight decay value of $1 0 ^ { - 4 }$ . In Figure $\boxed { 6 }$ we report the results for the SGD and Adam $\mathbb { \left[ \left[ 2 7 \right] \right] }$ optimizers run for $1 k$ and $5 k$ epochs without weight decay. Switching from SGD to Adam only reduced fidelity.
180
+
181
+ For both optimizers, training for more epochs does slightly improve train agreement. In particular, with SGD we achieve $8 3 . 3 \%$ agreement when training for $5 k$ epochs compared to $7 8 . 9 5 \%$ when training for 300 epochs. It is possible, though unlikely, that if we train for even more epochs the train agreement could reach $1 0 0 \%$ . However, training for $5 k$ epochs is significantly longer than what is typically done in practice (100 to 500 epochs). Furthermore, the improvement from $1 k$ to $5 k$ epochs is only about $2 \%$ , suggesting that we would need to train for tens of thousands of epochs, even in the optimistic case that agreement improves linearly, in order to get close to $1 0 0 \%$ train agreement.
182
+
183
+ The distillation loss surface hypothesis: If we cannot perfectly distill a ResNet-20 on CIFAR-100 with any of the interventions we have discussed so far, we now ask if there is any modification of the problem that can produce a high-fidelity student.
184
+
185
+ In the self-distillation setting, we do know of at least one set of weights that is optimal w.r.t. the distillation loss — the teacher’s own weights $\theta _ { t }$ . Letting $\theta _ { r }$ be a random weight initialization, in Figure $\boxed { 6 }$ (a) we examine the effect of choosing the student initialization to be a convex combination of the teacher and random weights, $\theta _ { s } = \lambda \bar { \theta _ { t } } + ( 1 - \lambda ) \theta _ { r }$ . After being initialized in this way, the student was trained as before. In other words $\lambda = 0$ corresponds to a random initialization and $\lambda = 1$ corresponds to initializing the student weights at the final teacher weights.
186
+
187
+ We find that if the student is initialized far from the teacher $\lambda \leq 0 . 2 5 )$ , the optimizer converges to a sub-optimal value of the distillation loss, producing a student that significantly disagrees with the teacher. However at $\lambda = 0 . 3 7 5$ there is a sudden change. The final train loss drops to the optimal value and the agreement drastically increases, and the behavior continues for $\lambda > 0 . 3 7 5$ . To further investigate, in Figure $6 ( \mathrm { c ) }$ we visualize the distillation loss surface for $\lambda \in \{ 0 , 0 . 2 5 , 0 . 3 7 5 \}$ projected on the 2D subspace intersecting $\theta _ { t }$ , the initial student weights, and the final student weights. If the student is initialized far from the teacher $( \lambda \in \{ 0 , 0 . 2 5 \} )$ , it converges to a distinct, sub-optimal basin of the loss surface. On the other hand, when initialized close to the teacher $\lambda = 0 . 3 7 5$ ), the student converges to the same basin as the teacher, achieving nearly $100 \%$ agreement.
188
+
189
+ Table 1: We examine whether fidelity can be improved in the context of ResNet-20 self-distillation on CIFAR-100 if the teacher and student share the same weight initialization. All metrics are computed on the test set. A shared initialization does make the student slightly more similar to the teacher in activation space (measured by CKA), but in function space the results are indistinguishable from randomly initialized students. We report the mean and standard deviation, estimated from 10 trials. The average teacher accuracy was 70.522 (0.412).
190
+
191
+ <table><tr><td colspan="3"></td><td colspan="3">CKA (1)</td></tr><tr><td>Init.</td><td>Agree. (↑)</td><td>KL (↓)</td><td>Stage 1</td><td> Stage 2</td><td>Stage 3</td></tr><tr><td>Rand.</td><td>77.174 (0.352)</td><td>0.836 (0.016)</td><td>0.939 (0.017)</td><td>0.925 (0.027)</td><td>0.885 (0.011)</td></tr><tr><td>Teach.</td><td>77.098 (0.238)</td><td>0.838 (0.020)</td><td>0.951 (0.017)</td><td>0.937 (0.020)</td><td>0.890 (0.015)</td></tr></table>
192
+
193
+ Is using the initial teacher weights enough for good fidelity? If good fidelity can be obtained by initializing the student near the final teacher weights, it is possible that similar results could be obtained by initializing the student at the initial teacher weights. In Table $^ 1$ we compare students distilled from random initializations with those initialized at the initial teacher weights. In addition to the metrics reported in the rest of the paper, we also include the centered kernel alignment (CKA) $\left[ \left[ 2 8 \right] \right]$ of the preactivations of each of the teacher and student networks. There is a small increase in CKA, indicating that sharing an initialization between teacher and student does increase alignment in activation space, but functionally the students are identical to their randomly initialized counterparts – there is no observable change in accuracy, agreement, or predictive KL when compared to random initialization.
194
+
195
+ To summarize, we have at last identified a root cause of the ineffectiveness of all our previous interventions on the knowledge distillation procedure. Knowledge distillation is unable to converge to optimal student parameters, even when we know a solution and give the initialization a small head start in the direction of an optimum. Indeed, while identifiability can be an issue, in order to match the teacher on all inputs, the student has to at least match the teacher on the data used for distillation, and achieve a near-optimal value of the distillation loss. Furthermore, the suboptimal convergence of knowledge distillation appears to be a consequence of the optimization dynamics specifically, and not simply initialization bias. In practice, optimization converges to sub-optimal solutions, leading to poor distillation fidelity.
196
+
197
+ # 7 Discussion
198
+
199
+ Our work provides several new key findings about knowledge distillation:
200
+
201
+ • Good student accuracy does not imply good distillation fidelity: even outside of selfdistillation, the models with the best generalization do not always achieve the best fidelity. • Student fidelity is correlated with calibration when distilling ensembles: although the highest-fidelity student is not always the most accurate, it is always the best calibrated. • Optimization is challenging in knowledge distillation: even in cases when the student has sufficient capacity to match the teacher on the distillation data, it is unable to do so. • There is a trade-off between optimization complexity and distillation data quality: Enlarging the distillation dataset beyond the teacher training data makes it easier for the student to identify the correct solution, but also makes an already difficult optimization problem harder.
202
+
203
+ In standard deep learning, we are saved by not needing to solve the optimization problem well: while it true that our training loss is highly multimodal, properties such as the flatness of good solutions, the inductive biases of the network, and the implicit biases of SGD, often enable good generalization in practice. In knowledge distillation, however, good fidelity is directly aligned with solving what turns out to be an exceptionally difficult optimization problem.
204
+
205
+ # Acknowledgements
206
+
207
+ The authors would like to thank Gregory Benton, Marc Finzi, Sanae Lotfi, Nate Gruver, and Ben Poole for helpful feedback. This research is supported by an Amazon Research Award, NSF I-DISRE 193471, NIH R01DA048764-01A1, NSF IIS-1910266, and NSF 1922658NRT-HDR: FUTURE Foundations, Translation, and Responsibility for Data Science. Samuel Stanton is also supported by a United States Department of Defense NDSEG fellowship.
208
+
209
+ # References
210
+
211
+ [1] Anil, R., Gupta, V., Koren, T., Regan, K., and Singer, Y. (2021). Scalable second order optimization for deep learning. arXiv preprint arXiv:2002.09018.
212
+ [2] Ba, J. and Caruana, R. (2014). Do deep nets really need to be deep? Advances in neural information processing systems, 27:2654–2662.
213
+ [3] Ba, J. L., Kiros, J. R., and Hinton, G. E. (2016). Layer normalization. Proceedings of the NIPS 2016 Deep Learning Symposium.
214
+ [4] Beyer, L., Zhai, X., Royer, A., Markeeva, L., Anil, R., and Kolesnikov, A. (2021). Knowledge distillation: A good teacher is patient and consistent.
215
+ [5] Bucila, C., Caruana, R., and Niculescu-Mizil, A. (2006). Model compression. In ˘ Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 535–541.
216
+ [6] Che, Z., Purushotham, S., Khemani, R., and Liu, Y. (2015). Distilling knowledge from deep networks with applications to healthcare domain. arXiv preprint arXiv:1512.03542.
217
+ [7] Chebotar, Y. and Waters, A. (2016). Distilling knowledge from ensembles of neural networks for speech recognition. In Interspeech, pages 3439–3443.
218
+ [8] Chen, D., Mei, J.-P., Wang, C., Feng, Y., and Chen, C. (2020). Online knowledge distillation with diverse peers. In AAAI, pages 3430–3437.
219
+ [9] Chen, G., Choi, W., Yu, X., Han, T., and Chandraker, M. (2017). Learning efficient object detection models with knowledge distillation. In Advances in neural information processing systems, pages 742–751.
220
+ [10] Cho, J. H. and Hariharan, B. (2019). On the efficacy of knowledge distillation. In Proceedings of the IEEE International Conference on Computer Vision, pages 4794–4802.
221
+ [11] Cohen, G., Afshar, S., Tapson, J., and Van Schaik, A. (2017). Emnist: Extending mnist to handwritten letters. In 2017 International Joint Conference on Neural Networks (IJCNN), pages 2921–2926. IEEE.
222
+ [12] Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. (2009). Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee.
223
+ [13] Fakoor, R., Mueller, J. W., Erickson, N., Chaudhari, P., and Smola, A. J. (2020). Fast, accurate, and simple models for tabular data via augmented distillation. Advances in Neural Information Processing Systems, 33.
224
+ [14] Furlanello, T., Lipton, Z., Tschannen, M., Itti, L., and Anandkumar, A. (2018). Born again neural networks. In International Conference on Machine Learning, pages 1607–1616. PMLR.
225
+ [15] Goldblum, M., Fowl, L., Feizi, S., and Goldstein, T. (2020). Adversarially robust distillation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 3996–4003.
226
+ [16] Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. (2017). On calibration of modern neural networks. In International Conference on Machine Learning, pages 1321–1330. PMLR.
227
+ [17] Gupta, V., Koren, T., and Singer, Y. (2018). Shampoo: Preconditioned stochastic tensor optimization. In International Conference on Machine Learning, pages 1842–1850.
228
+ [18] Han, S., Mao, H., and Dally, W. J. (2016). Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. In International Conference on Learning Representations.
229
+ [19] Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., del Río, J. F., Wiebe, M., Peterson, P., Gérard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C., and Oliphant, T. E. (2020). Array programming with NumPy. Nature, 585(7825):357–362.
230
+ [20] He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778.
231
+ [21] Heo, B., Lee, M., Yun, S., and Choi, J. Y. (2019). Knowledge transfer via distillation of activation boundaries formed by hidden neurons. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3779–3787.
232
+ [22] Hinton, G., Vinyals, O., and Dean, J. (2015). Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531.
233
+ [23] Hu, Z., Ma, X., Liu, Z., Hovy, E., and Xing, E. (2016a). Harnessing deep neural networks with logic rules. In Association for Computational Linguistics.
234
+ [24] Hu, Z., Yang, Z., Salakhutdinov, R., and Xing, E. (2016b). Deep neural networks with massive learned knowledge. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1670–1679.
235
+ [25] Ioffe, S. and Szegedy, C. (2015). Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pages 448–456. PMLR.
236
+ [26] Kim, Y. and Rush, A. M. (2016). Sequence-level knowledge distillation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1317–1327.
237
+ [27] Kingma, D. P. and Ba, J. (2015). Adam: A method for stochastic optimization. In International Conference on Learning Representations.
238
+ [28] Kornblith, S., Norouzi, M., Lee, H., and Hinton, G. (2019). Similarity of neural network representations revisited. In International Conference on Machine Learning, pages 3519–3529. PMLR.
239
+ [29] Krizhevsky, A. et al. (2009). Learning multiple layers of features from tiny images.
240
+ [30] LeCun, Y., Boser, B., Denker, J. S., Henderson, D., Howard, R. E., Hubbard, W., and Jackel, L. D. (1989a). Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551.
241
+ [31] LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324.
242
+ [32] LeCun, Y., Denker, J. S., Solla, S. A., Howard, R. E., and Jackel, L. D. (1989b). Optimal brain damage. In NIPs, volume 2, pages 598–605. Citeseer.
243
+ [33] Liu, X., Wang, X., and Matwin, S. (2018). Improving the interpretability of deep neural networks with knowledge distillation. In 2018 IEEE International Conference on Data Mining Workshops (ICDMW), pages 905–912. IEEE.
244
+ [34] Maas, A. L., Daly, R. E., Pham, P. T., Huang, D., Ng, A. Y., and Potts, C. (2011). Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon, USA. Association for Computational Linguistics.
245
+ [35] Malinin, A., Mlodozeniec, B., and Gales, M. (2019). Ensemble distribution distillation. In International Conference on Learning Representations.
246
+ [36] Marcel, S. and Rodriguez, Y. (2010). Torchvision the machine-vision package of torch. In Proceedings of the 18th ACM international conference on Multimedia, pages 1485–1488.
247
+ [37] Meng, Z., Li, J., Gong, Y., and Juang, B.-H. (2018). Adversarial teacher-student learning for unsupervised domain adaptation. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5949–5953. IEEE.
248
+ [38] Mishra, A. and Marr, D. (2018). Apprentice: Using knowledge distillation techniques to improve low-precision network accuracy. In International Conference on Learning Representations.
249
+ [39] Miyato, T., Kataoka, T., Koyama, M., and Yoshida, Y. (2018). Spectral normalization for generative adversarial networks. In International Conference on Learning Representations.
250
+ [40] Mobahi, H., Farajtabar, M., and Bartlett, P. L. (2020). Self-distillation amplifies regularization in hilbert space. Advances in Neural Information Processing Systems.
251
+ [41] Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Y. (2011). Reading digits in natural images with unsupervised feature learning. In Advances in Neural Information Processing Systems.
252
+ [42] Papernot, N., McDaniel, P., Wu, X., Jha, S., and Swami, A. (2016). Distillation as a defense to adversarial perturbations against deep neural networks. In 2016 IEEE Symposium on Security and Privacy $( S P )$ , pages 582–597. IEEE.
253
+ [43] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., and Chintala, S. (2019a). Pytorch: An imperative style, high-performance deep learning library. In Wallach, H., Larochelle, H., Beygelzimer, A., d'Alché-Buc, F., Fox, E., and Garnett, R., editors, Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc.
254
+ [44] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., and Chintala, S. (2019b). Pytorch: An imperative style, high-performance deep learning library. In Wallach, H., Larochelle, H., Beygelzimer, A., d'Alché-Buc, F., Fox, E., and Garnett, R., editors, Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc.
255
+ [45] Romero, A., Ballas, N., Kahou, S. E., Chassang, A., Gatta, C., and Bengio, Y. (2015). Fitnets: Hints for thin deep nets. International Conference on Learning Representations.
256
+ [46] Shen, Z., He, Z., and Xue, X. (2019). Meal: Multi-model ensemble via adversarial learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 4886–4893.
257
+ [47] Simonyan, K. and Zisserman, A. (2015). Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations.
258
+ [48] Tan, S., Caruana, R., Hooker, G., and Lou, Y. (2018). Distill-and-compare: Auditing black-box models using transparent model distillation. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pages 303–310.
259
+ [49] Tokozume, Y., Ushiku, Y., and Harada, T. (2018). Between-class learning for image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5486–5494.
260
+ [50] Urban, G., Geras, K. J., Kahou, S. E., Aslan, O., Wang, S., Caruana, R., Mohamed, A., Philipose, M., and Richardson, M. (2017). Do deep convolutional nets really need to be deep and convolutional? International Conference on Learning Representations.
261
+ [51] Van Rossum, G. and Drake, F. L. (2009). Python 3 Reference Manual. CreateSpace, Scotts Valley, CA.
262
+ [52] Yim, J., Joo, D., Bae, J., and Kim, J. (2017). A gift from knowledge distillation: Fast optimization, network minimization and transfer learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4133–4141.
263
+ [53] You, S., Xu, C., Xu, C., and Tao, D. (2017). Learning from multiple teacher networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1285–1294.
264
+ [54] Zagoruyko, S. and Komodakis, N. (2017). Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. International Conference on Learning Representations.
265
+ [55] Zeng, X. and Martinez, T. R. (2000). Using a neural network to approximate an ensemble of classifiers. Neural Processing Letters, 12(3):225–237.
266
+ [56] Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. (2018). Mixup: Beyond empirical risk minimization. International Conference on Learning Representations.
md/train/S1ejj64YvS/S1ejj64YvS.md ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GOOD SEMI-SUPERVISED VAE REQUIRES TIGHTEREVIDENCE LOWER BOUND
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Semi-supervised learning approaches based on generative models have now encountered 3 challenges: (1) The two-stage training strategy is not robust. (2) Good semi-supervised learning results and good generative performance can not be obtained at the same time. (3) Even at the expense of sacrificing generative performance, the semi-supervised classification results are still not satisfactory. To address these problems, we propose One-stage Semi-suPervised Optimal Transport VAE (OSPOT-VAE), a one-stage deep generative model that theoretically unifies the generation and classification loss in one ELBO framework and achieves a tighter ELBO by applying the optimal transport scheme to the distribution of latent variables. We show that with tighter ELBO, our OSPOT-VAE surpasses the best semi-supervised generative models by a large margin across many benchmark datasets. For example, we reduce the error rate from $1 4 . 4 1 \%$ to $6 . 1 1 \%$ on Cifar-10 with 4k labels and achieve state-of-the-art performance with $2 5 . 3 0 \%$ on Cifar-100 with 10k labels. We also demonstrate that good generative models and semi-supervised results can be achieved simultaneously by OSPOT-VAE.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The rise of deep neural networks has led to breakthroughs in computer vision, natural language processing, and many other domains. Most of these models are trained on large labeled datasets via supervised learning. However, in many scenarios, although it is easy to acquire a large amount of the original data, obtaining corresponding labels is often very costly or even infeasible. Semisupervised learning (Thomas, 2009) is proposed to address this problem by training classifiers with sufficient unlabeled data and a small fraction of labeled data.
12
+
13
+ Recent works on semi-supervised learning can be grouped into three categories: (1) disagreement based learning via data perturbation (Miyato et al., 2019) and consistency enforcing (Verma et al., 2019), (2) metric learning (Wu et al., 2018), (3) generative approaches via generative adversarial network (GAN) (Springenberg, 2016) and variational autoencoder (VAE) (Kingma et al., 2014). Compared with the first two categories, generative approaches have great advantages in interpretability. Based on the latent variable assumption (Doersch, 2016), the generative model has an explicit variational inference form, so it can learn the marginal probability distribution of the raw data as well as the conditional distribution of the latent variables given the input data, which makes predictions more reasonable. Besides, generative approaches not only learn the required classification representations, but also capture the semantics-disentangled factors that generate the data, making it easier to generalize to different tasks (Narayanaswamy et al., 2017).
14
+
15
+ However, in practice, semi-supervised generative approaches often encounter three major challenges: (1) The two-stage training process is not robust. Semi-supervised VAE (Kingma et al., 2014) needs to be trained carefully with a two-stage hierarchical strategy, while the training process of GAN is a two-stage adversarial game (Chrysos et al., 2019). (2) Good semi-supervised learning results and good generative performance can not be obtained at the same time. In GAN, good semi-supervised learning performance will lead to a mismatch between the generated results and the real data distribution (Dai et al., 2017). While in VAE, the evidence lower bound (ELBO) objective is irrelevant to the classification loss, making it difficult to learn from the labels directly (Narayanaswamy et al., 2017). (3) Even at the expense of sacrificing generative performance, the semi-supervised classification results are still not satisfactory. In practice, disagreement-based methods (Xie et al., 2019; Berthelot et al., 2019) have dramatically improved the state-of-the-art results on several standard datasets, surpassing generative approaches by a large margin. These challenges naturally raise a question: What limits the performance of generative approaches in semi-supervised learning?
16
+
17
+ ![](images/6a7096b8d04a9c60b237cc335b2a0bad726f4db3bc04839eec2139f9c99e967e.jpg)
18
+ Figure 1: The schematic of OSPOT-VAE
19
+
20
+ In this work, we propose One-stage Semi-suPervised Optimal Transport VAE (OSPOT-VAE) to address these challenges, which consists of two improvements: (1) a one-stage semi-supervised VAE model that unifies the generation and classification loss in one ELBO framework. (2) an estimation of the margin between true log-likelihood and the ELBO that exports a tighter evidence lower bound by applying optimal transport (Ambrosio & Gigli, 2013) scheme to the distribution of latent variables.
21
+
22
+ Our model has the following contributions:
23
+
24
+ • We show that OSPOT-VAE can be well trained with a direct one-stage strategy. • We show that OSPOT-VAE can achieve both good generative performance and semisupervised learning results simultaneously on a series of benchmark datasets. • We point out that it is the large margin between the ELBO and the log-likelihood of the input data that limits the performance of semi-supervised VAE. Besides, we evaluate this assumption across many standard datasets and show that with the proposed tighter ELBO, OSPOT-VAE surpasses the best semi-supervised generative models by a large margin and achieves state-of-the-art performance on Cifar-100 with 10k labels.
25
+
26
+ # 2 SEMI-SUPERVISED LEARNING METHODS
27
+
28
+ In supervised learning (SL), we are facing with training data that appears as input-target pairs $( \mathbf { X } , \bar { \mathbf { y } } ) \ \in \ \mathbb { D } _ { L }$ sampled from an unknown distribution $p ( \mathbf { X } , \mathbf { y } )$ . Our goal is to learn a function $f ( \mathbf { X } ; \phi )$ parameterized by $\phi$ that makes the correct inference $\mathbf { y }$ for unseen samples from $p ( \mathbf { X } )$ . While in semi-supervised learning (SSL), we can obtain an extra collection of unlabeled data $\mathbf { X } \in \mathbb { D } _ { U }$ sampled from the same distribution $p ( \mathbf { X } )$ . We hope to leverage the data from both $\mathbb { D } _ { L }$ and $\mathbb { D } _ { U }$ to achieve a more accurate model than what would have been obtained by only using $\mathbb { D } _ { L }$ .
29
+
30
+ In this section, we review some existing methods for SSL. We mainly focus on those who have reached state-of-the-art results, as well as generative approaches which are strongly connected with our model; the more comprehensive overview is beyond the scope of this paper, we refer readers to (Oliver et al., 2018).
31
+
32
+ # 2.1 DISAGREEMENT BASED LEARNING
33
+
34
+ Disagreement-based learning refers to the general approaches of imposing disagreement among multiple learners on the same task or multiple predictions from a single learner. By eliminating the disagreement, we can enforce the generalization of the model on unseen data. A common technique for creating disagreement is data augmentation, which applies transformations or perturbations on the input data and leaves class semantics unchanged. For $\mathbf { X } \in \mathbb { D } _ { U }$ , loss term can be derived as
35
+
36
+ $$
37
+ \| f ( \operatorname { A u g m e n t } ( \mathbf { X } ) ; \phi ) - f ( \mathbf { X } ; \phi ) \| _ { 2 } ^ { 2 }
38
+ $$
39
+
40
+ where the Augment $( \mathbf { X } )$ is a stochastic function which can be obtained by image transformation (Xie et al., 2019), virtual adversarial training (Miyato et al., 2019), or mixup method (Verma et al. 2018;
41
+
42
+ Berthelot et al. 2019). Another disagreement construction technique is to train multiple learners on the same dataset and utilize the loss
43
+
44
+ $$
45
+ \| f ( \mathbf { X } ; \boldsymbol { \phi } _ { 1 } ) - f ( \mathbf { X } ; \boldsymbol { \phi } _ { 2 } ) \| _ { 2 } ^ { 2 }
46
+ $$
47
+
48
+ to enforce the predictive consistency of different models, for example, “Mean Teacher” (Tarvainen & Valpola, 2017) and “Teacher Graph” (Luo et al., 2018). The generalization of the models gets enhanced.
49
+
50
+ # 2.2 GENERATIVE APPROACHES
51
+
52
+ In generative approaches, input $\mathbf { X }$ is supposed to have corresponding continuous and discrete latent variables, which we denote by $\mathbf { z }$ and c respectively.
53
+
54
+ Feature matching (FM) GANs (Salimans et al., 2016; Dai et al., 2017) apply GANs to semisupervised learning on K-classification tasks by specifying a $( \mathsf { K } { + } 1 )$ -class objective for the discriminator. Instead of binary classification, true samples are classified into the first K classes respectively and fake samples are classified into the $( \mathsf { K } { + } 1 )$ -th class. This target function achieves strong empirical results by matching the generator distribution with true data distribution and improves semi-supervised classification performance.
55
+
56
+ Semi-supervised VAEs (Kingma et al. 2014; Narayanaswamy et al. 2017) construct a probabilistic model parameterized by $\pmb \theta$ and $\phi$ that respectively describe the generation and inference process between $\mathbf { X }$ and latent variables $\mathbf { z }$ , c. The generation process of $\mathbf { X }$ by $\mathbf { z }$ and $\mathbf { c }$ is :
57
+
58
+ $$
59
+ p ( \mathbf { z } ) = { \mathcal { N } } ( z ; \mathbf { 0 } , I ) ; \qquad p ( \mathbf { c } ) = \mathbf { M } \mathbf { u } \mathbf { l } \mathbf { t } ( \mathbf { c } ; K , \pi ) ; \qquad p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) = f ( \mathbf { X } ; \mathbf { z } , \mathbf { c } , \theta )
60
+ $$
61
+
62
+ where $\operatorname { M u l t } ( K , \pi )$ is the multinomial distribution with class $K$ and parameter $\pi$ . $f ( \mathbf { X } ; \mathbf { z } , \mathbf { c } , \theta )$ is a suitable likelihood function, e.g. a Bernoulli or Gaussian distribution, parameterized by a non-linear transformation of the latent variables $\mathbf { z }$ and $\mathbf { c }$ . The class label $\mathbf { y }$ is treated as c if given. For the inference process, with the following hypothesis
63
+
64
+ $$
65
+ \begin{array} { r } { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) = q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) ; \qquad p ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) = p ( \mathbf { z } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) ; \qquad p ( \mathbf { z } , \mathbf { c } ) = p ( \mathbf { z } ) p ( \mathbf { c } ) } \end{array}
66
+ $$
67
+
68
+ evidence lower bound (ELBO) is used as objective to predict the posterior distribution of latent variables as follows (see Appendix A.1 for proof):
69
+
70
+ $$
71
+ \log p ( \mathbf { X } ) \geq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } [ \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) ] - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } ) ) - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } ) ) = \mathrm { E L B O } ( \phi ) ,
72
+ $$
73
+
74
+ For the likelihood $\log p ( \mathbf { X } )$ is infeasible, VAE maximizes its evidence lower bound instead, which derives the negative ELBO loss function $\mathcal { L } ( \mathbf { X } ; \boldsymbol { \phi } , \pmb { \theta } ) = - \mathrm { E L B O }$ . The predictions for the classification label $\mathbf { y }$ can be obtained from the inferred posterior distribution $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ . When class label $\mathbf { y }$ is not given, missing label sampling technique is used to sample from $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ as
75
+
76
+ $$
77
+ \mathbb { E } _ { q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } f ( \mathbf { X } ; \mathbf { c } , \theta ) = \sum _ { k = 1 } ^ { K } q _ { \phi } ( \mathbf { y } _ { k } | \mathbf { X } ) f ( \mathbf { X } ; \mathbf { y } _ { k } , \theta )
78
+ $$
79
+
80
+ Here $\mathbf { y } _ { k }$ represents a one-hot vector with 1 in $\mathbf { k }$ -th dimension. Utilizing this sampling method, the algorithmic complexity of VAE is proportional to $\mathrm { K }$ so it is computationally inefficient. Note that in objective (4), the label predictive distribution $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ only contributes to the generative performance. To remedy this, existing models simply add a cross-entropy loss to the negative ELBO loss such that the distribution $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ can also learn classification rules from the labeled data. The extended objective loss is
81
+
82
+ $$
83
+ \operatorname* { m i n } _ { \phi , \theta } \mathbb { E } _ { \mathbf { X } \sim \mathbb { D } _ { U } } \mathcal { L } \big ( \mathbf { X } ; \phi , \pmb { \theta } ) + \mathbb { E } _ { ( \mathbf { X } , \mathbf { y } ) \sim \mathbb { D } _ { L } } \big [ \mathcal { L } \big ( \mathbf { X } , \mathbf { c } = \mathbf { y } ; \phi , \pmb { \theta } \big ) - \log q _ { \phi } ( \mathbf { y } | \mathbf { X } ) \big ]
84
+ $$
85
+
86
+ Two-stage Training Strategy: In practice, (Kingma et al., 2014) finds that directly training the one-stage objective (7) will lead to a bad semi-supervised learning result, so a two-stage training strategy is proposed to improve the model. The two-stage training strategy consists of two parts, M1 and M2. M1 means to learn a new continuous latent representation $\mathbf { z } _ { 1 }$ first, and M2 means to train a semi-supervised model (7) with the embedding $\mathbf { z } _ { 1 }$ from M1 instead of the raw data $\mathbf { X }$ . This $\mathbf { M } 1 { + } \mathbf { M } 2$ strategy builds a deep VAE with two layers of random variables: $\begin{array} { r l r } { \mathrm { \nabla } p _ { \pmb \theta } ( \mathbf { X } , \mathbf { z } _ { 1 } , \mathbf { z } _ { 2 } , \mathbf { c } ) } & { { } = } & { } \end{array}$ $p _ { \pmb { \theta } } ( \mathbf { X } | \mathbf { z } _ { 1 } ) p _ { \pmb { \theta } } ( \mathbf { z } _ { 1 } | \mathbf { z } _ { 2 } , \bar { \mathbf { c } } ) p ( \mathbf { z } _ { 2 } ) p ( \mathbf { c } )$ , which can dramatically improve the performance of the inference $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ but is not robust in training. Moreover, GAN’s training process can also be considered as two-stage with generator and discriminator competing with each other, and the two-stage adversarial game adds the difficulty in training.
87
+
88
+ # 3 ONE-STAGE SEMI-SUPERVISED OPTIMAL TRANSPORT VAE
89
+
90
+ In this section, we introduce our semi-supervised VAE framework, OSPOT-VAE. Firstly, we derive a one-stage loss function that unifies the generation and classification loss under one ELBO without introducing any additional auxiliary loss items like (7). Then, we analyze a phenomenon that good ELBO values do not guarantee good semi-supervised performance and propose the optimal transport estimation to deal with it. At last, combining the two parts, we give the detailed algorithm of OSPOTVAE and discuss some problems in model optimization.
91
+
92
+ # 3.1 ONE-STAGE SEMI-SUPERVISED VAE
93
+
94
+ Following the notations and assumptions $( 3 , 4 )$ in Section 2.2, we derive our one-stage semisupervised VAE. With the empirical distribution $p _ { e m p } ( \mathbf { X } ; \mathbb { D } ) = { \frac { 1 } { | \mathbb { D } | } } \sum _ { \mathbf { X } ^ { \prime } \in \mathbb { D } } \mathbf { 1 } _ { \mathbf { X } = \mathbf { X } ^ { \prime } }$ , we utilize the decomposition in (Zhao et al., 2017) and rewrite the second part of (5) into (proof in Appendix A.2)
95
+
96
+ $$
97
+ \begin{array} { r } { \mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } ) \big ) = \mathbf { I } _ { q _ { \phi } } ( \mathbf { X } ; \mathbf { z } ) + D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } ) \| p ( \mathbf { z } ) \big ) \geq \mathbf { I } _ { q _ { \phi } } ( \mathbf { X } ; \mathbf { z } ) } \end{array}
98
+ $$
99
+
100
+ where $q _ { \phi } ( \mathbf { z } ) = \frac { 1 } { | \mathbb { D } | } \sum _ { \mathbf { X } \in \mathbb { D } } q _ { \phi } ( \mathbf { z } | x )$ and $\mathbf { I } _ { q _ { \phi } } ( \mathbf { X } ; \mathbf { z } )$ is the mutual information between $\mathbf { X }$ and $\mathbf { z }$ . The left part of (8) equals to 0 when $\mathbf { X }$ and $\mathbf { z }$ are independent. This is undesirable, so $\mathbf { I } _ { q _ { \phi } } ( \mathbf { X } ; \mathbf { z } )$ can be regarded as the lower bound of controlled mutual information. The continuous variables in (8) can be easily extend to discrete variables $\mathbf { c }$ . We can use $\mathbf { I _ { z } }$ and $\mathbf { I _ { c } }$ to denote the controlled information capacity and derive the objective for the unlabeled dataset $\mathbb { D } _ { U }$
101
+
102
+ $$
103
+ \begin{array} { r l } & { { \mathcal { L } } _ { \mathbb { D } _ { U } } ( { \mathbf { X } } ; \pmb { \theta } , \phi ) = { \mathbb { E } } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } [ - \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) ] + \beta _ { \mathbf { z } } | D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) | | p ( \mathbf { z } ) - \mathbf { I } _ { \mathbf { z } } | } \\ & { \quad \quad \quad \quad + \beta _ { \mathbf { c } } | D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) | | p ( \mathbf { c } ) ) - \mathbf { I } _ { \mathbf { c } } | } \end{array}
104
+ $$
105
+
106
+ where $\beta , \mathbf { I _ { z } } , \mathbf { I _ { c } }$ are all hyper-parameters forcing the KL divergence term to match the mutual information capacities of $\mathbf { z }$ and $\mathbf { c }$ .
107
+
108
+ For the labeled subset $\mathbb { D } _ { L }$ , instead of directly employing class label y as sampled $\mathbf { c }$ , we view it as the parameter of the true posterior distribution, i.e. $p ( \mathbf { c } | \mathbf { X } ) = \mathbf { M u l t } ( \mathbf { c } ; K , \mathbf { y } )$ and derive the following one-stage ELBO form:
109
+
110
+ $$
111
+ \begin{array} { r l } & { \log p ( \mathbf { X } ) = \log \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , p ( \mathbf { c } | \mathbf { X } ) } \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) } \geq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , p ( \mathbf { c } | \mathbf { X } ) } \log \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) } } \\ & { = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , p ( \mathbf { c } | \mathbf { X } ) } [ \log p ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) + \log \frac { p ( \mathbf { z } ) p ( \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) } ] = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , p ( \mathbf { c } | \mathbf { X } ) } \log p ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) } \\ & { - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } ) ) - D _ { \mathrm { K L } } ( p ( \mathbf { c } | \mathbf { X } ) \| q _ { \phi } ( \mathbf { c } | \mathbf { X } ) ) + \mathbb { E } _ { p ( \mathbf { c } | \mathbf { X } ) } \log \frac { p ( \mathbf { c } ) } { q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } } \end{array}
112
+ $$
113
+
114
+ Notice that $D _ { \mathrm { K L } } ( p ( \mathbf { c } | \mathbf { X } ) \| q _ { \phi } ( \mathbf { c } | \mathbf { X } ) )$ is equal to the common cross-entropy loss for y is a one-hot vector. In this respect, the margin between $p ( \mathbf { c } | \mathbf { X } )$ and $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ can be significantly small when the suitable optimization method is chosen. This allows us to utilize the approximation $p ( \mathbf { c } | \mathbf { X } ) \approx$ $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ to modify $\mathbb { E } _ { p ( \mathbf { c } | \mathbf { X } ) } \log { \frac { p ( \mathbf { c } ) } { q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } }$ in (10), resulting in a consist ELBO with $\mathcal { L } _ { \mathbb { D } _ { U } } ( \mathbf { X } ; \pmb { \theta } , \phi )$ :
115
+
116
+ $$
117
+ \mathbb { E } _ { p ( { \mathbf { c } } | { \mathbf { X } } ) } \log { \frac { p ( { \mathbf { c } } ) } { q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) } } \approx { \mathrm { ( } } { \mathrm { w h e n ~ } } p ( { \mathbf { c } } | { \mathbf { X } } ) \approx q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) { \mathrm { ) } } \mathbb { E } _ { q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) } \log { \frac { p ( { \mathbf { c } } ) } { q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) } } = D _ { \mathrm { K L } } ( q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) \| p ( { \mathbf { c } } ) )
118
+ $$
119
+
120
+ Combining the ELBO form (10) of $\mathbb { D } _ { L }$ with the mutual information decomposition (8) and the approximation (11), the new objective for semi-supervised VAE is:
121
+
122
+ $$
123
+ \begin{array} { r l } & { { \mathcal { L } } _ { \mathbb { D } _ { L } } ( { \mathbf { X } } , { \mathbf { y } } ; \pmb { \theta } , \phi ) = { \mathbb { E } } _ { q _ { \phi } ( { \mathbf { z } } | { \mathbf { X } } ) , p ( { \mathbf { c } } | { \mathbf { X } } ) } [ - \log p _ { \theta } ( { \mathbf { X } } | { \mathbf { z } } , { \mathbf { c } } ) ] + \beta _ { \mathbf { z } } | D _ { \mathrm { K L } } ( q _ { \phi } ( { \mathbf { z } } | { \mathbf { X } } ) \| p ( { \mathbf { z } } ) ) - { \mathbf { I } } _ { \mathbf { z } } | } \\ & { \quad \quad \quad \quad \quad \quad + \beta _ { \mathbf { c } } | D _ { \mathrm { K L } } ( q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) \| p ( { \mathbf { c } } ) ) - { \mathbf { I } } _ { \mathbf { c } } | + D _ { \mathrm { K L } } ( p ( { \mathbf { c } } | { \mathbf { X } } ) \| q _ { \phi } ( { \mathbf { c } } | { \mathbf { X } } ) ) } \end{array}
124
+ $$
125
+
126
+ With (9) and (12), the objective for the entire dataset is now
127
+
128
+ $$
129
+ \operatorname* { m i n } _ { \phi , \theta } \mathbb { E } _ { \mathbf { X } \sim p _ { e m p } ( \mathbf { X } ; \mathbb { D } _ { U } ) } \mathcal { L } _ { \mathbb { D } _ { U } } ( \mathbf { X } ; \theta , \phi ) + \mathbb { E } _ { ( \mathbf { X } , \mathbf { y } ) \sim p _ { e m p } ( ( \mathbf { X } , \mathbf { y } ) ; \mathbb { D } _ { L } ) } \mathcal { L } _ { \mathbb { D } _ { L } } ( \mathbf { X } , \mathbf { y } ; \theta , \phi )
130
+ $$
131
+
132
+ This one-stage objective with a simple approximate transformation (9) unifies the generation loss as well as the target of SSL and results in improved performance of semi-supervised learning, which we demonstrate in Section 4.1.
133
+
134
+ Algorithm 1 Optimal transport estimation ingests a batch of observation $\mathbf { X }$ as well as the representation $q _ { \phi } ( \mathbf { z } | \mathbf { X } )$ , $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ inferred from the original VAE and returns the estimation of the margin $D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } | \mathbf { X } ) )$ and $D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) | | p ( \mathbf { \bar { c } } | \mathbf { X } ) )$ .
135
+
136
+ # Input:
137
+
138
+ Batch of observation $\mathbf { X }$ sampled from $p _ { e m p } ( \mathbf { X } )$ ; Inferred parameter $( \mu , \mathrm { d i a g } ( \sigma ^ { 2 } ) )$ of $q _ { \phi } ( \mathbf { z } | \mathbf { X } ) = \mathcal { N } ( \mathbf { z } ; \pmb { \mu } , \mathrm { d i a g } ( \pmb { \sigma } ^ { 2 } ) ) ;$ ; Inferred parameter $\pi$ of $q _ { \phi } ( \mathbf { c } | \mathbf { X } ) = \mathbf { M } \mathbf { u } \mathrm { l t } ( \mathbf { c } ; K , \pi )$ ; Hyperparameter $\alpha$ for mixup vicinal distribution $p _ { m i x u p } ( \mathbf { X } )$
139
+
140
+ # Output:
141
+
142
+ $\tilde { \mathbf { X } }$ sampled from $p _ { m i x u p } ( \mathbf { X } )$ ; Estimation $L _ { M \mathbf { z } }$ of the margin $D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \tilde { \mathbf { X } } ) | | p ( \mathbf { z } | \tilde { \mathbf { X } } ) )$ Estimation $L _ { M _ { \mathbf { c } } }$ of the margin $D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \tilde { \mathbf { X } } ) | | p ( \mathbf { c } | \tilde { \mathbf { X } } ) )$ 1: $: \mathrm { \bf ~ X } ^ { \prime } , \pi ^ { \prime } , \mu ^ { \prime } , \sigma ^ { \prime 2 } = \mathrm { \bf F }$ andomPermutation $( \mathbf { X } , \pi , \mu , \sigma ^ { 2 } )$ 2: $\tilde { \mathbf { X } } = \lambda * \mathbf { X } + \left( 1 - \lambda \right) * \mathbf { X } ^ { \prime }$ , $\lambda \in \beta ( \alpha , \alpha )$ 3: π˜ = OptimalTransportC $\prime ( \pi , \pi ^ { \prime } , \lambda )$ 4: $( \tilde { \mu } , \tilde { \sigma } ^ { 2 } ) =$ OptimalTransportZ((µ, σ2), (µ0, σ02), λ) 5: $q _ { \phi } ( \mathbf { z } | \tilde { \mathbf { X } } ) , q _ { \phi } ( \mathbf { c } | \tilde { \mathbf { X } } ) = \mathrm { V A E } ( \tilde { \mathbf { X } } )$ 6: $\tilde { p } ( \mathbf { z } | \tilde { \mathbf { X } } ) = \mathcal { N } ( z ; \tilde { \mu } , \mathrm { d i a g } ( \tilde { \pmb { \sigma } } ^ { 2 } ) )$ 7: $\tilde { p } ( \mathbf { c } | \tilde { \mathbf { X } } ) = \mathbf { M u l t } ( \mathbf { c } ; K , \tilde { \pi } )$ 8: ${ \cal L } _ { M _ { \mathbf { z } } } = { \cal D } _ { \mathrm { K L } } ( q _ { \phi } ( { \mathbf { z } } | \tilde { \mathbf { X } } ) | | \tilde { p } ( { \mathbf { z } } | \tilde { \mathbf { X } } ) )$ 9: ${ \cal L } _ { M _ { \mathbf { c } } } = { \cal D } _ { \mathrm { K L } } ( q _ { \phi } ( { \mathbf { c } } | \tilde { \mathbf { X } } ) | | \tilde { p } ( { \mathbf { c } } | \tilde { \mathbf { X } } ) )$ 10: return $\tilde { \mathbf { X } } , L _ { M _ { \mathbf { z } } } , L _ { M _ { \mathbf { c } } }$
143
+
144
+ # 3.2 OPTIMAL TRANSPORT ESTIMATION
145
+
146
+ To summarize the above, VAE aims to learn the useful representation $q _ { \phi } ( \mathbf { z } | \mathbf { X } )$ and $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ by reducing the KL divergence between the empirical distribution $p _ { e m p } ( \mathbf { X } )$ and the model marginal $\begin{array} { r } { p ( \mathbf { X } ) \ { \stackrel { } { = } } \ \int _ { \mathbf { z } } \int _ { \mathbf { c } } p ( \mathbf { X } ) p ( \mathbf { \tilde { z } } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) d \mathbf { z } d \mathbf { c } } \end{array}$ . Instead of minimizing $\hat { D _ { \mathrm { K L } } } ( p _ { e m p } ( \mathbf { X } ) | | p ( \mathbf { X } ) )$ directly, VAE models use the expected ELBO mentioned in (5) as target via the following inequality
147
+
148
+ $$
149
+ D _ { \mathrm { K L } } ( p _ { e m p } ( \mathbf { X } ) \| p ( \mathbf { X } ) ) \leq H ( p _ { e m p } ( \mathbf { X } ) ) - \mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } \mathrm { E L B O }
150
+ $$
151
+
152
+ However, one phenomenon is that good ELBO values do not imply accurate inference. A typical example has been discussed in (Zhao et al., 2017). Here we mainly focus on the cause of this phenomenon and propose optimal transport estimation to alleviate this problem in semi-supervised learning. Following the work in (Rezende et al., 2014), we write down the closed form of the expected margin between true log-likelihood and ELBO as (proof in Appendix A.3):
153
+
154
+ $$
155
+ \mathbb { E } _ { p _ { \epsilon m p } ( \mathbf { X } ) } [ \log p ( \mathbf { X } ) - \mathrm { E L B O } ] = \mathbb { E } _ { p _ { \epsilon m p } ( \mathbf { X } ) } [ D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) | | p ( \mathbf { z } | \mathbf { X } ) ) + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) | | p ( \mathbf { c } | \mathbf { X } ) ) ]
156
+ $$
157
+
158
+ Combined with the decomposition (8), training the expected ELBO target can only reduce the difference between marginal distributions $q _ { \phi } ( \mathbf { c } ) , \bar { q } _ { \phi } ( \mathbf { z } )$ and $p ( \mathbf { c } ) \mathbf { , } p ( \mathbf { z } )$ . It means that even with a good ELBO, the margin $\mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } | \dot { \mathbf { X } } ) \big | \big | p ( \dot { \mathbf { z } } | \mathbf { X } ) \big )$ and $\mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } | \mathbf { X } ) \big )$ in (15) can still be large. In this scenario, the consistent optimization of ELBO will contribute no more to the semi-supervised classification performance. However, optimizing the margin in (15) directly is impossible, for $p ( \mathbf { c } | \mathbf { X } )$ and $p ( \mathbf { z } | \mathbf { X } )$ are unknown. To remedy this, we extend the empirically effective approximation in (Zhang et al., 2018) to our VAE framework with the form
159
+
160
+ $$
161
+ \begin{array} { r l } & { \mathbb { E } _ { p _ { m i x u p } ( \mathbf { X } ) } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } | \mathbf { X } ) ) \approx \mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } | \mathbf { X } ) ) ( \alpha \to 0 ) } \\ & { \mathbb { E } _ { p _ { m i x u p } ( \mathbf { X } ) } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } | \mathbf { X } ) ) \approx \mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } | \mathbf { X } ) ) ( \alpha \to 0 ) } \end{array}
162
+ $$
163
+
164
+ where $p _ { m i x u p } ( \mathbf { X } )$ is the mixup vicinal distribution (Zhang et al., 2018) and $\alpha$ is the related parameter. Then we propose optimal transport estimation to construct the estimations of $\mathbb { E } _ { p _ { m i x u p } ( \mathbf { X } ) } D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \big | \big | p \big ( \mathbf { z } | \bar { \mathbf { X } } \big ) \big )$ as wellariables s $\mathbb { E } _ { p _ { m i x u p } ( \mathbf { X } ) } D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \big | \big | p ( \mathbf { z } | \mathbf { X } ) \big )$ by applying op-ptimal transport $\mathbf { z }$ $\mathbf { c }$
165
+ estimation are provided in Algorithm 1, and we present the details of the optimal transport scheme in the rest of this section.
166
+
167
+ # Algorithm 2 OSPOT-VAE training process with epoch $t$
168
+
169
+ #
170
+
171
+ Batch of labeled pairs $( \mathbf { X } _ { L } , \mathbf { y } _ { L } ) \in \mathbb { D } _ { L }$ ,Batch of unlabeled examples $\mathbf { X } _ { U } \in \mathbb { D } _ { U }$ ;
172
+ ELBO hyperparameters: $\beta _ { \mathbf { z } } , \beta _ { \mathbf { c } } , \mathbf { I } _ { \mathbf { z } } , \mathbf { I } _ { \mathbf { c } } = \mathrm { E L B O S c h e d u l e r } ( t )$ ;
173
+ Optimal transport estimation weights: $w _ { M _ { \mathbf { z } } }$ $M _ { \mathbf { z } } \mathbf { , } w _ { } M _ { \mathbf { c } } =$ WeightScheduler $\cdot ( t )$ ;
174
+ Model parameters: $\pmb \theta ^ { ( t - 1 ) } , \phi ^ { ( t - 1 ) }$ ;
175
+ Model optimizer: SGD
176
+
177
+ # Output:
178
+
179
+ 1: Updated parameters: $\begin{array} { r l } & { \mathrm { U p d a t e d ~ p a r a m e t e r s : ~ } \theta ^ { \mathrm { { t x } ^ { \prime } } } , \phi ^ { \mathrm { { t x } ^ { \prime } } } , \phi ^ { \mathrm { { t x } ^ { \prime } } } } \\ & { L _ { L } = \mathcal { L } _ { \mathbb { D } _ { L } } \big ( \mathbf { X } _ { L } , \mathbf { y } _ { L } ; \theta ^ { ( t - 1 ) } , \phi ^ { ( t - 1 ) } ; \beta _ { \mathbf { z } } , \beta _ { \mathbf { c } } , \mathbf { I } _ { \mathbf { z } } , \mathbf { I } _ { \mathbf { c } } \big ) } \\ & { L _ { U } = \mathcal { L } _ { \mathbb { D } _ { U } } \big ( \mathbf { X } _ { U } ; \theta ^ { ( t - 1 ) } , \phi ^ { ( t - 1 ) } ; \beta _ { \mathbf { z } } , \beta _ { \mathbf { c } } , \mathbf { I } _ { \mathbf { z } } , \mathbf { I } _ { \mathbf { c } } \big ) } \\ & { L _ { M _ { \mathbf { z } } } , L _ { M _ { \mathbf { c } } } = \mathrm { O p t i m a l T r a n s p o r t E s t i m a t i o n } \big ( \mathbf { X } _ { U } , q _ { \phi } \big ( \mathbf { z } \big | \mathbf { X } _ { U } \big ) , q _ { \phi } \big ( \mathbf { c } | \mathbf { X } _ { U } \big ) \big ) } \\ & { L = L _ { L } + L _ { U } + w _ { M _ { \mathbf { z } } } L _ { M _ { \mathbf { z } } } + w _ { M _ { \mathbf { c } } } L _ { M _ { \mathbf { c } } } } \\ & { \theta ^ { ( t ) } , \phi ^ { ( t ) } = \mathrm { S G D } \big ( \theta ^ { ( t - 1 ) } , \phi ^ { ( t - 1 ) } , \frac { \partial L } { \partial \theta } , \frac { \partial L } { \partial \phi } \big ) } \end{array}$ $\pmb { \theta } ^ { ( t ) } , \phi ^ { ( t ) }$
180
+ 2:
181
+ 3:
182
+ 4:
183
+ 5:
184
+ 6: return $\theta ^ { ( t ) } , \phi ^ { ( t ) }$
185
+
186
+ Optimal Transport Scheme: The mixup vicinal distribution can be understood as applying linear transport between the points $\mathbf { X } , \mathbf { X ^ { \prime } } \in \mathbb { D }$ , extending the original dataset with new points falling on one straight line $\tilde { \mathbf { X } } = \lambda * \mathbf { X } + ( 1 - \lambda ) * \mathbf { X ^ { \prime } } , \lambda \in [ 0 , 1 ] .$ . For $\mathbf { \tilde { X } }$ , it is a natural thought that this linear transformation could associate with the shortest-path transport in the latent space. Based on this, we calculate the distributions $\tilde { p } ( \mathbf { z } | \tilde { \mathbf { X } } ) , \tilde { p } ( \mathbf { c } | \tilde { \mathbf { X } } )$ of $\mathbf { z } , \mathbf { c }$ and consider them as the estimation of the true posterior distributions. Following the work of (Ambrosio & Gigli, 2013), the norm-2 based optimal transport scheme $\gamma ( \mathbf { x } , \mathbf { y } )$ between two distributions $p ( \mathbf { x } )$ and $p ( \mathsf { y } )$ satisfy:
187
+
188
+ $$
189
+ \begin{array} { c } { { \displaystyle \operatorname* { i n f } _ { \gamma ( \mathbf { x } , \mathbf { y } ) } \int _ { \mathbf { x } } \int _ { \mathbf { y } } \| \mathbf { x } - \mathbf { y } \| _ { 2 } ^ { 2 } \gamma ( \mathbf { x } , \mathbf { y } ) d \mathbf { x } d \mathbf { y } } } \\ { { \mathrm { s . t . } ~ \displaystyle \int _ { \mathbf { y } } \gamma ( \mathbf { x } , \mathbf { y } ) d \mathbf { y } = p ( \mathbf { x } ) ; \displaystyle \int _ { \mathbf { x } } \gamma ( \mathbf { x } , \mathbf { y } ) d \mathbf { x } = p ( \mathbf { y } ) } } \end{array}
190
+ $$
191
+
192
+ For the continuous variable $\mathbf z \sim \mathcal N ( \pmb \mu , \mathrm { d i a g } ( \pmb \sigma ^ { 2 } ) )$ and discrete variable $\mathbf { c } \sim \mathbf { M } \mathbf { u } \mathrm { l t } ( K , \pi )$ , the following 2 propositions are proposed to calculate the shortest-path based on optimal transport scheme (see Appendix A.4 for proof).
193
+
194
+ Proposition 3.1. The shortest-path derived from optimal transport scheme (17) between $\mathbf { z } _ { 1 } ~ \sim$ $\mathcal { N } ( \bar { \mu } _ { 1 } , d i a g ( \sigma _ { 1 } ^ { 2 } ) )$ and $\mathbf { z } _ { 2 } \sim \mathcal { N } ( \bar { \pmb { \mu } } _ { 2 } , d i a g ( \pmb { \sigma } _ { 2 } ^ { 2 } ) )$ with $\lambda \in [ 0 , 1 ]$ is
195
+
196
+ $$
197
+ \begin{array} { r } { \tilde { \pmb { \mu } } = \lambda \pmb { \mu } _ { 1 } + ( 1 - \lambda ) \pmb { \mu } _ { 2 } } \\ { \tilde { \pmb { \sigma } } = \lambda \pmb { \sigma } _ { 1 } + ( 1 - \lambda ) \pmb { \sigma } _ { 2 } } \end{array}
198
+ $$
199
+
200
+ Proposition 3.2. The shortest-path derived from $K L$ divergence based optimal transport scheme between $\mathbf { c } _ { 1 } \sim M u l t ( K , \pmb { \pi } _ { 1 } )$ and $\mathbf { c } _ { 2 } \sim M u l t ( K , \pmb { \pi } _ { 2 } )$ with $\lambda \in [ 0 , 1 ]$ is
201
+
202
+ $$
203
+ \tilde { \pi } = \lambda \pi _ { 1 } + ( 1 - \lambda ) \pi _ { 2 }
204
+ $$
205
+
206
+ Algorithm 1 yields the optimal transport estimation of the margin in (15), which leads to a tighter ELBO. In Section 4.2, we demonstrate that with this tighter ELBO, the inference performance of semi-supervised VAE is significantly improved on many benchmark datasets.
207
+
208
+ # 3.3 OPTIMIZATION OF OSPOT-VAE
209
+
210
+ Combining one-stage semi-supervised VAE and optimal transport estimation, we can get the complete OSPOT-VAE model. The full OSPOT-VAE algorithm is provided in Algorithm 2, and a schematic is shown in Figure 1. Note that the conditions for the approximations used in Algorithm 1,2 satisfy (1) $q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \approx p ( \mathbf { c } | \mathbf { X } )$ and (2) the VAE model has already achieved a good ELBO. Therefore, the warm-up schedule (Higgins et al., 2017) is used to set parameters $\mathbf { I } _ { z } , \mathbf { I } _ { c } , \beta _ { \mathbf { z } } , \beta _ { \mathbf { c } }$ and $w _ { M _ { \mathbf { z } } } , w _ { M _ { \mathbf { c } } }$ . We list the details of “ELBOScheduler $( t )$ ” and “WeightScheduler $( t ) ^ { , }$ in Appendix A.5.
211
+
212
+ In Algorithm 2, we apply stochastic gradient descent (SGD) as optimizer, which needs to calculate the gradient $\nabla _ { \pmb { \theta } , \pmb { \phi } } L$ . The target loss $L$ consists of KL divergence and the expected loglikelihood . The derivation of KL divergence part has a closed form, while calculating the gradient
213
+
214
+ <table><tr><td colspan="2"></td><td rowspan="2">MNIST(100 labels)</td><td rowspan="2">SVHN(1k labels)</td></tr><tr><td>BackBone</td><td>Method</td></tr><tr><td rowspan="5">Same with M1+M2</td><td>Disentangled VAE</td><td>9.71(±0.91)</td><td>38.91(±1.06)</td></tr><tr><td>(Narayanaswamy et al., 2017)</td><td>11.97(±1.71)</td><td>54.33(±0.11)</td></tr><tr><td>M1(Kingma et al., 2014)</td><td>3.33(±0.14)</td><td>36.02(±0.10)</td></tr><tr><td>M1+M2(Kingma et al., 2014)</td><td></td><td></td></tr><tr><td>One-stage VAE</td><td>3.14(±0.19)</td><td>27.38(±0.78)</td></tr></table>
215
+
216
+ Table 1: One-stage VAE error rate in MNIST and SVHN.
217
+
218
+ <table><tr><td>BackBone</td><td>Model category</td><td>Model</td><td>Cifar10(4k labels)</td></tr><tr><td rowspan="5">WRN-28-2</td><td rowspan="5">Disagreement</td><td>Temporal Ensembling(TE) (Laine &amp; Aila,2017)</td><td>16.37</td></tr><tr><td>Mean Teacher(Tarvainen &amp; Valpola,2017)</td><td>15.87</td></tr><tr><td></td><td>13.13</td></tr><tr><td>VAT+EntMin(Miyato et al., 2019) MixMatch(Berthelot et al., 2019)</td><td>6.37</td></tr><tr><td>GS-BadGANt*(Li et al., 2019)</td><td>17.11</td></tr><tr><td rowspan="5">WRN-28-10 Generative</td><td rowspan="2">Generative</td><td>OSPOT-VAE</td><td>8.51(±0.32)</td></tr><tr><td>AutoAugment(Cubuk et al., 2019)</td><td>14.1</td></tr><tr><td rowspan="3">Disagreement</td><td>Temporal Ensembing(Laine &amp; Aila, 2017)</td><td>12.16</td></tr><tr><td>MixMatch*(Berthelot et al., 2019)</td><td>4.95</td></tr><tr><td>GS-BadGANt*(Li et al., 2019) GAN combine TE‡*(Wei et al., 2018)</td><td>14.41</td></tr></table>
219
+
220
+ Table 2: Error rate in Cifar10. $\dagger$ denotes the best semi-supervised generative approach result. $\ddagger$ denotes the model ensemble two categories. $^ *$ denotes the corresponding backbone is not exactly WideResNet (Zagoruyko & Komodakis, 2016), but belongs to one kind of its variations with a comparable amount of parameters.
221
+
222
+ of $\mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } )$ is difficult. To this end, we follow the work of (Rezende et al., 2014) and (Jang et al., 2017), using the reparameterization trick as
223
+
224
+ $$
225
+ \begin{array} { r l } & { \nabla _ { \theta , \phi } \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) } \log p _ { \theta } ( \mathbf { X } | \mathbf { z } ) = \mathbb { E } _ { \mathcal { N } ( \epsilon ; \mathbf { 0 } , \mathbf { I } ) } \nabla _ { \theta , \phi } \log p _ { \theta } ( \mathbf { X } | \mu + \sigma \cdot \epsilon ) } \\ & { \mathbb { E } _ { \mathrm { G u m b e l } ( \epsilon ; \mathbf { 0 } , \mathbf { 1 } ) } ) \nabla _ { \theta , \phi } \log p _ { \theta } ( \mathbf { X } | \mathrm { S o f t m a x } ( \frac { \log \pi + \epsilon } { \tau } ) ) \to \nabla _ { \theta , \phi } \mathbb { E } _ { q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } \log p _ { \theta } ( \mathbf { X } | \mathbf { c } ) ( \tau \to 0 ) } \end{array}
226
+ $$
227
+
228
+ Note that with (20), the algorithmic complexity of one-stage semi-supervised VAE is independent with the class number $K$ , making it easier to extend to large-scale classification tasks.
229
+
230
+ # 4 EXPERIMENTS
231
+
232
+ In this section, we demonstrate the 3 contributions of our OSPOT-VAE model with sufficient experiments on 4 standard SSL benchmark datasets, that is, MNIST, SVHN, Cifar10, and Cifar100. In Section 4.1, we show the validity of our one-stage semi-supervised VAE objective (13) by comparing with other one-stage and two-stage VAE models. Then, we evaluate the performance of OSPOT-VAE under “WideResNet”(Zagoruyko & Komodakis, 2016) backbone and compare with other state-of-the-art SSL models mentioned in Section 2. Besides, We provide an ablation study to verify the contribution of the optimal transport estimation. As an additional application, we show that good generative models and semi-supervised results can be obtained at the same time by OSPOT-VAE (Section 4.3). The source code is available at https: //github.com/PaperCodeSubmission/OSPOT-VAE; more details are available in Appendix A.6.
233
+
234
+ # 4.1 ONE-STAGE SEMI-SUPERVISED VAE
235
+
236
+ We evaluate the effectiveness of the one-stage semi-supervised VAE objective on 2 standard benchmarks, MNIST and SVHN. As for baseline models, we consider two VAE-based SSL models, which are one-stage disentangled VAE (Narayanaswamy et al., 2017) and two-stage VAE $[ \mathbf { M } 1 + \mathbf { M } 2 ]$ ) (Kingma et al., 2014). For fairness, except the target loss functions, all models use the same structure as is used in $\mathbf { M } 1 { + } \mathbf { M } 2$ (Kingma et al., 2014). The results are presented in Table 1, and our model achieves the best performance.
237
+
238
+ Table 3: Error in Cifar100. $\dagger$ and $^ *$ have the same meaning as described in Table 2.
239
+
240
+ <table><tr><td>BackBone</td><td>Model</td><td>Cifar100(4k labels)</td><td>Cifar100(10k labels)</td></tr><tr><td rowspan="4">WRN-28-2</td><td>II - Model(Laine &amp; Aila, 2017)</td><td></td><td>39.19</td></tr><tr><td>GS-BadGANt*(Li et al., 2019)</td><td>45.11</td><td>37.16</td></tr><tr><td>LP*(Iscen et al., 2019)</td><td>43.73</td><td>35.92</td></tr><tr><td>OSPOT-VAE</td><td>40.58(±0.48)</td><td>31.41(±0.21)</td></tr><tr><td rowspan="2">WRN-28-10</td><td>MixMatch* (Berthelot et al., 2019)</td><td></td><td>25.88</td></tr><tr><td>OSPOT-VAE</td><td>33.76(±0.53)</td><td>25.30(±0.31)</td></tr></table>
241
+
242
+ Table 4: Ablation study with SVHN, Cifar10, and Cifar100.
243
+
244
+ <table><tr><td>Methods</td><td>SVHN(1k labels)</td><td>Cifar10(4k labels)</td><td>Cifar100(10k labels)</td></tr><tr><td>One-stage VAE</td><td>10.53(±0.17)</td><td>18.26(±0.51)</td><td>38.62(±0.67)</td></tr><tr><td>Optimal transport estimation (with encoder only)</td><td>6.54(±0.62)</td><td>10.71(±0.44)</td><td>36.21(±0.29)</td></tr><tr><td>OSPOT-VAE</td><td>5.79(±0.15)</td><td>8.51(±0.32)</td><td>31.41(±0.21)</td></tr></table>
245
+
246
+ # 4.2 OSPOT-VAE
247
+
248
+ We compare the results of OSPOT-VAE with two categories of state-of-the-art models mentioned in Section2. In all experiments, we use the “WideResNet-28” model or other deep models with a comparable amount of parameters as the backbone. The results in Table 2,3 demonstrate that our model outperforms most of the existing methods and surpasses state-of-the-art semi-supervised generative models (Dai et al., 2017) by a large margin. Notice that recently, data-augmentation based method, MixMatch, (Berthelot et al., 2019) achieves the absolute state-of-the-art results in all benchmarks. It uses pre-designed sophisticated data augmentation strategies for different datasets and outperforms our model. We list its results fairly as a comparison, while OSPOT-VAE surpasses it in Cifar100 dataset.
249
+
250
+ Ablation Study: The OSPOT-VAE model consists of two parts: (1) a one-stage VAE objective and (2) an optimal transport estimation. In ablation study, we analyze the effect of each component in our model with the backbone “WideResNet-28-2”. To study the independent effects of transport estimation, we combine it with the encoder part of OSPOT-VAE to build a classifier with loss function $L _ { M _ { \mathbf { c } } }$ . The improved classification error rates in Table 4 show that, with optimal transport estimation, the posterior inference $q _ { \phi } ( \mathbf { c } | \mathbf { X } )$ gets closer to the true distribution $p ( \mathbf { c } | \mathbf { X } )$ . It indicates that our optimal transport estimation does reduce the gap between ELBO and the log-likelihood of the input data and yield a tighter ELBO, which leads to a better semi-supervised performance.
251
+
252
+ Table 5: Generative performance measured by ELBO with EL $\mathbf { B O } \leq \log p ( \mathbf { X } )$
253
+
254
+ <table><tr><td>Model</td><td>Cifar10</td><td>Cifar100</td></tr><tr><td>Pure VAE</td><td>-226.25(±14.25)</td><td>−1292.91(±1.10)</td></tr><tr><td>OSPOT-VAE</td><td>-237.62(±6.27)</td><td>-1271.82(±24.15)</td></tr></table>
255
+
256
+ # 4.3 GENERATIVE PERFORMANCE
257
+
258
+ $\mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } \mathrm { E L B O }$ measures the margin between the true data distribution and the distribution learned by generation models (Doersch, 2016). By comparing the $\mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) }$ value of pure unsupervised VAE and our semi-supervised VAE model under the same “WideResNet-28-2” backbone, we demonstrate that good generative models and semi-supervised results can be obtained at the same time in OSPOTVAE. The results in Table 5 show that the data generative distribution learned by our OSPOT-VAE model is as good as the pure VAE model. Further generated results are available in Appendix A.7.
259
+
260
+ # 5 CONCLUSION
261
+
262
+ In this work, we pointed out that it was the large margin between ELBO and the true log-likelihood of the raw data that limits the performance of semi-supervised VAE. To this end, we introduced OSPOT-VAE, a one-stage generative model that unified the classification and generation objective and achieved a tighter ELBO by optimal transport estimation. We demonstrated our assertion through extensive experiments, and our semi-supervised results significantly outperform former state-of-the-art generative SSL methods by a large margin on Cifar10 and Cifar100.
263
+
264
+ # REFERENCES
265
+
266
+ Luigi Ambrosio and Nicola Gigli. A users guide to optimal transport. 2013.
267
+
268
+ David Berthelot, Nicholas Carlini, Ian J. Goodfellow, Nicolas Papernot, Avital Oliver, and Colin Raffel. Mixmatch: A holistic approach to semi-supervised learning. CoRR, abs/1905.02249, 2019. URL http://arxiv.org/abs/1905.02249.
269
+
270
+ Grigorios G. Chrysos, Jean Kossaifi, and Stefanos Zafeiriou. Robust conditional generative adversarial networks. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019. URL https://openreview.net/forum?id= Byg0DsCqYQ.
271
+
272
+ Ekin D. Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V. Le. Autoaugment: Learning augmentation strategies from data. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
273
+
274
+ Zihang Dai, Zhilin Yang, Fan Yang, William W. Cohen, and Ruslan Salakhutdinov. Good semi-supervised learning that requires a bad GAN. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pp. 6510–6520, 2017. URL http://papers.nips.cc/paper/ 7229-good-semi-supervised-learning-that-requires-a-bad-gan.
275
+
276
+ Carl Doersch. Tutorial on variational autoencoders. CoRR, abs/1606.05908, 2016. URL http: //arxiv.org/abs/1606.05908.
277
+
278
+ 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 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Sy2fzU9gl.
279
+
280
+ Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, and Ondrej Chum. Label propagation for deep semisupervised learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5070–5079, 2019.
281
+
282
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24- 26, 2017, Conference Track Proceedings, 2017. URL https://openreview.net/forum? id $=$ rkE3y85ee.
283
+
284
+ Diederik P. Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semisupervised learning with deep generative models. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pp. 3581–3589, 2014. URL http://papers.nips.cc/ paper/5352-semi-supervised-learning-with-deep-generative-models.
285
+
286
+ Max Kuang and Esteban G. Tabak. Preconditioning of optimal transport. SIAM J. Scientific Computing, 39(4), 2017. doi: 10.1137/16M1074953. URL https://doi.org/10.1137/ 16M1074953.
287
+
288
+ Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017. URL https://openreview.net/forum? id $=$ BJ6oOfqge.
289
+
290
+ Wenyuan Li, Zichen Wang, Jiayun Li, Jennifer Polson, William Speier, and Corey W. Arnold. Semisupervised learning based on generative adversarial network: a comparison between good GAN and bad GAN approach. CoRR, abs/1905.06484, 2019. URL http://arxiv.org/abs/ 1905.06484.
291
+
292
+ Yucen Luo, Jun Zhu, Mengxi Li, Yong Ren, and Bo Zhang. Smooth neighbors on teacher graphs for semi-supervised learning. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 8896–8905, 2018. doi: 10.1109/ CVPR.2018.00927. URL http://openaccess.thecvf.com/content_cvpr_2018/ html/Luo_Smooth_Neighbors_on_CVPR_2018_paper.html.
293
+
294
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: A regularization method for supervised and semi-supervised learning. IEEE Trans. Pattern Anal. Mach. Intell., 41(8):1979–1993, 2019. doi: 10.1109/TPAMI.2018.2858821. URL https:// doi.org/10.1109/TPAMI.2018.2858821.
295
+
296
+ Siddharth Narayanaswamy, Brooks Paige, Jan-Willem van de Meent, Alban Desmaison, Noah D. Goodman, Pushmeet Kohli, Frank D. Wood, and Philip H. S. Torr. Learning disentangled representations with semi-supervised deep generative models. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pp. 5925–5935, 2017.
297
+
298
+ Avital Oliver, Augustus Odena, Colin Raffel, Ekin D. Cubuk, and Ian J. Goodfellow. Realistic evaluation of semi-supervised learning algorithms. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Workshop Track Proceedings, 2018. URL https://openreview.net/forum?id $=$ ByCZsFyPf.
299
+
300
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of the 31th International Conference on Machine Learning, ICML 2014, Beijing, China, 21-26 June 2014, pp. 1278–1286, 2014. URL http://proceedings.mlr.press/v32/rezende14.html.
301
+
302
+ 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. URL http://papers.nips.cc/paper/ 6125-improved-techniques-for-training-gans.pdf.
303
+
304
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. In 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016. URL http: //arxiv.org/abs/1511.06390.
305
+
306
+ Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Workshop Track Proceedings, 2017. URL https://openreview.net/forum?id $=$ ry8u21rtl.
307
+
308
+ Philippe Thomas. Semi-supervised learning by olivier chapelle, bernhard scholkopf, and alexander ¨ zien (review). IEEE Trans. Neural Networks, 20(3):542, 2009. doi: 10.1109/TNN.2009.2015974. URL https://doi.org/10.1109/TNN.2009.2015974.
309
+
310
+ Vikas Verma, Alex Lamb, Christopher Beckham, Aaron C. Courville, Ioannis Mitliagkas, and Yoshua Bengio. Manifold mixup: Encouraging meaningful on-manifold interpolation as a regularizer. CoRR, abs/1806.05236, 2018. URL http://arxiv.org/abs/1806.05236.
311
+
312
+ Vikas Verma, Alex Lamb, Juho Kannala, Yoshua Bengio, and David Lopez-Paz. Interpolation consistency training for semi-supervised learning. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pp. 3635–3641, 2019. doi: 10.24963/ijcai.2019/504. URL https://doi.org/10. 24963/ijcai.2019/504.
313
+
314
+ Xiang Wei, Boqing Gong, Zixia Liu, Wei Lu, and Liqiang Wang. Improving the improved training of wasserstein gans: A consistency term and its dual effect. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018. URL https://openreview.net/forum? id=SJx9GQb0-.
315
+
316
+ Zhirong Wu, Yuanjun Xiong, Stella X. Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 3733–3742, 2018. doi: 10.1109/CVPR.2018. 00393. URL http://openaccess.thecvf.com/content_cvpr_2018/html/Wu_ Unsupervised_Feature_Learning_CVPR_2018_paper.html.
317
+
318
+ Qizhe Xie, Zihang Dai, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. Unsupervised data augmentation. CoRR, abs/1904.12848, 2019. URL http://arxiv.org/abs/1904. 12848.
319
+
320
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. CoRR, abs/1605.07146, 2016. URL http://arxiv.org/abs/1605.07146.
321
+
322
+ Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empiri- ´ cal risk minimization. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1Ddp1-Rb.
323
+
324
+ Shengjia Zhao, Jiaming Song, and Stefano Ermon. Infovae: Information maximizing variational autoencoders. CoRR, abs/1706.02262, 2017. URL http://arxiv.org/abs/1706.02262.
325
+
326
+ # A APPENDIX
327
+
328
+ A.1 BASIC INEQUALITY OF ELBO
329
+
330
+ Proposition A.1. The Basic inequality of ELBO is
331
+
332
+ $$
333
+ \log p ( \mathbf { X } ) \geq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } [ \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) ] - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } ) ) - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } ) )
334
+ $$
335
+
336
+ proof
337
+
338
+ $$
339
+ \begin{array} { r l } & { \log p ( \mathbf { X } ) = \log \displaystyle \int _ { \mathbf { z } , \mathbf { c } } q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } = \log \mathbb { E } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } } \\ & { \geq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } \log \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } } \\ & { = \displaystyle \int _ { \mathbf { z } , \mathbf { c } } q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) \log \frac { p ( \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } + \displaystyle \int _ { \mathbf { z } , \mathbf { c } } q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) } \\ & { = - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) | p ( \mathbf { z } , \mathbf { c } ) ) + \mathbb { E } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } [ \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) ] } \\ & { = \mathrm { w i t h ~ a s s u m p t i o n } \left( 3 . 4 \right) \mathbb { E } _ { q _ { \phi } ( \mathbf { z } , \mathbf { c } | \mathbf { X } ) } [ \log p _ { \theta } ( \mathbf { X } | \mathbf { z } , \mathbf { c } ) ] - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) | p ( \mathbf { z } ) ) - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) | p ( \mathbf { c } ) ) } \end{array}
340
+ $$
341
+
342
+ # A.2 DECOMPOSITION OF ELBO IN INFO-VAE
343
+
344
+ Proposition A.2. The expected ELBO with empirical distribution satisfies
345
+
346
+ $$
347
+ \mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } ) \big ) = \mathbf { I } _ { q _ { \phi } } \big ( \mathbf { X } ; \mathbf { z } \big ) + D _ { \mathrm { K L } } \big ( q _ { \phi } ( \mathbf { z } ) \| p ( \mathbf { z } ) \big )
348
+ $$
349
+
350
+ proof
351
+
352
+ $$
353
+ \begin{array} { r l } & { \displaystyle \mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) | | p ( \mathbf { z } ) ) = \int _ { \mathbf { X } } p _ { e m p } ( \mathbf { X } ) \int _ { \mathbf { z } } q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \frac { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) } { p ( \mathbf { z } ) } d \mathbf { z } d \mathbf { X } } \\ & { \displaystyle = \int _ { \mathbf { X } } p _ { e m p } ( \mathbf { X } ) \int _ { \mathbf { z } } q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \frac { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) } { q _ { \phi } ( \mathbf { z } ) } d \mathbf { z } d \mathbf { X } + \int _ { \mathbf { X } } p _ { e m p } ( \mathbf { X } ) \int _ { \mathbf { z } } q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \frac { q _ { \phi } ( \mathbf { z } ) } { p ( \mathbf { z } ) } d \mathbf { z } d \mathbf { X } } \\ & { \displaystyle = \int _ { \mathbf { X } } \int _ { \mathbf { z } } q _ { \phi } ( \mathbf { z } , \mathbf { X } ) \log \frac { q _ { \phi } ( \mathbf { z } , \mathbf { X } ) } { q _ { \phi } ( \mathbf { z } ) p _ { e m p } ( \mathbf { X } ) } d \mathbf { z } d \mathbf { X } + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } ) | | p ( \mathbf { z } ) ) } \\ & { \displaystyle = \mathbf { I } _ { q _ { \phi } } ( \mathbf { X } ; \mathbf { z } ) + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } ) | | p ( \mathbf { z } ) ) } \end{array} \overset { \mathrm { U L } } { \mathop : }
354
+ $$
355
+
356
+ # A.3 THE EQUATION FORM OF ELBO
357
+
358
+ Proposition A.3. The expected margin between the true log-likelihood $\mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } \log p ( \mathbf { X } )$ and $\mathbb { E } _ { p _ { e m p } ( \mathbf { X } ) } E L B O$ is
359
+
360
+ $$
361
+ \mathbb { E } _ { p _ { c m p } ( \mathbf { X } ) } [ \log p ( \mathbf { X } ) - E L B O ] = \mathbb { E } _ { p _ { c m p } ( \mathbf { X } ) } [ D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } | \mathbf { X } ) ) + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } | \mathbf { X } ) ) ]
362
+ $$
363
+
364
+ # proof
365
+
366
+ We just need to prove the following equation
367
+
368
+ $$
369
+ \log p ( \mathbf { X } ) - \mathrm { E L B O } = D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } | \mathbf { X } ) ) + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } | \mathbf { X } ) )
370
+ $$
371
+
372
+ and the proof under assumption $( 3 , 4 )$ is
373
+
374
+ $$
375
+ \begin{array} { r l } & { \log p ( \mathbf { X } ) = \displaystyle \int _ { z , \mathbf { c } } q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \log p ( \mathbf { X } ) d \mathbf { z } d \mathbf { c } = \displaystyle \int _ { z , \mathbf { c } } q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \log \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { p ( \mathbf { z } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) } d \mathbf { z } d \mathbf { c } } \\ & { = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } \log \frac { p ( \mathbf { X } , \mathbf { z } , \mathbf { c } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } + \displaystyle \int _ { \mathbf { z } , \mathbf { c } } q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \log \frac { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } { p ( \mathbf { z } | \mathbf { X } ) p ( \mathbf { c } | \mathbf { X } ) } } \\ & { = \mathrm { E L B O } + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { X } ) \| p ( \mathbf { z } | \mathbf { X } ) ) + D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { c } | \mathbf { X } ) \| p ( \mathbf { c } | \mathbf { X } ) ) } \end{array}
376
+ $$
377
+
378
+ # A.4 OPTIMAL TRANSPORT SCHEME
379
+
380
+ # Proposition A.4.
381
+
382
+ 1. The shortest-path derived from optimal transport scheme (17) between $\mathbf z _ { 1 } \sim \mathcal N ( \pmb { \mu } _ { 1 } , \mathrm { d i a g } ( \pmb { \sigma } _ { 1 } ^ { 2 } ) )$ and $\mathbf z _ { 2 } \sim \mathcal N ( \pmb { \mu } _ { 2 } , \mathrm { d i a g } ( \pmb { \sigma } _ { 2 } ^ { 2 } ) )$ with $\lambda \in [ 0 , 1 ]$ is
383
+
384
+ $$
385
+ \begin{array} { r } { \tilde { \pmb { \mu } } = \lambda \pmb { \mu } _ { 1 } + ( 1 - \lambda ) \pmb { \mu } _ { 2 } } \\ { \tilde { \pmb { \sigma } } = \lambda \pmb { \sigma } _ { 1 } + ( 1 - \lambda ) \pmb { \sigma } _ { 2 } } \end{array}
386
+ $$
387
+
388
+ # proof
389
+
390
+ Utilizing the conclusions in Kuang & Tabak (2017), the closed form of optimal transport from one multi-normal distribution $\mathcal { N } ( \mathbf { z } _ { 1 } ; \mu _ { 1 } , \pmb { \Sigma } _ { 1 } )$ to another normal distribution $\bar { \mathcal { N } } ( \mathbf { z } _ { 2 } ; \mu _ { 2 } , \Sigma _ { 2 } )$ is
391
+
392
+ $$
393
+ \begin{array} { r } { { \mathbf z } \to { \mathcal T } ( { \mathbf z } ) = \mu _ { 2 } + { \mathbf T } ( { \mathbf z } - { \boldsymbol \mu _ { 1 } } ) ; \qquad { \mathbf T } = { \mathbf { \Sigma } } _ { 1 } ^ { - \frac { 1 } { 2 } } \bigr ( { \mathbf { \Sigma } } _ { 1 } ^ { \frac { 1 } { 2 } } { \mathbf { \Sigma } } _ { 2 } { \mathbf { \Sigma } } _ { 1 } ^ { \frac { 1 } { 2 } } \bigr ) ^ { \frac { 1 } { 2 } } { \mathbf { \Sigma } } _ { 1 } ^ { - \frac { 1 } { 2 } } } \end{array}
394
+ $$
395
+
396
+ Utilize the diag matrix assumption, the optimal transport scheme with $\lambda$ is
397
+
398
+ $$
399
+ \begin{array} { r } { \mathbf { z } _ { \lambda } = ( 1 - \lambda ) \mathbf { z } _ { 1 } + \lambda T ( \mathbf { z } _ { 1 } ) } \\ { \mathbf { T } = d i a g ( \pmb { \sigma } _ { 1 } / \pmb { \sigma } _ { 2 } ) } \end{array}
400
+ $$
401
+
402
+ Utilize (A.2), we can get (A.1) as
403
+
404
+ $$
405
+ { \bf z } _ { \lambda } \sim \mathcal { N } ( \tilde { \pmb { \mu } } , d i a g ( \tilde { \pmb { \sigma } } ^ { 2 } ) ) ; \qquad \tilde { \pmb { \mu } } = \lambda { \pmb { \mu } } _ { 1 } + ( 1 - \lambda ) { \pmb { \mu } } _ { 2 } ; \qquad \tilde { \pmb { \sigma } } = \lambda { \pmb { \sigma } } _ { 1 } + ( 1 - \lambda ) { \pmb { \sigma } } _ { 2 } \quad [ \lambda \in \mathcal { N } ^ { \pmb { \mu } } ] .
406
+ $$
407
+
408
+ 2. The shortest-path derived from KL divergence based optimal transport scheme between $\mathbf { c } _ { 1 } \sim$ $\mathrm { M u l t } ( K , \pi _ { 1 } )$ and ${ \bf c } _ { 2 } \sim \mathrm { M u l t } ( K , \pi _ { 2 } )$ with $\lambda \in [ 0 , 1 ]$ is
409
+
410
+ $$
411
+ \tilde { \pi } = \lambda \pi _ { 1 } + ( 1 - \lambda ) \pi _ { 2 }
412
+ $$
413
+
414
+ # proof
415
+
416
+ As the definition (17) has no closed-form solution for multinomial distribution, we use $\mathrm { K L }$ divergence instead. The KL divergence based optimal transport target $\mathbf { c } _ { \lambda } \sim \mathbf { M u l t } ( K , \tilde { \pi } )$ between two multinomial distribution ${ \bf c } _ { 1 } \sim \mathrm { M u l t } ( K , \pi _ { 1 } )$ and ${ \bf c } _ { 2 } \sim \bf { M u l t } ( { \cal K } , \pi _ { 2 } )$ with $\lambda \in [ 0 , 1 ]$ satisfy
417
+
418
+ $$
419
+ \operatorname* { m i n } _ { \tilde { \pi } } \lambda D _ { \mathrm { K L } } ( \pi _ { 1 } \| \tilde { \pi } ) + ( 1 - \lambda ) D _ { \mathrm { K L } } ( \pi _ { 2 } \| \tilde { \pi } ) \qquad s . t . \sum _ { i = 1 } ^ { K } \tilde { \pi } _ { i } = 1
420
+ $$
421
+
422
+ The Lagrange multiplier form of (A.4) is
423
+
424
+ $$
425
+ \mathcal { L } ( \tilde { \pi } , t ) = \lambda D _ { \mathrm { K L } } ( \pi _ { 1 } \| \tilde { \pi } ) + ( 1 - \lambda ) D _ { \mathrm { K L } } ( \pi _ { 2 } \| \tilde { \pi } ) + t * ( \sum _ { i = 1 } ^ { K } \tilde { \pi } _ { i } - 1 )
426
+ $$
427
+
428
+ Table 6: Schedule Parameters
429
+
430
+ <table><tr><td></td><td colspan="2">MNIST</td><td colspan="2">SVHN(one-stage)</td><td colspan="2">SVHN</td><td colspan="2">Cifar10</td><td colspan="2">Cifar100</td></tr><tr><td></td><td>hmax</td><td>tmax</td><td>hmax</td><td>tmax</td><td>hmax</td><td>tmax</td><td>hmax</td><td>tmax</td><td>hmax</td><td>tmax</td></tr><tr><td></td><td>30</td><td>50</td><td>1</td><td>175</td><td>1e-3</td><td>150</td><td>1e-3</td><td>150</td><td>1e-1</td><td>150</td></tr><tr><td>B</td><td>30</td><td>50</td><td>1</td><td>175</td><td>1</td><td>150</td><td>1e-3</td><td>150</td><td>1e-3</td><td>150</td></tr><tr><td>1</td><td>17.5</td><td>50</td><td>50</td><td>175</td><td>1280</td><td>150</td><td>200</td><td>150</td><td>1280</td><td>150</td></tr><tr><td>Ic</td><td>17</td><td>50</td><td>50</td><td>175</td><td>2.3</td><td>150</td><td>2.3</td><td>150</td><td>4.6</td><td>150</td></tr><tr><td>WMz</td><td>/</td><td>/</td><td>/</td><td>一</td><td>1e-3</td><td>150</td><td>1e-3</td><td>150</td><td>1e-1</td><td>150</td></tr><tr><td>WMc</td><td>/</td><td></td><td></td><td>1</td><td>1</td><td>400</td><td>1</td><td>280</td><td>1</td><td>280</td></tr></table>
431
+
432
+ and the related KKT conditions are
433
+
434
+ $$
435
+ \begin{array} { r } { \frac { \partial \mathcal { L } ( \tilde { \boldsymbol { \pi } } , t ) } { \partial \tilde { \boldsymbol { \pi } } } = t - \frac { \lambda \boldsymbol { \pi } _ { 1 } + ( 1 - \lambda ) \boldsymbol { \pi } _ { 2 } } { \tilde { \boldsymbol { \pi } } } = 0 } \\ { t \ast ( \displaystyle \sum _ { i = 1 } ^ { K } \tilde { \boldsymbol { \pi } } _ { i } - 1 ) = 0 } \end{array}
436
+ $$
437
+
438
+ Solve the equation (A.5), we can get the closed form of $\tilde { \pi }$ as
439
+
440
+ $$
441
+ \tilde { \pi } = \lambda \pi _ { 1 } + ( 1 - \lambda ) \pi _ { 2 } \quad \bigsqcup
442
+ $$
443
+
444
+ # A.5 SCHEDULE ANALYSIS
445
+
446
+ ![](images/712ae7b375b430e62be3a30c858dcdfec56c3e221e02585de9e0516814126163.jpg)
447
+ Figure 2: The Exponential Function-Based Scheduler
448
+
449
+ The warm-up scheduler aims to slowly increase the parameters until they reach their maximum. For a certain hyperparameter $h$ , there are 2 parameters control its warm-up process, the target value $h _ { m a x }$ and the total epoch $t _ { m a x }$ to reach the target value. We use the exponential function to get the middle value $h _ { t }$ as
450
+
451
+ $$
452
+ h _ { t } = h _ { m a x } \times \exp { [ - 5 * ( 1 - \operatorname* { m i n } ( 1 , t / t _ { m a x } ) ) ^ { 2 } ] }
453
+ $$
454
+
455
+ The curve of (A.6) is shown in Figure 2, and we list the scheduler parameters of 4 benchmark datasets, i.e. MNIST, SVHN, Cifar10, Cifar100, in Table 6.
456
+
457
+ Table 7: Details of Training Process
458
+
459
+ <table><tr><td></td><td>MNIST</td><td>SVHN(one-stage)</td><td>SVHN</td><td>Cifar10</td><td>Cifar100</td></tr><tr><td>Latent Dim(z/c)</td><td>10/10</td><td>32/10</td><td>128/10</td><td>128/10</td><td>128/100</td></tr><tr><td>Mutual Info(z/c)</td><td>17.5/17.0</td><td>50/50</td><td>1280/2.3</td><td>200/2.3</td><td>1280/4.6</td></tr><tr><td>loss of -log pe(X|c,z)</td><td>BCE</td><td>BCE</td><td>MSE</td><td>MSE</td><td>BCE</td></tr><tr><td>a of pmixup(X)</td><td>一</td><td>一</td><td>2</td><td>2</td><td>2</td></tr><tr><td>optimizer</td><td>Adam</td><td></td><td></td><td>SGD</td><td></td></tr><tr><td>learning rate</td><td>5e-4</td><td>1e-3</td><td colspan="3">0.1</td></tr><tr><td>lr scheduler(decay ratio)</td><td>一</td><td>一</td><td>every 50 epoch after 200-th(0.5)</td><td>[500,600,650](0.2)</td><td></td></tr><tr><td>weight decay</td><td>0</td><td>0</td><td></td><td>5e-4</td><td></td></tr></table>
460
+
461
+ # A.6 DETAILS OF TRAINING PROCESS
462
+
463
+ Here we list some important items need to set in the training process for different process. We classify these items into 2 categories: (1) items related to the loss function and (2) items related to the optimization strategy. The details are as follows and we list the exact value in Table 7:
464
+
465
+ 1. Items related to the loss function
466
+
467
+ • Latent dim The latent dim of discrete variable c is the same as the number of classifications, that is, $K$ . For continuous variable $\mathbf { z }$ , the latent dim is determined by experiments.
468
+ • Mutual information We find the value of continuous mutual information will affect the generative performance, but have little impact on semi-supervised learning results, so we choose a suitable value to get the best generative performance. For discrete information, we choose the value in the ideal scene, that is, $\mathbf { I } _ { \mathbf { c } } = \log ( K )$ .
469
+ • Calculation of $\mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } - \log p _ { \theta } ( \mathbf { X } | \mathbf { c } , \mathbf { z } )$ $p _ { \pmb { \theta } } ( \mathbf { X } | \mathbf { c } , \mathbf { z } )$ has two forms: (1) normal distribution with $\mathcal { N } ( f _ { \boldsymbol { \theta } } ( \mathbf { c } , \mathbf { z } ) , \mathbf { I } )$ and (2) multinomial distribution with $\mathbf { M u l t } ( d i m ( \mathbf { X } ) , f _ { \theta } ( \mathbf { c } , \mathbf { z } ) )$ . For the two forms, the loss function of $- \log p _ { \pmb { \theta } } ( \mathbf { X } | \mathbf { c } , \mathbf { z } )$ is mean square error(MSE) and binary cross entropy(BCE) respectively. We use reparameterization trick in (20) to approximate expectation, and the sampling frequency is 1.
470
+ �� $\alpha$ of $p _ { m i x u p } ( \mathbf { X } )$ The $\beta ( \alpha , \alpha )$ for mixup vicinal distribution will strongly affect SSL performance. We set it to 2 in all experiments.
471
+
472
+ 2. Items related to the optimization strategy
473
+
474
+ • Optimizer In one-stage VAE, we use Adam. In OSPOT-VAE, we use SGD with momentum 0.9.
475
+ • Learning rate We set the initial learning rate to 0.1 in OSPOT-VAE, which obtains best SSL performance. The scheduler of adjusting learning rate We decay the learning ratio in some milestones with the specified decay rate.
476
+ • Weight decay Weight decay controls the strength of $L _ { 2 }$ regularization.
477
+
478
+ We also list some standard training curves on benchmark datasets in Figure 3 and 4.
479
+
480
+ ![](images/cb00a1218b54c04419c02f3df09a2f7602585690b55a8620fed2b95acb2b231b.jpg)
481
+ Figure 3: The training curves of Cifar10. Left: classification performance. Right: $\mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } - \log p _ { \theta } ( \mathbf { X } | \mathbf { c } , \mathbf { z } )$
482
+
483
+ ![](images/c99910939dd2e58faf73c25c385af2b0e5d3daf4d34a0192b639b515b048f86f.jpg)
484
+ Figure 4: The training curves of Cifar100. Left: classification performance. Right: $\mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { X } ) , q _ { \phi } ( \mathbf { c } | \mathbf { X } ) } - \log p _ { \theta } ( \mathbf { X } | \mathbf { c } , \mathbf { z } )$
485
+
486
+ # A.7 GENERATIVE PERFORMANCE
487
+
488
+ Following figures5-7 show the generation performance of our OSPOT-VAE.
489
+
490
+ ![](images/25e8427bc09e3e5a473bfd67e0a4ebd896f3b330cc776a7003253b54f424ad84.jpg)
491
+ Figure 5: The generative performance of OSPOT-VAE in MNIST and SVHN
492
+
493
+ ![](images/ee3780017d783d4bf7dd38dea93a2d2af64e16334a08785719316d9fd5e1961d.jpg)
494
+ Figure 6: Compare the generative performance of pure VAE and OSPOT-VAE in Cifar10
495
+
496
+ ![](images/5871b177cdb29994688d651de1f8c9d3eec78a3fb02e32f4b5033317a4d4ac6b.jpg)
497
+ Figure 7: Compare the generative performance of pure VAE and OSPOT-VAE in Cifar100
md/train/S1m6h21Cb/S1m6h21Cb.md ADDED
@@ -0,0 +1,772 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE CRAMÉR DISTANCE AS A SOLUTION TO BIASED WASSERSTEIN GRADIENTS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The Wasserstein probability metric has received much attention from the machine learning community. Unlike the Kullback-Leibler divergence, which strictly measures change in probability, the Wasserstein metric reflects the underlying geometry between outcomes. The value of being sensitive to this geometry has been demonstrated, among others, in ordinal regression and generative modelling, and most recently in reinforcement learning. In this paper we describe three natural properties of probability divergences that we believe reflect requirements from machine learning: sum invariance, scale sensitivity, and unbiased sample gradients. The Wasserstein metric possesses the first two properties but, unlike the Kullback-Leibler divergence, does not possess the third. We provide empirical evidence suggesting this is a serious issue in practice. Leveraging insights from probabilistic forecasting we propose an alternative to the Wasserstein metric, the Cramér distance. We show that the Cramér distance possesses all three desired properties, combining the best of the Wasserstein and Kullback-Leibler divergences. We give empirical results on a number of domains comparing these three divergences. To illustrate the practical relevance of the Cramér distance we design a new algorithm, the Cramér Generative Adversarial Network (GAN), and show that it has a number of desirable properties over the related Wasserstein GAN.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In machine learning, the Kullback-Leibler (KL) divergence is perhaps the most common way of assessing how well a probabilistic model explains observed data. Among the reasons for its popularity is that it is directly related to maximum likelihood estimation and is easily optimized. However, the KL divergence suffers from a significant limitation: it does not take into account how close two outcomes might be, but only their relative probability. This closeness can matter a great deal: in image modelling, for example, perceptual similarity is key (Rubner et al., 2000; Gao & Kleywegt, 2016). Put another way, the KL divergence cannot reward a model that “gets it almost right”.
12
+
13
+ To address this limitation, researchers have turned to the Wasserstein metric, which does incorporate the underlying geometry between outcomes. The Wasserstein metric can be applied to distributions with non-overlapping supports, and has good out-of-sample performance (Esfahani & Kuhn, 2015). Yet, practical applications of the Wasserstein distance, especially in deep learning, remain tentative. In this paper we provide a clue as to why that might be: estimating the Wasserstein metric from samples yields biased gradients, and may actually lead to the wrong minimum. This precludes using stochastic gradient descent (SGD) and SGD-like methods, whose fundamental mode of operation is sample-based, when optimizing for this metric.
14
+
15
+ As a replacement we propose the Cramér distance (Székely, 2002; Rizzo & Székely, 2016), also known as the continuous ranked probability score in the probabilistic forecasting literature (Gneiting & Raftery, 2007). The Cramér distance, like the Wasserstein metric, respects the underlying geometry but also has unbiased sample gradients. To underscore our theoretical findings, we demonstrate a significant quantitative difference between the two metrics when employed in typical machine learning scenarios: categorical distribution estimation, regression, and finally image generation. In the latter case, we use a multivariate generalization of the Cramér distance, the energy distance (Székely, 2002), itself an instantiation of the MMD family of metrics (Gretton et al., 2012).
16
+
17
+ # 2 PROBABILITY DIVERGENCES AND METRICS
18
+
19
+ In this section we provide the notation to mathematically distinguish the Wasserstein metric (and later, the Cramér distance) from the Kullback-Leibler divergence and probability distances such as the total variation.
20
+
21
+ Let $P$ be a probability distribution over $\mathbb { R }$ . When $P$ is continuous, we will assume it has density $\mu _ { P }$ The expectation of a function $f : \mathbb { R } \to \mathbb { R }$ with respect to $P$ is
22
+
23
+ $$
24
+ { \underset { x \sim P } { \mathbb { E } } } f ( x ) : = \int _ { - \infty } ^ { \infty } f ( x ) P ( { \mathrm { d } } x ) = { \left\{ \begin{array} { l l } { \int f ( x ) \mu _ { P } ( x ) { \mathrm { d } } x } & { { \mathrm { i f ~ } } P { \mathrm { ~ i s ~ c o n t i n u o u s , a n d } } } \\ { \sum f ( x ) P ( x ) } & { { \mathrm { i f ~ } } P { \mathrm { ~ i s ~ d i s c r e t e . } } } \end{array} \right. }
25
+ $$
26
+
27
+ We will suppose all expectations and integrals under consideration are finite. We will often associate $P$ to a random variable $X$ , such that for a subset of the reals $A \subseteq \mathbb { R }$ , we have $\operatorname* { P r } \{ X \in A \} = P ( A )$ . The (cumulative) distribution function of $P$ is then
28
+
29
+ $$
30
+ F _ { P } ( x ) : = \operatorname* { P r } \{ X \leq x \} = \int _ { - \infty } ^ { x } P ( d x ) .
31
+ $$
32
+
33
+ Finally, the inverse distribution function of $P$ , defined over the interval $( 0 , 1 ]$ , is
34
+
35
+ $$
36
+ F _ { P } ^ { - 1 } ( u ) : = \operatorname* { i n f } \{ x : F _ { P } ( x ) = u \} .
37
+ $$
38
+
39
+ # 2.1 DIVERGENCES AND METRICS
40
+
41
+ Consider two probability distributions $P$ and $Q$ over $\mathbb { R }$ . A divergence $\mathbf { d }$ is a mapping $( P , Q ) \mapsto \mathbb { R } ^ { + }$ with $\mathbf { d } ( P , Q ) { \overline { { \ } } } = 0$ if and only if $P = Q$ almost everywhere. A popular choice is the KullbackLeibler (KL) divergence
42
+
43
+ $$
44
+ \mathrm { K L } ( P \parallel Q ) : = \int _ { - \infty } ^ { \infty } \log \frac { P ( \mathrm { d } x ) } { Q ( \mathrm { d } x ) } P ( \mathrm { d } x ) ,
45
+ $$
46
+
47
+ with $\operatorname { K L } ( P \left\| { Q } \right. = \infty$ if $P$ is not absolutely continuous w.r.t. $Q$ . The KL divergence, also called relative entropy, measures the amount of information needed to encode the change in probability from $Q$ to $P$ (Cover $\&$ Thomas, 1991).
48
+
49
+ A probability metric is a divergence which is also symmetric $( \mathbf { d } ( P , Q ) = \mathbf { d } ( Q , P ) )$ and respects the triangle inequality: for any distribution $R$ , ${ \bf d } ( P , Q ) \leq { \bf d } ( P , R ) + { \bf d } ( R , Q )$ . We will use the term probability distance to mean a symmetric divergence satisfying the relaxed triangle inequality ${ \bf d } ( P , Q ) \leq c [ { \bf d } ( P , R ) + { \bf d } ( R , Q ) ]$ for some $c \geq 1$ .
50
+
51
+ We will first study the $p$ -Wasserstein metrics $w _ { p }$ (Dudley, 2002). For $1 \leq p < \infty$ , a practical definition is through the inverse distribution functions of $P$ and $Q$ :
52
+
53
+ $$
54
+ w _ { p } ( P , Q ) : = \left( \int _ { 0 } ^ { 1 } \left| F _ { P } ^ { - 1 } ( u ) - F _ { Q } ^ { - 1 } ( u ) \right| ^ { p } \mathrm { d } u \right) ^ { 1 / p } .
55
+ $$
56
+
57
+ We will sometimes find it convenient to deal with the $p ^ { t h }$ power of the metric, which we will denote by $w _ { p } ^ { p }$ ; note that $w _ { p } ^ { p }$ is not a metric proper, but is a probability distance.
58
+
59
+ We will be chiefly concerned with the 1-Wasserstein metric, which is most commonly used in practice. The 1-Wasserstein metric has a dual form which is theoretically convenient and which we mention here for completeness. Define $\mathbb { F } _ { \infty }$ to be the class of 1-Lipschitz functions. Then
60
+
61
+ $$
62
+ w _ { 1 } ( P , Q ) : = \operatorname* { s u p } _ { f \in \mathbb { F } _ { \infty } } | \operatorname* { \mathbb { E } } _ { x \sim P } f ( x ) - \operatorname* { \mathbb { E } } _ { x \sim Q } f ( x ) | .
63
+ $$
64
+
65
+ This is a special case of the celebrated Monge-Kantorovich duality (Rachev et al., 2013), and is the integral probability metric (IPM) with function class $\mathbb { F } _ { \infty }$ (Müller, 1997). We invite the curious reader to consult these two sources as a starting point on this rich topic.
66
+
67
+ # 2.2 PROPERTIES OF A DIVERGENCE
68
+
69
+ As noted in the introduction, the fundamental difference between the KL divergence and the Wasserstein metric is that the latter is sensitive not only to change in probability but also to the geometry of possible outcomes. To capture this notion we now introduce the concept of an ideal divergence.
70
+
71
+ Consider a divergence $\mathbf { d }$ , and for two random variables $X , Y$ with distributions $P , Q$ write $\mathbf { d } ( X , Y ) : = \mathbf { d } ( { \bar { P _ { , } } } Q )$ . We say that $\mathbf { d }$ is scale sensitive (of order $\beta$ ), i.e. it has property (S), if there exists a $\beta > 0$ such that for all $X , Y$ , and a real value $c > 0$ ,
72
+
73
+ $$
74
+ \mathbf { d } ( c X , c Y ) \leq | c | ^ { \beta } \mathbf { d } ( X , Y ) .
75
+ $$
76
+
77
+ A divergence $\mathbf { d }$ has property $\mathbf { \eta } ^ { ( \mathbf { I } ) }$ , i.e. it is sum invariant, if whenever $A$ is independent from $X , Y$
78
+
79
+ $$
80
+ \mathbf { d } ( A + X , A + Y ) \leq \mathbf { d } ( X , Y ) .
81
+ $$
82
+
83
+ Following Zolotarev (1976), an ideal divergence $\mathbf { d }$ is one that possesses both (S) and (I).1
84
+
85
+ We can illustrate the sensitivity of ideal divergences to the value of outcomes by considering Dirac functions $\delta _ { x }$ at different values of $x$ . If $\mathbf { d }$ is scale sensitive of order $\beta = 1$ then the divergence $\mathbf { d } ( \delta _ { 0 } , \delta _ { 1 / 2 } )$ can be no more than half the divergence $\mathbf { d } ( \delta _ { 0 } , \delta _ { 1 } )$ . If $\mathbf { d }$ is sum invariant, then the divergence of $\delta _ { 0 }$ to $\delta _ { 1 }$ is equal to the divergence of the same distributions shifted by a constant $c$ , i.e. of $\delta _ { c }$ to $\delta _ { 1 + c }$ . As a concrete example of the importance of these properties, Bellemare et al. (2017) recently demonstrated the importance of ideal metrics in reinforcement learning, specifically their role in providing the contraction property of the distributional Bellman operator. In particular, the contraction modulus is $\gamma ^ { \beta }$ , where $\gamma \in [ 0 , 1 )$ is a discount factor and $\beta$ is the scale sensitivity order.
86
+
87
+ In machine learning we often view the divergence $\mathbf { d }$ as a loss function. Specifically, let $Q _ { \theta }$ be some distribution parametrized by $\theta$ , and consider the loss $ { \boldsymbol { \theta } } \mapsto \mathbf { d } ( P , Q _ { \theta } )$ . We are interested in minimizing this loss, that is finding $\theta ^ { * } : = \arg \operatorname* { m i n } _ { \theta } \mathbf { d } ( P , Q _ { \theta } )$ . We now describe a third property based on this loss, which we call unbiased sample gradients.
88
+
89
+ Let $\mathbf { X } _ { m } : = X _ { 1 } , X _ { 2 } , . . . , X _ { m }$ be independent samples from $P$ and define the empirical distribution $\begin{array} { r } { \hat { P } _ { m } : = \hat { P } _ { m } ( \mathbf { X } _ { m } ) : = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \delta _ { X _ { i } } } \end{array}$ (note that $\hat { P } _ { m }$ is a random quantity). From this, define the sample loss $\theta \mapsto \mathbf { d } ( \hat { P } _ { m } , Q _ { \theta } )$ . We say that $\mathbf { d }$ has unbiased sample gradients when the expected gradient of the sample loss equals the gradient of the true loss for all $P$ and $m$ :
90
+
91
+ $$
92
+ \underset { \mathbf { X } _ { m } \sim P } { \mathbb { E } } \nabla _ { \theta } \mathbf { d } ( \hat { P } _ { m } , Q _ { \theta } ) = \nabla _ { \theta } \mathbf { d } ( P , Q _ { \theta } ) .
93
+ $$
94
+
95
+ The notion of unbiased sample gradients is ubiquitous in machine learning and in particular in deep learning. Specifically, if a divergence $\mathbf { d }$ does not possess (U) then minimizing it with stochastic gradient descent may not converge, or it may converge to the wrong minimum. Conversely, if d possesses (U) then we can guarantee that the distribution which minimizes the expected sample loss is $Q = P$ . In the probabilistic forecasting literature, this makes $\mathbf { d }$ a proper scoring rule (Gneiting & Raftery, 2007).
96
+
97
+ We now characterize the KL divergence and the Wasserstein metric in terms of these properties. As it turns out, neither simultaneously possesses both (U) and (S).
98
+
99
+ Proposition 1. The KL divergence has unbiased sample gradients (U), but is not scale sensitive (S).
100
+
101
+ Proposition 2. The Wasserstein metric is ideal (I, S), but does not have unbiased sample gradients.
102
+
103
+ We will provide a proof of the bias in the sample Wasserstein gradients just below; the proof of the rest and later results are provided in the appendix.
104
+
105
+ # 3 BIAS IN THE SAMPLE GRADIENT ESTIMATES OF THE WASSERSTEIN DISTANCE
106
+
107
+ In this section we give theoretical evidence of serious issues with gradients of the sample Wasserstein loss. We will consider a simple Bernoulli distribution $P$ with parameter $\theta ^ { * } \in ( 0 , 1 )$ , which we would like to estimate from samples. Our model is $Q _ { \theta }$ , a Bernoulli distribution with parameter $\theta$ . We study the behaviour of stochastic gradient descent w.r.t. $\theta$ over the sample Wasserstein loss, specifically using the $p ^ { t h }$ power of the metric (as is commonly done to avoid fractional exponents). Our results build on the example given by Bellemare et al. (2017), whose result is for $\theta ^ { * } \stackrel { } { = } \frac { 1 } { 2 }$ and $m = 1$ .
108
+
109
+ Consider the estimate $\nabla _ { \theta } w _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } )$ of the gradient $\nabla _ { \theta } w _ { p } ^ { p } ( P , Q _ { \theta } )$ . We now show that even in this simplest of settings, this estimate is biased, and we exhibit a lower bound on the bias for any value of $m$ . Hence the Wasserstein metric does not have property (U). More worrisome still, we show that the minimum of the expected empirical Wasserstein loss $\theta \mapsto \mathbb { E } _ { \mathbf { X } _ { m } } \left[ w _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) \right]$ is not the minimum of the Wasserstein loss $\theta \mapsto w _ { p } ^ { p } ( P , Q _ { \theta } )$ . We then conclude that minimizing the sample Wasserstein loss by stochastic gradient descent may in general fail to converge to the minimum of the true loss.
110
+
111
+ Theorem 1. Let $\begin{array} { r } { \hat { P } _ { m } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \delta _ { X _ { i } } } \end{array}$ be the empirical distribution derived from $m$ independent samples $\mathbf { X } _ { m } = X _ { 1 } , \ldots , \ddot { X _ { m } }$ drawn from a Bernoulli distribution $P$ . Then for all $1 \leq p < \infty$ ,
112
+
113
+ • Non-vanishing minimax bias of the sample gradient. For any $m \geq 1$ there exists a pair of Bernoulli distributions $P$ , $Q _ { \theta }$ for which
114
+
115
+ $$
116
+ \begin{array} { r l } & { \Big | \underset { { \bf X } _ { m } \sim P } { \mathbb { E } } \left[ \nabla _ { \theta } w _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) \right] - \nabla _ { \theta } w _ { p } ^ { p } ( P , Q _ { \theta } ) \Big | \geq 2 e ^ { - 2 } ; } \end{array}
117
+ $$
118
+
119
+ • Wrong minimum of the sample Wasserstein loss. The minimum of the expected sample loss $\tilde { \theta } =$ arg $\operatorname* { m i n } _ { \theta } \mathbb { E } _ { \mathbf { X } _ { m } }$ $\left[ w _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) \right]$ is in general different from the minimum of the true Wasserstein loss $\theta ^ { * } = \arg \operatorname* { m i n } _ { \theta } w _ { p } ^ { p } ( P , Q _ { \theta } )$ .
120
+
121
+ • Deterministic solutions to stochastic problems. For any $m \geq 1$ , there exists a distribution $P$ with nonzero entropy whose sample loss is minimized by a distribution $Q _ { \tilde { \theta } }$ with zero entropy.
122
+
123
+ Taken as a whole, Theorem 1 states that we cannot in general minimize the Wasserstein loss using naive stochastic gradient descent methods. Although our result does not imply the lack of a stochastic optimization procedure for this loss,2 we believe our result to be cause for concern. We leave as an open question whether an unbiased optimization procedure exists and is practical.
124
+
125
+ # WASSERSTEIN BIAS IN THE LITERATURE
126
+
127
+ Our result is surprising given the prevalence of the Wasserstein metric in empirical studies. We hypothesize that this bias exists in published results and is an underlying cause of learning instability and poor convergence often remedied to by heuristic means. For example, Frogner et al. (2015) and Montavon et al. (2016) reported the need for a mixed KL-Wasserstein loss to obtain good empirical results, with the latter explicitly discussing the issue of wrong minima when using Wasserstein gradients.
128
+
129
+ We remark that our result also applies to the dual (2), since the losses are the same. This dual was recently considered by Arjovsky et al. (2017) as an alternative loss to the primal (1). The adversarial procedure proposed by the authors is a two time-scale process which first maximizes (2) w.r.t $f \in \mathbb { F } _ { \infty }$ using $m$ samples, then takes a single stochastic gradient step w.r.t. $\theta$ . Interestingly, this approach does seem to provide unbiased gradients as $m \infty$ . However, the cost of a single gradient is now significantly higher, and for a fixed $m$ we conjecture that the minimax bias remains.
130
+
131
+ # 4 THE CRAMÉR DISTANCE
132
+
133
+ We are now ready to describe an alternative to the Wasserstein metric, the Cramér distance (Székely, 2002; Rizzo & Székely, 2016). As we shall see, the Cramér distance has the same appealing properties as the Wasserstein metric, but also provides us with unbiased sample gradients. As a result, we believe this underappreciated distance is an appealing alternative to the Wasserstein metric for many machine learning applications.
134
+
135
+ # 4.1 DEFINITION AND ANALYSIS
136
+
137
+ Recall that for two distributions $P$ and $Q$ over $\mathbb { R }$ , their (cumulative) distribution functions are respectively $F _ { P }$ and $F _ { Q }$ . The (squared) Cramér distance between $P$ and $Q$ is
138
+
139
+ $$
140
+ l _ { 2 } ^ { 2 } ( P , Q ) : = \int _ { - \infty } ^ { \infty } ( F _ { P } ( x ) - F _ { Q } ( x ) ) ^ { 2 } { \mathrm d } x .
141
+ $$
142
+
143
+ ![](images/7a5ddbb854890652d13ba81d3aeca5ebb11158e85bd02f1bb7776b1fef5e4bd4.jpg)
144
+ Figure 1: Leftmost. Target distribution. One outcome (10) is significantly more distant than the two others $( 0 , 1 )$ . Rest. Distributions minimizing the divergences discussed in this paper, under the constraint $Q ( 1 ) = Q ( 1 0 )$ . Both Wasserstein metric and Cramér distance underemphasize $Q ( 0 )$ to better match the cumulative distribution function. The sample Wasserstein loss result is for $m = 1$ .
145
+
146
+ The Cramér distance is a Bregman divergence, and is a member of the $l _ { p }$ family of divergences
147
+
148
+ $$
149
+ l _ { p } ( P , Q ) : = \left( \int _ { - \infty } ^ { \infty } | F _ { P } ( x ) - F _ { Q } ( x ) | ^ { p } \mathrm { d } x \right) ^ { 1 / p } .
150
+ $$
151
+
152
+ The $l _ { p }$ and Wasserstein metrics are identical at $p = 1$ , but are otherwise distinct. As the following theorem shows, the Cramér distance possesses unique properties.
153
+
154
+ Theorem 2. Consider two random variables $X , Y$ , a random variable $A$ independent of $X , Y$ , and a real value $c > 0$ . Then for $1 \leq p \leq \infty$ ,
155
+
156
+ $$
157
+ ( I ) \ l _ { p } ( A + X , A + Y ) \leq l _ { p } ( X , Y ) \qquad ( S ) \ l _ { p } ( c X , c Y ) \leq | c | ^ { 1 / p } l _ { p } ( X , Y ) .
158
+ $$
159
+
160
+ Furthermore, the Cramér distance has unbiased sample gradients. That is, given $\mathrm { ~ \bf ~ X ~ } _ { m } : = \mathrm { ~ \bf ~ \Omega ~ }$ $X _ { 1 } , \ldots , X _ { m }$ drawn from a distribution $P$ , the empirical distribution $\begin{array} { r } { \hat { P } _ { m } : = \frac { 1 } { m } \dot { \sum _ { i = 1 } ^ { m } } \delta _ { X _ { i } } } \end{array}$ , and $a$ distribution $Q _ { \theta }$ ,
161
+
162
+ $$
163
+ \underset { \mathbf { X } _ { m } \sim P } { \mathbb { E } } \nabla _ { \theta } l _ { 2 } ^ { 2 } ( \hat { P } _ { m } , Q _ { \theta } ) = \nabla _ { \theta } l _ { 2 } ^ { 2 } ( P , Q _ { \theta } ) ,
164
+ $$
165
+
166
+ and of all the $l _ { p }$ distances, only the Cramér $\mathrm { { \bar { \it { p } } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \bar { \it { n } } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { { \it { n } } = 2 } \mathrm { \it { \it { n } } = 2 } \mathrm { \it { \it \it { n } } = 2 } \mathrm { { \it \it { n } } = 2 } \mathrm { \it { \it { \it \it { n } } = 2 } \mathrm { \it { \it \it { \it \it { n } } = } \it \it } \mathrm { \it { \it \it \it { \it \it \it { \it \it \it } } } } }$ ) has this property.
167
+
168
+ We conclude that the Cramér distance enjoys both the benefits of the Wasserstein metric and the SGD-friendliness of the KL divergence. Given the close similarity of the Wasserstein and $l _ { p }$ metrics, it is truly remarkable that only the Cramér distance has unbiased sample gradients.
169
+
170
+ # 4.2 COMPARISON TO THE 1-WASSERSTEIN METRIC
171
+
172
+ To illustrate how the Cramér distance compares to the 1-Wasserstein metric, we consider modelling the discrete distribution $P$ depicted in Figure 1 (left). Since the trade-offs between metrics are only apparent when using an approximate model, we use an underparametrized discrete distribution $Q _ { \theta }$ which assigns the same probability to $x = 1$ and $x = 1 0$ . That is,
173
+
174
+ $$
175
+ Q _ { \theta } ( 0 ) : = Q _ { \theta } \{ x = 0 \} = \frac { 1 } { 1 + 2 e ^ { \theta } } \qquad Q _ { \theta } ( 1 ) = Q _ { \theta } ( 1 0 ) = \frac { e ^ { \theta } } { 1 + 2 e ^ { \theta } } .
176
+ $$
177
+
178
+ Figure 1 depicts the distributions minimizing the various divergences under this parametrization. In particular, the Cramér solution is relatively close to the 1-Wasserstein solution. Furthermore, the minimizer of the sample Wasserstein loss $( m = 1$ ) clearly provides a bad solution (most of the mass is on 0). Note that, as implied by Theorem 1, the bias shown here would arise even if the distribution could be exactly represented.
179
+
180
+ To further show the impact of the Wasserstein bias we used gradient descent to minimize either the true or sample losses with a fixed step-size $\mathbf { \Phi } ( \alpha = 0 . 0 0 1 $ ). In the stochastic setting, at each step we construct the empirical distribution $\hat { P } _ { m }$ from $m$ samples (a Dirac when $m = 1$ ), and take a gradient step. We measure the performance of each method in terms of the true 1-Wasserstein loss.
181
+
182
+ Figure 2 (left) plots the resulting training curves in the 1-Wasserstein regime, with the KL and Cramér solutions indicated for reference. We first note that, compared to the KL solution, the Cramér solution has significantly smaller Wasserstein distance to the target distribution. Second, for small sample sizes stochastic gradient descent fails to find reasonable solutions, and for $m = 1$ even converges to a solution worse than the KL minimizer. This small experiment highlights the cost incurred from minimizing the sample Wasserstein loss, and shows that increasing the sample size may not be sufficient to guarantee good behaviour.
183
+
184
+ ![](images/6eeff3aa3fa7194f9cdca98f6cc23f97c78d9cc118e52a150644fb492ecaa425.jpg)
185
+ Figure 2: Left. Wasserstein distance in terms of SGD updates, minimizing the true or sample Wasserstein losses. Also shown are the distances for the KL and Cramér solutions. Results are averaged over 10 random initializations, with error-bands indicating one standard deviation. Center. Ordinal regression on the Year Prediction MSD dataset. Learning curves report RMSE on test set. Right. The same in terms of sample Wasserstein loss.
186
+
187
+ # ORDINAL REGRESSION
188
+
189
+ We next trained a neural network in an ordinal regression task using either of the three divergences. The task we consider is the Year Prediction MSD dataset (Lichman, 2013). In this task, the model must predict the year a song was written (from 1922 to 2011) given a 90-dimensional feature representation. In our setting, this prediction takes the form of a probability distribution. We measure each method’s performance on the test set (Figure 2) in two ways: root mean squared error (RMSE) – the metric minimized by Hernández-Lobato & Adams (2015) – and the sample Wasserstein loss. Full details on the experiment may be found in the appendix.
190
+
191
+ The results show that minimizing the sample Wasserstein loss results in significantly worse performance. By contrast, minimizing the Cramér distance yields the lowest RMSE and Wasserstein loss, confirming the practical importance of having unbiased sample gradients. Naturally, minimizing for one loss trades off performance with respect to the others, and minimizing the Cramér distance results in slightly higher negative log likelihood than when minimizing the KL divergence (Figure 7 in appendix). We conclude that, in the context of ordinal regression where outcome similarity plays an important role, the Cramér distance should be preferred over either KL or the Wasserstein metric.
192
+
193
+ # 5 MULTIVARIATE DISTRIBUTIONS
194
+
195
+ The energy distance (Székely, 2002) is a natural extension of the Cramér distance to the multivariate case. Let $P , Q$ be probability distributions over $\mathbb { R } ^ { d }$ and let $X , X ^ { \prime }$ and $Y , Y ^ { \prime }$ be independent random variables distributed according to $P$ and $Q$ , respectively. The energy distance (sometimes called the squared energy distance, see e.g. Rizzo & Székely, 2016) is
196
+
197
+ $$
198
+ \mathcal { E } ( P , Q ) : = \mathcal { E } ( X , Y ) : = 2 \mathbb { E } \left. X - Y \right. _ { 2 } - \mathbb { E } \left. X - X ^ { \prime } \right. _ { 2 } - \mathbb { E } \left. Y - Y ^ { \prime } \right. _ { 2 } .
199
+ $$
200
+
201
+ Székely showed that, in the univariate case, $l _ { 2 } ^ { 2 } ( P , Q ) = \frac { 1 } { 2 } \mathcal { E } ( P , Q )$ . Interestingly enough, the energy distance can also be written in terms of a difference of expectations. For
202
+
203
+ $$
204
+ f ^ { * } ( x ) : = \mathbb { E } \left\| x - Y ^ { \prime } \right\| _ { 2 } - \mathbb { E } \left\| x - X ^ { \prime } \right\| _ { 2 } ,
205
+ $$
206
+
207
+ we find that
208
+
209
+ $$
210
+ { \mathcal { E } } ( X , Y ) = \mathbb { E } f ^ { * } ( X ) - \mathbb { E } f ^ { * } ( Y ) .
211
+ $$
212
+
213
+ The energy distance is closely related to the distances known as maximum mean discrepancies (MMDs; Gretton et al., 2012); in particular, Sejdinovic et al. (2013) showed that the energy distance is equivalent to the squared MMD with kernel $k ( x , y ) = \| x \| _ { 2 } + \| y \| _ { 2 } - \| x - y \| _ { 2 }$ . Finally, we remark that $\mathcal { E }$ also possesses properties (I), (S), and (U) (proof in the appendix).
214
+
215
+ ![](images/5e524c18483a41d268d2db2c11497d216ec04648b24ac0bc9f357ed64e68e5b7.jpg)
216
+ Figure 3: Generated right halves of the faces for WGAN-GP (left) and Cramér GAN (right). The given left halves are from CelebA 64x64 validation set (Liu et al., 2015).
217
+
218
+ <table><tr><td>Algorithm1:Cramér GANLosses.</td></tr><tr><td>Parameter. Gradient penalty coefficient 入. Sample xr ~ P,𝑥g,xg~ Q,∈~ Uniform(0,1). Interpolate real and generated samples: 𝑥=∈xr+(1-∈)xg Sample generator loss (12):</td></tr><tr><td>Lg= |/h(xr)-h(xg)ll2+|/h(xr)-h(𝑥g)ll2</td></tr><tr><td>-|h(xg)-h(xg)ll2 Sample surrogate generator loss (13) and critic loss:</td></tr><tr><td>Ls(u,v)= |h(xr)-h(u)ll2-|/h(xr)ll2 -/h(u)-h(ν)ll2+ h(u)ll2 Ls=1[Ls(xg,xg)+Ls(xg,xg)]</td></tr></table>
219
+
220
+ ![](images/10c3321ab14ddd89420fde4333c1de5a5e166d15df5415254b4af109a6ace48b.jpg)
221
+ Figure 4: Approximate Wasserstein distances between CelebA test set and the generators. $N _ { u }$ is the number critic updates per generator update.
222
+
223
+ # 5.1 CRAMÉR GAN
224
+
225
+ We now consider the Generative Adversarial Networks (GAN) framework (Goodfellow et al., 2014), in particular issues arising in the Wasserstein GAN (Arjovsky et al., 2017), and propose a better GAN based on the Cramér distance. A GAN is composed of a generative model $Q$ (in our experiments, over images), called the generator, a target source $P$ , and a trainable loss function called a discriminator or critic. GANs are particularly interesting because we can establish a direct comparison between the two distances. Our choice of name reflects this fact, and we prefer Cramér GAN to the perhaps more technically correct, but less palatable Energy Distance GAN. In theory, the Wasserstein GAN algorithm requires training the critic until convergence, but this is rarely achievable: we would require a critic that is a very powerful network to approximate the Wasserstein distance well (Arora et al., 2017). Simultaneously, training this critic to convergence would overfit the empirical distribution of the training set, which is undesirable.
226
+
227
+ Our proposed loss function allows for useful learning with imperfect critics by combining the energy distance with a transformation function $h : \mathbb { R } ^ { d } \mathbb { R } ^ { k }$ , where $d$ is the input dimensionality and $k ~ = ~ 2 5 6$ in our experiments. The generator then seeks to minimize the energy distance of the transformed variables $\mathcal { E } ( h ( X ) , h ( Y ) )$ , where $X$ is a real sample and $Y$ is a generated sample. The critic itself seeks to maximize this same distance by changing the parameters of $h$ , subject to a soft constraint (the gradient penalty used by Gulrajani et al., 2017). Specifically, the critic maximizes a surrogate loss whose gradient can be estimated from a single real sample. The Cramér GAN losses are summarized in Algorithm 1, with additional design choices detailed in Appendix C.
228
+
229
+ We note that MMDs such as the energy distance have in the last year become an appealing tool for training GANs. Among others, the squared MMD is used within Generative Moment Matching Networks (Li et al., 2015; Dziugaite et al., 2015); Bouchacourt et al. (2016) trained a model to minimize the energy distance for hand pose estimation. Our use of the tranformation $h ( x )$ reflects our anecdotal finding that the direct minimization of the energy distance over raw images does not work well (see Figure 10 in appendix). Similar findings can be found in the work of Mroueh et al. (2017) and the independently developed MMD GAN (Li et al., 2017), which additionally uses an auto-encoder loss to make the transformation injective.
230
+
231
+ The Cramér GAN we present here complements our comparison of the Wasserstein and Cramér distance from previous sections. At the same time, our experiments also provide novel GAN-related contributions, including the ability to perform conditional modelling using a surrogate generator loss, which lets us train the critic even when only one independent sample from $P$ is available. We note also that in our experiments, $\| x - y \| _ { 2 }$ distances were more stable than distances generated by Gaussian or Laplacian kernels.
232
+
233
+ # 5.2 CRAMÉR GAN EXPERIMENTS
234
+
235
+ We now show that, compared to the improved Wasserstein GAN (WGAN-GP) of Gulrajani et al. (2017), the Cramér GAN leads to more stable learning and increased diversity in the generated samples. In both cases we train generative models that predict the right half of an image given the left half; samples from unconditional models are provided in the appendix (Figure 10). The dataset we use here is the CelebA $6 4 \times 6 4$ dataset (Liu et al., 2015) of celebrity faces.
236
+
237
+ Increased diversity. In our first experiment, we compare the qualitative diversity of completed faces by showing three sample completions generated by either model given the left half of a validation set image (Figure 3). We observe that the completions produced by WGAN-GP are almost deterministic. Our findings echo those of Isola et al. (2016), who observed that “the generator simply learned to ignore the noise.” By contrast, the completions produced by Cramér GAN are fairly diverse, including different hairstyles, accessories, and backgrounds. We view this lack of diversity in WGAN-GP as undesirable given that the main requirement of a generative model is that it should provide a variety of outputs.
238
+
239
+ Theorem 1 provides a clue as to what may be happening here. We know that minimizing the sample Wasserstein loss will find the wrong minimum. In particular, when the target distribution has low entropy, the sample Wasserstein minimizer may actually be a deterministic distribution. But a good generative model of images must lie in this “almost deterministic” regime, since the space of natural images makes up but a fraction of all possible pixel combinations and hence there is little perpixel entropy. We hypothesize that the increased diversity in the Cramér GAN comes exactly from learning these almost deterministic predictions.
240
+
241
+ More stable learning. In a second experiment, we varied the number of critic updates $( N _ { u } )$ per generator update. To compare performance between the two architectures, we measured the loss computed by an independent WGAN-GP critic trained on the validation set, following a similar evaluation previously done by Danihelka et al. (2017). Figure 4 shows the independent Wasserstein critic distance between each generator and the test set during the course of training. Echoing our results with the toy experiment and ordinal regression, the plot shows that when a single critic update is used, WGAN-GP performs particularly poorly. We note that additional critic updates also improve Cramér GAN. This indicates that it is helpful to keep adapting the $h ( x )$ transformation.
242
+
243
+ # 6 CONCLUSION
244
+
245
+ There are many situations in which the KL divergence, which is commonly used as a loss function in machine learning, is not suitable. The desirable alternatives, as we have explored, are the divergences that are ideal and allow for unbiased estimators: they allow geometric information to be incorporated into the optimization problem; because they are scale-sensitive and sum-invariant, they possess the convergence properties we require for efficient learning; and the correctness of their sample gradients means we can deploy them in large-scale optimization problems. Among open questions, we mention deriving an unbiased estimator that minimizes the Wasserstein distance, and variance analysis and reduction of the Cramér distance gradient estimate.
246
+
247
+ # REFERENCES
248
+
249
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In Proceedings of the International Conference on Machine Learning, 2017.
250
+
251
+ Sanjeev Arora, Rong Ge, Yingyu Liang, Tengyu Ma, and Yi Zhang. Generalization and equilibrium in generative adversarial nets (GANs). arXiv preprint arXiv:1703.00573, 2017.
252
+
253
+ Marc G. Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. In Proceedings of the International Conference on Machine Learning, 2017.
254
+
255
+ Peter J. Bickel and David A. Freedman. Some asymptotic theory for the bootstrap. The Annals of Statistics, pp. 1196–1217, 1981.
256
+
257
+ Diane Bouchacourt, Pawan K Mudigonda, and Sebastian Nowozin. DISCO Nets: DISsimilarity COefficients Networks. In Advances in Neural Information Processing Systems, pp. 352–360, 2016.
258
+
259
+ Kun-Jen Chung and Matthew J Sobel. Discounted MDP’s: Distribution functions and exponential utility maximization. SIAM Journal on Control and Optimization, 25(1):49–62, 1987.
260
+
261
+ Thomas M. Cover and Joy A. Thomas. Elements of information theory. John Wiley & Sons, 1991.
262
+
263
+ Ivo Danihelka, Balaji Lakshminarayanan, Benigno Uria, Daan Wierstra, and Peter Dayan. Comparison of Maximum Likelihood and GAN-based training of Real NVPs. arXiv preprint arXiv:1705.05263, 2017.
264
+
265
+ Jérôme Dedecker and Florence Merlevède. The empirical distribution function for dependent variables: asymptotic and nonasymptotic results in Lp. ESAIM: Probability and Statistics, 11:102– 114, 2007.
266
+
267
+ Richard M Dudley. Real analysis and probability, volume 74. Cambridge University Press, 2002.
268
+
269
+ Gintare Karolina Dziugaite, Daniel M Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. In Proceedings of the Conference on Uncertainty in Artificial Intelligence, 2015.
270
+
271
+ Peyman Mohajerin Esfahani and Daniel Kuhn. Data-driven distributionally robust optimization using the Wasserstein metric: Performance guarantees and tractable reformulations. Mathematical Programming, 2015.
272
+
273
+ Charlie Frogner, Chiyuan Zhang, Hossein Mobahi, Mauricio Araya, and Tomaso A Poggio. Learning with a Wasserstein loss. In Advances in Neural Information Processing Systems, 2015.
274
+
275
+ Rui Gao and Anton J Kleywegt. Distributionally robust stochastic optimization with Wasserstein distance. arXiv preprint arXiv:1604.02199, 2016.
276
+
277
+ Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association, 102(477):359–378, 2007.
278
+
279
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, 2014.
280
+
281
+ Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. Journal of Machine Learning Research, 13:723–773, 2012.
282
+
283
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of Wasserstein GANs. arXiv preprint arXiv:1704.00028, 2017.
284
+
285
+ José Miguel Hernández-Lobato and Ryan P Adams. Probabilistic backpropagation for scalable learning of Bayesian neural networks. In Proceedings of the International Conference on Machine Learning, 2015.
286
+
287
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Günter Klambauer, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a Nash equilibrium. arXiv preprint arXiv:1706.08500, 2017.
288
+
289
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the Conference on Computer Vision and Pattern Recognition, 2016.
290
+
291
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. Proceedings of the International Conference on Learning Representations, 2014.
292
+
293
+ C.-L. Li, W.-C. Chang, Y. Cheng, Y. Yang, and B. Póczos. MMD GAN: Towards deeper understanding of moment matching network. In Proceedings of the Neural Information Processing Systems, 2017.
294
+
295
+ Yujia Li, Kevin Swersky, and Rich Zemel. Generative moment matching networks. In Proceedings of the International Conference on Machine Learning, 2015.
296
+
297
+ M. Lichman. UCI machine learning repository, 2013. URL http://archive.ics.uci.edu/ ml.
298
+
299
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision, 2015.
300
+
301
+ Grégoire Montavon, Klaus-Robert Müller, and Marco Cuturi. Wasserstein training of restricted Boltzmann machines. In Advances in Neural Information Processing Systems, 2016.
302
+
303
+ Youssef Mroueh, Tom Sercu, and Vaibhava Goel. McGan: Mean and covariance feature matching GAN. In Proceedings of the International Conference on Machine Learning, 2017.
304
+
305
+ Alfred Müller. Integral probability metrics and their generating classes of functions. Advances in Applied Probability, 29(2):429–443, 1997.
306
+
307
+ Svetlozar T. Rachev, Lev Klebanov, Stoyan V. Stoyanov, and Frank Fabozzi. The methods of distances in the theory of probability and statistics. Springer, 2013.
308
+
309
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
310
+
311
+ Maria L Rizzo and Gábor J Székely. Energy distance. Wiley Interdisciplinary Reviews: Computational Statistics, 8(1):27–38, 2016.
312
+
313
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, 2015.
314
+
315
+ Yossi Rubner, Carlo Tomasi, and Leonidas J Guibas. The earth mover’s distance as a metric for image retrieval. International journal of computer vision, 40(2):99–121, 2000.
316
+
317
+ 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.
318
+
319
+ Dino Sejdinovic, Bharath Sriperumbudur, Arthur Gretton, Kenji Fukumizu, et al. Equivalence of distance-based and RKHS-based statistics in hypothesis testing. The Annals of Statistics, 41(5): 2263–2291, 2013.
320
+
321
+ 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.
322
+
323
+ Gabor J. Székely. E-statistics: The energy of statistical samples. Technical Report 02-16, Bowling Green State University, Department of Mathematics and Statistics, 2002.
324
+
325
+ Gábor J Székely and Maria L Rizzo. Energy statistics: A class of statistics based on distances. Journal of statistical planning and inference, 143(8):1249–1272, 2013.
326
+ Aaron Van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In Proceedings of the International Conference on Machine Learning, 2016.
327
+ Mark Veraar. On Khintchine inequalities with a weight. Proceedings of the American Mathematical Society, 138(11):4119–4121, 2010.
328
+ Vladimir M. Zolotarev. Metric distances in spaces of random variables and their distributions. Sbornik: Mathematics, 30(3):373–401, 1976.
329
+
330
+ # A PROOFS
331
+
332
+ # A.1 PROPERTIES OF A DIVERGENCE
333
+
334
+ Proof (Proposition 1 and 2). The statement regarding (U) for the KL divergence is well-known, and forms the basis of most stochastic gradient algorithms for classification. Chung & Sobel (1987) have shown that the total variation does not have property (S); by Pinsker’s inequality, it follows that the same holds for the KL divergence. A proof of (I) and (S) for the Wasserstein metric is given by Bickel & Freedman (1981), while the lack of (U) is shown in the proof of Theorem 1. □
335
+
336
+ # A.2 BIASED ESTIMATE
337
+
338
+ Proof (Theorem $^ { l }$ ). Minimax bias: Consider $P = B ( { \theta } ^ { * } )$ , a Bernoulli distribution of parameter $\theta ^ { * }$ and $Q _ { \theta } = B ( \theta )$ a Bernoulli of parameter $\theta$ . The empirical distribution $\hat { P } _ { m }$ is a Bernoulli with parameter $\begin{array} { r } { \hat { \theta } : = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } X _ { i } } \end{array}$ . Note that with $P$ and $Q _ { \theta }$ both Bernoulli distributions, the p $p ^ { t h }$ powers -Wasserstein metrics are equal, i.e. $w _ { 1 } ( P , Q _ { \theta } ) = w _ { p } ^ { p } ( P , Q _ { \theta } )$ . This gives us an easy way to prove the stronger result that all $p$ -Wasserstein metrics have biased sample gradients. The gradient of the loss $w _ { p } ^ { p } ( P , Q _ { \theta } )$ is, for $\theta \neq \theta ^ { * }$ ,
339
+
340
+ $$
341
+ \begin{array} { r } { g : = \nabla w _ { p } ^ { p } ( P , Q _ { \theta } ) = \nabla \Big [ \big | \theta ^ { * } - \theta \big | \Big ] = \mathrm { s g n } ( \theta - \theta ^ { * } ) , } \end{array}
342
+ $$
343
+
344
+ and similarly, the gradient of the sample loss is, for $\theta \neq { \hat { \theta } }$ ,
345
+
346
+ $$
347
+ \boldsymbol { \hat { g } } : = \nabla w _ { p } ^ { p } ( \boldsymbol { \hat { P } } _ { m } , Q _ { \theta } ) = \nabla \Big [ \big | \boldsymbol { \hat { \theta } } - \boldsymbol { \theta } \big | \Big ] = \mathrm { s g n } ( \theta - \boldsymbol { \hat { \theta } } ) .
348
+ $$
349
+
350
+ Notice that this estimate is biased for any $m \geq 1$ since
351
+
352
+ $$
353
+ \begin{array} { r } { \mathbb { E } \hat { g } = 2 \operatorname* { P r } \{ \hat { \theta } < \theta \} - 1 , } \end{array}
354
+ $$
355
+
356
+ which is different from $g$ for any $\theta ^ { * } \in ( 0 , 1 )$ . In particular for $m = 1$ , $\mathbb { E } _ { P } \hat { g } = 1 - 2 \theta ^ { * }$ does not depend on $\theta$ , thus a gradient descent using a one-sample gradient estimate has no chance of minimizing the Wasserstein loss as it will converge to either 1 or 0 instead of $\theta ^ { * }$ .
357
+
358
+ Now observe that for $m \geq 2$ , and any $\textstyle \theta > { \frac { m - 1 } { m } }$ ,
359
+
360
+ $$
361
+ \operatorname* { P r } \{ \hat { \theta } < \theta \} = \operatorname* { P r } \{ \exists i \ { \mathrm { s . t . } } \ X _ { i } = 0 \} = 1 - ( \theta ^ { * } ) ^ { m } ,
362
+ $$
363
+
364
+ and therefore
365
+
366
+ $$
367
+ \mathbb { E } \hat { g } = 1 - 2 ( \theta ^ { * } ) ^ { m } .
368
+ $$
369
+
370
+ Taking $\textstyle \theta ^ { * } = { \frac { m - 1 } { m } }$ , we find that
371
+
372
+ $$
373
+ g - \mathbb { E } \hat { g } = 1 - [ 1 - 2 ( \theta ^ { * } ) ^ { m } ] = 2 \left( 1 - \frac { 1 } { m } \right) ^ { m } \ge 2 e ^ { - 2 } .
374
+ $$
375
+
376
+ Thus for any $m$ , there exists $P = B ( \theta ^ { * } )$ and $Q _ { \theta } = B ( \theta )$ with $\textstyle \theta ^ { * } = { \frac { m - 1 } { m } } < \theta < 1$ such that the bias $\boldsymbol { g } - \mathbb { E } \hat { \boldsymbol { g } }$ is lower-bounded by a numerical constant. Thus the minimax bias does not vanish with the number of samples $m$ .
377
+
378
+ Notice that a similar argument holds for $\theta ^ { * }$ and $\theta$ being close to 0. In both situations where $\theta ^ { * }$ is close to 0 or 1, the bias is non vanishing when $| \theta ^ { * } - \theta |$ is of order $\textstyle { \frac { 1 } { m } }$ . However this is even worse when $\theta ^ { * }$ is away from the boundaries. For example chosing $\theta ^ { * } = \textstyle { \frac { 1 } { 2 } }$ , we can prove that the bias is non vanishing even when $| \theta ^ { * } - \theta |$ is (only) of order $\frac { 1 } { \sqrt { m } }$ .
379
+
380
+ Indeed, using the anti-concentration result of Veraar (2010) (Proposition 2), we have that for a sequence $Y _ { 1 } , \dots , Y _ { m }$ of Rademacher random variables (i.e. $+ / - 1$ with equal probability),
381
+
382
+ $$
383
+ \operatorname* { P r } \left( { \frac { 1 } { n } } \sum _ { i = 1 } ^ { m } Y _ { i } \geq \epsilon \right) \geq ( 1 - m \epsilon ^ { 2 } ) ^ { 2 } / 3 .
384
+ $$
385
+
386
+ This means that for samples $X _ { 1 } , \ldots , X _ { m }$ drawn from a Bernoulli $\begin{array} { r } { B ( \theta ^ { * } = \frac { 1 } { 2 } ) } \end{array}$ (i.e., $Y _ { i } = 2 X _ { i } - 1$ are Rademacher), we have
387
+
388
+ $$
389
+ \operatorname* { P r } \left( \hat { \theta } \geq \theta ^ { * } + \epsilon / 2 \right) \geq ( 1 - m \epsilon ^ { 2 } ) ^ { 2 } / 3 ,
390
+ $$
391
+
392
+ ![](images/a67267df7cc310db4629c2ccc9bd29f80be80a577a57c7c0486e836a94a6d02e.jpg)
393
+ Figure 5: Wasserstein loss (black curve) $\theta \mapsto | \theta ^ { * } - \theta |$ versus expected sample Wasserstein loss (red curve) $\theta \mapsto \mathbb { E } [ | \hat { \theta } - \theta | ]$ , for different values of $m$ and $\theta ^ { * }$ and $p = 1$ . Left: $m = 1$ , $\theta ^ { * } = 0 . 6$ . A stochastic gradient using a one-sample Wasserstein gradient estimate will converge to 1 instead of $\theta ^ { * }$ . Middle: $m = 6$ , $\theta ^ { * } = 0 . 6$ . The minimum of the expected sample Wasserstein loss is the median of $\hat { \theta }$ which is here $\tilde { \theta } = { \textstyle \frac { 2 } { 3 } } \ne \theta ^ { * } = 0 . 6$ . Right: $m = 5$ , $p = 0 . 9$ . The minimum of the expected sample Wasserstein is $\tilde { \theta } = 1$ and not $\theta ^ { * } = 0 . 9$ .
394
+
395
+ thus for $1 / 2 = \theta ^ { \ast } < \theta < \theta ^ { \ast } + 1 / \sqrt { 8 m }$ we have the following lower bound on the bias:
396
+
397
+ $$
398
+ g - \mathbb { E } \hat { g } = 2 \operatorname* { P r } \left( \hat { \theta } \geq \theta \right) \geq 1 / 6 .
399
+ $$
400
+
401
+ Thus the bias is lower-bounded by a constant (independent of $m$ ) when $\theta ^ { * } = \textstyle { \frac { 1 } { 2 } }$ and $\left| \theta ^ { * } - \theta \right| =$ $O ( 1 / \sqrt { m } )$ .
402
+
403
+ Wrong minimum: From (5), we deduce that a stochastic gradient descent algorithm based on the sample Wasserstein gradient will converge to a $\tilde { \theta }$ such that $\begin{array} { r } { \mathrm { \tilde { P r } } \{ \hat { \theta } < \tilde { \theta } \} = \frac { 1 } { 2 } } \end{array}$ , i.e., $\tilde { \theta }$ is the median of the distribution over $\hat { \theta }$ , whereas $\theta ^ { * }$ is the mean of that distribution. Since $\hat { \theta }$ follows a (normalized) binomial distribution with parameters $m$ and $\theta ^ { * }$ , we know that the median $\tilde { \theta }$ and the mean $\theta ^ { * }$ do not necessarily coincide, and can actually be as far as $\frac { 1 } { 2 m }$ -away from each other. For example for any odd $m$ and any $\theta ^ { * } \in \left( { \frac { 1 } { 2 } } , { \frac { 1 } { 2 } } - { \frac { 1 } { 2 m } } \right)$ the median is $\theta ^ { * } - \frac { 1 } { 2 m }$ .
404
+
405
+ It follows that the minimum of the expected sample Wasserstein loss (the fixed point of the stochastic gradient descent using the sample Wasserstein gradient) is different from the minimum of the true Wasserstein loss:
406
+
407
+ $$
408
+ \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } [ w _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) ] \neq \underset { \theta } { \arg \operatorname* { m i n } } [ w _ { p } ^ { p } ( P , Q _ { \theta } ) ] .
409
+ $$
410
+
411
+ This is illustrated in Figure 5.
412
+
413
+ Notice that the fact that the minima of these losses differ is worrisome as it means that minimizing the sample Wasserstein loss using (finite) samples will not converge to the correct solution.
414
+
415
+ Deterministic solutions: Consider the specific case where $( 1 / 2 ) ^ { 1 / n } < \theta ^ { * } < 1$ (illustrated in the right plot of Figure 5). Then the expected sample gradient $\nabla \mathbb { E } [ w _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta ^ { * } } ) ] = \mathbb { E } \hat { g } = 1 - 2 ( \theta ^ { * } ) ^ { n } <$ 0 for any $\theta$ , so a gradient descent algorithm will converge to 1 instead of $\theta ^ { * }$ . Notice that a symmetric argument applies for $\theta ^ { * }$ close to 0.
416
+
417
+ In this simple example, minimizing the sample Wasserstein loss may lead to degenerate solutions (i.e., deterministic) when our target distributions have low (but not zero) entropy. □
418
+
419
+ # A.3 CONSISTENCY OF THE SAMPLE 1-WASSERSTEIN GRADIENT
420
+
421
+ We provide an additional result here showing that the sample 1-Wasserstein gradient converges to the true gradient as $m \infty$ .
422
+
423
+ Theorem 3. Let $P$ and $Q _ { \theta }$ be probability distributions, with $Q _ { \theta }$ parametrized by $\theta$ . Assume that the set $\{ x \in X$ , such that $F _ { P } ( x ) = F _ { Q _ { \theta } } ( x ) \big \}$ has measure zero, and that for any $x \in X$ , the map $\tilde { \theta } \mapsto F _ { Q _ { \tilde { \theta } } } ( x )$ is differentiable in a neighborhood $\mathcal { V } ( \boldsymbol { \theta } )$ of $\theta$ with a uniformly bounded derivative
424
+
425
+ (for $\tilde { \theta } \in \mathcal { V } ( \theta )$ and $x \in X ,$ ). Let $\begin{array} { r } { \hat { P } _ { m } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \delta _ { X _ { i } } } \end{array}$ be the empirical distribution derived from m independent samples $X _ { 1 } , \ldots , X _ { m }$ drawn from $P$ . Then
426
+
427
+ We note that the measure requirement is strictly to keep the proof simple, and does not subtract from the generality of the result.
428
+
429
+ Proof. Let $\nabla : = \nabla _ { \theta }$ . Since $p = 1$ the Wasserstein distance $w _ { 1 } ( P , Q )$ measures the area between the curves defined by the distribution function of $P$ and $Q$ , thus $\begin{array} { r } { w _ { 1 } ( P , Q ) = l _ { 1 } ( P , Q ) = \int \left| F _ { P } ( x ) - \frac { } { } \right. } \end{array}$ $F _ { Q } ( x ) { \left| { d x } \right. }$ and
430
+
431
+ $$
432
+ \begin{array} { l l l } { \nabla w _ { 1 } ( P , Q _ { \theta } ) } & { = } & { \displaystyle \operatorname* { l i m } _ { \Delta \to 0 } \frac { w _ { 1 } ( P , Q _ { \theta + \Delta } ) - w _ { 1 } ( P , Q _ { \theta } ) } { \Delta } } \\ & { = } & { \displaystyle \operatorname* { l i m } _ { \Delta \to 0 } \int \frac { 1 } { \Delta } \Big ( \big | F _ { P } ( x ) - F _ { Q _ { \theta + \Delta } } ( x ) \big | - \big | F _ { P } ( x ) - F _ { Q _ { \theta } } ( x ) \big | \Big ) d x . } \end{array}
433
+ $$
434
+
435
+ Now since we have assumed that for any $x \in X$ , the map $\theta \mapsto F _ { Q _ { \theta } } ( x )$ is differentiable in a neighborhood $\mathcal { V } ( \boldsymbol { \theta } )$ of $\theta$ and its derivative is uniformly (over $\mathcal { V } ( \boldsymbol { \theta } )$ and $x$ ) bounded by $M$ , we have
436
+
437
+ $$
438
+ \frac { 1 } { \Delta } \Big | \big | F _ { P } ( x ) - F _ { Q _ { \theta + \Delta } } ( x ) \big | - \big | F _ { P } ( x ) - F _ { Q _ { \theta } } ( x ) \big | \Big | \quad \le \quad \frac { 1 } { \Delta } \big | F _ { Q _ { \theta + \Delta } } ( x ) - F _ { Q _ { \theta } } ( x ) \big | \le M .
439
+ $$
440
+
441
+ Thus the dominated convergence theorem applies and
442
+
443
+ $$
444
+ \begin{array} { r c l } { \nabla w _ { 1 } ( P , Q _ { \theta } ) } & { = } & { \displaystyle \int \operatorname* { l i m } _ { \Delta \to 0 } \frac { 1 } { \Delta } \Big ( \big | F _ { P } ( x ) - F _ { Q _ { \theta + \Delta } } ( x ) \big | - \big | F _ { P } ( x ) - F _ { Q _ { \theta } } ( x ) \big | \Big ) d x } \\ & { = } & { \displaystyle \int \nabla \big | F _ { P } ( x ) - F _ { Q _ { \theta } } ( x ) \big | d x } \\ & { = } & { \displaystyle \int \mathrm { s g n } \big ( F _ { P } ( x ) - F _ { Q _ { \theta } } ( x ) \big ) \nabla F _ { Q _ { \theta } } ( x ) d x , } \end{array}
445
+ $$
446
+
447
+ since we have assumed that the set of $x \in X$ such that $F _ { P } ( x ) = F _ { Q _ { \theta } } ( x )$ has measure zero.
448
+
449
+ Now, using the same argument for $w _ { 1 } \big ( \hat { P } _ { m } , Q _ { \theta } \big )$ we deduce that
450
+
451
+ $$
452
+ \begin{array} { r l r } { \nabla w _ { 1 } ( \hat { P } _ { m } , Q _ { \theta } ) } & { = } & { \displaystyle \int \underbrace { \operatorname* { l i m } _ { \Delta \to 0 } \frac { 1 } { \Delta } \Big ( \big | F _ { \hat { P } _ { m } } ( x ) - F _ { Q _ { \theta + \Delta } } ( x ) \big | - \big | F _ { \hat { P } _ { m } } ( x ) - F _ { Q _ { \theta } } ( x ) \big | \Big ) } _ { A ( x ) } d x . } \end{array}
453
+ $$
454
+
455
+ Let us decompose this integral over $X$ as the sum of two integrals, one over $X \setminus \Omega _ { m }$ and the other one over $\Omega _ { m }$ , where $\Omega _ { m } = \big \{ x \in X , F _ { \hat { P } _ { m } } ( x ) = F _ { Q _ { \theta } } ( x ) \big \}$ . We have
456
+
457
+ $$
458
+ \int _ { X \setminus \Omega _ { m } } A ( x ) d x = \int _ { X \setminus \Omega _ { m } } \operatorname { s g n } \bigl ( F _ { \hat { P } _ { m } } ( x ) - F _ { Q _ { \theta } } ( x ) \bigr ) \nabla F _ { Q _ { \theta } } ( x ) d x ,
459
+ $$
460
+
461
+ and
462
+
463
+ $$
464
+ \begin{array} { r c l } { \Big | \displaystyle \int _ { \Omega _ { m } } A ( x ) d x \Big | } & { \le } & { \displaystyle \int _ { \Omega _ { m } } \operatorname* { l i m } _ { \Delta \to 0 } \frac { 1 } { \Delta } \Big ( \big | F _ { Q _ { \theta + \Delta } } ( x ) - F _ { Q _ { \theta } } ( x ) \big | \Big ) d x } \\ & { \le } & { M | \Omega _ { m } | . } \end{array}
465
+ $$
466
+
467
+ Now from the strong law of large numbers, we have that for any $x$ , the empirical cumulative distribution function $F _ { \hat { P } _ { m } } ( x )$ converges to the cumulative distribution $F _ { P } ( x )$ almost surely. We deduce that $\Omega _ { m }$ converges to the set $\left\{ x , F _ { P } ( x ) = F _ { Q _ { \theta } } ( x ) \right\}$ which has measure zero, thus $| \Omega _ { m } | \to 0$ and
468
+
469
+ $$
470
+ \begin{array} { r l r } { \displaystyle \operatorname* { l i m } _ { m \to \infty } \nabla w _ { 1 } ( \hat { P } _ { m } , Q _ { \theta } ) } & { = } & { \displaystyle \operatorname* { l i m } _ { m \to \infty } \int _ { X } \mathrm { s g n } \big ( { \cal F } _ { \hat { P } _ { m } } ( x ) - { \cal F } _ { Q _ { \theta } } ( x ) \big ) \nabla { \cal F } _ { Q _ { \theta } } ( x ) d x . } \end{array}
471
+ $$
472
+
473
+ Now, since $| \nabla F _ { Q _ { \theta } } ( x ) | \leq M$ , we can use once more the dominated convergence theorem to deduce that
474
+
475
+ $$
476
+ \begin{array} { l } { \displaystyle \operatorname* { l i m } _ { m \infty } \nabla w _ { 1 } ( \hat { P } _ { m } , Q _ { \theta } ) = \int _ { X } \displaystyle \operatorname* { l i m } _ { m \infty } \mathrm { s g n } \big ( F _ { \hat { P } _ { m } } ( x ) - F _ { Q _ { \theta } } ( x ) \big ) \nabla F _ { Q _ { \theta } } ( x ) d x } \\ { \displaystyle = \int _ { X } \mathrm { s g n } \big ( F _ { P } ( x ) - F _ { Q _ { \theta } } ( x ) \big ) \nabla F _ { Q _ { \theta } } ( x ) d x } \\ { \displaystyle = \nabla w _ { 1 } ( P , Q _ { \theta } ) . } \end{array}
477
+ $$
478
+
479
+ The following lemma will be useful in proving that the Cramér distance has property (U).
480
+
481
+ Lemma 1. Let $\mathbf { X } _ { m } : = X _ { 1 } , \ldots , X _ { m }$ be independent samples from $P$ , and let $\begin{array} { r } { \hat { P } _ { m } : = \frac { 1 } { m } \sum _ { i } \delta _ { X _ { i } } } \end{array}$ . Then
482
+
483
+ $$
484
+ \begin{array} { r } { \underset { \mathbf { X } _ { m } \sim P } { \mathbb { E } } F _ { \hat { P } _ { m } } ( x ) = F _ { P } ( x ) . } \end{array}
485
+ $$
486
+
487
+ Proof. Because the $X _ { i }$ ’s are independent,
488
+
489
+ $$
490
+ F _ { \hat { P } _ { m } } ( x ) = \int _ { - \infty } ^ { x } \hat { P } _ { m } ( \mathrm { d } x ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathbb { I } \left[ X _ { i } \le x \right] .
491
+ $$
492
+
493
+ Now, taking the expectation w.r.t. ${ \bf { X } } _ { m }$ ,
494
+
495
+ $$
496
+ \begin{array} { l } { \displaystyle \underset { { \bf X } _ { m } \sim P } { \mathbb { E } } F _ { \hat { P } _ { m } } ( x ) = \underset { { \bf X } _ { m } \sim P } { \mathbb { E } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } { \mathbb { I } } \left[ X _ { i } \leq x \right] } \\ { \displaystyle = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } X _ { i \sim P } ^ { { \mathbb { E } } } \mathbb { I } \left[ X _ { i } \leq x \right] } \\ { \displaystyle = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathrm { P r } \{ X _ { i } \leq x \} } \\ { \displaystyle = F _ { P } ( x ) , } \end{array}
497
+ $$
498
+
499
+ since the $X _ { i }$ are identically distributed according to $P$ .
500
+
501
+ Proof (Theorem 2). Like the Wasserstein metrics, the $l _ { p }$ metrics have dual forms as integral probability metrics (see Dedecker & Merlevède, 2007, for a proof):
502
+
503
+ $$
504
+ l _ { p } ( P , Q ) = \operatorname* { s u p } _ { f \in \mathbb { F } _ { q } } \big | \operatorname* { \mathbb { E } } _ { x \sim P } f ( x ) - \operatorname* { \mathbb { E } } _ { x \sim Q } f ( x ) \big | ,
505
+ $$
506
+
507
+ where $\mathbb { F } _ { q } : = \{ f : f$ is absolutely continuous, $\begin{array} { r } { \left\| \frac { \mathrm { d } f } { \mathrm { d } x } \right\| _ { q } \leq 1 \} } \end{array}$ and $q$ is the conjugate exponent of $p$ , i.e.
508
+ $p ^ { - 1 } + q ^ { - 1 } = 1$ .3 We will use this dual form below.
509
+
510
+ We will prove that $l _ { p }$ has properties (I) and (S) for $p \in [ 1 , \infty )$ ; the case $p = \infty$ follows by a similar argument. Begin by observing that
511
+
512
+ $$
513
+ \begin{array} { c } { { F _ { c X } ( x ) = P r \{ c X \leq x \} } } \\ { { = P r \left\{ X \leq \displaystyle \frac { x } { c } \right\} } } \\ { { = F _ { X } \left( \displaystyle \frac { x } { c } \right) . } } \end{array}
514
+ $$
515
+
516
+ Then we may rewrite $l _ { p } ^ { p } ( c X , c Y )$ as
517
+
518
+ $$
519
+ l _ { p } ^ { p } ( c X , c Y ) = \int _ { - \infty } ^ { \infty } { \left| F _ { X } \left( \frac { x } { c } \right) - F _ { Y } \left( \frac { x } { c } \right) \right| ^ { p } } \mathrm { d } x
520
+ $$
521
+
522
+ 3This relationship is the reason for the notation $\mathbb { F } _ { \infty }$ in the definition the dual of the 1-Wasserstein (2).
523
+
524
+ where $( a )$ uses a change of variables $z = x / c$ . Taking both sides to the power $1 / p$ proves that the $l _ { p }$ metric possesses property (S) of order $1 / p$ . For (I), we use the IPM formulation (6):
525
+
526
+ $$
527
+ \begin{array} { r l } & { l _ { p } \big ( A + X , A + Y \big ) = \underset { f \in \mathcal { F } _ { q } } { \operatorname* { s u p } } \bigg | _ { A + X } f ( x ) - \underset { A + Y } { \mathbb { E } } f ( y ) \bigg | } \\ & { \stackrel { ( a ) } { = } \underset { f \in \mathcal { F } _ { q } } { \operatorname* { s u p } } \bigg | \mathbb { E } _ { A } \mathbb { E } _ { X } f ( x + a ) - \mathbb { E } _ { A } \mathbb { E } _ { Y } f ( y + a ) \bigg | } \\ & { \stackrel { ( b ) } { = } \underset { f \in \mathcal { F } _ { q } } { \operatorname* { s u p } } \bigg | \mathbb { E } _ { A } \big [ \mathbb { E } _ { X } f ( x + a ) - \mathbb { E } _ { Y } f ( y + a ) \big ] \bigg | } \\ & { \stackrel { ( b ) } { \leq } \mathbb { E } _ { A } \underset { f \in \mathcal { F } _ { q } } { \operatorname* { s u p } } \bigg | \mathbb { E } _ { X } f ( x + a ) - \mathbb { E } _ { Y } f ( y + a ) \bigg | , } \end{array}
528
+ $$
529
+
530
+ where $( a )$ is by independence of $A$ and $X , Y$ , and $( b )$ is by Jensen’s inequality. Next, recall that $\mathcal { F } _ { q }$ is the set of absolutely continuous functions whose derivative has bounded $L _ { q }$ norm. Hence if $f \in \mathcal { F } _ { q }$ , then also for all $a$ the translate $g _ { a } ( x ) : = f ( x + a )$ is also in $\mathcal { F } _ { q }$ . Therefore,
531
+
532
+ $$
533
+ \begin{array} { r l } & { l _ { p } ( A + X , A + Y ) \leq \mathbb { E } _ { A } \underset { f \in \mathcal { F } _ { q } } { \mathrm { \mathbb { E } } } \bigg | \mathbb { E } _ { X } f ( x + a ) - \mathbb { E } _ { Y } f ( y + a ) \bigg | } \\ & { \qquad = \mathbb { E } _ { A } \underset { g \in \mathcal { F } _ { q } } { \mathrm { \mathbb { E } } } \bigg | \mathbb { E } _ { X } g ( x ) - \mathbb { E } _ { Y } g ( y ) \bigg | } \\ & { \qquad = \underset { g \in \mathcal { F } _ { q } } { \mathrm { \operatorname* { s u p } } } \bigg | \mathbb { E } _ { X } g ( x ) - \mathbb { E } _ { Y } g ( y ) \bigg | } \\ & { \qquad = l _ { p } ( X , Y ) . } \end{array}
534
+ $$
535
+
536
+ Now, to prove (U). Here we make use of the introductory requirement that “all expectations under consideration are finite.” Specifically, we require that the mean under $P$ $\mathbb { \lambda } , \mathbb { E } _ { x \sim P } [ x ]$ , is well-defined and finite, and similarly for $Q _ { \theta }$ . In this case,
537
+
538
+ $$
539
+ \underset { x \sim P } { \mathbb { E } } [ x ] = \int _ { 0 } ^ { \infty } ( 1 - F _ { P } ( x ) ) \mathrm { d } x - \int _ { - \infty } ^ { 0 } F _ { P } ( x ) \mathrm { d } x .
540
+ $$
541
+
542
+ This mild requirement guarantees that the tails of the distribution function $F _ { P }$ are light enough to avoid infinite Cramér distances and expected gradients (a similar condition was set by Dedecker & Merlevède (2007)). Now, by definition,
543
+
544
+ $$
545
+ \begin{array} { r l } { \nabla \theta _ { i } ^ { 2 } ( P , Q _ { \theta } ) = \nabla \theta \displaystyle \int _ { - \infty } ^ { \infty } \left( F _ { Q _ { \theta } } ( x ) - F _ { P } ( x ) \right) ^ { 2 } \mathrm { d } z } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & { \underset { 0 \leq i } { \iint } \int _ { - \infty } ^ { \infty } \nabla \theta \left( F _ { Q _ { \theta } } ( x ) - F _ { P } ( x ) \right) ^ { 2 } \mathrm { d } z } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & { \underset { 0 \leq i } { \iint } ( F _ { Q _ { \theta } } ( x ) - F _ { P } ( x ) ) \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & { \underset { 0 \leq i } { \iint } \int _ { - \infty } ^ { \infty } 2 \left( F _ { Q _ { \theta } } ( x ) - \mathbb { E } _ { \mathbf { x } _ { m } } F _ { \hat { \mu } _ { \infty } } ( x ) \right) \nabla _ { \theta } F _ { P } ( y _ { \infty } ( x ) \mathrm { d } x ) } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & { \underset { 0 \leq i } { \iint } \int _ { - \infty } ^ { \infty } \left( F _ { Q _ { \theta } } ( x ) - F _ { \hat { \mu } _ { \infty } } ( x ) \right) \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & { \underset { 0 \leq i } { \iint } \sum _ { \mathbf { R } \setminus \mathbf { x } _ { m } } \left( F _ { Q _ { \theta } } ( x ) - F _ { \hat { \mu } _ { \infty } } ( x ) \right) \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & { \underset { 0 \leq i } { \iint } \sum _ { \mathbf { R } \setminus \mathbf { x } _ { m } } \int _ { - \infty } ^ { \infty } \left( F _ { Q _ { \theta } } ( x ) - F _ { \hat { \mu } _ { \infty } } ( x ) \right) \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x } \\ { \boldsymbol { \stackrel { \cdot } { = } } } & \underset { 0 \leq i } { \iint } \int _ { \mathbf { R } \setminus \mathbf { x } _ { m } } f \end{array}
546
+ $$
547
+
548
+ where (a) follows from the hypothesis (7) (the convergence of the squares follows from the convergence of the ordinary values), (b) follows from Lemma 1 and (c) follows from Fubini’s theorem, again invoking (7).
549
+
550
+ Finally, we prove that of all the $l _ { p } ^ { p }$ distances $1 \le p \le \infty$ ) only the Cramér distance, $l _ { 2 } ^ { 2 }$ , has the (U) property.
551
+
552
+ Without loss of generality, let us suppose $P$ is not a Dirac, and further suppose that for any $\mathbf { X } _ { m } \sim { \cal P }$ , $F _ { Q _ { \theta } } ( x ) \geq F _ { \hat { P } _ { m } } \bar { ( x ) }$ everywhere. For example, when $Q _ { \theta }$ has bounded support we can take $P$ to be a sufficiently translated version of $Q _ { \theta }$ , such that the two distributions’ supports do not overlap.
553
+
554
+ We have already established that the 1-Wasserstein does not have the (U) property, and is equivalent to $l _ { p } ^ { p }$ for $p = 1$ . We will thus assume that $p > 1$ , and also that $p < \infty$ , the latter being recovered through standard limit arguments. Begin with the gradient for $l _ { p } ^ { p } ( P , Q _ { \theta } )$ ,
555
+
556
+ $$
557
+ \begin{array} { r l } { { \nabla _ { \theta } l _ { p } ^ { p } ( P , Q _ { \theta } ) = \nabla _ { \theta } \int _ { - \infty } ^ { \infty } | F _ { Q _ { \theta } } ( x ) - F _ { P } ( x ) | ^ { p } \mathrm { d } x } } \\ & { \stackrel { ( a ) } { = } p \int _ { - \infty } ^ { \infty } \big ( F _ { Q _ { \theta } } ( x ) - F _ { P } ( x ) \big ) ^ { p - 1 } \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x } \\ & { = p \int _ { - \infty } ^ { \infty } \phi _ { p } ( F _ { Q _ { \theta } } ( x ) - F _ { P } ( x ) ) \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x } \\ & { = p \int _ { - \infty } ^ { \infty } \phi _ { p } \Big ( \mathbb { E } _ { \mathbf { X } _ { m } } ( F _ { Q _ { \theta } } ( x ) - F _ { \hat { P } _ { m } } ( x ) ) \Big ) \nabla _ { \theta } F _ { Q _ { \theta } } ( x ) \mathrm { d } x , } \end{array}
558
+ $$
559
+
560
+ for $\phi _ { p } ( z ) = z ^ { p - 1 }$ ; in (a) we used the same argument as in Theorem 3.
561
+
562
+ Now, $\phi _ { p }$ is convex on $[ 0 , \infty )$ when $p \geq 2$ and concave on the same interval when $1 < p < 2$ . From Jensen’s inequality we know that for a convex (concave) function $\phi$ and a random variable $Z$ , $\mathbb { E } \phi ( Z )$ is greater than (less than) or equal to $\phi ( \mathbb { E } Z )$ , with equality if and only if $\phi$ is linear or $Z$ is deterministic. By our first assumption we have ruled out the latter. By our second assumption $F _ { Q _ { \theta } } ( x ) \geq F _ { \hat { P } _ { m } } ( x )$ , we can apply Jensen’s inequality at every $x$ to deduce that
563
+
564
+ $$
565
+ \begin{array} { r l } & { \mathbb { E } _ { \mathbf { X } _ { m } } \left[ \nabla _ { \theta } l _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) \right] < \nabla _ { \theta } l _ { p } ^ { p } ( P , Q _ { \theta } ) , \quad \mathrm { i f ~ } 1 < p < 2 , } \\ & { \mathbb { E } _ { \mathbf { X } _ { m } } \left[ \nabla _ { \theta } l _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) \right] > \nabla _ { \theta } l _ { p } ^ { p } ( P , Q _ { \theta } ) , \quad \mathrm { i f ~ } p > 2 , } \\ & { \mathbb { E } _ { \mathbf { X } _ { m } } \left[ \nabla _ { \theta } l _ { p } ^ { p } ( \hat { P } _ { m } , Q _ { \theta } ) \right] = \nabla _ { \theta } l _ { p } ^ { p } ( P , Q _ { \theta } ) , \quad \mathrm { i f ~ } p = 2 . } \end{array}
566
+ $$
567
+
568
+ We conclude that of the $l _ { p } ^ { p }$ distances, only the Cramér distance has unbiased sample gradients.
569
+
570
+ Proposition 3. The energy distance $\mathcal { E } ( P , Q )$ has properties (I), (S), and $( U )$ .
571
+
572
+ Proof. As before, write $\mathcal { E } ( X , Y ) : = \mathcal { E } ( P , Q )$ . Recall that
573
+
574
+ $$
575
+ \mathcal { E } ( X , Y ) = 2 \mathbb { E } \left\| X - Y \right\| _ { 2 } - \mathbb { E } \left\| X - X ^ { \prime } \right\| _ { 2 } - \mathbb { E } \left\| Y - Y ^ { \prime } \right\| _ { 2 } .
576
+ $$
577
+
578
+ Consider a random variable $A$ independent of $X$ and $Y$ . First, we want to prove property (I):
579
+
580
+ $$
581
+ { \mathcal { E } } ( A + X , A + Y ) \leq { \mathcal { E } } ( X , Y ) .
582
+ $$
583
+
584
+ We will use Proposition 2 from Székely & Rizzo (2013) to express the energy distance in terms of characteristic functions $\phi _ { X } , \phi _ { Y }$ of $d$ -dimensional random variables $X$ and $Y$ :
585
+
586
+ $$
587
+ { \mathcal { E } } ( X , Y ) = { \frac { 1 } { c _ { d } } } \int _ { R ^ { d } } { \frac { | \phi _ { X } ( t ) - \phi _ { Y } ( t ) | ^ { 2 } } { | t | ^ { d + 1 } } } d t
588
+ $$
589
+
590
+ where
591
+
592
+ $$
593
+ c _ { d } = \frac { \pi ^ { ( d + 1 ) / 2 } } { \Gamma ( \frac { d + 1 } { 2 } ) } .
594
+ $$
595
+
596
+ The proof then uses properties of characteristic functions $( | \phi _ { A } ( t ) | \leq 1$ and $\phi _ { A + X } ( t ) = \phi _ { A } ( t ) \phi _ { X } ( t )$ for independent variables $A$ and $X$ ) to show:
597
+
598
+ $$
599
+ \begin{array} { l } { \displaystyle \mathcal { E } ( A + X , A + Y ) = \frac { 1 } { c _ { d } } \int _ { R ^ { d } } \frac { | \phi _ { A + X } ( t ) - \phi _ { A + Y } ( t ) | ^ { 2 } } { | t | ^ { d + 1 } } d t } \\ { \displaystyle \qquad = \frac { 1 } { c _ { d } } \int _ { R ^ { d } } \frac { | \phi _ { A } ( t ) \phi _ { X } ( t ) - \phi _ { A } ( t ) \phi _ { Y } ( t ) | ^ { 2 } } { | t | ^ { d + 1 } } d t } \\ { \displaystyle \qquad = \frac { 1 } { c _ { d } } \int _ { R ^ { d } } \frac { | \phi _ { X } ( t ) - \phi _ { Y } ( t ) | ^ { 2 } } { | t | ^ { d + 1 } } | \phi _ { A } ( t ) | ^ { 2 } d t } \\ { \displaystyle \qquad \leq \frac { 1 } { c _ { d } } \int _ { R ^ { d } } \frac { | \phi _ { X } ( t ) - \phi _ { Y } ( t ) | ^ { 2 } } { | t | ^ { d + 1 } } d t } \\ { \displaystyle \qquad = \mathcal { E } ( X , Y ) . } \end{array}
600
+ $$
601
+
602
+ This proves (I). Next, consider a real value $c > 0$ . We have
603
+
604
+ $$
605
+ \begin{array} { r l } & { \mathcal { E } ( c X , c Y ) = 2 \mathbb { E } \left\| c X - c Y \right\| _ { 2 } - \mathbb { E } \left\| c X - c X ^ { \prime } \right\| _ { 2 } - \mathbb { E } \left\| c Y - c Y ^ { \prime } \right\| _ { 2 } } \\ & { \qquad = 2 c \mathbb { E } \left\| X - Y \right\| _ { 2 } - c \mathbb { E } \left\| X - X ^ { \prime } \right\| _ { 2 } - c \mathbb { E } \left\| Y - Y ^ { \prime } \right\| _ { 2 } } \\ & { \qquad = c \mathcal { E } ( X , Y ) . } \end{array}
606
+ $$
607
+
608
+ This proves (S). Finally, suppose that $Y$ is distributed according to $Q _ { \theta }$ parametrized by $\theta$ . Let $\mathbf { X } _ { m } = X _ { 1 } , \ldots , X _ { m }$ be drawn from $P$ , and let $\begin{array} { r } { \hat { P } _ { m } : = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \delta _ { X _ { i } } } \end{array}$ . Let $\hat { X }$ be the random variable distributed according to $\hat { P } _ { m }$ , and ${ \hat { X } } ^ { \prime }$ an independent copy of $\hat { X }$ . Then
609
+
610
+ $$
611
+ \mathcal { E } ( \hat { P } _ { m } , Q _ { \theta } ) = \mathcal { E } ( \hat { X } , Y ) = 2 \mathbb { E } \left\| \hat { X } - Y \right\| _ { 2 } - \mathbb { E } \left\| \hat { X } - \hat { X } ^ { \prime } \right\| _ { 2 } - \mathbb { E } \left\| Y - Y ^ { \prime } \right\| _ { 2 } .
612
+ $$
613
+
614
+ The gradient of the true loss w.r.t. $\theta$ is
615
+
616
+ $$
617
+ \nabla _ { \theta } \mathcal { E } ( X , Y ) = 2 \nabla _ { \theta } \mathbb { E } \left\| X - Y \right\| _ { 2 } - \nabla _ { \theta } \mathbb { E } \left\| Y - Y ^ { \prime } \right\| _ { 2 } .
618
+ $$
619
+
620
+ Now, taking the gradient of the sample loss w.r.t. $\theta$ ,
621
+
622
+ $$
623
+ \nabla _ { \theta } \mathcal { E } ( \hat { X } , Y ) = 2 \nabla _ { \theta } \mathbb { E } \left. \hat { X } - Y \right. _ { 2 } - \nabla _ { \theta } \mathbb { E } \left. Y - Y ^ { \prime } \right. _ { 2 } .
624
+ $$
625
+
626
+ Since the second terms of the gradients match, all we need to show is that the first terms are equal, in expectation. Assuming that $\nabla _ { \theta }$ and the expectation over $\mathbf { X } _ { m }$ commute, we write
627
+
628
+ $$
629
+ \begin{array} { r l } & { \underset { { \mathbf { X } } _ { m } } { \mathbb { E } } \nabla _ { \theta } \mathbb { E } \| \hat { X } - Y \| _ { 2 } = \nabla _ { \theta } \underset { { \mathbf { X } } _ { m } } { \mathbb { E } } \mathbb { E } \| \hat { X } - Y \| _ { 2 } } \\ & { \qquad = \nabla _ { \theta } \underset { { \mathbf { X } } _ { m } } { \mathbb { E } } \underset { { \mathbf { X } } \sim \hat { P } _ { m } } { \mathbb { E } } \| x - Y \| _ { 2 } , } \end{array}
630
+ $$
631
+
632
+ by independence of $X$ and $Y$ . But now we know that the expected empirical distribution is $P$ , that is
633
+
634
+ $$
635
+ \begin{array} { r } { \underset { \mathbf { X } _ { m } } { \mathbb { E } } \underset { x \sim \hat { P } _ { m } } { \mathbb { E } } \left\| x - Y \right\| _ { 2 } = \underset { x \sim P } { \mathbb { E } } \left\| x - Y \right\| _ { 2 } = \mathbb { E } \left\| X - Y \right\| _ { 2 } . } \end{array}
636
+ $$
637
+
638
+ It follows that the first terms of (8) and (9) are also equal, in expectation w.r.t. $\mathbf { X } _ { m }$ . Hence we conclude that the energy distance has property (U), that is
639
+
640
+ $$
641
+ \underset { { \substack { \mathbf { X } _ { m } \sim P } } } { \mathbb { E } } \nabla _ { \theta } \mathcal { E } ( \hat { P } _ { m } , Q _ { \theta } ) = \nabla _ { \theta } \mathcal { E } ( P , Q _ { \theta } ) .
642
+ $$
643
+
644
+ # B COMPARISON WITH THE WASSERSTEIN DISTANCE
645
+
646
+ Figure 2 (left) provides learning curves for the toy experiment described in Section 4.2.
647
+
648
+ ![](images/bb9eb8fc8453f3de2d2d611d050cc847c8987ed509f0f247ded575cc13ebd29f.jpg)
649
+ Figure 6: Wasserstein while training to minimize different loss functions (Wasserstein, KL, Cramér). Averaged over 10 random initializations. Error-bands indicate one standard deviation. Note the different y-axes.
650
+
651
+ ![](images/91a73c66b75972f227e6f2e628ecc59ee0f795684aee37530bca503bdaa84b93.jpg)
652
+ Figure 7: Ordinal regression on the year prediction MSD dataset. Each loss function trained with various minibatch sizes. Training progress shown in terms of: Left. RMSE, Middle. Wasserstein distance, Right. Negative log-likelihood.
653
+
654
+ # B.1 ORDINAL REGRESSION
655
+
656
+ We compare the different losses on an ordinal regression task using the Year Prediction MSD dataset from (Lichman, 2013). The task is to predict the year of a song (taking on values from 1922 to 2011), from 90-dimensional feature representation of the song.4 Previous work has used this dataset for benchmarking regression performance (Hernández-Lobato & Adams, 2015), treating the target as a continuous value. Following Hernández-Lobato & Adams (2015), we train a network with a single hidden layer with 100 units and ReLU non-linearity, using SGD with 40 passes through the training data, using the standard train-test split for this dataset (Lichman, 2013). Unlike (Hernández-Lobato & Adams, 2015), the network outputs a probability distribution over the years (90 possible years from 1922-2011).
657
+
658
+ We train models using either the 1-Wasserstein loss, the Cramér loss, or the KL loss, the latter of which reduces the ordinal regression problem to a classification problem. In all cases, we compare performance for three different minibatch sizes, i.e. the number of input-target pairs per gradient step. Note that the minibatch size only affects the gradient estimation, but has otherwise no direct relation to the number of samples $m$ previously discussed, since each sample corresponds to a different input vector. We report results as a function of number of passes over the training data so that our results are comparable with previous work, but note that smaller batch sizes get more updates.
659
+
660
+ The results are shown in Figure 2. Training using the Cramér loss results in the lowest root mean squared error (RMSE) and the final RMSE value of 8.89 is comparable to regression (HernándezLobato & Adams, 2015) which directly optimizes for MSE. We further observe that minimizing the Wasserstein loss trains relatively slowly and leads to significantly higher KL loss. Interestingly, larger minibatch sizes do seem to improve the performance of the Wasserstein-based method somewhat, suggesting that there might be some beneficial bias reduction from combining similar inputs. By contrast, using with the Cramér loss trains significantly faster and is more robust to choice of minibatch size.
661
+
662
+ <table><tr><td rowspan="2">min.</td><td colspan="2">test loss</td></tr><tr><td>KL</td><td>Cramér</td></tr><tr><td>KL</td><td>3.76</td><td>3.55 7.10</td></tr><tr><td>Cramér</td><td>10.09</td><td>3.51 7.02</td></tr><tr><td>Wass.</td><td>4016</td><td>15.99 16.00</td></tr></table>
663
+
664
+ ![](images/5418d8115a2662cc33345edc6af738760ba53b0d179ca1a638d12e6851e9e2fd.jpg)
665
+ Figure 8: Left, middle. Sample Wasserstein and cross-entropy loss curves on the CelebA validation data set. Right. Test loss at the end of training, in function of loss minimized (see text for details).
666
+
667
+ ![](images/f95c66b913dfcb486e5ed5c3c1801ab18656a1dc91825b2e2a99cf8ba29c14dc.jpg)
668
+ Figure 9: Generated right halves for WGAN-GP (left) and Cramér GAN (right) for left halves from the validation set of Downsampled ImageNet 64x64 (Van den Oord et al., 2016). The low diversity in WGAN-GP samples is consistent with the observations of Isola et al. (2016): “the generator simply learned to ignore the noise.”
669
+
670
+ # B.2 IMAGE MODELLING WITH PIXELCNN
671
+
672
+ As additional supporting material, we provide here the results of experiments on learning a probabilistic generative model on images using either the 1-Wasserstein, Cramér, or KL loss. We trained a PixelCNN model (Van den Oord et al., 2016) on the CelebA 32x32 dataset (Liu et al., 2015), which is constituted of 202,599 images of celebrity faces. At a high level, probabilistic image modelling involves defining a joint probability $Q _ { \theta }$ over the space of images. PixelCNN forms this joint probability autoregressively, by predicting each pixel using a histogram distribution conditional on a probability-respecting subset of its neighbours. This kind of modelling task is a perfect setting to study Wasserstein-type losses, as there is a natural ordering on pixel intensities. This is also a setting in which full distributions are almost never available, because each prediction is conditioned on very different context; and hence we require a loss that can be optimized from single samples. Here the true losses are not available. Instead we report the sample Wasserstein loss, which is an upper bounds on the true loss Bellemare et al. (proof is provided by 2017). For the KL divergence we report the cross-entropy loss, as is typically done; the KL divergence itself corresponds to the expected cross-entropy loss minus the real distribution’s (unknown) entropy.
673
+
674
+ Figure 8 shows, as in the toy example, that minimizing the Wasserstein distance by means of stochastic gradient fails. The Cramér distance, on the other hand, is as easily minimized as the KL and in fact achieves lower Wasserstein and Cramér loss. We note that the resulting KL loss is higher than when directly minimizing the KL, reflecting the very real trade-off of using one loss over another. We conclude that in the context of learning an autoregressive image model, the Cramér should be preferred to the Wasserstein metric.
675
+
676
+ # C CRAMÉR GAN
677
+
678
+ # C.1 LOSS FUNCTION DETAILS
679
+
680
+ Our critic has a special form:
681
+
682
+ $$
683
+ f ( \boldsymbol { x } ) = \underset { \boldsymbol { Y } ^ { \prime } \sim \boldsymbol { Q } } { \mathbb { E } } \| h ( \boldsymbol { x } ) - h ( \boldsymbol { Y } ^ { \prime } ) \| _ { 2 } - \underset { \boldsymbol { X } ^ { \prime } \sim \boldsymbol { P } } { \mathbb { E } } \| h ( \boldsymbol { x } ) - h ( \boldsymbol { X } ^ { \prime } ) \| _ { 2 }
684
+ $$
685
+
686
+ where $Q$ is the generator and $P$ is the target distribution. The critic has trainable parameters only inside the deep network used for the transformation $h$ . From (4), we define the generator loss to be
687
+
688
+ $$
689
+ L _ { g } ( X , Y ) = \biguplus _ { X \sim P } [ f ( X ) ] - \biguplus _ { Y \sim Q } [ f ( Y ) ] ,
690
+ $$
691
+
692
+ as in Wasserstein GAN, except that no $\operatorname { m a x } _ { f }$ operator is present and we can obtain unbiased sample gradients. At the same time, to provide helpful gradients for the generator, we train the transformation $h$ to maximize the generator loss. Concretely, the critic seeks to maximize the generator loss while minimizing a gradient penalty:
693
+
694
+ $$
695
+ L _ { c r i t i c } ( X , Y ) = - L _ { g } ( X , Y ) + \lambda \mathrm { G P }
696
+ $$
697
+
698
+ where GP is the gradient penalty from the original WGAN-GP algorithm (Gulrajani et al., 2017) (the penalty is given in Algorithm 1). The gradient penalty bounds the critic’s outputs without using a saturating function. We chose $\lambda = 1 0$ from a short parameter sweep. Our training is otherwise similar to the improved training of Wasserstein GAN (Gulrajani et al., 2017).
699
+
700
+ In the next two sections, we describe how to practically compute gradients of these losses with respect to the generator and transformation parameters, respectively.
701
+
702
+ # C.2 GRADIENT ESTIMATES FOR THE GENERATOR
703
+
704
+ Recall that the energy distance is:
705
+
706
+ $$
707
+ \mathcal { E } ( X , Y ) = 2 \underset { { X \sim Q } } { \mathbb { E } } \left\| X - Y \right\| _ { 2 } - \underset { { X ^ { \prime } \sim P } } { \mathbb { E } } \left\| X - X ^ { \prime } \right\| _ { 2 } - \underset { { Y ^ { \prime } \sim Q } } { \mathbb { E } } \left\| Y - Y ^ { \prime } \right\| _ { 2 }
708
+ $$
709
+
710
+ If $Y$ is generated from the standard normal noise $Z \sim N ( 0 , 1 )$ by a differentiable generator $Y =$ $G ( Z )$ and the generator has an integrable gradient, we can use the reparametrization trick (Kingma & Welling, 2014) to compute the gradient with respect to the generator parameters:
711
+
712
+ $$
713
+ \nabla _ { \theta _ { G } } \mathcal { E } ( X , Y ) = 2 \operatorname* { l i m } _ { Z \stackrel { X \sim P } { \sim } ( 0 , 1 ) } \nabla _ { \theta _ { G } } \| X - G ( Z ) \| _ { 2 } - \operatorname* { \mathbb { E } } _ { Z \sim N ( 0 , 1 ) } \nabla _ { \theta _ { G } } \| G ( Z ) - G ( Z ) ^ { \prime } \| _ { 2 } .
714
+ $$
715
+
716
+ We see that we only need one real sample $X$ to estimate the gradient, because the $\| X - X ^ { \prime } \|$ term does not depend on the generator parameters. This allows us to define a generator loss usable for situations with only one real sample (e.g., for conditional modeling):
717
+
718
+ $$
719
+ \hat { L } _ { g } ( X , Y ) = 2 \operatorname* { l i R } _ { { X \sim P } \atop { Y \sim Q } } \| h ( X ) - h ( Y ) \| _ { 2 } - \operatorname* { \mathbb { E } } _ { { Y \sim Q } \atop { Y ^ { \prime } \sim Q } } \| h ( Y ) - h ( Y ^ { \prime } ) \| _ { 2 }
720
+ $$
721
+
722
+ # C.3 GRADIENT ESTIMATES FOR THE TRANSFORMATION
723
+
724
+ As shown in the previous section, we can obtain an unbiased gradient estimate of the generator loss (12) from three samples: two from the generator, and one from the target distribution. However, to estimate the gradient of the Cramér GAN loss with respect to the transformation parameters we need four independent samples: two from the generator and two from the target distribution. In many circumstances, for example when learning conditional densities, we do not have access to two independent target samples. We will instead define a surrogate objective for the critic. The surrogate critic will have the following form:
725
+
726
+ $$
727
+ f _ { s } ( x ) = \underset { Y ^ { \prime } \sim Q } { \mathbb { E } } \| h ( x ) - h ( Y ^ { \prime } ) \| _ { 2 } - \| h ( x ) \| _ { 2 }
728
+ $$
729
+
730
+ ![](images/a67bd1fc4bb9d984a919699e1dd3b04d2a3d17dd8bb6ed3d873608ec6d82ca64.jpg)
731
+ Figure 10: Left. Generated images from a generator trained to minimize the energy distance of raw images, ${ \mathcal { E } } ( X , Y )$ . Right. Generated images if minimizing the Cramér GAN loss, $\mathcal { E } ( h ( X ) , h ( Y ) )$ . Both generators had the same DCGAN architecture (Radford et al., 2015).
732
+
733
+ which we use to define a surrogate loss $L _ { s } ( X , Y )$ similar to (10):
734
+
735
+ $$
736
+ \begin{array} { r l } & { L _ { s } ( X , Y ) = \underset { X \sim P } { \mathbb { E } } [ f _ { s } ( X ) ] - \underset { Y \sim Q } { \mathbb { E } } [ f _ { s } ( Y ) ] } \\ & { \quad \quad = \underset { X \sim P } { \mathbb { E } } \left\| h ( X ) - h ( Y ^ { \prime } ) \right\| _ { 2 } - \underset { X \sim P } { \mathbb { E } } \left\| h ( X ) \right\| _ { 2 } } \\ & { \quad \quad \quad - \underset { Y \sim Q } { \mathbb { E } } \left\| h ( Y ) - h ( Y ^ { \prime } ) \right\| _ { 2 } + \underset { Y \sim Q } { \mathbb { E } } \left\| h ( Y ) \right\| _ { 2 } } \end{array}
737
+ $$
738
+
739
+ The surrogate loss emulates an integral probability metric (IPM) (Müller, 1997) and can be used to train the critic. The maximization of this loss will force $\mathbb { E } \| h ( X ) - h ( Y ^ { \prime } ) \| _ { 2 }$ and $\mathbb { E } \| h ( Y ) - h ( Y ^ { \prime } ) \| _ { 2 }$ to be informative about the underlying distributions.
740
+
741
+ The generator can be then trained to minimize the energy distance $\hat { L } _ { g }$ (12) of the transformed variables. It is also possible to obtain training more similar to Wasserstein GAN by training the generator to minimize the surrogate loss (13). We recommend trying both possibilities, because they were both stable and produced diverse conditional samples. The whole training procedure is summarized as Algorithm 1.
742
+
743
+ Finally, when estimating the losses in Algorithm 1, we use two independent samples $x _ { g } , x _ { g } ^ { \prime }$ from the generator. However, in constructing the surrogate loss $\tilde { L } _ { s }$ , an asymmetry arises. We reduce variance by averaging the two losses $ { \tilde { L } } _ { s } ( x _ { g } , x _ { g } ^ { \prime } )$ and $\tilde { L _ { s } } ( x _ { g } ^ { \prime } , x _ { g } )$ .
744
+
745
+ # C.4 GENERATOR ARCHITECTURE
746
+
747
+ The generator architecture is the U-Net (Ronneberger et al., 2015) previously used for Image-toImage translation (Isola et al., 2016). We used no batch normalization and no dropout in the generator and in the critic. The network conditioned on the left half of the image and on extra 12 channels with Gaussian noise. We generated two independent samples for a given image to compute the Cramér GAN loss. To be computationally fair to WGAN-GP, we trained WGAN-GP with twice the minibatch size (i.e., the Cramér GAN minibatch size was 64, while the WGAN-GP minibatch size was 128).
748
+
749
+ # C.5 CRITIC ARCHITECTURE
750
+
751
+ Our $h ( x )$ transformation is a deep network with 256 outputs (more is better). The network has the traditional deep convolutional architecture (Radford et al., 2015). We do not use batch normalization, as it would conflict with the gradient penalty.
752
+
753
+ # C.6 PERFORMANCE EVALUATION
754
+
755
+ We report the Inception score (Salimans et al., 2016) and the Fréchet Inception Distance (FID) (Heusel et al., 2017) in Figure 11 (left), which are commonly used measures of evaluation for GANs.
756
+
757
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=3>Inception</td><td rowspan=1 colspan=1>FID</td></tr><tr><td rowspan=1 colspan=1>Training set</td><td rowspan=1 colspan=3>11.2</td><td rowspan=2 colspan=1>0.036.4</td></tr><tr><td rowspan=1 colspan=1>WGAN-GP</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>6.5</td></tr><tr><td rowspan=2 colspan=1>Cramér GAN</td><td rowspan=1 colspan=2></td><td rowspan=2 colspan=1>6.7</td><td rowspan=2 colspan=1>33.6</td></tr><tr><td rowspan=2 colspan=1>Surrogate GAN</td><td rowspan=2 colspan=3>6.6</td></tr><tr><td rowspan=1 colspan=1>34.1</td></tr></table>
758
+
759
+ ![](images/39a9c09f6450c7168ab8aca6fbaa5fe96e760592159229ac1567d918e9fd52d0.jpg)
760
+ Figure 11: Left. Inception score and FID on CIFAR-10. The Surrogate GAN is a Cramér GAN with the generator trained to minimize the surrogate loss (13). Right. Inception Energy Distance on conditional CIFAR-10. The network conditioned on the left half of the CIFAR-10 images. The shaded area denotes the standard deviation from 3 runs.
761
+
762
+ These evaluation measures have the disadvantage that they are not able to detecting overfitting and account for diversity in generated conditional samples. For example, a mixture model that overfits to the training set would get a better Inception score and FID than the trained GANs.
763
+
764
+ We propose a new evaluation for conditional GANs that uses data from the validation set and that is able to detect overfitting. Our Inception Energy Distance (IED) measures a difference, similar to the genererator loss (12), between features of completed image and features of the corresponding real image. An unbiased estimator of the IED is:
765
+
766
+ $$
767
+ \mathrm { I E D } = \left. i n ( x _ { r } ) - i n ( x _ { g } ) \right. _ { 2 } + \left. i n ( x _ { r } ) - i n ( x _ { g } ^ { \prime } ) \right. _ { 2 } - \left. i n ( x _ { g } ) - i n ( x _ { g } ^ { \prime } ) \right. _ { 2 }
768
+ $$
769
+
770
+ where $x _ { r }$ is a real sample and $x _ { g } , x _ { g } ^ { \prime }$ are two independent generated samples. $i n ( x )$ are the features for image $x$ , and is the is the output of the pretrained Inception network5 (Szegedy et al., 2016), specifically the output layer $\mathtt { p o o l } \_ 3 : 0$ with 2048 features. The pretrained Inception network allows to objectively compare different GANs. Our performance measure is similar to the FID, but can be computed with one real sample and monitored online.
771
+
772
+ We use the Inception Energy Distance only to detect underfitting and overfitting. Figure 11 (right) shows that WGAN-GP is not minimizing IED on the training set. WGAN-GP produces very deterministic completions and this is detected by the $\lVert i n ( x _ { g } ) - \bar { i } n ( x _ { g } ^ { \prime } ) \rVert _ { 2 }$ term in the IED. We also see that the Cramér GAN is overfitting the training set. The Cramér GAN is progressively learning the distribution of the training set and obtains a worse IED on the validation set. This suggests that our optimization is able to successfully train the generator, and that with more data and regularization methods, we will be able to overcome this overfitting. For example, future work can train on large video datasets and try to minimize the IED directly.
md/train/SJlJSaEFwS/SJlJSaEFwS.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ROBUST CROSS-LINGUAL EMBEDDINGS FROM PARALLEL SENTENCES
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Recent advances in cross-lingual word embeddings have primarily relied on mapping-based methods, which project pre-trained word embeddings from different languages into a shared space through a linear transformation. However, these approaches assume word embedding spaces are isomorphic between different languages, which has been shown not to hold in practice (Søgaard et al., 2018), and fundamentally limits their performance. This motivates investigating joint learning methods which can overcome this impediment, by simultaneously learning embeddings across languages via a cross-lingual term in the training objective. Given the abundance of parallel data available (Tiedemann, 2012), we propose a bilingual extension of the CBOW method which leverages sentencealigned corpora to obtain robust cross-lingual word and sentence representations. Our approach significantly improves cross-lingual sentence retrieval performance over all other approaches, as well as convincingly outscores mapping methods while maintaining parity with jointly trained methods on word-translation. It also achieves parity with a deep RNN method on a zero-shot cross-lingual document classification task, requiring far fewer computational resources for training and inference. As an additional advantage, our bilingual method also improves the quality of monolingual word vectors despite training on much smaller datasets. We make our code and models publicly available.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Cross-lingual representations—such as embeddings of words and phrases into a single comparable feature space—have become a key technique in multilingual natural language processing. They offer strong promise towards the goal of a joint understanding of concepts across languages, as well as for enabling the transfer of knowledge and machine learning models between different languages. Therefore, cross-lingual embeddings can serve a variety of downstream tasks such as bilingual lexicon induction, cross-lingual information retrieval, machine translation and many applications of zero-shot transfer learning, which is particularly impactful from resource-rich to low-resource languages.
12
+
13
+ Existing methods can be broadly classified into two groups (Ruder et al., 2017): mapping methods leverage existing monolingual embeddings which are treated as independent, and apply a postprocess step to map the embeddings of each language into a shared space, through a linear transformation (Mikolov et al., 2013b; Conneau et al., 2017; Joulin et al., 2018). On the other hand, joint methods learn representations concurrently for multiple languages, by combining monolingual and cross-lingual training tasks (Luong et al., 2015; Coulmance et al., 2015; Gouws et al., 2015; Vulic & Moens, 2015; Chandar et al., 2014; Hermann & Blunsom, 2013).
14
+
15
+ While recent work on word embeddings has focused almost exclusively on mapping methods, which require little to no cross-lingual supervision, (Søgaard et al., 2018) establish that their performance is hindered by linguistic and domain divergences in general, and for distant language pairs in particular. Principally, their analysis shows that cross-lingual hubness, where a few words (hubs) in the source language are nearest cross-lingual neighbours of many words in the target language, and structural non-isometry between embeddings do impose a fundamental barrier to the performance of linear mapping methods.
16
+
17
+ (Ormazabal et al., 2019) propose using joint learning as a means of mitigating these issues. Given parallel data, such as sentences, a joint model learns to predict either the word or context in both source and target languages. As we will demonstrate with results from our algorithm, joint methods yield compatible embeddings which are closer to isomorphic, less sensitive to hubness, and perform better on cross-lingual benchmarks.
18
+
19
+ Contributions. We propose the BI-SENT2VEC algorithm, which extends the SENT2VEC algorithm (Pagliardini et al., 2018; Gupta et al., 2019) to the cross-lingual setting. We also revisit TRANSGRAM Coulmance et al. (2015), another joint learning method, to assess the effectiveness of joint learning over mapping-based methods. Our contributions are
20
+
21
+ • On cross-lingual sentence-retrieval and monolingual word representation quality evaluations, BI-SENT2VEC significantly outperforms competing methods, both jointly trained as well as mapping-based ones while preserving state-of-the-art performance on cross-lingual word retrieval tasks. For dis-similar language pairs, BI-SENT2VEC outperform their competitors by an even larger margin on all the tasks hinting towards the robustness of our method. BI-SENT2VEC performs on par with a multilingual RNN based sentence encoder, LASER (Artetxe & Schwenk, 2018), on MLDoc (Schwenk & Li, 2018), a zero-shot crosslingual transfer task on documents in multiple languages. Compared to LASER, our method improves computational efficiency by an order of magnitude for both training and inference, making it suitable for resource or latency-constrained on-device cross-lingual NLP applications.
22
+ We verify that joint learning methods consistently dominate state-of-the-art mapping methods on standard benchmarks, i.e., cross-lingual word and sentence retrieval.
23
+ • Training on parallel data additionally enriches monolingual representation quality, evident by the superior performance of BI-SENT2VEC over FASTTEXT embeddings trained on a $1 0 0 \times$ larger corpus.
24
+
25
+ We make our models and code publicly available.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ The literature on cross-lingual representation learning is extensive. Most recent advances in the field pursue unsupervised (Artetxe et al., 2017; Conneau et al., 2017; Chen & Cardie, 2018; Hoshen & Wolf, 2018; Grave et al., 2018b) or supervised (Joulin et al., 2018; Conneau et al., 2017) mapping or alignment-based algorithms. All these methods use existing monolingual word embeddings, followed by a cross-lingual alignment procedure as a post-processing step— that is to learn a simple (typically linear) mapping from the source language embedding space to the target language embedding space.
30
+
31
+ Supervised learning of a linear map from a source embedding space to another target embedding space (Mikolov et al., 2013b) based on a bilingual dictionary was one of the first approaches towards cross-lingual word embeddings. Additionally enforcing orthogonality constraints on the linear map results in rotations, and can be formulated as an orthogonal Procrustes problem (Smith et al., 2017). However, the authors found the translated embeddings to suffer from hubness, which they mitigate by introducing the inverted softmax as a corrective search metric at inference time. (Artetxe et al., 2017) align embedding spaces starting from a parallel seed lexicon such as digits and iteratively build a larger bilingual dictionary during training.
32
+
33
+ In their seminal work, (Conneau et al., 2017) propose an adversarial training method to learn a linear orthogonal map, avoiding bilingual supervision altogether. They further refine the learnt mapping by applying the Procrustes procedure iteratively with a synthetic dictionary generated through adversarial training. They also introduce the ‘Cross-Domain Similarity Local Scaling’ (CSLS) retrieval criterion for translating between spaces, which further improves on the word translation accuracy over nearest-neighbour and inverted softmax metrics. They refer to their work as Multilingual Unsupervised and Supervised Embeddings (MUSE). In this paper, we will use MUSE to denote the unsupervised embeddings introduced by them, and “Procrustes $^ +$ refine” to denote the supervised embeddings obtained by them. (Chen & Cardie, 2018) similarly use “multilingual adversarial training” followed by “pseudo-supervised refinement” to obtain unsupervised multilingual word embeddings (UMWE), as opposed to bilingual word embeddings by (Conneau et al., 2017). Hoshen & Wolf (2018) describe an unsupervised approach where they align the second moment of the two word embedding distributions followed by a further refinement. Building on the success of CSLS in reducing retrieval sensitivity to hubness, (Joulin et al., 2018) directly optimize a convex relaxation of the CSLS function (RCSLS) to align existing mono-lingual embeddings using a bilingual dictionary.
34
+
35
+ While none of the methods described above require parallel corpora, all assume structural isomorphism between existing embeddings for each language (Mikolov et al., 2013b), i.e. there exists a simple (typically linear) mapping function which aligns all existing embeddings. However, this is not always a realistic assumption (Søgaard et al., 2018)—even in small toy-examples it is clear that many geometric configurations of points can not be linearly mapped to their targets.
36
+
37
+ Joint learning algorithms such as TRANSGRAM (Coulmance et al., 2015) and Cr5 (Josifoski et al., 2019) , circumvent this restriction by simultaneously learning embeddings as well as their alignment. TRANSGRAM, for example, extends the Skipgram (Mikolov et al., 2013a) method to jointly train bilingual embeddings in the same space, on a corpus composed of parallel sentences. In addition to the monolingual Skipgram loss for both languages, they introduce a similar cross-lingual loss where a word from a sentence in one language is trained to predict the word-contents of the sentence in the other. Cr5, on the other hand, uses document-aligned corpora to achieve state-of-the-art results for cross-lingual document retrieval while staying competitive at cross-lingual sentence and word retrieval. TRANSGRAM embeddings have been absent from discussion in most of the recent work. However, the growing abundance of sentence-aligned parallel data (Tiedemann, 2012) merits a reappraisal of their performance.
38
+
39
+ (Ormazabal et al., 2019) use BIVEC (Luong et al., 2015), another bilingual extension of Skipgram, which uses a bilingual dictionary in addition to parallel sentences to obtain word-alignments and compare it with the unsupervised version of VECMAP (Artetxe et al., 2018b), another mappingbased method. Our experiments show this extra level of supervision in the case of BIVEC is redundant in obtaining state-of-the-art performance.
40
+
41
+ # 3 MODEL
42
+
43
+ Proposed Model. Our BI-SENT2VEC model is a cross-lingual extension of SENT2VEC proposed by (Pagliardini et al., 2018), which in turn is an extension of the $C$ -BOW embedding method (Mikolov et al., 2013a). SENT2VEC is trained on sentence contexts, with the word and higher-order word n-gram embeddings specifically optimized toward obtaining robust sentence embeddings using additive composition. Formally, SENT2VEC obtains representation ${ \pmb v } _ { s }$ of a sentence $S$ by averaging the word-ngram embeddings (including unigrams) as $\begin{array} { r } { \mathbf { \dot { \boldsymbol { v } } } _ { s } : = \frac { 1 } { R ( S ) } \sum _ { w \in R ( S ) } \pmb { v } _ { w } } \end{array}$ where $R ( S )$ is the set of word n-grams in the sentence $S$ .
44
+
45
+ The SENT2VEC training objective aims to predict a masked word token $w _ { t }$ in the sentence $S$ using the rest of the sentence representation ${ \pmb v } _ { S \backslash \{ { u v } _ { t } \} }$ . To formulate the training objective, we use logistic loss $\ell : x \mapsto \log { ( 1 + e ^ { - x } ) }$ in conjunction with negative sampling. More precisely, for a raw text corpus $C$ , the monolingual training objective for SENT2VEC is given by
46
+
47
+ $$
48
+ \operatorname* { m i n } _ { U , V } \sum _ { S \in C } \sum _ { w _ { t } \in S } \left( \ell \big ( \boldsymbol { u } _ { w _ { t } } ^ { \top } \boldsymbol { v } _ { S \setminus \{ w _ { t } \} } \big ) + \sum _ { w ^ { \prime } \in N _ { w _ { t } } } \ell \big ( - \boldsymbol { u } _ { w ^ { \prime } } ^ { \top } \boldsymbol { v } _ { S \setminus \{ w _ { t } \} } \big ) \right)
49
+ $$
50
+
51
+ where $w _ { t }$ is the target word and, $V$ and $U$ are the source n-gram and target word embedding matrices respectively. Here, the set of negative words $N _ { w _ { t } }$ is sampled from a multinomial distribution where the probability of picking a word is directly proportional to the square root of its frequency in the corpus. Each target word $w _ { t }$ is sampled with probability $m i n \{ 1 , \sqrt { t / f _ { w _ { t } } } + t / f _ { w _ { t } } \}$ where $f _ { w _ { t } }$ is the frequency of the word in the corpus.
52
+
53
+ We adapt the SENT2VEC model to bilingual corpora by introducing a cross-lingual loss in addition to the monolingual loss in equation (1). Given a sentence pair $S = ( S _ { l _ { 1 } } , S _ { l _ { 2 } } )$ where $S _ { l _ { 1 } }$ and $S _ { l _ { 2 } }$ are translations of each other in languages $l _ { 1 }$ and $l _ { 2 }$ , the cross-lingual loss for a target word $w _ { t }$ in $l _ { 1 }$ is given by
54
+
55
+ $$
56
+ \ell \big ( { \pmb u } _ { w _ { t } } ^ { \top } { \pmb v } _ { S _ { l _ { 2 } } } \big ) + \sum _ { w ^ { \prime } \in N _ { w _ { t } } } \ell \big ( - { \pmb u } _ { w _ { t } ^ { \prime } } ^ { \top } { \pmb v } _ { S _ { l _ { 2 } } } \big )
57
+ $$
58
+
59
+ Thus, we use the sentence $S _ { l _ { 1 } }$ to predict the constituent words of $S _ { l _ { 2 } }$ and vice-versa in a similar fashion to the monolingual SENT2VEC, shown in Figure 1. This ensures that the word and $\mathbf { n }$ -gram embeddings of both languages lie in the same space.
60
+
61
+ ![](images/447f2c4e9599c41e36d0eb4b008a68d7f6bba88815213ca6273055255c6f9dd4.jpg)
62
+ Figure 1: An illustration of the BI-SENT2VEC training process. A word from a sentence pair is chosen as a target and the algorithm learns to predict it using the rest of the sentence(monolingual training component) and the translation of the sentence(cross-lingual component).
63
+
64
+ Assuming $C$ to be a sentence aligned bilingual corpus and combining equations (1) and (2), our BI-SENT2VEC model objective function is formulated as
65
+
66
+ $$
67
+ \operatorname* { m i n } _ { U , V } \sum _ { \underbrace { l , l ^ { \prime } \in [ l _ { 1 } , l _ { 2 } ] } _ { l \neq l ^ { \prime } } } \sum _ { w _ { t } \in S _ { l } \atop l \neq l ^ { \prime } } \left( \underbrace { \ell ( u _ { w _ { t } } ^ { \top } v _ { S _ { l } \backslash \{ w _ { t } \} } ) + \sum _ { w ^ { \prime } \in N _ { w _ { t } } } \ell ( - u _ { w _ { t } ^ { \prime } } v _ { S _ { l } \backslash \{ w _ { t } \} } ) } _ { \mathrm { m o n o i n g u a l ~ l o s s } } + \underbrace { \ell ( u _ { w _ { t } } ^ { \top } v _ { S _ { l ^ { \prime } } } ) + \sum _ { w ^ { \prime } \in N _ { w _ { t } } } \ell ( - u _ { w _ { t } ^ { \prime } } v _ { S _ { l ^ { \prime } } } ) } _ { \mathrm { c r o s s i n g u a l ~ l o s s } } \right)
68
+ $$
69
+
70
+ Implementation Details. We build our $\mathrm { C } { + } { + }$ implementation on the top of the FASTTEXT library (Bojanowski et al., 2016; Joulin et al., 2016). Model parameters are updated by asynchronous SGD with a linearly decaying learning rate.
71
+
72
+ Our model is trained on the ParaCrawl (Espla-Gomis, 2019) v4.0 datasets for the English-Italian, \` English-German, English-French, English-Spanish, English-Hungarian and English-Finnish language pairs. For the English-Russian language pair, we concatenate the OpenSubtitle corpus1(Lison & Tiedemann, 2016) and the Tanzil project2 (Quran translations) corpus. The number of parallel sentence pairs in the corpora except for those of English-Finnish and English-Hungarian used by us range from 17-32 Million. Number of parallel sentence pairs for the dis-similar language pairs(English-Hungarian and English-Finnish) is approximately 2 million. Evaluation results for these two language pairs can be found in Subsection 4.4. Exact statistics regarding the different corpora can be found in the Table 7 in the Appendix. All the sentences were tokenized using Spacy tokenizers3 for their respective languages.
73
+
74
+ For each dataset, we trained two different models: one with unigram embeddings only, and the other additionally augmented with bigrams. The earlier TRANSGRAM models (Coulmance et al., 2015) were trained on a small amount of data (Europarl Corpus (Koehn, 2005)). To facilitate a fair comparison, we train new TRANSGRAM embeddings on the same data used for BI-SENT2VEC. Given that TRANSGRAM and BI-SENT2VEC are a cross-lingual extension of Skipgram and SENT2VEC respectively, we use the same parameters as (Bojanowski et al., 2016) and (Gupta et al., 2019), except increasing the number of epochs for TRANSGRAM to 8, and decreasing the same for BI-SENT2VEC to 5. Additionally, a preliminary hyperparameter search (except changing the number of epochs) on BI-SENT2VEC and TRANSGRAM did not improve the results. All parameters for training the TRANSGRAM and BI-SENT2VEC models can be found in the Table 6 in the Appendix.
75
+
76
+ In order to make the comparison more extensive, we also train VECMAP (mapping-based) (Artetxe et al., 2018b;a) and BIVEC (joint-training)(Luong et al., 2015) methods on the same corpora using the exact pipeline as (Ormazabal et al., 2019).
77
+
78
+ # 4 EVALUATION
79
+
80
+ To assess the quality of the word and sentence embeddings obtained as well as their cross-lingual alignment quality, we compare our results using the following four benchmarks
81
+
82
+ • Cross-lingual word retrieval • Monolingual word representation quality
83
+
84
+ • Cross-lingual sentence retrieval • Zero-shot cross-lingual transfer of document classifiers
85
+
86
+ where benchmarks are presented in order of increasing linguistic granularity, i.e. word, sentence, and document level. We also analyze the effect of training data by studying the relationship between representation quality and corpus size.
87
+
88
+ We use the code available in the MUSE library4 (Conneau et al., 2017) for all evaluations except the zero-shot classifier transfer, which is tested on the MLDoc task (Schwenk & Li, 2018)5.
89
+
90
+ # 4.1 WORD TRANSLATION
91
+
92
+ The task involves retrieving correct translation(s) of a word in a source language from a target language. To evaluate translation accuracy, we use the bilingual dictionaries constructed by (Conneau et al., 2017). We consider 1500 source-test queries and $2 0 0 \mathrm { k }$ target words for each language pair and report $\mathrm { P @ 1 }$ scores for the supervised and unsupervised baselines as well as our models in Table 1.
93
+
94
+ Table 1: Word translation retrieval $\mathbf { P } @ \mathbf { 1 }$ for various language pairs of MUSE evaluation dictionary (Conneau et al., 2017). NN: nearest neighbours. CSLS: Cross-Domain Similarity Local Scaling. (‘en’ is English, ‘fr’ is French, ‘de’ is German, ‘ru’ is Russian, ‘it’ is Italian) (‘uni.’ and ‘bi.’ denote unigrams and bigrams respectively) denotes translation from the first language to the second and $\gets$ the other way around.)
95
+
96
+ <table><tr><td rowspan="2">Method</td><td colspan="2">en-es</td><td colspan="2">en-fr</td><td colspan="2">en-de</td><td colspan="2">en-ru</td><td colspan="2">en-it</td><td rowspan="2">avg.</td></tr><tr><td>→↑</td><td></td><td></td><td>→↑</td><td>→↑</td><td></td><td>→↑</td><td></td><td>→↑</td><td></td></tr><tr><td>MUSE (Conneau et al.,2017)</td><td>81.7 83.3</td><td></td><td></td><td>82.3 82.1</td><td>74.0 72.2</td><td></td><td>44.0 59.1</td><td></td><td>78.6 77.9</td><td></td><td>73.5</td></tr><tr><td>UMWE(Chen &amp; Cardie,2018)</td><td>82.5 83.1</td><td></td><td></td><td>82.5 82.1</td><td>74.6 72.5</td><td></td><td>49.5 61.7</td><td></td><td>78.3 77.0</td><td></td><td>74.4</td></tr><tr><td>Procrustes + refine (Conneau et al., 2017)</td><td>82.4 83.9</td><td></td><td></td><td>82.3 83.2</td><td>75.3 73.2</td><td></td><td>50.1 63.5</td><td></td><td>77.5 77.6</td><td></td><td>74.9</td></tr><tr><td>RCSLS (Joulin et al., 2018)</td><td>83.7 87.1</td><td></td><td></td><td>84.1 84.7</td><td>79.2 77.5</td><td></td><td>60.9 70.2</td><td></td><td>81.1 82.7</td><td></td><td>79.1</td></tr><tr><td>TRANSGRAM (Coulmance et al., 2015)</td><td>91.6 88.6</td><td></td><td></td><td>89.1 90.1</td><td>87.5 87.2</td><td></td><td>65.6 73.7</td><td></td><td>88.6 89.5</td><td></td><td>85.2</td></tr><tr><td>VECMAP (unsupervised) (Artetxe et al.,2018b)</td><td>87.4 87.8</td><td></td><td></td><td>88.3 88.5</td><td>84.3 87.2</td><td></td><td>48.6 50.5</td><td></td><td>87.4 86.5</td><td></td><td>79.6</td></tr><tr><td>VECMAP (supervised) (Artetxe et al.,2018a)</td><td>87.2 90.2</td><td></td><td></td><td>87.6 90.4</td><td>87.3 86.8</td><td></td><td>49.7 65.6</td><td></td><td>87.2 89.2</td><td></td><td>82.1</td></tr><tr><td>BIVEC NN (Luong et al., 2015)</td><td>87.4 88.6</td><td></td><td></td><td>86.8 89.1</td><td>87.5 87.2</td><td></td><td>64.0 59.1</td><td></td><td>86.8 84.0</td><td></td><td>81.7</td></tr><tr><td>BIVEC CSLS (Luong et al., 2015)</td><td>87.6 89.1</td><td></td><td></td><td>88.8 90.3</td><td>86.4 87.2</td><td></td><td>66.1 70.6</td><td></td><td></td><td>87.6 87.8</td><td>84.3</td></tr><tr><td>BI-SENT2VEC uni. NN</td><td>86.9 91.6</td><td></td><td></td><td>86.9 91.0</td><td>86.0 88.7</td><td></td><td>58.0 72.8</td><td></td><td>88.3 92.4</td><td></td><td>84.3</td></tr><tr><td>BI-SENT2VEC uni. + bi. NN</td><td>89.4 92.9</td><td></td><td></td><td>89.3 92.8</td><td>86.7 89.3</td><td></td><td></td><td>59.0 70.2</td><td>89.5 91.8</td><td></td><td>85.1</td></tr><tr><td>BI-SENT2VEC uni.CSLS</td><td>86.0 91.7</td><td></td><td></td><td>86.4 91.4</td><td>84.6 88.8</td><td></td><td></td><td>60.5 73.0</td><td>88.2 91.8</td><td></td><td>84.2</td></tr><tr><td>BI-SENT2VEC uni. + bi. CSLS</td><td>89.0 92.1</td><td></td><td></td><td>88.9 92.4</td><td>86.5 89.0</td><td></td><td></td><td>61.0 73.5</td><td>89.6 91.4</td><td></td><td>85.3</td></tr></table>
97
+
98
+ # 4.2 MONOLINGUAL WORD REPRESENTATION QUALITY
99
+
100
+ We assess the monolingual quality improvement of our proposed cross-lingual training by evaluating performance on monolingual word similarity tasks. To disentangle the specific contribution of the cross-lingual loss, we train the monolingual counterpart of BI-SENT2VEC, SENT2VEC on the same corpora as our method.
101
+
102
+ Performance on monolingual word-similarity tasks is evaluated using the English SimLex-999 (Hill et al., 2014) and its Italian and German translations, English WS-353 (Finkelstein et al., 2001) and its German, Italian and Spanish translations. For French, we use a translation of the RG-65 (Joubarne & Inkpen, 2011) dataset. Pearson scores are used to measure the correlation between human-annotated word similarities and predicted cosine similarities. We also include FASTTEXT monolingual vectors trained on CommonCrawl data (Grave et al., 2018a) which is comprised of 600 billion, 68 billion, 66 billion, 72 billion and 36 billion words of English, French, German, Spanish and Italian respectively and is at least $1 0 0 \times$ larger than the corpora on which we trained BI-SENT2VEC. We report Pearson correlation scores on different word-similarity datasets for En-It pair in Table 2. Evaluation results on other language pairs are similar and can be found in the appendix in Tables 8, 9, and 10.
103
+
104
+ Table 2: Monolingual word similarity task performance of our methods when trained on en-it ParaCrawl data. We report Pearson correlation scores.
105
+
106
+ <table><tr><td rowspan="2">Method\Dataset</td><td>SimLex-999</td><td></td><td>WS-353</td></tr><tr><td>en it</td><td></td><td>en it</td></tr><tr><td>MUSE</td><td>0.38</td><td>0.30</td><td>0.74 0.64</td></tr><tr><td>RCSLS</td><td>0.38 0.30</td><td>0.74</td><td>0.64</td></tr><tr><td>FASTTEXT- Common Crawl</td><td>0.49 0.32</td><td>0.75</td><td>0.57</td></tr><tr><td>BIVEC</td><td>0.40 0.36</td><td>0.70</td><td>0.60</td></tr><tr><td>TRANSGRAM</td><td>0.43 0.37</td><td>0.73</td><td>0.63</td></tr><tr><td>SENT2VEC uni.</td><td>0.49 0.38</td><td>0.73</td><td>0.60</td></tr><tr><td>BI-SENT2VEC uni.</td><td>0.57</td><td>0.47 0.79</td><td>0.65</td></tr><tr><td>BI-SENT2VEC uni. + bi.</td><td>0.58</td><td>0.50 0.80</td><td>0.69</td></tr></table>
107
+
108
+ # 4.3 CROSS-LINGUAL SENTENCE RETRIEVAL
109
+
110
+ The primary contribution of our work is to deliver improved cross-lingual sentence representations. We test sentence embeddings for each method obtained by bag-of-words composition for sentence retrieval across different languages on the Europarl corpus. In particular, the tf-idf weighted average is used to construct sentence embeddings from word embeddings. We consider 2000 sentences in the source language dataset and retrieve their translation among 200K sentences in the target language dataset. The other 300K sentences in the Europarl corpus are used to calculate tf-idf weights. Results for $\mathrm { P @ 1 }$ of unsupervised and supervised benchmarks vs our models are included in Table 3.
111
+
112
+ <table><tr><td rowspan="2">Method</td><td colspan="2">en-es</td><td colspan="2">en-fr</td><td colspan="2">en-de</td><td colspan="2">en-it</td><td rowspan="2">avg.</td></tr><tr><td>→</td><td>↑</td><td>→</td><td>↑</td><td>→</td><td>↑</td><td>→</td><td>↑</td></tr><tr><td>MUSE</td><td>72.7</td><td>71.5</td><td>69.2</td><td>68.8</td><td>53.3</td><td>53.4</td><td>66.1</td><td>64.3</td><td>64.9</td></tr><tr><td>RCSLS</td><td>26.9</td><td>26.7</td><td>19.3</td><td>21.2</td><td>8.8</td><td>11.3</td><td>15.1</td><td>17.6</td><td>18.4</td></tr><tr><td>TRANSGRAM</td><td>83.5</td><td>81.4</td><td>80.4</td><td>81.6</td><td>64.8</td><td>69.9</td><td>77.2</td><td>77.9</td><td>77.1</td></tr><tr><td>VECMAP (unsupervised)</td><td>81.7</td><td>82.1</td><td>79.8</td><td>80.4</td><td>62.8</td><td>64.6</td><td>69.0</td><td>71.1</td><td>74.0</td></tr><tr><td>VECMAP (supervised)</td><td>81.3</td><td>81</td><td>80.4</td><td>80.7</td><td>62.6</td><td>64.3</td><td>67.8</td><td>71</td><td>73.6</td></tr><tr><td>BIVEC NN</td><td>69.8</td><td>77.1</td><td>54.7</td><td>75.5</td><td>56.1</td><td>44.1</td><td>58.2</td><td>45.1</td><td>60.1</td></tr><tr><td>BIVEC CSLS</td><td>81.6</td><td>83.4</td><td>78.1</td><td>81.6</td><td>71.6</td><td>68.1</td><td>74.2</td><td>72.4</td><td>76.4</td></tr><tr><td>BI-SENT2VEC uni. NN</td><td>87.8</td><td>86.4</td><td>85.2</td><td>83.4</td><td>82.3</td><td>80.2</td><td>85.9</td><td>85.8</td><td>84.6</td></tr><tr><td>BI-SENT2VEC uni. + bi. NN</td><td>87.9</td><td>87.8</td><td>86.1</td><td>83.9</td><td>79.5</td><td>79.7</td><td>85.1</td><td>85.3</td><td>84.4</td></tr><tr><td>BI-SENT2VEC uni. CSLS</td><td>89.5</td><td>88.5</td><td>87.1</td><td>86.4</td><td>84.4</td><td>83.0</td><td>88.2</td><td>87.5</td><td>86.8</td></tr><tr><td>BI-SENT2VEC uni. + bi. CSLS</td><td>89.7</td><td>89.6</td><td>87.8</td><td>87.4</td><td>84.2</td><td>84.0</td><td>87.9</td><td>87.6</td><td>87.3</td></tr><tr><td>Reduction in error</td><td></td><td>37.5% 37.3%</td><td>37.8% 31.5%</td><td></td><td>44.4% 46.8%</td><td></td><td></td><td>46.9% 43.9%</td><td>1</td></tr></table>
113
+
114
+ Table 3: Cross-lingual Sentence retrieval. We report $\mathrm { P @ 1 }$ scores for 2000 source queries searching over 200 000 target sentences. Reduction in error is calculated with respect to BI-SENT2VEC uni. $^ +$ bi. CSLS and the best non-BI-SENT2VEC method.
115
+
116
+ # 4.4 PERFORMANCE ON DIS-SIMILAR LANGUAGE PAIRS
117
+
118
+ We report a substantial improvement on the performance of previous models on cross-lingual word and sentence retrieval tasks for the dis-similar language pairs(English-Finnish and EnglishHungarian). We use the same evaluation scheme as in Subsections 4.1 and 4.3 Results for these pairs are included in Table 4.
119
+
120
+ # 4.5 ZERO-SHOT CROSS-LINGUAL TRANSFER OF DOCUMENT CLASSIFIERS
121
+
122
+ The MLDoc multilingual document classification task (Schwenk & Li, 2018) consists of news documents given in 8 different languages, which need to be classified into 4 different categories. To demonstrate the ability to transfer trained classifiers in a robust fashion between languages, we use a zero-shot setting, i.e., we train a classifier on embeddings in the source language, and report the accuracy of the same classifier applied to the target language. As the classifier, we use a simple feed-forward neural network with two hidden layers of size 10 and 8 respectively, optimized using the Adam optimizer. Each document is represented using the sum of its sentence embeddings.
123
+
124
+ Table 4: Cross-lingual Word and Sentence retrieval for dis-similar language pairs $( \mathbf { P } @ \mathbf { 1 }$ scores). ‘en’ is English, ‘fi’ is Finnish, ‘hu’ is Hungarian
125
+
126
+ <table><tr><td rowspan="2">Method</td><td colspan="3"> word retrieval</td><td colspan="4"> sentence retrieval</td></tr><tr><td>en-fi →</td><td>↑</td><td>en-hu → ↑</td><td>→</td><td>en-fi ↑</td><td></td><td>en-hu →↑</td></tr><tr><td>MUSE</td><td>48.1</td><td>59.5</td><td>53.9 64.9</td><td>21.7</td><td>29.5</td><td>39.1</td><td>46.7</td></tr><tr><td>RCSLS</td><td>61.8</td><td>69.9</td><td>67.0 73.0</td><td>3.2</td><td>4.8</td><td>3.6</td><td>5.1</td></tr><tr><td>VECMAP (unsupervised)</td><td>62.5</td><td>66.8</td><td>61.6 68.7</td><td>13.2</td><td>14.7</td><td>20.5</td><td>19.3</td></tr><tr><td>VECMAP (supervised)</td><td>62.6</td><td>78.3</td><td>63.7 76.6</td><td>15.0</td><td>16.9</td><td>20.9</td><td>21.7</td></tr><tr><td>BIVEC NN</td><td>62.1</td><td>55.3</td><td>62.1 53.7</td><td>14.2</td><td>9.7</td><td>26.2</td><td>13.7</td></tr><tr><td>BIVEC CSLS</td><td>69.6</td><td>78.0</td><td>72.4 78.4</td><td>33.3</td><td>32.0</td><td>46.7</td><td>41.3</td></tr><tr><td>TRANSGRAM</td><td>69.7</td><td>81.1</td><td>73.1 80.8</td><td>35.4</td><td>40.5</td><td>52.1</td><td>55</td></tr><tr><td>B1-SENT2VEC uni. NN</td><td>71.2</td><td>85.4</td><td>75.6</td><td>83.9</td><td>63.5 64.2</td><td></td><td>75.2 76.2</td></tr><tr><td>BI-SENT2VEC uni. + bi. NN</td><td>68.5</td><td>81.7</td><td>71.4 79.4</td><td></td><td>57.5 55.9</td><td>65.8</td><td>65.2</td></tr><tr><td>B1-SENT2VEC uni. CSLS</td><td></td><td>72.0 86.5</td><td>76.3 85.1</td><td></td><td>70.2 69.0</td><td>81.4</td><td>80.8</td></tr><tr><td>BI-SENT2VEC uni. + bi. CSLS</td><td>70.1</td><td>84.4</td><td>73.7</td><td>81.7</td><td>66 64.1</td><td>73.8</td><td>74.5</td></tr></table>
127
+
128
+ <table><tr><td rowspan="2">Method</td><td colspan="2">en-es</td><td colspan="2">en-fr</td><td colspan="2">en-de</td><td rowspan="2"></td><td rowspan="2">avg.</td></tr><tr><td>→↑</td><td>→</td><td>冏↑</td><td>→↑</td><td>→</td><td>en-it ↑</td></tr><tr><td>LASER</td><td>79.3 69.6</td><td></td><td>78.0 80.1</td><td></td><td>86.3 80.8</td><td>70.2 74.2</td><td></td><td>77.3</td></tr><tr><td>BI-SENT2VEC</td><td>74.0 71.5</td><td></td><td>81.6 82.2</td><td></td><td>86.5 79.2</td><td>75.0 72.6</td><td></td><td>77.8</td></tr></table>
129
+
130
+ Table 5: MLDoc Benchmark results (Schwenk & Li, 2018). A document classifier was trained on one language and tested on another without additional training/fine-tuning. We report $\%$ accuracy.
131
+
132
+ We compare the performance of BI-SENT2VEC with the LASER sentence embeddings (Artetxe & Schwenk, 2018) in Table 5. LASER sentence embedding model is a multi-lingual sentence embedding model which is composed of a biLSTM encoder and an LSTM decoder. It uses a shared byte pair encoding based vocabulary of 50k words. The LASER model which we compare to was trained on 223M sentences for 93 languages and requires 5 days to train on 16 V100 GPUs compared to our model which takes 1-2.5 hours for each language pair on 30 CPU threads.
133
+
134
+ # 4.6 EFFECT OF CORPUS SIZE ON REPRESENTATION QUALITY
135
+
136
+ We conduct an ablation study on how BI-SENT2VEC embeddings’ performance depends on the size of the training corpus. We uniformly sample smaller subsets of the En-Fr ParaCrawl dataset and train a BI-SENT2VEC model on them. We test word/sentence translation performance with the CSLS retrieval criterion, and monolingual embedding quality for En-Fr with increasing ParaCrawl corpus size. The results are illustrated in Figures 2 and 3.
137
+
138
+ # 5 DISCUSSION
139
+
140
+ In the following section, we discuss the results on monolingual and cross-lingual benchmarks, presented in Tables 1 - 5, and a data ablation study for how the model behaves with increasing parallel corpus size in Figure $2 \cdot 3$ . The most impressive outcome of our experiments is improved crosslingual sentence retrieval performance, which we elaborate on along with word translation in the next subsection.
141
+
142
+ ![](images/bb3e3da4961fcc13096a65b06ddba37fd74cb2a40ffb7fe4be5b7a1bd56621c1.jpg)
143
+ Figure 2: Effect of corpus size on cross-lingual word/sentence retrieval performance.
144
+
145
+ ![](images/1145c4987fe2df1428c48252033511b35e1e13156a25dc7e8955255c49fc87e7.jpg)
146
+ Figure 3: Effect of corpus size on monolingual word quality. We use SimLex-999, WS-353, and FR-RG datasets for measuring monolingual word embedding quality.
147
+
148
+ Cross-lingual evaluations For cross-lingual tasks, we observe in Table 1 that jointly trained embeddings produce much better results on cross-lingual word and sentence retrieval tasks. BISENT2VEC’s performance on word-retrieval tasks is uniformly superior to mapping methods, achieving up to $1 1 . 5 \%$ more in $\mathrm { P @ 1 }$ than RCSLS for the English to German language pair, consistent with the results from (Ormazabal et al., 2019). It is also on-par with, or better than competing joint methods except on translation from Russian to English, where TRANSGRAM receives a significantly better score. For word retrieval tasks, there is no discernible difference between CSLS/NN criteria for BI-SENT2VEC, suggesting the relative absence of the hubness phenomenon which significantly hinders the performance of cross-lingual word embedding methods.
149
+
150
+ Our principal contribution is in improving cross-lingual sentence retrieval. Table 3 shows BISENT2VEC decisively outperforms all other methods by a wide margin, reducing the relative $\mathrm { P @ 1 }$ error anywhere from $3 1 . 5 \%$ to $5 5 . 1 \%$ . Our model displays considerably less variance than others in quality across language pairs, with at most a $\approx 5 \%$ deficit between best and worst, and nearly symmetric accuracy within a language pair.
151
+
152
+ TRANSGRAM also outperforms the mapping-based methods, but still falls significantly short of BISENT2VEC’s. These results can be attributed to the fact that BI-SENT2VEC directly optimizes for obtaining robust sentence embeddings using additive composition of its word embeddings. Since BI-SENT2VEC’s learning objective is closest to a sentence retrieval task amongst current state-ofthe-art methods, it can surpass them without sacrificing performance on other tasks.
153
+
154
+ Cross-lingual evaluations on dis-similar language pairs Unlike other language pairs in the evaluation, English-Finnish and English-Hungarian pairs are composed of languages from two different language families(English being an Indo-European language and the other language being a Finno-Ugric language). In Table 4, we see that the performance boost achieved by BI-SENT2VEC on competing methods methods is more pronounced in the case of dis-similar language pairs as compared to paris of languages close to each other. This observation affirms the suitaibility of BISENT2VEC for learning joint representations on languages from different families.
155
+
156
+ Monolingual word quality For the monolingual word similarity tasks, we observe large gains over existing methods. SENT2VEC is trained on the same corpora as us, and FASTTEXT vectors are trained on the CommonCrawl corpora which are more than 100 times larger than ParaCrawl v4.0. In Table 2, we see that BI-SENT2VEC outperforms them by a significant margin on SimLex-999 and WS-353, two important monolingual word quality benchmarks. This observation is in accordance with the fact (Faruqui & Dyer, 2014) that bilingual contexts can be surprisingly effective for learning monolingual word representations. However, amongst the joint-training methods, BI-SENT2VEC also outperforms TRANSGRAM and BIVEC trained on the same corpora by a significant margin, again hinting at the superiority of the sentence level loss function over a fixed context window loss.
157
+
158
+ Effect of n-grams (Gupta et al., 2019) report improved results on monolingual word representation evaluation tasks for SENT2VEC and FASTTEXT word vectors by training them alongside word n-grams. Our method incorporates their results based on the observation that unigram vectors trained alongside with bigrams significantly outperform unigrams alone on the majority of the evaluation tasks. We can see from Tables 1 - 3 that this holds for the bilingual case as well. However, in case of dis-similar language pairs(Table 4), we observe that using n-grams degrades the cross-lingual performance of the embeddings. This observation suggests that use of higher order n-grams may not be helpful for language pairs where the grammatical structures are contrasting.
159
+
160
+ Effect of corpus size Considering the cross-lingual performance curve exhibited by BISENT2VEC in Figure 2, increasing corpus size for the English-French datasets up to 1-3.1M lines appears to saturate the performance of the model on cross-lingual word/sentence retrieval, after which it either plateaus or degrades slightly. This is an encouraging result, indicating that joint methods can use significantly less data to obtain promising performance. This implies that joint methods may not necessarily be constrained to high-resource language pairs as previously assumed, though further experimentation is needed to verify this claim.
161
+
162
+ It should be noted from Figure 3 that the monolingual quality does keep improving with an increase in the size of the corpus. A potential way to overcome this issue of plateauing cross-lingual performance is to give different weights to the monolingual and cross-lingual component of the loss with the weights possibly being dependent on other factors such as training progress.
163
+
164
+ Comparison with a cross-lingual sentence embedding model and performance on document level task On the MLDoc classifier transfer task (Schwenk & Li, 2018) where we evaluate a classifier learned on documents in one language on documents in another, Table 5 shows we achieve parity with the performance of the LASER model for language pairs involving English, where BISENT2VEC’s average accuracy of $7 7 . 8 \%$ is slightly higher than LASER’s $7 7 . 3 \%$ . While the comparison is not completely justified as LASER is multilingual in nature and is trained on a different dataset, one must emphasize that BI-SENT2VEC is a bag-of-words method as compared to LASER which uses a multi-layered biLSTM sentence encoder. Our method only requires to average a set of vectors to encode sentences reducing its computational footprint significantly. This makes BI-SENT2VEC an ideal candidate for on-device computationally efficient cross-lingual NLP, unlike LASER which has a huge computational overhead and specialized hardware requirement for encoding sentences.
165
+
166
+ # 6 CONCLUSION AND FUTURE WORK
167
+
168
+ We introduce a cross-lingual extension of an existing monolingual word and sentence embedding method. The proposed model is tested at three levels of linguistic granularity: words, sentences and documents. The model outperforms all other methods by a wide margin on the cross-lingual sentence retrieval task while maintaining parity with the best-performing methods on word translation tasks. Our method achieves parity with LASER on zero-shot document classification, despite being a much simpler model. We also demonstrate that training on parallel data yields a significant improvement in the monolingual word representation quality.
169
+
170
+ The success of our model on the bilingual level calls for its extension to the multilingual level especially for pairs which have little or no parallel corpora. While the amount of bilingual/multilingual parallel data has grown in abundance, the amount of monolingual data available is practically limitless. Consequently, we would like to explore training cross-lingual embeddings with a large amount of raw text combined with a smaller amount of parallel data.
171
+
172
+ # REFERENCES
173
+
174
+ Mikel Artetxe and Holger Schwenk. Massively multilingual sentence embeddings for zero-shot cross-lingual transfer and beyond. Transactions of the Association for Computational Linguistics, 7:597–610, 2018.
175
+
176
+ Mikel Artetxe, Gorka Labaka, and Eneko Agirre. Learning bilingual word embeddings with (almost) no bilingual data. In ACL, 2017.
177
+
178
+ Mikel Artetxe, Gorka Labaka, and Eneko Agirre. Generalizing and improving bilingual word embedding mappings with a multi-step framework of linear transformations. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, pp. 5012–5019, 2018a.
179
+
180
+ Mikel Artetxe, Gorka Labaka, and Eneko Agirre. A robust self-learning method for fully unsupervised cross-lingual mappings of word embeddings. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 789–798, 2018b.
181
+
182
+ Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5:135–146, 2016.
183
+
184
+ A. P. Sarath Chandar, Stanislas Lauly, Hugo Larochelle, Mitesh M. Khapra, Balaraman Ravindran, Vikas C. Raykar, and Amrita Saha. An autoencoder approach to learning bilingual word representations. In NIPS, 2014.
185
+
186
+ Xilun Chen and Claire Cardie. Unsupervised multilingual word embeddings. In EMNLP, 2018.
187
+
188
+ Alexis Conneau, Guillaume Lample, Marc’Aurelio Ranzato, Ludovic Denoyer, and Herve J ´ egou.´ Word translation without parallel data. ArXiv, abs/1710.04087, 2017.
189
+
190
+ Jocelyn Coulmance, Jean-Marc Marty, Guillaume Wenzek, and Amine Benhalloum. Trans-gram, Fast Cross-lingual Word-embeddings. In EMNLP - Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1109–1113, 2015.
191
+
192
+ M. Espla-Gomis. ParaCrawl: Web-scale parallel corpora for the languages of the EU. 2019. \`
193
+
194
+ Manaal Faruqui and Chris Dyer. Improving vector space word representations using multilingual correlation. In EACL, 2014.
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 WWW, 2001.
197
+
198
+ Stephan Gouws, Yoshua Bengio, and Greg Corrado. Bilbowa: Fast bilingual distributed representations without word alignments. 2015.
199
+
200
+ Edouard Grave, Piotr Bojanowski, Prakhar Gupta, Armand Joulin, and Tomas Mikolov. Learning word vectors for 157 languages. ArXiv, abs/1802.06893, 2018a.
201
+
202
+ Edouard Grave, Armand Joulin, and Quentin Berthet. Unsupervised alignment of embeddings with wasserstein procrustes. In AISTATS, 2018b.
203
+
204
+ Prakhar Gupta, Matteo Pagliardini, and Martin Jaggi. Better word embeddings by disentangling contextual n-gram information. In NAACL-HLT, 2019.
205
+
206
+ Karl Moritz Hermann and Phil Blunsom. Multilingual distributed representations without word alignment. In ICLR 2014, 2013.
207
+
208
+ Felix Hill, Roi Reichart, and Anna Korhonen. Simlex-999: Evaluating semantic models with (genuine) similarity estimation. Computational Linguistics, 41:665–695, 2014.
209
+
210
+ Yedid Hoshen and Lior Wolf. Non-adversarial unsupervised word translation. In EMNLP, 2018.
211
+
212
+ Martin Josifoski, Ivan S Paskov, Hristo S Paskov, Martin Jaggi, and Robert West. Crosslingual document embedding as reduced-rank ridge regression. In Proceedings of the Twelfth ACM International Conference on Web Search and Data Mining, pp. 744–752. ACM, 2019.
213
+
214
+ Colette Joubarne and Diana Inkpen. Comparison of semantic similarity for different languages using the google n-gram corpus and second-order co-occurrence measures. In Canadian Conference on AI, 2011.
215
+
216
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. In EACL, 2016.
217
+
218
+ Armand Joulin, Piotr Bojanowski, Tomas Mikolov, Herve J ´ egou, and Edouard Grave. Loss in trans-´ lation: Learning bilingual word mapping with a retrieval criterion. In EMNLP, 2018.
219
+
220
+ Philipp Koehn. Europarl: A parallel corpus for statistical machine translation. 2005.
221
+
222
+ Pierre Lison and Jorg Tiedemann. Opensubtitles2016: Extracting large parallel corpora from movie ¨ and tv subtitles. In LREC, 2016.
223
+
224
+ Thang Luong, Hieu Pham, and Christopher D Manning. Bilingual word representations with monolingual quality in mind. In Proceedings of the 1st Workshop on Vector Space Modeling for Natural Language Processing, pp. 151–159, 2015.
225
+
226
+ Tomas Mikolov, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. CoRR, abs/1301.3781, 2013a.
227
+
228
+ Tomas Mikolov, Quoc V. Le, and Ilya Sutskever. Exploiting similarities among languages for machine translation. ArXiv, abs/1309.4168, 2013b.
229
+
230
+ Aitor Ormazabal, Mikel Artetxe, Gorka Labaka, Aitor Soroa, and Eneko Agirre. Analyzing the limitations of cross-lingual word embedding mappings. In ACL, 2019.
231
+
232
+ Matteo Pagliardini, Prakhar Gupta, and Martin Jaggi. Unsupervised learning of sentence embeddings using compositional n-gram features. In NAACL-HLT, 2018.
233
+
234
+ Sebastian Ruder, Ivan Vulic, and Anders Søgaard. A survey of cross-lingual word embedding mod-´ els. arXiv preprint arXiv:1706.04902, 2017.
235
+
236
+ Holger Schwenk and Xian Li. A corpus for multilingual document classification in eight languages. arXiv preprint arXiv:1805.09821, 2018.
237
+
238
+ Samuel L. Smith, David H. P. Turban, Steven Hamblin, and Nils Y. Hammerla. Offline bilingual word vectors, orthogonal transformations and the inverted softmax. ArXiv, abs/1702.03859, 2017.
239
+
240
+ Anders Søgaard, Sebastian Ruder, and Ivan Vulic. On the limitations of unsupervised bilingual dictionary induction. In ACL, 2018.
241
+
242
+ Jorg Tiedemann. Parallel data, tools and interfaces in opus. In ¨ Proceedings of the Eighth International Conference on Language Resources and Evaluation (LREC-2012), pp. 2214–2218, 2012.
243
+
244
+ Ivan Vulic and Marie-Francine Moens. Bilingual word embeddings from non-parallel documentaligned data applied to bilingual lexicon induction. In ACL, 2015.
245
+
246
+ # A APPENDIX
247
+
248
+ A.1 DATASET STATISTICS
249
+
250
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Number of sentences</td><td rowspan=1 colspan=1>Number of tokens(English tokens if bilingual)</td></tr><tr><td rowspan=1 colspan=1>En-De ParaCrawl v4.0</td><td rowspan=1 colspan=1>17 Million</td><td rowspan=1 colspan=1>308 Million</td></tr><tr><td rowspan=1 colspan=1>En-Es ParaCrawl v4.0</td><td rowspan=1 colspan=1>22 Million</td><td rowspan=1 colspan=1>477 Million</td></tr><tr><td rowspan=1 colspan=1>En-FiParaCrawl v4.0</td><td rowspan=1 colspan=1>2.16 Million</td><td rowspan=1 colspan=1>42 Million</td></tr><tr><td rowspan=1 colspan=1>En-FrParaCrawl v4.0</td><td rowspan=1 colspan=1>32 Million</td><td rowspan=1 colspan=1>665 Million</td></tr><tr><td rowspan=1 colspan=1>En-Hu ParaCrawl v4.0</td><td rowspan=1 colspan=1>1.91Million</td><td rowspan=1 colspan=1>31Million</td></tr><tr><td rowspan=1 colspan=1>En-It ParaCrawl v4.0</td><td rowspan=1 colspan=1>13 Million</td><td rowspan=1 colspan=1>261 Million</td></tr><tr><td rowspan=1 colspan=1>En-Ru OpenSubtitles+ Tanzil</td><td rowspan=1 colspan=1>27 Million</td><td rowspan=1 colspan=1>363Million</td></tr><tr><td rowspan=1 colspan=1>Wikipedia - En</td><td rowspan=1 colspan=1>70 Million</td><td rowspan=1 colspan=1>1792 Million</td></tr><tr><td rowspan=1 colspan=1>Wikipedia - De</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>1384 Million</td></tr><tr><td rowspan=1 colspan=1>Wikipedia - Fr</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>1108Million</td></tr><tr><td rowspan=1 colspan=1>Wikipedia - Es</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>797 Million</td></tr><tr><td rowspan=1 colspan=1>Wikipedia - It</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>702 Million</td></tr><tr><td rowspan=1 colspan=1>Wikipedia - Ru</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>824 Million</td></tr><tr><td rowspan=1 colspan=1>Common Crawl - En</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>600 Billion</td></tr><tr><td rowspan=1 colspan=1>Common Crawl - De</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>66 Billion</td></tr><tr><td rowspan=1 colspan=1>Common Crawl -Fr</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>68 Billion</td></tr><tr><td rowspan=1 colspan=1>Common Crawl - It</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>36 Billion</td></tr><tr><td rowspan=1 colspan=1>Common Crawl -Es</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>72 Billion</td></tr></table>
251
+
252
+ Table 6: Dataset Sizes. ‘En’,‘De’,‘Fi’,‘Fr’,‘Hu’,‘It’,‘Es’ and ‘Ru’ stand for English, German, Finnish, French, Hungarian, Italian, Spanish and Russian respectively.
253
+
254
+ We used ParaCrawl $\mathrm { v } 4 . 0$ corpora for training BI-SENT2VEC, SENT2VEC,BIVEC,VECMAP and TRANSGRAM embeddings except for En-Ru pair for which we used OpenSubtitles and Tanzil corpora combined. MUSE and RCSLS vectors were trained from FASTTEXT vectors obtained from Wikipedia dumps(Grave et al., 2018a).
255
+
256
+ # A.2 TRAINING PARAMETERS FOR TRAINED MODELS
257
+
258
+ Table 7: Hyperparameters for the trained models
259
+
260
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>BI-SENT2VECuni.</td><td rowspan=1 colspan=1>BI-SENT2VECuni. + bi.</td><td rowspan=1 colspan=1>SENT2VECuni.</td><td rowspan=1 colspan=1>TRANSGRAM</td></tr><tr><td rowspan=1 colspan=1>Embedding dimension</td><td rowspan=1 colspan=1>300</td><td rowspan=1 colspan=1>300</td><td rowspan=1 colspan=1>300</td><td rowspan=1 colspan=1>300</td></tr><tr><td rowspan=1 colspan=1>Maxvocabulary size</td><td rowspan=1 colspan=1>750k</td><td rowspan=1 colspan=1>750k</td><td rowspan=1 colspan=1>750k</td><td rowspan=1 colspan=1>750k</td></tr><tr><td rowspan=1 colspan=1>Minimum word count</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>Initial Learning Rate</td><td rowspan=1 colspan=1>0.2</td><td rowspan=1 colspan=1>0.2</td><td rowspan=1 colspan=1>0.2</td><td rowspan=1 colspan=1>0.025</td></tr><tr><td rowspan=1 colspan=1>Epochs</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>8</td></tr><tr><td rowspan=1 colspan=1>Subsampling hyper-parameter</td><td rowspan=1 colspan=1>1·10-5</td><td rowspan=1 colspan=1>5:10-6</td><td rowspan=1 colspan=1>1·10-5</td><td rowspan=1 colspan=1>1·10-4</td></tr><tr><td rowspan=1 colspan=1>Word-Ngrams Bucket Size</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>2M</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>Word-Ngrams dropped per context</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>Window size</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>Number of negatives sampled</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>5</td></tr></table>
261
+
262
+ A.3 ADDITIONAL MONOLINGUAL QUALITY TABLES
263
+
264
+ <table><tr><td colspan="2">SimLex-999 Method\Dataset</td><td colspan="2">WS-353</td></tr><tr><td></td><td>en</td><td>en</td><td>es</td></tr><tr><td>MUSE RCSLS</td><td>0.38</td><td>0.74</td><td>0.61</td></tr><tr><td>FASTTEXT- Common Crawl</td><td>0.38 0.49</td><td>0.74 0.75</td><td>0.62 0.54</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>BIVEC</td><td>0.40</td><td>0.72</td><td>0.57</td></tr><tr><td>TRANSGRAM</td><td>0.42</td><td>0.74</td><td>0.59</td></tr><tr><td>SENT2VEC uni.</td><td>0.49</td><td>0.58</td><td>0.51</td></tr><tr><td>BI-SENT2VEC uni.</td><td>0.57</td><td>0.78</td><td>0.60</td></tr><tr><td>BI-SENT2VEC uni. + bi.</td><td>0.60</td><td>0.82</td><td>0.66</td></tr></table>
265
+
266
+ Table 8: Monolingual word similarity task performance of our methods when trained on en-es ParaCrawl data. We report Pearson correlation scores.
267
+
268
+ <table><tr><td>Method\Dataset</td><td>SimLex-999 en</td><td>WS-353 en</td><td>RG-65 fr</td></tr><tr><td>MUSE</td><td>0.38</td><td>0.74</td><td>0.72</td></tr><tr><td>RCSLS</td><td>0.38</td><td>0.74</td><td>0.70</td></tr><tr><td>FASTTEXT- Common Crawl</td><td>0.49</td><td>0.75</td><td>0.76</td></tr><tr><td>BIVEC</td><td>0.40</td><td>0.70</td><td>0.74</td></tr><tr><td>TRANSGRAM</td><td>0.39</td><td></td><td>0.74</td></tr><tr><td>SENT2VEC uni.</td><td></td><td>0.72</td><td></td></tr><tr><td></td><td>0.46</td><td>0.75</td><td>0.71</td></tr><tr><td>BI-SENT2VEC uni. BI-SENT2VEC uni. + bi.</td><td>0.55 0.59</td><td>0.78 0.79</td><td>0.74 0.78</td></tr></table>
269
+
270
+ Table 9: Monolingual word similarity task performance of our methods when trained on en-fr ParaCrawl data. We report Pearson correlation scores.
271
+ Table 10: Monolingual word similarity task performance of our methods when trained on ende ParaCrawl data. We report Pearson correlation scores.
272
+
273
+ <table><tr><td>Method\Dataset</td><td>SimLex-999</td><td>WS-353</td><td></td></tr><tr><td></td><td>en de</td><td>en</td><td>de</td></tr><tr><td>MUSE</td><td>0.38 0.41</td><td>0.74</td><td>0.68</td></tr><tr><td>RCSLS</td><td>0.38 0.43</td><td>0.74</td><td>0.70</td></tr><tr><td>FASTTEXT- Common Crawl</td><td>0.49 0.39</td><td>0.75</td><td>0.64</td></tr><tr><td>BIVEC</td><td>0.40 0.41</td><td>0.71</td><td>0.62</td></tr><tr><td>TRANSGRAM</td><td>0.42 0.42</td><td>0.74</td><td>0.66</td></tr><tr><td>SENT2VEC uni.</td><td>0.48 0.38</td><td>0.70</td><td>0.63</td></tr><tr><td>BI-SENT2VEC uni.</td><td>0.56 0.47</td><td>0.76</td><td>0.68</td></tr><tr><td>BI-SENT2VEC uni. + bi.</td><td>0.59 0.53</td><td>0.75</td><td>0.70</td></tr></table>
md/train/Sk9yuql0Z/Sk9yuql0Z.md ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MITIGATING ADVERSARIAL EFFECTS THROUGH RAN-DOMIZATION
2
+
3
+ Cihang Xie, Zhishuai Zhang & Alan L. Yuille
4
+
5
+ Department of Computer Science
6
+ The Johns Hopkins University
7
+ Baltimore, MD 21218 USA
8
+ {cihangxie306, zhshuai.zhang, alan.l.yuille}@gmail.com
9
+
10
+ Jianyu Wang Baidu Research USA Sunnyvale, CA 94089 USA wjyouch@gmail.com
11
+
12
+ Zhou Ren
13
+ Snap Inc.
14
+ Venice, CA 90291 USA
15
+ zhou.ren@snapchat.com
16
+
17
+ # ABSTRACT
18
+
19
+ Convolutional neural networks have demonstrated high accuracy on various tasks in recent years. However, they are extremely vulnerable to adversarial examples. For example, imperceptible perturbations added to clean images can cause convolutional neural networks to fail. In this paper, we propose to utilize randomization at inference time to mitigate adversarial effects. Specifically, we use two randomization operations: random resizing, which resizes the input images to a random size, and random padding, which pads zeros around the input images in a random manner. Extensive experiments demonstrate that the proposed randomization method is very effective at defending against both single-step and iterative attacks. Our method provides the following advantages: 1) no additional training or fine-tuning, 2) very few additional computations, 3) compatible with other adversarial defense methods. By combining the proposed randomization method with an adversarially trained model, it achieves a normalized score of 0.924 (ranked No.2 among 107 defense teams) in the NIPS 2017 adversarial examples defense challenge, which is far better than using adversarial training alone with a normalized score of 0.773 (ranked No.56). The code is public available at https: //github.com/cihangxie/NIPS2017_adv_challenge_defense.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Convolutional Neural Networks (CNNs) have been successfully applied to a wide range of vision tasks, including image classification (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; He et al., 2016a), object detection (Girshick, 2015; Ren et al., 2015; Zhang et al., 2017), semantic segmentation (Long et al., 2015; Chen et al., 2017), visual concept discovery (Wang et al., 2017) etc. However, recent works show that CNNs are extremely vulnerable to small perturbations to the input image. For example, adding visually imperceptible perturbations to the original image can result in failures for image classification (Szegedy et al., 2014; Goodfellow et al., 2015), object detection (Xie et al., 2017) and semantic segmentation (Xie et al., 2017; Fischer et al., 2017; Cisse et al., 2017). These perturbed images are called adversarial examples and Figure 1 gives an example. Adversarial examples pose a great security danger to the deployment of commercial machine learning systems. Thus, making CNNs more robust to adversarial examples is a very important yet challenging problem. Recent works (Papernot et al., 2016b; Kurakin et al., 2017; Tramer et al., 2017; Cao & Gong, \`
24
+
25
+ ![](images/48b3009e8ed26fd44338fb7b72d9eaf8e2ea6476d67d321696065b4e396f4087.jpg)
26
+ Figure 1: This is an adversarial example crafted for VGG (Simonyan & Zisserman, 2015). The left image is classified correctly as king penguin, the center image is the adversarial perturbation (magnified by 10 and enlarged by 128 for better visualization), and the right image is the adversarial example misclassfied as chihuahua.
27
+
28
+ 2017; Metzen et al., 2017; Feinman et al., 2017; Meng & Chen, 2017) are making progress on this line of research.
29
+
30
+ Adversarial attacks can be divided into two categories: single-step attacks, which perform only one step of gradient computation, and iterative attacks, which perform multiple steps. Intuitively, the perturbation generated by iterative methods may easily get over-fitted to the specific network parameters, and thus be less transferable. On the other hand, single-step methods may not be strong enough to fool the network. For examples, it has been demonstrated that single-step attacks, like Fast Gradient Sign Method (FGSM) (Goodfellow et al., 2015), have better transferability but weaker attack rate than iterative attacks, like DeepFool (Moosavi-Dezfooli et al., 2016).
31
+
32
+ Due to the weak generalization of iterative attacks, low-level image transformations, e.g., resizing, padding, compression, etc, may probably destroy the specific structure of adversarial perturbations, thus making it a good defense. It can even defend against white-box iterative attacks if random transformations are applied. This is because each test image goes through random transformations and the attacker does not know the specific transformation when generating adversarial noise. Recently, adversarial training (Kurakin et al., 2017; Tramer et al., 2017) was developed to defend against \` single-step attacks. Thus by adding the proposed random transformations as additional layers to an adversarially trained model (Tramer et al., 2017), it is expected that the method is able to effec- \` tively defend against both single-step and iterative attacks, including both black-box and white-box settings.
33
+
34
+ Based on the above reasoning, in this paper, we propose a defense method by randomization at inference time, i.e., random resizing and random padding, to mitigate adversarial effects. To the best of our knowledge, this is the first work that demonstrates the effectiveness of randomization at inference time on mitigating adversarial effects on large-scale dataset, e.g., ImageNet (Deng et al., 2009). The proposed method provides the following advantages:
35
+
36
+ • Randomization at inference time makes the network much more robust to adversarial images, especially for iterative attacks (both white-box and black box), but hardly hurts the performance on clean (non-adversarial) images. Experiments on section 4.2 support this argument.
37
+ • There is no additional training or fine-tuning required which is easy for implementation.
38
+ • Very few computations are required by adding the two randomization layers, thus there is nearly no run time increase.
39
+ • Randomization layers are compatible to different network structures and adversarial defense methods, which can serve as a basic network module for adversarial defense.
40
+
41
+ We conduct comprehensive experiments to test the effectiveness of our defense method, using different network structures, against different attack methods, and under different attack scenarios. The results in Section 4 demonstrate that the proposed randomization layers can significantly mitigate adversarial effects, especially for iterative attack methods. Moreover, we submitted the model, which combines the proposed randomization layers and an adversarially trained model (Tramer\` et al., 2017), to the NIPS 2017 adversarial examples defense challenge. It reaches a normalized score of 0.924 (ranked No.2 among 107 defense teams), which is far better than just using adversarial training (Tramer et al., 2017) alone with a normalized score of \` 0.773 (ranked No.56).
42
+
43
+ # 2 RELATED WORK
44
+
45
+ # 2.1 GENERATING ADVERSARIAL EXAMPLES
46
+
47
+ Generating adversarial examples has been extensively studied recently. (Szegedy et al., 2014) first showed that adversarial examples, computed by adding visually imperceptible perturbations to the original images, make CNNs predict wrong labels with high confidence. (Goodfellow et al., 2015) proposed the fast gradient sign method to generate adversarial examples based on the linear nature of CNNs, and also proposed adversarial training for defense. (Moosavi-Dezfooli et al., 2016) generated adversarial examples by assuming that the loss function can be linearized around the current data point at each iteration. (Carlini & Wagner, 2017) developed a stronger attack to find adversarial perturbations by introducing auxiliary variables which incooperate the pixel value constrain, e.g., pixel intensity must be within the range [0,255], naturally into the loss function and make the optimization process easier. (Liu et al., 2017) proposed an ensemble-based approaches to generate adversarial examples with stronger transferability. Unlike the works above, (Biggio & Laskov, 2012; Koh & Liang, 2017) showed that manipulating only a small fraction of the training data can significantly increase the number of misclassified samples at test time for learning algorithms, and such attacks are called poisoning attacks.
48
+
49
+ # 2.2 DEFENDING AGAINST ADVERSARIAL EXAMPLES
50
+
51
+ Opposite to generating adversarial examples, there is also progress on reducing the effects of adversarial examples. (Papernot et al., 2016b) showed networks trained using defensive distillation can effectively defend against adversarial examples. (Kurakin et al., 2017) proposed to replace the original clean images with a mixture of clean images and corresponding adversarial images in each training batch to improve the network robustness. (Tramer et al., 2017) improved the robustness \` further by training the network on an ensemble of adversarial images generated from the trained model itself and from a number of other pre-trained models. Cao & Gong (2017) proposed a regionbased classification to let models be robust to adversarial examples. (Metzen et al., 2017) trained a detector on the inner layer of the classifier to detect adversarial examples. (Feinman et al., 2017) detected adversarial examples by looking at the Bayesian uncertainty estimates of the input images in dropout neural networks and by performing density estimation in the subspace of deep features learned by the model. MagNet (Meng & Chen, 2017) detected adversarial examples with large perturbation using detector networks, and pushed adversarial examples with small perturbation towards the manifold of clean images.
52
+
53
+ # 3 APPROACH
54
+
55
+ # 3.1 AN OVERVIEW OF GENERATING ADVERSARIAL EXAMPLES
56
+
57
+ Before introducing the proposed adversarial defense method, we give an overview of generating adversarial examples. Let $X _ { n }$ denote the $n$ -th image in a dataset containing $N$ images, and let $y _ { n } ^ { \mathrm { t r u e } }$ denote the corresponding ground-truth label. We use $\theta$ to denote the network parameters, and $L ( X _ { n } , y _ { n } ^ { \mathrm { t r u e } } ; \theta )$ to denote the loss. For the adversarial example generation, the goal is to maximize the loss $L ( X _ { n } + r _ { n } , y _ { n } ^ { \mathrm { t r u e } } ; \theta )$ for each image $X _ { n }$ , under the constraint that the generated adversarial example $X _ { n } ^ { \mathrm { a d v } } = X _ { n } + r _ { n }$ should look visually similar to the original image $X _ { n }$ , i.e., $| | r _ { n } | | \leq \epsilon$ , and the corresponding predicted label $y _ { n } ^ { \mathrm { a d v } } \neq y _ { n } ^ { \mathrm { t r u e } }$ .
58
+
59
+ In our experiment, we consider three different attack methods, including one single-step attack method and two iterative attack methods. We use the cleverhans library (Papernot et al., 2016a) to generate adversarial examples, where all these attacks have been implemented via TensorFlow.
60
+
61
+ • Fast Gradient Sign Method (FGSM): FGSM (Goodfellow et al., 2015) is a single-step attack method. It finds the adversarial perturbation that yields the highest increase of the linear cost function under $l _ { \infty }$ -norm. The update equation is
62
+
63
+ $$
64
+ X _ { n } ^ { \mathrm { a d v } } = X _ { n } + \epsilon \cdot s i g n \big ( \nabla _ { X _ { n } } L ( X _ { n } , y _ { n } ^ { \mathrm { t r u e } } ; \theta ) \big ) ,
65
+ $$
66
+
67
+ where $\epsilon$ controls the magnitude of adversarial perturbation. In the experiment, we choose $\epsilon = \{ 2 , 5 , 1 0 \}$ , which corresponds to small, medium and high magnitude of adversarial perturbations, respectively.
68
+
69
+ • DeepFool: DeepFool (Moosavi-Dezfooli et al., 2016) is an iterative attack method which finds the minimal perturbation to cross the decision boundary based on the linearization of the classifier at each iteration. Any $l _ { p }$ -norm can be used with DeepFool, and we choose $l _ { 2 }$ -norm for the study in this paper.
70
+
71
+ • Carlini $\&$ Wagner (C&W): C&W (Carlini & Wagner, 2017) is a stronger iterative attack method proposed recently. It finds the adversarial perturbation $r _ { n }$ by using an auxiliary variable $\omega _ { n }$ as
72
+
73
+ $$
74
+ r _ { n } = { \frac { 1 } { 2 } } ( t a n h ( \omega _ { n } + 1 ) ) - X _ { n } .
75
+ $$
76
+
77
+ Then the loss function optimizes the auxiliary variable $\omega _ { n }$
78
+
79
+ $$
80
+ \operatorname* { m i n } _ { \omega _ { n } } | | \frac { 1 } { 2 } ( t a n h ( \omega _ { n } ) + 1 ) - X _ { n } | | + c \cdot f ( \frac { 1 } { 2 } ( t a n h ( \omega _ { n } ) + 1 ) ) .
81
+ $$
82
+
83
+ The function $f ( \cdot )$ is defined as
84
+
85
+ $$
86
+ f ( x ) = \operatorname* { m a x } ( Z ( x ) _ { y ^ { \mathrm { t u e } } } - \operatorname* { m a x } \{ Z ( x ) _ { i } : i \neq y ^ { \mathrm { t r u e } } \} , - k ) ,
87
+ $$
88
+
89
+ where $Z ( x ) _ { i }$ is the logits output for class $i$ , and $k$ controls the confidence gap between the adversarial class and true class. C&W can also work with various $l _ { p }$ -norm, and we choose $l _ { 2 }$ -norm in the experiments.
90
+
91
+ # 3.2 DEFENDING AGAINST ADVERSARIAL EXAMPLES
92
+
93
+ The goal of defense is to build a network that is robust to adversarial examples, i.e., it can classify adversarial images correctly with little performance loss on non-adversarial (clean) images. Towards this goal, we propose a randomization-based method, as shown in Figure 2, which adds a random resizing layer and a random padding layer to the beginning of the classification networks. There is no re-training or fine-tuning needed which makes the proposed method very easy to implement.
94
+
95
+ # 3.2.1 RANDOMIZATION LAYERS
96
+
97
+ The first randomization layer is a random resizing layer, which resizes the original image $X _ { n }$ with the size $W \times H \times 3$ to a new image $X _ { n } ^ { \prime }$ with random size $W ^ { \prime } \times H ^ { \prime } \times 3$ . Note that, $| W ^ { \prime } - W |$ and $| H ^ { \prime } - H |$ should be within a reasonablely small range, otherwise the network performance on non-adversarial images would significantly drop. Taking Inception-ResNet network (Szegedy et al., 2017) as an example, the original data input size is $2 9 9 \times 2 9 9 \times 3$ . Empirically we found that the network performance hardly drops if we control the height and width of the resized image $X _ { n } ^ { \prime }$ to be within the range [299, 331).
98
+
99
+ The second randomization layer is the random padding layer, which pads zeros around the resized image in a random manner. Specifically, by padding the resized image $X _ { n } ^ { \prime }$ into a new image $X _ { n } ^ { \prime \prime }$ with the size $W ^ { \prime \prime } \times H ^ { \prime \prime } \times 3$ , we can choose to pad $w$ zero pixels on the left, $W ^ { \prime \prime } - W ^ { \prime } - w$ zero pixels on the right, $h$ zero pixels on the top and $H ^ { \prime \prime } - H ^ { \prime } - h$ zero pixels on the bottom. This results in a total number of $\left( W ^ { \prime \prime } - W ^ { \prime } + 1 \right) \times \left( H ^ { \prime \prime } - H ^ { \prime } + 1 \right)$ different possible padding patterns.
100
+
101
+ During implementation, the original image first goes through two randomization layers, and then we pass the transformed image to the original CNN for classification. The pipeline is illustrated in Figure 2.
102
+
103
+ # 3.2.2 RANDOMIZATION LAYERS $^ +$ ADVERSARIAL TRAINING
104
+
105
+ Note that our randomization-based method is good at defending against iterative attacks, and adversarial training (Kurakin et al., 2017; Tramer et al., 2017) can effectively increase the robustness of \` neural networks to single-step attacks. Thus, to make the best of both worlds, we can combine the proposed randomization layers and an adversarially trained model (Tramer et al., 2017) together to \` defend against both single-step and iterative attacks.
106
+
107
+ ![](images/b391dc2283db9234f0f293be29409bb96e04b1cf038128ded1f2d00537f1f162.jpg)
108
+ Figure 2: The pipeline of our randomization-based defense mechanism. The input image $X _ { n }$ first goes through the random resizing layer with a random scale applied. Then the random padding layer pads the resized image $X _ { n } ^ { \prime }$ in a random manner. The resulting padded image $X _ { n } ^ { \prime \prime }$ is used for classification.
109
+
110
+ # 4 EXPERIMENTS
111
+
112
+ # 4.1 EXPERIMENT SETUP
113
+
114
+ Dataset: It is less meaningful to attack the images that are already classified wrongly. Therefore, we randomly choose 5000 images from the ImageNet validation set that are classified correctly by all the considered networks to form our test dataset. All these images are of the size $2 9 9 \times 2 9 9 \times 3$ .
115
+
116
+ Networks: We test with four publicly available networks1,2, including Inception- $\nu 3$ (Szegedy et al., 2016), ResNet- $\cdot \nu 2$ (He et al., 2016b) of 101 layers, Inception-ResNet- $\cdot \nu 2$ (Szegedy et al., 2017), and ens-adv-Inception-ResNet- $\nu 2$ which applies the ensemble adversarial training (Tramer et al., 2017) \` on Inception-ResNet- $\nu 2$ . These networks have been trained on ImageNet, and we do not perform any re-training or fine-tuning on them for the whole experiments.
117
+
118
+ Defense Models: The defense models consist of the original networks (i.e., four above-mentioned networks) and two additional randomization layers. For the random resizing layer, it changes the input shape from $2 9 9 \times 2 9 9 \times 3$ to $r n d \times r n d \times 3$ , where rnd is a integer randomly sampled from the range [299, 331). For the random padding layer, it pads the resized image to the shape of $3 3 1 \times 3 3 1 \times 3$ in a random manner. By applying these two randomization layers, we can create 330
119
+ $\sum _ { r n d = 2 9 9 } ( 3 3 1 - r n d + 1 ) ^ { 2 } = 1 2 5 2 8$ different patterns for a single image. Since there exists small variance on model performance w.r.t. different random patterns, we run the defense model three times independently and report the average accuracy.
120
+
121
+ Target Models under Different Attack Scenarios: The strongest attack would be that the attackers consider ALL possible patterns of the defense models when generating the adversarial examples. However, this is computationally impossible, because failing a large number of patterns (e.g., 12528 here) at the same time takes extremely long time, and may not even converge. Thus, we let attackers use the target models to generate adversarial examples instead, and consider the following three different attack scenarios.
122
+
123
+ • Vanilla Attack: The attackers do not know the existence of the randomization layers and the target model is just the original network.
124
+
125
+ Table 1: Top-1 classification accuracy on the clean images. We see that adding random resizing and random padding cause very little accuracy drop on clean (non-adversarial) images.
126
+
127
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>Inception-v3</td><td rowspan=1 colspan=1>ResNet-v2-101</td><td rowspan=1 colspan=1>Inception-ResNet-v2</td><td rowspan=1 colspan=1>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1>w/o randomization layers</td><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>100%</td></tr><tr><td rowspan=1 colspan=1>wrandomization layers</td><td rowspan=1 colspan=1>97.3%</td><td rowspan=1 colspan=1>98.3%</td><td rowspan=1 colspan=1>99.3%</td><td rowspan=1 colspan=1>99.2%</td></tr></table>
128
+
129
+ • Single-Pattern Attack: The attackers know the existence of the randomization layers. In order to mimic the structures of defense models, the target model is chosen as the original network $^ +$ randomization layers with only one predefined pattern.
130
+
131
+ • Ensemble-Pattern Attack: The attackers know the existence of the randomization layers. In order to mimic the structures of defense models in a more representative way, the target model is chosen as the original network $^ +$ randomization layers with an ensemble of predefined patterns.
132
+
133
+ Target Models and Defense Models: The target models and the defense models are exactly the same except for the parameter settings of the randomization layers, i.e., the randomization parameters at the target models are predefined while randomization parameters at the defense models are randomly generated at test time. The original networks (e.g., Inception- $\nu 3$ ) utilized by the target models and the defense models are the same. The attackers first generate adversarial examples using the target models, and then evaluate the classification accuracy of these generated adversarial examples on both the target and defense models. A low accuracy of the target model indicates that the attack is successful, and a high accuracy of the defense model indicates that the defense is effective.
134
+
135
+ # 4.2 CLEAN IMAGES
136
+
137
+ Table 1 shows the top-1 accuracy of networks with and without randomization layers on the clean images. We can see that randomization layers introduce negligible performance degradation on clean images. Specifically, we can observe that: (1) models with more advanced architectures tend to have less performance degradation, e.g., Inception-ResNet- $\cdot \nu 2$ only has $0 . 7 \%$ degradation while Inception-v3 has $2 . 7 \%$ degradation; (2) ensemble adversarial training brings nearly no performance degradation to the models, e.g., Inception-ResNet-v2 and ens-adv-Inception-ResNet-v2 have nearly the same performance degradation.
138
+
139
+ # 4.3 VANILLA ATTACK SCENARIO
140
+
141
+ For the vanilla attack scenario, the attackers are not aware of randomization layers, and directly use the original networks as the target model to generate adversarial examples. The attack ability on the defense models mostly rely on the transferability of adversarial examples to different resizing and padding. From the top-1 accuracy presented in Table 2, we observe that randomization layers can mitigate the adversarial effects for both single-step and iterative attacks significantly. As for singlestep attacks FGSM-, larger $\epsilon$ indicates stronger transferability, thus making it harder to defend. However, we can still get satisfactory accuracy of the defense model on single-step attacks (even with large $\epsilon$ ) using ens-adv-Inception-ResNet- $\cdot \nu 2$ $9 4 . 3 \%$ top-1 accuracy). As for iterative attacks, attackers always reach a very high attack rate on target model, but have almost no impact on models after randomization layers are applied. This is because iterative attack methods are over-fitted to the target models thus have weak transferability.
142
+
143
+ # 4.4 SINGLE-PATTERN ATTACK SCENARIO
144
+
145
+ For the single-pattern attack scenario, the attackers are aware of the existence of randomization layers and also the parameters of the random resizing and random padding (i.e., from $2 9 9 \times 2 9 9$ to $3 3 1 \times 3 3 1$ ), but they do not know the specific randomization patterns utilized by the defense models (even the defense models themselves do not know these specific randomization patterns since they are randomly instantiated at test time). In order to generate adversarial examples, the attackers choose the target models as the original networks $^ +$ randomization layers but with only one specific pattern to compute the gradient. In this experiment, the specific pattern that we use is to place the original input $X _ { n }$ at the center of the padded image $X _ { n } ^ { \prime \prime }$ , i.e., no resizing is applied, and 16 zeros pixels are padded on the left, right, top and bottom on the input images, respectively. Table 3 shows the top-1 accuracy of both target models and defense models, and similar results to vanilla attack scenario are observed: (1) for single-step attacks, randomization layers are less effective on mitigating adversarial effects for a larger $\epsilon$ , while the adversarially trained models are able to defend against such attacks; (2) for iterative attacks, they reach high attack rates on target models, while have nearly no impact on defense models.
146
+
147
+ Table 2: Top-1 classification accuracy under the vanilla attack scenario. We see that randomization layers effectively mitigate adversarial effects for all attacks and all networks. Particularly, combining randomization layers with ensemble adversarial training (ens-adv-Inception-ResNet-v2) performs very well on all attacks.
148
+
149
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>33.2%</td><td rowspan=1 colspan=1>65.1%</td><td rowspan=1 colspan=1>26.3%</td><td rowspan=1 colspan=1>71.8%</td><td rowspan=1 colspan=1>65.3%</td><td rowspan=1 colspan=1>81.0%</td><td rowspan=1 colspan=1>84.4%</td><td rowspan=1 colspan=1>95.7%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>31.1%</td><td rowspan=1 colspan=1>54.5%</td><td rowspan=1 colspan=1>20.4%</td><td rowspan=1 colspan=1>54.3%</td><td rowspan=1 colspan=1>61.7%</td><td rowspan=1 colspan=1>74.1%</td><td rowspan=1 colspan=1>87.4%</td><td rowspan=1 colspan=1>94.5%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>33.0%</td><td rowspan=1 colspan=1>52.4%</td><td rowspan=1 colspan=1>20.4%</td><td rowspan=1 colspan=1>46.1%</td><td rowspan=1 colspan=1>61.2%</td><td rowspan=1 colspan=1>71.3%</td><td rowspan=1 colspan=1>90.2%</td><td rowspan=1 colspan=1>94.3%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>98.3%</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>97.7%</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>0.2%</td><td rowspan=1 colspan=1>99.1%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>96.9%</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>97.1%</td><td rowspan=1 colspan=1>0.3%</td><td rowspan=1 colspan=1>97.7%</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>98.8%</td></tr></table>
150
+
151
+ Table 3: Top-1 classification accuracy under the single-pattern attack scenario. We see that randomization layers effectively mitigate adversarial effects for all attacks and all networks. Particularly, combining randomization layers with ensemble adversarial training (ens-adv-Inception-ResNet- $\cdot \nu 2$ ) performs very well on all attacks.
152
+
153
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>35.1%</td><td rowspan=1 colspan=1>63.8%</td><td rowspan=1 colspan=1>29.5%</td><td rowspan=1 colspan=1>70.1%</td><td rowspan=1 colspan=1>71.6%</td><td rowspan=1 colspan=1>83.4%</td><td rowspan=1 colspan=1>86.3%</td><td rowspan=1 colspan=1>96.4%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>32.4%</td><td rowspan=1 colspan=1>53.9%</td><td rowspan=1 colspan=1>23.2%</td><td rowspan=1 colspan=1>52.3%</td><td rowspan=1 colspan=1>68.3%</td><td rowspan=1 colspan=1>78.2%</td><td rowspan=1 colspan=1>88.4%</td><td rowspan=1 colspan=1>95.4%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>34.7%</td><td rowspan=1 colspan=1>51.8%</td><td rowspan=1 colspan=1>22.4%</td><td rowspan=1 colspan=1>43.8%</td><td rowspan=1 colspan=1>66.8%</td><td rowspan=1 colspan=1>75.6%</td><td rowspan=1 colspan=1>90.7%</td><td rowspan=1 colspan=1>95.2%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>1.1%</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>1.7%</td><td rowspan=1 colspan=1>97.8%</td><td rowspan=1 colspan=1>0.6%</td><td rowspan=1 colspan=1>98.4%</td><td rowspan=1 colspan=1>1.0%</td><td rowspan=1 colspan=1>99.2%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>1.1%</td><td rowspan=1 colspan=1>97.4%</td><td rowspan=1 colspan=1>1.7%</td><td rowspan=1 colspan=1>97.0%</td><td rowspan=1 colspan=1>0.8%</td><td rowspan=1 colspan=1>97.9%</td><td rowspan=1 colspan=1>1.6%</td><td rowspan=1 colspan=1>99.1%</td></tr></table>
154
+
155
+ # 4.5 ENSEMBLE-PATTERN ATTACK SCENARIO
156
+
157
+ For the ensemble-pattern attack scenario, similar to single-pattern attack scenario, the attackers are aware of the randomization layers and the parameters of the random resizing and random padding (i.e., starting from $2 9 9 \times 2 9 9$ to $3 3 1 \times 3 3 1$ ), but they do not know the specific patterns utilized by the defense models at test time. The target models thus are constructed in a more representative way: let randomization layers choose an ensemble of predefined patterns, and the goal of the attackers is to let all chosen patterns fail on classification. In this experiment, the specific ensemble patterns that we choose are: (1) first resize the input image to five different scales $\{ 2 9 9 , 3 0 7 , 3 1 5 , 3 2 3 , 3 3 1 \}$ ; (2) then pad each resized image to five different patterns, where the resized image is placed at the top left, top right, bottom left, bottom right, and center of the padded image, respectively. Since there is only one padding pattern for the resized image with size 331, we can obtain $4 * 5 + 1 = 2 1$ patterns in total. Due to the large computation amounts introduced by the ensemble-pattern attack scenario, we randomly choose 500 images out of the entire test dataset for this experiment. The top-1 accuracy for the target model here is calculated by summing up the number of correctly classified patterns of each image over the entire pattern number of all images. For the results presented in Table 4, we can see that the adversarial examples generated under ensemble-pattern attack scenario are much stronger. For single-step attacks, the generated adversarial examples can let the performance of the defense model with an adversarially trained network drop around $8 \%$ compared to the performance under vanilla attack and single-pattern attack scenarios, and drop much more on other defense models. For iterative attacks, we observe that the adversarial examples generated by C&W are stronger than those generated by DeepFool, e.g., the defense model with Inception- $\nu 3$ has an accuracy of $8 1 . 3 \%$ on DeepFool, while only has an accuracy of $6 2 . 9 \%$ on C&W. We argue that this is due to the more advanced loss function (i.e., introduction of auxiliary variable for pixel value control) utilized by C&W than DeepFool. Additionally, the accuracy of defense model on C&W can be improved by utilizing more advanced architecture (e.g., ResNet-v2-101 has higher accuracy than Inception-v3) and applying ensemble adversarial training (e.g., ens-adv-Inception-ResNet- $\nu 2$ has higher accuracy than Inception-ResNet-v2). For the best defense model that we have, ens-adv-Inception-ResNet- $\nu 2$ $^ +$ randomization layers reaches the top-1 accuracy of $9 3 . 5 \%$ on DeepFool and $8 6 . 1 \%$ on C&W, respectively.
158
+
159
+ Table 4: Top-1 classification accuracy under the ensemble-pattern attack scenario. Similar to vanilla attack and single-pattern attack scenarios, we see that randomization layers increase the accuracy under all attacks and networks. This clearly demonstrates the effectiveness of the proposed randomization method on defending against adversarial examples, even under this very strong attack scenario.
160
+
161
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>37.3%</td><td rowspan=1 colspan=1>41.2%</td><td rowspan=1 colspan=1>39.2%</td><td rowspan=1 colspan=1>44.9%</td><td rowspan=1 colspan=1>71.5%</td><td rowspan=1 colspan=1>74.3%</td><td rowspan=1 colspan=1>86.2%</td><td rowspan=1 colspan=1>88.9%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>31.7%</td><td rowspan=1 colspan=1>34.0%</td><td rowspan=1 colspan=1>24.6%</td><td rowspan=1 colspan=1>29.7%</td><td rowspan=1 colspan=1>65.2%</td><td rowspan=1 colspan=1>67.3%</td><td rowspan=1 colspan=1>85.8%</td><td rowspan=1 colspan=1>87.5%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>30.4%</td><td rowspan=1 colspan=1>32.8%</td><td rowspan=1 colspan=1>18.6%</td><td rowspan=1 colspan=1>21.7%</td><td rowspan=1 colspan=1>62.9%</td><td rowspan=1 colspan=1>64.5%</td><td rowspan=1 colspan=1>86.6%</td><td rowspan=1 colspan=1>87.9%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>0.6%</td><td rowspan=1 colspan=1>81.3%</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>80.5%</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>69.4%</td><td rowspan=1 colspan=1>1.6%</td><td rowspan=1 colspan=1>93.5%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>0.6%</td><td rowspan=1 colspan=1>62.9%</td><td rowspan=1 colspan=1>1.0%</td><td rowspan=1 colspan=1>74.3%</td><td rowspan=1 colspan=1>1.6%</td><td rowspan=1 colspan=1>68.3%</td><td rowspan=1 colspan=1>5.8%</td><td rowspan=1 colspan=1>86.1%</td></tr></table>
162
+
163
+ # 4.6 DIAGNOSTIC EXPERIMENT
164
+
165
+ Due to the large amount of possible patterns introduced by randomization layers, it is hard to analyze the effectiveness of random resizing and random padding precisely. In this section, we limit the freedom of randomization to be a small number (i.e., 4 in random padding and 1 in random resizing) and analyze the effectiveness of these two operations separately. The same 500 images in section 4.5 are used in this experiment. In addition, the input images for target models and defense models are resized to the shape $3 3 0 \times 3 3 0 \times 3$ beforehand.
166
+
167
+ # 4.6.1 ONE PIXEL PADDING
168
+
169
+ For the random padding, there are only 4 patterns when padding the input images from $3 3 0 \times 3 3 0 \times 3$ to $3 3 1 \times 3 3 1 \times 3$ . In order to construct a stronger attack, we follow the experiment setup in section 4.5 where 3 chosen patterns are ensembled. Specifically, the target model takes an ensemble of patterns where the original images are at the top left, top right and bottom left (3 patterns) of the padded images, and the defense model takes the last pattern where the original images are at the bottom right of the padded images. Note that, since there is no randomization in the defense model, we only run the defense model once. Table 5 summaries the results, and we can see that: (1) adversarial examples generated by single-step attacks have strong transferability, but still cannot attack the defense model with an adversarially trained model successfully (i.e., the defense model with ensadv-Inception-ResNet- $\nu 2$ ); (2) adversarial examples generated by iterative attacks are much less transferable between different padding patterns even when only 4 different patterns exist. The results demonstrate that creating different padding patterns can effectively mitigate adversarial effects.
170
+
171
+ Table 5: Top-1 classification accuracy under one pixel padding scenario. This table shows that creating different padding patterns (even 1-pixel padding) can effectively mitigate adversarial effects.
172
+
173
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>36.4%</td><td rowspan=1 colspan=1>39.6%</td><td rowspan=1 colspan=1>29.8%</td><td rowspan=1 colspan=1>34.4%</td><td rowspan=1 colspan=1>71.3%</td><td rowspan=1 colspan=1>74.0%</td><td rowspan=1 colspan=1>88.2%</td><td rowspan=1 colspan=1>94.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>33.5%</td><td rowspan=1 colspan=1>36.2%</td><td rowspan=1 colspan=1>22.2%</td><td rowspan=1 colspan=1>26.2%</td><td rowspan=1 colspan=1>68.4%</td><td rowspan=1 colspan=1>71.0%</td><td rowspan=1 colspan=1>92.1%</td><td rowspan=1 colspan=1>94.4%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>34.5%</td><td rowspan=1 colspan=1>38.8%</td><td rowspan=1 colspan=1>21.3%</td><td rowspan=1 colspan=1>23.6%</td><td rowspan=1 colspan=1>67.4%</td><td rowspan=1 colspan=1>70.4%</td><td rowspan=1 colspan=1>93.7%</td><td rowspan=1 colspan=1>94.0%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>97.2%</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>95.2%</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>87.6%</td><td rowspan=1 colspan=1>1.5%</td><td rowspan=1 colspan=1>99.2%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>0.8%</td><td rowspan=1 colspan=1>70.2%</td><td rowspan=1 colspan=1>0.9%</td><td rowspan=1 colspan=1>76.8%</td><td rowspan=1 colspan=1>1.0%</td><td rowspan=1 colspan=1>79.4%</td><td rowspan=1 colspan=1>2.4%</td><td rowspan=1 colspan=1>98.2%</td></tr></table>
174
+
175
+ Table 6: Top-1 classification accuracy under one pixel resizing scenario. This table shows that resizing image to a different scale (even 1-pixel scale) can effectively mitigate adversarial effects.
176
+
177
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td><td rowspan=1 colspan=1>targetmodel</td><td rowspan=1 colspan=1>defensemodel</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>30.8%</td><td rowspan=1 colspan=1>56.2%</td><td rowspan=1 colspan=1>31.6%</td><td rowspan=1 colspan=1>44.6%</td><td rowspan=1 colspan=1>66.2%</td><td rowspan=1 colspan=1>75.0%</td><td rowspan=1 colspan=1>87.6%</td><td rowspan=1 colspan=1>97.2%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>31.2%</td><td rowspan=1 colspan=1>48.8%</td><td rowspan=1 colspan=1>25.6%</td><td rowspan=1 colspan=1>35.8%</td><td rowspan=1 colspan=1>61.4%</td><td rowspan=1 colspan=1>70.2%</td><td rowspan=1 colspan=1>91.2%</td><td rowspan=1 colspan=1>96.6%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>36.4%</td><td rowspan=1 colspan=1>51.0%</td><td rowspan=1 colspan=1>23.8%</td><td rowspan=1 colspan=1>32.6%</td><td rowspan=1 colspan=1>62.8%</td><td rowspan=1 colspan=1>68.2%</td><td rowspan=1 colspan=1>94.8%</td><td rowspan=1 colspan=1>95.2%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>2.6%</td><td rowspan=1 colspan=1>99.4%</td><td rowspan=1 colspan=1>1.0%</td><td rowspan=1 colspan=1>98.6%</td><td rowspan=1 colspan=1>1.2%</td><td rowspan=1 colspan=1>97.4%</td><td rowspan=1 colspan=1>1.2%</td><td rowspan=1 colspan=1>99.4%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>2.6%</td><td rowspan=1 colspan=1>97.8%</td><td rowspan=1 colspan=1>1.0%</td><td rowspan=1 colspan=1>94.8%</td><td rowspan=1 colspan=1>2.0%</td><td rowspan=1 colspan=1>94.8%</td><td rowspan=1 colspan=1>1.8%</td><td rowspan=1 colspan=1>99.6%</td></tr></table>
178
+
179
+ # 4.6.2 ONE-PIXEL RESIZING
180
+
181
+ For the random resizing, there is only 1 pattern that exists when the input images are resized from $3 3 0 \times 3 3 0 \times 3$ to $3 3 1 \times 3 3 1 \times 3$ . The results in Table 6 indicate that resizing the images by only 1 pixel can effectively destroy the transferability of adversarial examples by both single-step and iterative attacks.
182
+
183
+ # 5 NIPS 2017 ADVERSARIAL EXAMPLES DEFENSE CHALLENGE
184
+
185
+ We submitted our model to the NIPS 2017 adversarial examples defense challenge3 for a more comprehensive performance evaluation. The test dataset contains 5000 images which are all of the size $2 9 9 \times 2 9 9 \times 3$ , and their corresponding labels are the same as the ImageNet 1000-class labels. Each defense method are run on all 5000 adversarial images generated against all adversarial attacks. For each correctly classified image, the defense method gets one point. The normalized score for each defense method is computed using the following formula:
186
+
187
+ $$
188
+ \mathrm { s c o r e } = \frac { 1 } { M } \sum _ { \mathrm { a t t a c k } \in A } \sum _ { n = 1 } ^ { 5 0 0 0 } \left[ \mathrm { d e f e n s e } ( \mathrm { a t t a c k } ( X _ { n } ) ) = y _ { n } ^ { \mathrm { t r u e } } \right] ,
189
+ $$
190
+
191
+ where $A$ is the set of all attacks, $M$ is the total number of generated adversarial examples by all attacks, and the function $[ \cdot ]$ is the indicator function which equals to 1 when the prediction is true.
192
+
193
+ # 5.1 CHALLENGE RESULTS
194
+
195
+ The best defense model in our experiments, i.e., randomization layers $^ +$ ens-adv-Inception-Resnet$\nu 2$ , was submitted to the challenge. To increase the classification accuracy, we (1) changed the resizing range from [299, 331) to [310, 331); (2) averaged the prediction results over 30 randomization patterns for each image; (3) flipped the input image with probability 0.5 for each randomization pattern.
196
+
197
+ By evaluating our model against 156 different attacks, it reaches a normalized score of 0.924 (ranked No.2 among 107 defense models), which is far better than using ensemble adversarial training (Tramer et al., 2017) alone with a normalized score of \` 0.773 (ranked No.56). This result further demonstrates that the proposed randomization method effectively make deep networks much more robust to adversarial attacks.
198
+
199
+ # 6 CONCLUSION
200
+
201
+ In this paper, we propose a randomization-based mechanism to mitigate adversarial effects. We conduct comprehensive experiments to validate the effectiveness of our defense method, using different network structures, against different attack methods, and under different attack scenarios. The experimental results show that adversarial examples rarely transfer between different randomization patterns, especially for iterative attacks. In addition, the proposed randomization layers are compatible to different network structures and adversarial defense methods, which can serve as a basic module for defense against adversarial examples. By adding the proposed randomization layers to an adversarially trained model (Tramer et al., 2017), it achieves a normalized score of \` 0.924 (ranked No.2 among 107 defense models) in the NIPS 2017 adversarial examples defense challenge, which is far better than using adversarial training alone with a normalized score of 0.773 (ranked No.56). The code is public available at https://github.com/cihangxie/NIPS2017_ adv_challenge_defense.
202
+
203
+ # ACKNOWLEDGEMENTS
204
+
205
+ This work is supported by a gift grant from SNAP Research, ONR–N00014-15-1-2356 and NSF Visual Cortex on Silicon CCF-1317560.
206
+
207
+ # REFERENCES
208
+
209
+ Battista Biggio and Pavel Laskov. Poisoning attacks against support vector machines. In International Conference on Machine Learning, 2012.
210
+
211
+ Xiaoyu Cao and Neil Zhenqiang Gong. Mitigating evasion attacks to deep neural networks via region-based classification. In Proceedings of the 33rd Annual Computer Security Applications Conference. ACM, 2017.
212
+
213
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy. IEEE, 2017.
214
+
215
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
216
+
217
+ Moustapha Cisse, Yossi Adi, Natalia Neverova, and Joseph Keshet. Houdini: Fooling deep structured prediction models. arXiv preprint arXiv:1707.05373, 2017.
218
+
219
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition. IEEE, 2009.
220
+
221
+ Reuben Feinman, Ryan R Curtin, Saurabh Shintre, and Andrew B Gardner. Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017.
222
+
223
+ Volker Fischer, Mummadi Chaithanya Kumar, Jan Hendrik Metzen, and Thomas Brox. Adversarial examples for semantic image segmentation. arXiv preprint arXiv:1703.01101, 2017.
224
+
225
+ Ross Girshick. Fast r-cnn. In International Conference on Computer Vision. IEEE, 2015.
226
+
227
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.
228
+
229
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Computer Vision and Pattern Recognition. IEEE, 2016a.
230
+
231
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision. Springer, 2016b.
232
+
233
+ Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. arXiv preprint arXiv:1703.04730, 2017.
234
+
235
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 2012.
236
+
237
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In International Conference on Learning Representations, 2017.
238
+
239
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In International Conference on Learning Representations, 2017.
240
+
241
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Computer Vision and Pattern Recognition. IEEE, 2015.
242
+
243
+ Dongyu Meng and Hao Chen. Magnet: a two-pronged defense against adversarial examples. arXiv preprint arXiv:1705.09064, 2017.
244
+
245
+ Jan Hendrik Metzen, Tim Genewein, Volker Fischer, and Bastian Bischoff. On detecting adversarial perturbations. In International Conference on Learning Representations, 2017.
246
+
247
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Computer Vision and Pattern Recognition. IEEE, 2016.
248
+
249
+ Nicolas Papernot, Ian Goodfellow, Ryan Sheatsley, Reuben Feinman, and Patrick McDaniel. cleverhans v1.0.0: an adversarial machine learning library. arXiv preprint arXiv:1610.00768, 2016a.
250
+
251
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In IEEE Symposium on Security and Privacy. IEEE, 2016b.
252
+
253
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems, 2015.
254
+
255
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
256
+
257
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014.
258
+
259
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Computer Vision and Pattern Recognition. IEEE, 2016.
260
+
261
+ Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI, 2017.
262
+
263
+ Florian Tramer, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick McDaniel. Ensemble \` adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017.
264
+
265
+ Jianyu Wang, Zhishuai Zhang, Cihang Xie, Yuyin Zhou, Vittal Premachandran, Jun Zhu, Lingxi Xie, and Alan Yuille. Visual concepts and compositional voting. arXiv preprint arXiv:1711.04451, 2017.
266
+
267
+ Cihang Xie, Jianyu Wang, Zhishuai Zhang, Yuyin Zhou, Lingxi Xie, and Alan Yuille. Adversarial Examples for Semantic Segmentation and Object Detection. In International Conference on Computer Vision. IEEE, 2017.
268
+
269
+ Zhishuai Zhang, Siyuan Qiao, Cihang Xie, Wei Shen, Bo Wang, and Alan L Yuille. Single-shot object detection with enriched semantics. arXiv preprint arXiv:1712.00433, 2017.
270
+
271
+ # APPENDIX A OTHER RANDOMIZATION METHODS
272
+
273
+ Besides random resizing and random padding, we further evaluate the effectiveness of four other randomization methods against adversarial examples. All these four methods are used as dataaugmentation during the standard network training.
274
+
275
+ • Random Brightness: a brightness factor $\delta$ is randomly picked in the interval $[ - \delta _ { \mathrm { m a x } } , \delta _ { \mathrm { m a x } } ]$ to adjust the brightness of the normalized image $\hat { X _ { n } }$ . We choose $\begin{array} { r } { \delta _ { \mathrm { m a x } } = \frac { 3 2 } { 2 5 5 } } \end{array}$ .
276
+ • Random Saturation: a saturation factor $\alpha$ is randomly picked in the interval $[ \alpha _ { l o w e r } , \alpha _ { u p p e r } ]$ to adjust the saturation of the normalized image $\hat { X _ { n } }$ . We choose $\alpha _ { l o w e r } =$ 0.5 and $\alpha _ { u p p e r } = 1 . 5$ .
277
+ • Random Hue: a hue factor $\theta$ is randomly picked in the interval $[ - \theta _ { \mathrm { m a x } } , \theta _ { \mathrm { m a x } } ]$ to adjust the hue of the normalized image ${ \hat { X _ { n } } }$ . We choose $\theta _ { \mathrm { m a x } } = 0 . 2$ .
278
+ • Random Contrast: a contrast factor $\beta$ is randomly picked in the interval $[ \beta _ { l o w e r } , \beta _ { u p p e r } ]$ to adjust the contrast of the normalized image $\hat { X _ { n } }$ . We choose $\beta _ { l o w e r } = 0 . 5$ and $\beta _ { u p p e r } = 1 . 5$ .
279
+
280
+ Note that, (1) the parameters chosen above are the same as the ones used during network training process4; (2) the pixel value of the normalized image $\hat { X _ { n } }$ are all within the interval $[ 0 , 1 ]$ , and we also use this range to clip the pixel value of the image after pre-processing.
281
+
282
+ Following the experiment setup in section 4, we first evaluate the effectiveness of each of these randomization methods on the 5000 clean images. The results are shown in the Table 7. We can see that these methods hardly hurt the performance on clean images. We further combine the proposed randomization layers, i.e., random resizing layer and random padding layer, with each of these randomization methods (denoted as $^ { 6 6 } + + ^ { 7 }$ ). We see that the combined randomization modules only cause very little accuracy drop on clean images.
283
+
284
+ Table 7: Top-1 classification accuracy on clean images. We see that these four randomization methods hardly hurt the performance on clean images. We use $^ { 6 6 } { + + ^ { 9 9 } }$ to denote the addition of the proposed randomization layers, i.e., random resizing and random padding, and the results indicate that combined models still performs pretty good on clean images.
285
+
286
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>Inception-v3</td><td rowspan=1 colspan=1>ResNet-v2-101</td><td rowspan=1 colspan=1>Inception-ResNet-v2</td><td rowspan=1 colspan=1>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1>random brightness</td><td rowspan=1 colspan=1>99.6%</td><td rowspan=1 colspan=1>99.7%</td><td rowspan=1 colspan=1>99.8%</td><td rowspan=1 colspan=1>99.8%</td></tr><tr><td rowspan=1 colspan=1>random brightness ++</td><td rowspan=1 colspan=1>98.6%</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>99.1%</td><td rowspan=1 colspan=1>99.2%</td></tr><tr><td rowspan=1 colspan=1>random saturation</td><td rowspan=1 colspan=1>99.6%</td><td rowspan=1 colspan=1>99.7%</td><td rowspan=1 colspan=1>99.9%</td><td rowspan=1 colspan=1>99.9%</td></tr><tr><td rowspan=1 colspan=1>random saturation ++</td><td rowspan=1 colspan=1>98.6%</td><td rowspan=1 colspan=1>98.3%</td><td rowspan=1 colspan=1>99.3%</td><td rowspan=1 colspan=1>99.3%</td></tr><tr><td rowspan=1 colspan=1>random hue</td><td rowspan=1 colspan=1>99.4%</td><td rowspan=1 colspan=1>99.6%</td><td rowspan=1 colspan=1>99.7%</td><td rowspan=1 colspan=1>99.4%</td></tr><tr><td rowspan=1 colspan=1>random hue ++</td><td rowspan=1 colspan=1>98.6%</td><td rowspan=1 colspan=1>98.3%</td><td rowspan=1 colspan=1>99.2%</td><td rowspan=1 colspan=1>99.1%</td></tr><tr><td rowspan=1 colspan=1>random contrast</td><td rowspan=1 colspan=1>99.5%</td><td rowspan=1 colspan=1>99.6%</td><td rowspan=1 colspan=1>99.7%</td><td rowspan=1 colspan=1>99.6%</td></tr><tr><td rowspan=1 colspan=1>random contrast ++</td><td rowspan=1 colspan=1>98.6%</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>99.3%</td><td rowspan=1 colspan=1>99.1%</td></tr></table>
287
+
288
+ We then evaluate the effectiveness of these randomization methods against the adversarial examples generated under the vanilla attack scenario. The results are shown in the Tables 8 - 11. Compared to the results in Table 2, all these four methods are much less effective than the proposed randomization layers. By combining the proposed randomization layers with each of these four randomization methods (denoted as $^ { 6 6 } { + } { + } ^ { , 9 } )$ , the performance can be slightly improved than using the proposed randomization layers alone.
289
+
290
+ Since each of these four randomization methods alone are not as effective as our proposed randomization methods against adversarial examples generated under the vanilla attack scenario, we do not further investigate their effectiveness under single-pattern attack and ensemble-pattern attack scenarios. However, combining these randomization methods with our proposed randomization layers together provides a way to build a slightly stronger defense mechanism.
291
+
292
+ Table 8: Top-1 classification accuracy by using random brightness under the vanilla attack scenario. Compared to the results in Table 2, random brightness is much less effective than the proposed randomization layers. By combing random brightness and the proposed randomization layers (denoted as random brightness $^ { + + }$ ), it reaches slightly better performance than using the proposed randomization layers alone.
293
+
294
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>randombright-ness</td><td rowspan=1 colspan=1>randombright-ness++</td><td rowspan=1 colspan=1>randombright-ness</td><td rowspan=1 colspan=1>randombright-ness++</td><td rowspan=1 colspan=1>randombright-ness</td><td rowspan=1 colspan=1>randombright-ness++</td><td rowspan=1 colspan=1>randombright-ness</td><td rowspan=1 colspan=1>randombright-ness++</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>34.9%</td><td rowspan=1 colspan=1>67.0%</td><td rowspan=1 colspan=1>28.5%</td><td rowspan=1 colspan=1>73.5%</td><td rowspan=1 colspan=1>66.4%</td><td rowspan=1 colspan=1>81.3%</td><td rowspan=1 colspan=1>85.0%</td><td rowspan=1 colspan=1>95.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>31.9%</td><td rowspan=1 colspan=1>55.5%</td><td rowspan=1 colspan=1>21.6%</td><td rowspan=1 colspan=1>55.7%</td><td rowspan=1 colspan=1>62.4%</td><td rowspan=1 colspan=1>74.7%</td><td rowspan=1 colspan=1>87.6%</td><td rowspan=1 colspan=1>95.0%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>33.2%</td><td rowspan=1 colspan=1>52.9%</td><td rowspan=1 colspan=1>20.9%</td><td rowspan=1 colspan=1>47.2%</td><td rowspan=1 colspan=1>61.8%</td><td rowspan=1 colspan=1>71.5%</td><td rowspan=1 colspan=1>90.4%</td><td rowspan=1 colspan=1>94.5%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>79.4%</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>82.3%</td><td rowspan=1 colspan=1>97.5%</td><td rowspan=1 colspan=1>62.8%</td><td rowspan=1 colspan=1>98.3%</td><td rowspan=1 colspan=1>79.0%</td><td rowspan=1 colspan=1>99.1%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>34.5%</td><td rowspan=1 colspan=1>96.9%</td><td rowspan=1 colspan=1>47.7%</td><td rowspan=1 colspan=1>97.2%</td><td rowspan=1 colspan=1>51.3%</td><td rowspan=1 colspan=1>98.0%</td><td rowspan=1 colspan=1>42.3%</td><td rowspan=1 colspan=1>98.6%</td></tr></table>
295
+
296
+ Table 9: Top-1 classification accuracy by using random saturation under the vanilla attack scenario. Compared to the results in Table 2, random saturation is much less effective than the proposed randomization layers. By combing random saturation and the proposed randomization layers (denoted as random saturation $^ { + + }$ ), it reaches slightly better performance than using the proposed randomization layers alone.
297
+
298
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=2 colspan=1></td><td rowspan=2 colspan=1>randomsatura-tion</td><td rowspan=2 colspan=1>randomsatura-tion++</td><td rowspan=1 colspan=1>random</td><td rowspan=1 colspan=1>random</td><td rowspan=1 colspan=1>random</td><td rowspan=2 colspan=1>random satura-tion++</td><td rowspan=2 colspan=1>randomsatura-tion</td><td rowspan=2 colspan=1>random satura-tion++</td></tr><tr><td rowspan=1 colspan=1>satura-tion</td><td rowspan=1 colspan=1>satura-tion++</td><td rowspan=1 colspan=1>satura-tion</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>34.2%</td><td rowspan=1 colspan=1>66.5%</td><td rowspan=1 colspan=1>27.9%</td><td rowspan=1 colspan=1>73.6%</td><td rowspan=1 colspan=1>66.3%</td><td rowspan=1 colspan=1>81.5%</td><td rowspan=1 colspan=1>85.2%</td><td rowspan=1 colspan=1>95.7%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>31.8%</td><td rowspan=1 colspan=1>55.2%</td><td rowspan=1 colspan=1>21.1%</td><td rowspan=1 colspan=1>55.7%</td><td rowspan=1 colspan=1>62.1%</td><td rowspan=1 colspan=1>74.6%</td><td rowspan=1 colspan=1>87.0%</td><td rowspan=1 colspan=1>95.0%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>33.5%</td><td rowspan=1 colspan=1>52.2%</td><td rowspan=1 colspan=1>20.7%</td><td rowspan=1 colspan=1>46.5%</td><td rowspan=1 colspan=1>61.7%</td><td rowspan=1 colspan=1>71.4%</td><td rowspan=1 colspan=1>90.1%</td><td rowspan=1 colspan=1>93.9%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>82.6%</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>79.6%</td><td rowspan=1 colspan=1>97.6%</td><td rowspan=1 colspan=1>64.7%</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>78.5%</td><td rowspan=1 colspan=1>99.0%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>39.2%</td><td rowspan=1 colspan=1>97.2%</td><td rowspan=1 colspan=1>47.5%</td><td rowspan=1 colspan=1>96.9%</td><td rowspan=1 colspan=1>51.7%</td><td rowspan=1 colspan=1>97.7%</td><td rowspan=1 colspan=1>50.9%</td><td rowspan=1 colspan=1>99.1%</td></tr></table>
299
+
300
+ Table 10: Top-1 classification accuracy by using random hue under the vanilla attack scenario. Compared to the results in Table 2, random hue is much less effective than the proposed randomization layers. By combing random hue and the proposed randomization layers (denoted as random $\mathbf { h u e + + }$ ), it reaches slightly better performance than using the proposed randomization layers alone.
301
+
302
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>randomhue</td><td rowspan=1 colspan=1>randomhue++</td><td rowspan=1 colspan=1>randomhue</td><td rowspan=1 colspan=1>randomhue++</td><td rowspan=1 colspan=1>randomhue</td><td rowspan=1 colspan=1>randomhue++</td><td rowspan=1 colspan=1>randomhue</td><td rowspan=1 colspan=1>randomhue++</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>38.1%</td><td rowspan=1 colspan=1>69.0%</td><td rowspan=1 colspan=1>32.0%</td><td rowspan=1 colspan=1>74.9%</td><td rowspan=1 colspan=1>68.6%</td><td rowspan=1 colspan=1>83.0%</td><td rowspan=1 colspan=1>87.4%</td><td rowspan=1 colspan=1>95.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>33.9%</td><td rowspan=1 colspan=1>57.2%</td><td rowspan=1 colspan=1>23.0%</td><td rowspan=1 colspan=1>57.6%</td><td rowspan=1 colspan=1>64.0%</td><td rowspan=1 colspan=1>76.1%</td><td rowspan=1 colspan=1>86.7%</td><td rowspan=1 colspan=1>93.9%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>36.4%</td><td rowspan=1 colspan=1>54.2%</td><td rowspan=1 colspan=1>22.1%</td><td rowspan=1 colspan=1>48.4%</td><td rowspan=1 colspan=1>63.0%</td><td rowspan=1 colspan=1>72.5%</td><td rowspan=1 colspan=1>88.0%</td><td rowspan=1 colspan=1>91.3%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>95.0%</td><td rowspan=1 colspan=1>97.9%</td><td rowspan=1 colspan=1>91.2%</td><td rowspan=1 colspan=1>97.6%</td><td rowspan=1 colspan=1>86.5%</td><td rowspan=1 colspan=1>98.4%</td><td rowspan=1 colspan=1>96.8%</td><td rowspan=1 colspan=1>99.1%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>72.1%</td><td rowspan=1 colspan=1>97.3%</td><td rowspan=1 colspan=1>74.0%</td><td rowspan=1 colspan=1>97.0%</td><td rowspan=1 colspan=1>77.4%</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>81.1%</td><td rowspan=1 colspan=1>98.8%</td></tr></table>
303
+
304
+ Table 11: Top-1 classification accuracy by using random contrast under the vanilla attack scenario. Compared to the results in Table 2, random contrast is much less effective than the proposed randomization layers. By combing random contrast and the proposed randomization layers (denoted as random contrast $^ { + + }$ ), it reaches slightly better performance than using the proposed randomization layers alone.
305
+
306
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=2>Inception-v3</td><td rowspan=1 colspan=2>ResNet-v2-101</td><td rowspan=1 colspan=2>Inception-ResNet-v2</td><td rowspan=1 colspan=2>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>randomcon-trast</td><td rowspan=1 colspan=1>randomcon-trast++</td><td rowspan=1 colspan=1>randomcon-trast</td><td rowspan=1 colspan=1>randomcon-trast++</td><td rowspan=1 colspan=1>randomcon-trast</td><td rowspan=1 colspan=1>randomcon-trast++</td><td rowspan=1 colspan=1>randomcon-trast</td><td rowspan=1 colspan=1>randomcon-trast++</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>37.0%</td><td rowspan=1 colspan=1>68.0%</td><td rowspan=1 colspan=1>29.4%</td><td rowspan=1 colspan=1>74.1%</td><td rowspan=1 colspan=1>67.2%</td><td rowspan=1 colspan=1>82.5%</td><td rowspan=1 colspan=1>85.9%</td><td rowspan=1 colspan=1>96.0%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>32.7%</td><td rowspan=1 colspan=1>56.3%</td><td rowspan=1 colspan=1>22.7%</td><td rowspan=1 colspan=1>57.0%</td><td rowspan=1 colspan=1>63.1%</td><td rowspan=1 colspan=1>74.9%</td><td rowspan=1 colspan=1>88.1%</td><td rowspan=1 colspan=1>94.9%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>34.4%</td><td rowspan=1 colspan=1>53.5%</td><td rowspan=1 colspan=1>21.2%</td><td rowspan=1 colspan=1>47.0%</td><td rowspan=1 colspan=1>62.1%</td><td rowspan=1 colspan=1>72.0%</td><td rowspan=1 colspan=1>90.6%</td><td rowspan=1 colspan=1>94.3%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>90.4%</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>87.5%</td><td rowspan=1 colspan=1>97.5%</td><td rowspan=1 colspan=1>73.8%</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>90.8%</td><td rowspan=1 colspan=1>99.0%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>56.8%</td><td rowspan=1 colspan=1>97.0%</td><td rowspan=1 colspan=1>57.1%</td><td rowspan=1 colspan=1>96.7%</td><td rowspan=1 colspan=1>63.7%</td><td rowspan=1 colspan=1>97.9%</td><td rowspan=1 colspan=1>67.6%</td><td rowspan=1 colspan=1>98.8%</td></tr></table>
307
+
308
+ # APPENDIX B RANDOMIZATION LAYERS WITH SMALLER SIZE
309
+
310
+ Instead of resizing the input image to a larger size, we here resize the input image to a smaller size, i.e., the resizing parameter is randomly sampled from the range [267, 299). The random padding layer then pads the resized image to the shape of $2 9 9 \times 2 9 9 \times 3$ in a random manner. Note that, the random resizing layer and the random padding layer here have the same freedom as the ones used in the paper, i.e., they create the same number, 12528, of different patterns for a single image. We evaluate the effectiveness of this parameter setting on both the 5000 clean images and the adversarial examples generated under the vanilla attack scenario. The results are shown in the Table 12. We see that randomization layers still work well with smaller size images, but is slightly worse than using larger size images as in the paper. This is because resizing to a smaller size loses certain information of the original image.
311
+
312
+ Table 12: Top-1 classification accuracy on the clean images and the adversarial examples generated under the vanilla attack scenario. Compared to the results in Tables 1 and 2, randomization parameters applied here (i.e., resize between [267, 299), and pad to $2 9 9 \times 2 9 9 \times 3 )$ ) is slightly worse than the randomization parameters applied in the paper (i.e., resize between [299, 331), and pad to $3 3 1 \times 3 3 1 \times 3 )$ .
313
+
314
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>Inception-v3</td><td rowspan=1 colspan=1>ResNet-v2-101</td><td rowspan=1 colspan=1>Inception-ResNet-v2</td><td rowspan=1 colspan=1>ens-adv-Inception-ResNet-v2</td></tr><tr><td rowspan=1 colspan=1>clean images</td><td rowspan=1 colspan=1>98.2%</td><td rowspan=1 colspan=1>97.5%</td><td rowspan=1 colspan=1>99.1%</td><td rowspan=1 colspan=1>98.7%</td></tr><tr><td rowspan=1 colspan=1>FGSM-2</td><td rowspan=1 colspan=1>63.1%</td><td rowspan=1 colspan=1>65.0%</td><td rowspan=1 colspan=1>79.9%</td><td rowspan=1 colspan=1>95.0%</td></tr><tr><td rowspan=1 colspan=1>FGSM-5</td><td rowspan=1 colspan=1>53.4%</td><td rowspan=1 colspan=1>48.3%</td><td rowspan=1 colspan=1>73.3%</td><td rowspan=1 colspan=1>94.0%</td></tr><tr><td rowspan=1 colspan=1>FGSM-10</td><td rowspan=1 colspan=1>50.8%</td><td rowspan=1 colspan=1>40.5%</td><td rowspan=1 colspan=1>70.6%</td><td rowspan=1 colspan=1>93.4%</td></tr><tr><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>97.2%</td><td rowspan=1 colspan=1>96.5%</td><td rowspan=1 colspan=1>96.0%</td><td rowspan=1 colspan=1>98.6%</td></tr><tr><td rowspan=1 colspan=1>C&amp;W</td><td rowspan=1 colspan=1>95.2%</td><td rowspan=1 colspan=1>95.2%</td><td rowspan=1 colspan=1>97.2%</td><td rowspan=1 colspan=1>97.8%</td></tr></table>
315
+
316
+ # APPENDIX C RANDOMIZATION LAYERS WITH MULTIPLE ITERATIONS
317
+
318
+ In this section, we show the relationship between the top-1 accuracy of the defense model and the iteration number performed on each image. Specifically, we choose ens-adv-Inception-ResNet- $\nu 2 +$ randomization layers as the defense model for the experiment. The same trend can be observed for other defense models.
319
+
320
+ For the defense model, the iteration number is chosen to be $\{ 1 , 5 , 1 0 , 2 0 , 3 0 \}$ , and it is evaluated on the 5000 clean test images and the adversarial examples generated under all three attack scenarios. The results are shown in the Figures 3 - 5. We can observe that (1) increasing the number of iteration can slightly improve the top-1 classification accuracy of the defense model on clean images and adversarial examples generated under both the vanilla attack and the single-pattern attack scenarios; (2) increasing the number of iteration has nearly no improvement for the top-1 classification accuracy of the defense model on adversarial examples generated by single-step attacks under the ensemble-pattern attack scenario; (3) increasing the number of iteration can improve the top-1 classification accuracy of the defense model on adversarial examples generated by iterative attacks under the ensemble-pattern attack scenario.
321
+
322
+ ![](images/a25aa63356ef141cc900583f46c838547d3cb72eeae8c3fce9b665da139db3ec.jpg)
323
+ Figure 3: Top-1 classification accuracy on the clean images and the adversarial examples generated under the vanilla attack scenrio.
324
+
325
+ ![](images/0cf83e4d60ebaeaa48670a3eae350647157c26303fc23d006fea2afbff49f186.jpg)
326
+ Figure 4: Top-1 classification accuracy on the adversarial examples generated under the single-pattern attack scenrio.
327
+
328
+ ![](images/49c765887d9ca814549732caf7e88c202b46e49cbcf0f3ce57891fd62a33e450.jpg)
329
+ Figure 5: Top-1 classification accuracy on the adversarial examples generated under the ensemble-pattern attack scenrio.
md/train/SkaPsfZ0W/SkaPsfZ0W.md ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NETWORK OF GRAPH CONVOLUTIONAL NETWORKS TRAINED ON RANDOM WALKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Graph Convolutional Networks (GCNs) are a recently proposed architecture which has had success in semi-supervised learning on graph-structured data. At the same time, unsupervised learning of graph embeddings has benefited from the information contained in random walks. In this paper we propose a model, Network of GCNs (N-GCN), which marries these two lines of work. At its core, N-GCN trains multiple instances of GCNs over node pairs discovered at different distances in random walks, and learns a combination of the instance outputs which optimizes the classification objective. Our experiments show that our proposed NGCN model achieves state-of-the-art performance on all of the challenging node classification tasks we consider: Cora, Citeseer, Pubmed, and PPI. In addition, our proposed method has other desirable properties, including generalization to recently proposed semi-supervised learning methods such as GraphSAGE, allowing us to propose N-SAGE, and resilience to adversarial input perturbations.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Semi-supervised learning on graphs is important in many real-world applications, where the goal is to recover labels for all nodes given only a fraction of labeled ones. Some applications include social networks, where one wishes to predict user interests, or in health care, where one wishes to predict whether a patient should be screened for cancer. In many such cases, collecting node labels can be prohibitive. However, edges between nodes can be easier to obtain, either using an explicit graph (e.g. social network) or implicitly by calculating pairwise similarities (e.g. using a patient-patient similarity kernel, Merdan et al., 2017).
12
+
13
+ Convolutional Neural Networks (LeCun et al., 1998) learn location-invariant hierarchical filters, enabling significant improvements on Computer Vision tasks (Krizhevsky et al., 2012; Szegedy et al., 2015; He et al., 2016). This success has motivated researchers (Bruna et al., 2014) to extend convolutions from spatial (i.e. regular lattice) domains to graph-structured (i.e. irregular) domains, yielding a class of algorithms known as Graph Convolutional Networks (GCNs).
14
+
15
+ Formally, we are interested in semi-supervised learning where we are given a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ with $N = | \nu |$ nodes; adjacency matrix $A$ ; and matrix $\mathbf { \Psi } _ { X } \in \mathbb { R } ^ { N \times F }$ of node features. Labels for only a subset of nodes $\nu _ { L } \subset \nu$ observed. In general, $| \mathcal { V } _ { L } | \ll | \mathcal { V } |$ . Our goal is to recover labels for all unlabeled nodes $\mathcal { V } _ { U } = \mathcal { V } - \mathcal { V } _ { L }$ , using the feature matrix $X$ , the known labels for nodes in $\gamma _ { L }$ , and the graph $G$ . In this setting, one treats the graph as the “unsupervised” and labels of $\gamma _ { L }$ as the “supervised” portions of the data.
16
+
17
+ Depicted in Figure 1, our model for semi-supervised node classification builds on the GCN module proposed by Kipf & Welling (2017), which operates on the normalized adjacency matrix $\hat { A }$ , as in $\mathrm { G C N } ( { \hat { A } } )$ , where $\hat { A } = D ^ { - \frac { 1 } { 2 } } A D ^ { - \frac { 1 } { 2 } }$ , and $D$ is diagonal matrix of node degrees. Our proposed extension of GCNs is inspired by the recent advancements in random walk based graph embeddings (e.g. Perozzi et al., 2014; Grover & Leskovec, 2016; Abu-El-Haija et al., 2017). We make a Network of GCN modules (N-GCN), feeding each module a different power of $\hat { A }$ , as in $\{ \mathrm { G C N } ( \hat { A } ^ { 0 } ) , \mathrm { G C N } ( \hat { A } ^ { 1 } ) , \mathrm { G C N } ( \hat { A } ^ { 2 } ) , \dots \}$ . The $k$ -th power contains statistics from the $k$ -th step of a random walk on the graph. Therefore, our N-GCN model is able to combine information from various step-sizes. We then combine the output of all GCN modules into a classification sub-network, and we jointly train all GCN modules and the classification sub-network on the upstream objective, semi-supervised node classification. Weights of the classification sub-network give us insight on how the N-GCN model works. For instance, in the presence of input perturbations, we observe that the classification sub-network weights shift towards GCN modules utilizing higher powers of the adjacency matrix, effectively widening the “receptive field” of the (spectral) convolutional filters. We achieve state-of-the-art on several semi-supervised graph learning tasks, showing that explicit random walks enhance the representational power of vanilla GCN’s.
18
+
19
+ ![](images/991a2af6381889f75b8a8cb0aa21827ce958d82a66b177e0ba94be2399ff1a67.jpg)
20
+ Figure 1: Left: Model architecture, where $\hat { A }$ is the normalized normalized adjacency matrix, $I$ is the identity matrix, $X$ is node features matrix, and $\times$ is matrix-matrix multiply operator. We calculate $K$ powers of the $\hat { A }$ , feeding each power into $r$ GCNs, along with $X$ . The output of all $K \times r$ GCNs can be concatenated along the column dimension, then fed into fully-connected layers, outputting $C$ channels per node, where $C$ is size of label space. We calculate cross entropy error, between rows prediction $N \times C$ with known labels, and use them to update parameters of classification subnetwork and all GCNs. Right: pre-relu activations after the first fully-connected layer of a 2-layer classification sub-network. Activations are PCA-ed to 50 dimensions then visualized using t-SNE.
21
+
22
+ The rest of this paper is organized as follows. Section 2 reviews background work that provides the foundation for this paper. In Section 3, we describe our proposed method, followed by experimental evaluation in Section 4. We compare our work with recent closely-related methods in Section 5. Finally, we conclude with our contributions and future work in Section 6.
23
+
24
+ # 2 BACKGROUND
25
+
26
+ # 2.1 SEMI-SUPERVISED NODE CLASSIFICATION
27
+
28
+ Traditional label propagation algorithms (Weston et al., 2012; Belkin et al., 2006a) learn a model that transforms node features into node labels and uses the graph to add a regularizer term:
29
+
30
+ $$
31
+ \mathcal { L } _ { \mathrm { l a b e l . p r o p a g a t i o n } } = \mathcal { L } _ { \mathrm { c l a s s i f i c a t i o n } } + \mathcal { L } _ { r e g } = \mathcal { L } _ { \mathrm { c l a s s i f i c a t i o n } } + \lambda f ( X ) ^ { T } \Delta f ( X ) ,
32
+ $$
33
+
34
+ where $f : \mathbb { R } ^ { N \times d _ { 0 } } \to \mathbb { R } ^ { N \times C }$ is the model, $\Delta$ is the graph Laplacian, and $\lambda \in \mathbb { R }$ is the regularization coefficient hyperparameter.
35
+
36
+ # 2.2 GRAPH CONVOLUTIONAL NETWORKS
37
+
38
+ Graph Convolution (Bruna et al., 2014) generalizes convolution from Euclidean domains to graphstructured data. Convolving a “filter” over a signal on graph nodes can be calculated by transforming both the filter and the signal to the Fourier domain, multiplying them, and then transforming the result back into the discrete domain. The signal transform is achieved by multiplying with the eigenvectors of the graph Laplacian. The transformation requires a quadratic eigendecomposition of the symmetric Laplacian; however, the low-rank approximation of the eigendecomposition can be calculated using truncated Chebyshev polynomials (Hammond et al., 2011). For instance, Kipf &
39
+
40
+ Welling (2017) calculates a rank-1 approximation of the decomposition. They propose a multi-layer Graph Convolutional Networks (GCNs) for semi-supervised graph learning. Every layer computes the transformation:
41
+
42
+ $$
43
+ H ^ { ( l + 1 ) } = \sigma \left( \hat { A } H ^ { ( l ) } W ^ { ( l ) } \right) ,
44
+ $$
45
+
46
+ where $H ^ { ( l ) } \in \mathbb { R } ^ { N \times d _ { l } }$ is the input activation matrix to the $l$ -th hidden layer with row $H _ { i } ^ { ( l ) }$ containing a $d _ { l }$ -dimensional feature vector for vertex $i \in \mathcal V$ , and $W ^ { ( l ) } \in \mathbb { R } ^ { d _ { l } \times d _ { l + 1 } }$ is the layer’s trainable weights. The first hidden layer $H ^ { ( 0 ) }$ is set to the input features $X$ . A softmax on the last layer is used to classify labels. All layers use the same “normalized adjacency” $\hat { A }$ , obtained by the “renormalization trick” utilized by Kipf & Welling (2017), as $\hat { A } = D ^ { - \frac { 1 } { 2 } } A D ^ { - \frac { 1 } { 2 } }$ . 1
47
+
48
+ Eq. (2) is a first order approximation of convolving filter $W ^ { ( l ) }$ over signal $H ^ { ( l ) }$ (Hammond et al., 2011; Kipf & Welling, 2017). The left-multiplication with $\hat { A }$ averages node features with their direct neighbors; this signal is then passed through a non-linearity function $\sigma ( \cdot )$ (e.g, $\begin{array} { r l } { \operatorname { R e L U } ( z ) = } \end{array}$ $\operatorname* { m a x } ( 0 , z ) { \bar { ) } }$ . Successive layers effectively diffuse signals from nodes to neighbors.
49
+
50
+ Two-layer GCN model can be defined in terms of vertex features $X$ and normalized adjacency $\hat { A }$ as:
51
+
52
+ $$
53
+ \mathrm { { G C N } } _ { 2 - \mathrm { l a y e r } } ( \hat { A } , X ; \theta ) = \mathrm { s o f t m a x } \left( \hat { A } \sigma ( \hat { A } X W ^ { ( 0 ) } ) W ^ { ( 1 ) } \right) ,
54
+ $$
55
+
56
+ where the GCN parameters $\theta = \left\{ W ^ { ( 0 ) } , W ^ { ( 1 ) } \right\}$ are trained to minimize the cross-entropy error over labeled examples. The output of the GCN model is a matrix $\mathbb { R } ^ { N \times C }$ , where $N$ is the number of nodes and $C$ is the number of labels. Each row contains the label scores for one node, assuming there are $C$ classes.
57
+
58
+ # 2.3 GRAPH EMBEDDINGS
59
+
60
+ Node Embedding methods represent graph nodes in a continuous vector space. They learn a dictionary $Z ~ \in ~ \mathbb { R } ^ { \breve { N } \times d }$ , with one $d$ -dimensional embedding per node. Traditional methods use the adjacency matrix to learn embeddings. For example, Eigenmaps (Belkin & Niyogi, 2003) calculates the following constrained optimization:
61
+
62
+ $$
63
+ \sum _ { i , j } | | A _ { i j } ( Z _ { i } - Z _ { J } ) | | \mathrm { ~ s . t . ~ } Z ^ { T } D Z = I ,
64
+ $$
65
+
66
+ where $I$ is identity vector. Skipgram models on text corpora (Mikolov et al., 2013) inspired modern graph embedding methods, which simulate random walks to learn node embeddings (Perozzi et al., 2014; Grover & Leskovec, 2016). Each random walk generates a sequence of nodes. Sequences are converted to textual paragraphs, and are passed to a word2vec-style embedding learning algorithm (Mikolov et al., 2013). As shown in Abu-El-Haija et al. (2017), this learning-by-simulation is equivalent, in expectation, to the decomposition of a random walk co-occurrence statistics matrix $\mathcal { D }$ . The expectation on $\mathcal { D }$ can be written as:
67
+
68
+ $$
69
+ \begin{array} { r } { \mathbb { E } [ \mathcal { D } ] \propto \mathbb { E } _ { q \sim \mathcal { Q } } \left[ ( \mathcal { T } ) ^ { q } \right] = \mathbb { E } _ { q \sim \mathcal { Q } } \left[ \left( D ^ { - 1 } A \right) ^ { q } \right] , } \end{array}
70
+ $$
71
+
72
+ where ${ \mathcal { T } } = D ^ { - 1 } A$ is the row-normalized transition matrix (a.k.a right-stochastic adjacency matrix), and $\mathcal { Q }$ is a “context distribution” that is determined by random walk hyperparameters, such as the length of the random walk. The expectation therefore weights the importance of one node on another as a function of how well-connected they are, and the distance between them. The main difference between traditional node embedding methods and random walk methods is the optimization criteria: the former minimizes a loss on representing the adjacency matrix $A$ (see Eq. 4), while the latter minimizes a loss on representing random walk co-occurrence statistics $\mathcal { D }$ .
73
+
74
+ # 3 OUR METHOD
75
+
76
+ # 3.1 MOTIVATION
77
+
78
+ Graph Convolutional Networks and random walk graph embeddings are individually powerful. Kipf & Welling (2017) uses GCNs for semi-supervised node classification. Instead of following traditional methods that use the graph for regularization (e.g. Eq. 4), Kipf & Welling (2017) use the adjacency matrix for training and inference, effectively diffusing information across edges at all GCN layers (see Eq. 6). Separately, recent work has showed that random walk statistics can be very powerful for learning an unsupervised representation of nodes that can preserve the structure of the graph (Perozzi et al., 2014; Grover & Leskovec, 2016; Abu-El-Haija et al., 2017).
79
+
80
+ Under special conditions, it is possible for the GCN model to learn random walks. In particular, consider a two-layer GCN defined in Eq. 6 with the assumption that first-layer activation is identity as $\sigma ( z ) = z$ , and weight $W ^ { ( 0 ) }$ is an identity matrix (either explicitly set or learned to satisfy the upstream objective). Under these two identity conditions, the model reduces to:
81
+
82
+ $$
83
+ \mathbf { G C N _ { 2 \mathrm { - } \mathrm { l a y e r - s p e c i a l } } } ( \hat { A } , X ) = \mathrm { s o f t m a x } \left( \hat { A } \hat { A } X W ^ { ( 1 ) } \right) = \mathrm { s o f t m a x } \left( \hat { A } ^ { 2 } X W ^ { ( 1 ) } \right) ,
84
+ $$
85
+
86
+ where $\hat { A } ^ { 2 }$ can be expanded as:
87
+
88
+ $$
89
+ \hat { A } ^ { 2 } = \left( D ^ { - \frac { 1 } { 2 } } A D ^ { - \frac { 1 } { 2 } } \right) \left( D ^ { - \frac { 1 } { 2 } } A D ^ { - \frac { 1 } { 2 } } \right) = D ^ { - \frac { 1 } { 2 } } A \left[ D ^ { - 1 } A \right] D ^ { - \frac { 1 } { 2 } } = D ^ { - \frac { 1 } { 2 } } A T D ^ { - \frac { 1 } { 2 } } .
90
+ $$
91
+
92
+ By multiplying the adjacency $A$ with the transition matrix $\tau$ before normalization, the GCN is effectively doing a one-step random walk.
93
+
94
+ # 3.2 EXPLICIT RANDOM WALKS
95
+
96
+ The special conditions described above are not true in practice. Although stacking hidden GCN layers allows information to flow through graph edges, this flow is indirect as the information goes through feature reduction (matrix multiplication) and a non-linearity (activation function $\sigma ( \cdot ) _ { . } ^ { . }$ ). Therefore, the vanilla GCN cannot directly learn high powers of $\hat { A }$ , and could struggle with modeling information across distant nodes. We hypothesize that making the GCN directly operate on random walk statistics will allow the network to better utilize information across distant nodes, in the same way that node embedding methods (e.g. DeepWalk, Perozzi et al. (2014)) operating on $\mathcal { D }$ are superior to traditional embedding methods operating on the adjacency matrix (e.g. Eigenmaps, Belkin & Niyogi (2003)). Therefore, in addition to feeding only $\hat { A }$ to the GCN model as proposed by Kipf & Welling (2017) (see Eq. 6), we propose to feed a $K$ -degree polynomial of $\hat { A }$ to $K$ instantiations of GCN. Generalizing Eq. (7) gives:
97
+
98
+ $$
99
+ \hat { A } ^ { k } = D ^ { - \frac { 1 } { 2 } } A \mathcal { T } ^ { k - 1 } D ^ { - \frac { 1 } { 2 } } .
100
+ $$
101
+
102
+ We also define $\hat { A } ^ { 0 }$ to be the identity matrix. Similar to Kipf $\&$ Welling (2017), we add selfconnections and convert directed graphs to undirected ones, making $\hat { A }$ and hence $\hat { A } ^ { k }$ symmetric matrices. The eigendecomposition of symmetric matrices is real. Therefore, the low-rank approximation of the eigendecomposition Hammond et al. (2011) is still valid, and a one layer of Kipf & Welling (2017) utilizing $\hat { A } ^ { k }$ should still approximate multiplication in the Fourier domain.
103
+
104
+ # 3.3 NETWORK OF GCNS
105
+
106
+ Consider $K$ instantiations of $\{ \mathbf { G C N } ( \hat { A } ^ { 0 } , X ) , \mathbf { G C N } ( \hat { A } ^ { 1 } , X ) , \ldots , \mathbf { G C N } ( \hat { A } ^ { K - 1 } , X ) \}$ . Each GCN outputs a matrix $\mathbb { R } ^ { N \times C _ { k } }$ , where the $v$ -th row describes a latent representation of that particular GCN for node $v \in \mathcal V$ , and where $C _ { k }$ is the latent dimensionality. Though $C _ { k }$ can be different for each GCN, we set all $C _ { k }$ to be the same for simplicity. We then combine the output of all $K$ GCN and feed them into a classification sub-network, allowing us to jointly train all GCNs and the classification sub-network via backpropagation. This should allow the classification sub-network to choose features from the various GCNs, effectively allowing the overall model to learn a combination of features using the raw (normalized) adjacency, different steps of random walks, and the input features $X$ (as they are multiplied by identity $\hat { A } ^ { 0 }$ ).
107
+
108
+ # 3.3.1 FULLY-CONNECTED CLASSIFICATION NETWORK
109
+
110
+ From a deep learning prospective, it is intuitive to represent the classification network as a fullyconnected layer. We can concatenate the output of the $K$ GCNs along the column dimension, i.e. concatenating all $\mathrm { G C N } ( X , { \hat { A } } ^ { k } )$ , each $\mathbf { \Sigma } \in \mathbb { R } ^ { N \times C _ { k } }$ into matrix $\mathbf { \Psi } \in \mathbb { R } ^ { N \times C _ { K } }$ where $\begin{array} { r } { C _ { K } \ = \ \sum _ { k } C _ { k } } \end{array}$
111
+
112
+ We add a fully-connected layer $f _ { \mathrm { f c } } ~ \colon ~ \mathbb { R } ^ { N \times C _ { K } } \ \to ~ \mathbb { R } ^ { N \times C }$ , with trainable parameter matrix $W _ { \mathrm { f c } } \in$ $\mathbb { R } ^ { C _ { K } \times C }$ , written as:
113
+
114
+ $\operatorname { N - G C N } _ { \mathrm { f c } } ( \hat { A } , A ; W _ { \mathrm { f c } } , \theta ) = \operatorname { s o f t m a x } \left( \left[ \begin{array} { l } \operatorname { G C N } ( \hat { A } ^ { 0 } , X ; \theta ^ { ( 0 ) } ) \enspace ; \enspace \operatorname { G C N } ( \hat { A } ^ { 1 } , X ; \theta ^ { ( 1 ) } ) \enspace ; \enspace \dots \enspace \right] W _ { \mathrm { f c } } \right) . \end{array}$ (9) The classifier parameters $W _ { \mathrm { f c } }$ are jointly trained with GCN parameters $\theta = \{ \theta ^ { ( 0 ) } , \theta ^ { ( 1 ) } , \dots \}$ . We use subscript fc on N-GCN to indicate the classification network is a fully-connected layer.
115
+
116
+ # 3.3.2 ATTENTION CLASSIFICATION NETWORK
117
+
118
+ We also propose a classification network based on “softmax attention”, which learns a convex combination of the GCN instantiations. Our attention model $\left( \mathrm { { N - G C N _ { a } } } \right)$ is parametrized by vector $\widetilde { m } \in \mathbb { R } ^ { K }$ , one scalar for each GCN. It can be written as:
119
+
120
+ $$
121
+ \mathrm { N } \mathrm { - } \mathrm { G C N } _ { \mathrm { a } } ( \hat { A } , X ; m , \theta ) = \sum _ { k } m _ { k } \mathrm { G C N } ( \hat { A } ^ { k } , X ; \theta ^ { ( k ) } )
122
+ $$
123
+
124
+ where $m$ is output of a softmax: $m = \mathrm { s o f t m a x } ( \widetilde { m } )$ .
125
+
126
+ This softmax attention is similar to “Mixture of Experts” model, especially if we set the number of output channels for all GCNs equal to the number of classes, as in $C _ { 0 } = C _ { 1 } = \cdot \cdot \cdot = C$ . This allows us to add cross entropy loss terms on all GCN outputs in addition to the loss applied at the output NGCN, forcing all GCN’s to be independently useful. It is possible to set the $m \in \mathbb { R } ^ { K }$ parameter vector “by hand” using the validation split, especially for reasonable $K$ such as $K \leq 6$ . One possible choice might be setting $m _ { 0 }$ to some small value and remaining $m _ { 1 } , \ldots , m _ { K - 1 }$ to the harmonic series $\frac { 1 } { k }$ ; another choice may be linear decay $\frac { K - k } { K - 1 }$ . These are respectively similar to the context distributions of GloVe (Pennington et al., 2014) and word2vec (Mikolov et al., 2013; Levy et al., 2015). We note that if on average a node’s information is captured by its direct or nearby neighbors, then the output of GCNs consuming lower powers of $\hat { A }$ should be weighted highly.
127
+
128
+ # 3.4 TRAINING
129
+
130
+ We minimize the cross entropy between our model output and the known training labels $Y$ as:
131
+
132
+ $$
133
+ \operatorname* { m i n } \mathrm { d i a g } ( \mathcal { V } _ { L } ) \left[ Y \circ \log \mathrm { N - G C N } ( X , \hat { A } ) \right] ,
134
+ $$
135
+
136
+ where $\circ$ is Hadamard product, and $\mathrm { d i a g } ( \mathcal { V } _ { L } )$ denotes a diagonal matrix, with entry at $( i , i )$ set to 1 if $i \in \mathcal { V } _ { L }$ and 0 otherwise. In addition, we can apply intermediate supervision for the $\mathrm { N G C N _ { a } }$ to attempt make all GCN become independently useful, yielding minimization objective:
137
+
138
+ $$
139
+ \operatorname* { m i n } _ { m , \theta } \mathrm { d i a g } ( \mathcal { V } _ { L } ) \left[ Y \circ \log \mathrm { N } \mathrm { - } \mathbf { G } \mathbf { C } \mathrm { N } _ { \mathrm { a } } ( \hat { A } , X ; m , \theta ) + \sum _ { k } Y \circ \log \mathbf { G } \mathbf { C } \mathrm { N } ( \hat { A } ^ { k } , X ; \theta ^ { ( k ) } ) \right] .
140
+ $$
141
+
142
+ # 3.5 GCN REPLICATION
143
+
144
+ To simplify notation, our N-GCN derivations (e.g. Eq. 9) assume that there is one GCN per $\hat { A }$ power. However, our implementation feeds every $\hat { A }$ to $r$ GCN modules, as shown in Fig. 1.
145
+
146
+ # 3.6 GENERALIZATION TO OTHER GRAPH MODELS
147
+
148
+ In addition to vanilla GCNs (e.g. Kipf & Welling, 2017), our derivation also applies to other graph models including GraphSAGE (SAGE, Hamilton et al., 2017). Algorithm 1 shows a generalization that allows us to make a network of arbitrary graph models (e.g. GCN, SAGE, or others). Algorithm 2 shows pseudo-code for the vanilla GCN. Finally, Algorithm 3 defines our full Network of GCN model (N-GCN) by plugging Algorithm 2 into Algorithm 1. Similarly, we list the algorithms for SAGE and Network of SAGE (N-SAGE) in the Appendix.
149
+
150
+ We can recover the original algorithms GCN (Kipf & Welling, 2017) and SAGE (Hamilton et al., 2017), respectively, by using Algorithms 3 (N-GCN) and 5 (N-SAGE, listed in Appendix) with $r = 1$ , $K = 1$ , identity CLASSIFIERFN, and modifying line 2 in Algorithm 1 to $P { \hat { A } }$ . Moreover, we can recover original DCNN (Atwood & Towsley, 2016) by calling Algorithm 3 with $L = 1$ , $r = 1$ , modifying line 3 to $\hat { A } D ^ { - 1 } A$ , and keeping $K > 1$ as their proposed model operates on the power series of the transition matrix i.e. unmodified random walks, like ours.
151
+
152
+ Algorithm 1 General Implementation: Network of Graph Models
153
+
154
+ <table><tr><td colspan="2">Require: A is a normalization of A</td></tr><tr><td colspan="2">1: function NETWORK(GRAPHMODELFN,A,X,L,r = 4,K = 6,CLASSIFIERFN=FCLAYER)</td></tr><tr><td>2: 3:</td><td>P←I</td></tr><tr><td>4:</td><td>GraphModels ←[] for k=1 to K do</td></tr><tr><td>5:</td><td>fori=1 to r do</td></tr><tr><td>6:</td><td>GraphModels.append(GRAPHMoDELFN(P,X,L))</td></tr><tr><td>7:</td><td>P←AP</td></tr><tr><td>8:</td><td>return CLASSIFIERFN(GraphModels)</td></tr><tr><td></td><td></td></tr></table>
155
+
156
+ <table><tr><td>Algorithm 2 GCN (Kipf &amp; Welling,2017)</td><td>Algorithm 3 N-GCN</td></tr><tr><td>Require: A is a normalization of A</td><td>1: function NGCN(A, X,L = 2)</td></tr><tr><td>1: function GCNMODEL(A, X,L)</td><td>2: D ← diag(A1) Sum rows</td></tr><tr><td>2: Z←X</td><td>3: A←D-1/2AD-1/2</td></tr><tr><td>3: for i= 1 to L do</td><td>4: return NETWORK(GCNMODEL, A, X, L)</td></tr><tr><td>4: Z ←σ(AzW())</td><td></td></tr><tr><td>5: return Z</td><td></td></tr></table>
157
+
158
+ # 4 EXPERIMENTS
159
+
160
+ We follow the experimental setup by Kipf & Welling (2017) and Yang et al. (2016), including the provided dataset splits (train, validation, test) produced by Yang et al. (2016).
161
+
162
+ # 4.1 DATASETS
163
+
164
+ We experiment on three citation graph datasets: Pubmed, Citeseer, Cora, and a biological graph: Protein-Protein Interactions (PPI). We choose the aforementioned datasets because they are available online and are used by our baselines. The citation datasets are prepared by Yang et al. (2016), and the PPI dataset is prepared by Hamilton et al. (2017). Table 1 summarizes dataset statistics.
165
+
166
+ Each node in the citation datasets represents an article published in the corresponding journal. An edge between two nodes represents a citation from one article to another, and a label represents the subject of the article. Each dataset contains a binary Bag-of-Words (BoW) feature vector for each node. The BoW are extracted from the article abstract. Therefore, the task is to predict the subject of articles, given the $\mathbf { B o W }$ of their abstract and the citations to other (possibly labeled) articles. Following Yang et al. (2016) and Kipf & Welling (2017), we use 20 nodes per class for training, 500 (overall) nodes for validation, and 1000 nodes for evaluation. We note that the validation set is larger than training $| \nu _ { L } |$ for these datasets!
167
+
168
+ The PPI graph, as processed and described by Hamilton et al. (2017), consists of 24 disjoint subgraphs, each corresponding to a different human tissue. 20 of those subgraphs are used for training, 2 for validation, and 2 for testing, as partitioned by Hamilton et al. (2017).
169
+
170
+ # 4.2 BASELINE METHODS
171
+
172
+ For the citation datasets, we copy baseline numbers from Kipf & Welling (2017). These include label propagation (LP, Zhu et al. (2003)); semi-supervised embedding (SemiEmb, Weston et al. (2012)); manifold regularization (ManiReg, Belkin et al. (2006b)); skip-gram graph embeddings (DeepWalk Perozzi et al., 2014); Iterative Classification Algorithm (ICA, Lu & Getoor, 2003); Planetoid (Yang et al., 2016); vanilla GCN (Kipf & Welling, 2017). For PPI, we copy baseline numbers from (Hamilton et al., 2017), which include GraphSAGE with LSTM aggregation (SAGELSTM) and GraphSAGE with pooling aggregation (SAGE). Further, for all datasets, we use our implementation to run baselines DCNN (Atwood & Towsley, 2016), GCN (Kipf & Welling, 2017), and SAGE (with pooling aggregation, Hamilton et al., 2017), as these baselines can be recovered as special cases of our algorithm, as explained in Section 3.6.
173
+
174
+ Table 1: Dataset used for experiments. For citation datasets, 20 training nodes per class are observed, with $| \mathcal { V } _ { L } | = 2 0 \times C$
175
+
176
+ <table><tr><td>Dataset</td><td>Type</td><td>Nodes V</td><td>Edges E</td><td>Classes C</td><td>Features F</td><td>Labeled nodes VL</td></tr><tr><td>Citeseer</td><td>citaction</td><td>3,327</td><td>4,732</td><td>6 (single class)</td><td>3,703</td><td>120</td></tr><tr><td>Cora</td><td>citaction</td><td>2,708</td><td>5,429</td><td>7 (single class)</td><td>1,433</td><td>140</td></tr><tr><td>Pubmed</td><td>citaction</td><td>19,717</td><td>44,338</td><td>3 (single class)</td><td>500</td><td>60</td></tr><tr><td>PPI</td><td>biological</td><td>56,944</td><td>818,716</td><td>121 (multi-class)</td><td>50</td><td>44,906</td></tr></table>
177
+
178
+ Table 2: Node classification performance $\%$ accuracy for the first three, citation datasets, and f1 micro-averaged for multiclass PPI), using data splits of Yang et al. (2016); Kipf & Welling (2017) and Hamilton et al. (2017). We report the test accuracy corresponding to the run with the highest validation accuracy. Results in rows (a) through (g) are copied from Kipf & Welling (2017), rows (h) and (i) from (Hamilton et al., 2017), and (j) through (l) are generated using our code since we can recover other algorithms as explained in Section 3.6. Rows (m) and (n) are our models. Entries with “–” indicate that authors from whom we copied results did not run on those datasets. Nonetheless, we run all datasets using our implementation of the most-competitive baselines.
179
+
180
+ <table><tr><td>Method</td><td></td><td>Citeseer</td><td>Cora</td><td>Pubmed</td><td>PPI</td></tr><tr><td>(a)</td><td>ManiReg (Belkin et al.,2006b)</td><td>60.1</td><td>59.5</td><td>70.7</td><td>1</td></tr><tr><td>(b)</td><td>SemiEmb (Weston et al., 2012)</td><td>59.6</td><td>59.0</td><td>71.1</td><td></td></tr><tr><td>(c)</td><td>LP (Zhu et al., 2003)</td><td>45.3</td><td>68.0</td><td>63.0</td><td></td></tr><tr><td>(d)</td><td>DeepWalk (Perozzi et al., 2014)</td><td>43.2</td><td>67.2</td><td>65.3</td><td></td></tr><tr><td>e)</td><td>ICA (Lu &amp; Getoor,2003)</td><td>69.1</td><td>75.1</td><td>73.9</td><td></td></tr><tr><td>f</td><td>Planetoid (Yang et al., 2016)</td><td>64.7</td><td>75.7</td><td>77.2</td><td></td></tr><tr><td>(g))</td><td>GCN(Kipf &amp; Welling,2017)</td><td>70.3</td><td>81.5</td><td>79.0</td><td></td></tr><tr><td>h</td><td>SAGE-LSTM (Hamilton et al., 2017)</td><td></td><td>1</td><td>1</td><td>61.2</td></tr><tr><td>(i)</td><td>SAGE (Hamilton et al., 2017)</td><td>1</td><td>1</td><td>1</td><td>60.0</td></tr><tr><td>j</td><td>DCNN (our implementation)</td><td>71.1</td><td>81.3</td><td>79.3</td><td>44.0</td></tr><tr><td>(k)</td><td>GCN (our implementation)</td><td>71.2</td><td>81.0</td><td>78.8</td><td>46.2</td></tr><tr><td>(1)</td><td>SAGE (our implementation)</td><td>63.5</td><td>77.4</td><td>77.6</td><td>59.8</td></tr><tr><td>(m)</td><td>N-GCN (ours)</td><td>72.2</td><td>83.0</td><td>79.5</td><td>46.8</td></tr><tr><td>(n)</td><td>N-SAGE (ours)</td><td>71.0</td><td>81.8</td><td>79.4</td><td>65.0</td></tr></table>
181
+
182
+ # 4.3 IMPLEMENTATION
183
+
184
+ We use TensorFlow(Abadi et al., 2015) to implement our methods, which we use to also measure the performance of baselines GCN, SAGE, and DCNN. For our methods and baselines, all GCN and SAGE modules that we train are 2 layers, where the first outputs 16 dimensions per node and the second outputs the number of classes (dataset-dependent). DCNN baseline has one layer and outputs 16 dimensions per node, and its channels (one per transition matrix power) are concatenated into a fully-connected layer that outputs the number of classes. We use $5 0 \%$ dropout and L2 regularization of $\mathrm { i 0 ^ { - 5 } }$ for all of the aforementioned models.
185
+
186
+ # 4.4 NODE CLASSIFICATION ACCURACY
187
+
188
+ Table 2 shows node classification accuracy results. We run 20 different random initializations for every model (baselines and ours), train using Adam optimizer (Ba & Kingma, 2015) with learning rate of 0.01 for 600 steps, capturing the model parameters at peak validation accuracy to avoid overfitting. For our models, we sweep our hyperparameters $r , K$ , and choice of classification subnetwork $\bar { \in } \lbrace \mathrm { { f c , a } } \rbrace$ . For baselines and our models, we choose the model with the highest accuracy on validation set, and use it to record metrics on the test set in Table 2.
189
+
190
+ ![](images/ce744284a395afbb3e698181d8f4aa5e6bf25e34ac330acdca33461f0577af7b.jpg)
191
+ Figure 2: Sensitivity Analysis. Model performance when varying random walk steps $K$ and replication factor $r$ . Best viewed with zoom. Overall, model performance increases with larger values of $K$ and $r$ . In addition, having random walk steps (larger $K$ ) boosts performance more than increasing model capacity (larger $r$ ), as seen by the cross-section cuts on along the $K$ -axis versus the $r$ -axis.
192
+
193
+ <table><tr><td>Nodes per class</td><td>5</td><td>10</td><td>20</td><td>100</td></tr><tr><td>DCNN (our implementation)</td><td>63.0±1.0</td><td>72.3± 0.4</td><td>79.2± 0.2</td><td>82.6± 0.3</td></tr><tr><td>GCN (our implementation)</td><td>64.6 ± 0.3</td><td>70.0 ± 3.7</td><td>79.1 ± 0.3</td><td>81.8 ± 0.3</td></tr><tr><td>SAGE (our implementation)</td><td>69.0 ± 1.4</td><td>72.0 ± 1.3</td><td>77.2 ± 0.5</td><td>80.7 ± 0.7</td></tr><tr><td>N-GCNa (ours)</td><td>65.1 ±0.7</td><td>71.2 ± 1.1</td><td>79.7 ± 0.3</td><td>83.0±0.4</td></tr><tr><td>N-GCNfc (ours)</td><td>65.0± 2.1</td><td>71.7 ± 0.7</td><td>79.7 ± 0.4</td><td>82.9 ± 0.3</td></tr><tr><td>N-SAGEa (ours)</td><td>66.9 ± 0.4</td><td>73.4 ± 0.7</td><td>79.0 ± 0.3</td><td>82.5 ± 0.2</td></tr><tr><td>N-SAGEfc (ours)</td><td>70.7 ± 0.4</td><td>74.1 ± 0.8</td><td>78.5 ±1.0</td><td>81.8 ± 0.3</td></tr></table>
194
+
195
+ Table 3: Node classification accuracy (in $\%$ ) for our largest dataset (Pubmed) as we vary size of training data $\frac { | \mathcal { V } | } { C } ~ \in ~ \{ 5 , 1 0 , 2 0 , 1 0 0 \}$ . We report mean and standard deviations on 10 runs. We use a different random seed for every run (i.e. selecting different labeled nodes), but the same 10 random seeds across models. Convolution-based methods (e.g. SAGE) work well with few training examples, but unmodified random walk methods (e.g. DCNN) work well with more training data. Our methods combine convolution and random walks, making them work well in both conditions.
196
+
197
+ Table 2 shows that N-GCN outperforms GCN (Kipf & Welling, 2017) and N-SAGE improves on SAGE for all datasets, showing that unmodified random walks indeed help in semi-supervised node classification. Finally, our proposed models acheive state-of-the-art on all datasets.
198
+
199
+ # 4.5 SENSITIVITY ANALYSIS
200
+
201
+ We analyze the impact of $K$ and $r$ on classification accuracy in Figure 2. We note that adding random walks by specifically setting $K > 1$ improves model accuracy due to the additional information, not due to increased model capacity. Contrast $K = 1 , r > 1$ (i.e. mixture of GCNs, no random walks) with $K > 1 , r = 1$ (i.e. N-GCN on random walks): in both scenarios, the model has more capacity, but the latter shows better performance. The same holds for SAGE, as shown in Appendix.
202
+
203
+ # 4.6 TOLERANCE TO FEATURE NOISE
204
+
205
+ We test our method under feature noise perturbations by removing node features at random. This is practical, as article authors might forget to include relevant terms in the article abstract, and more generally not all nodes will have the same amount of detailed information. Figure 3 shows that when features are removed, methods utilizing unmodified random walks: N-GCN, N-SAGE, and DCNN, outperform convolutional methods including GCN and SAGE. Moreover, the performance gap widens as we remove more features. This suggests that our methods can somewhat recover removed features by directly pulling-in features from nearby and distant neighbors. We visualize in Figure 4 the attention weights as a function of $\%$ features removed. With little feature removal, there is some weight on $\hat { A } ^ { 0 }$ , and the attention weights for $\hat { A } ^ { 1 } , \hat { A } ^ { 2 } , \ldots$ follow some decay function. Maliciously dropping features causes our model to shift its attention weights towards higher powers of $\hat { A }$ .
206
+
207
+ ![](images/adbaffb4c98c32d52371d96121e6848f764655a24e4754bae1672e032c39adc7.jpg)
208
+ Figure 3: Classification accuracy for the Cora dataset with 20 labeled nodes per class $( | \mathcal { V } | = 2 0 \times C )$ , but features removed at random, averaging 10 runs. We use a different random seed for every run (i.e. removing different features per node), but the same 10 random seeds across models.
209
+
210
+ ![](images/fe35c4ae7b88b5c7bebfefbd2f7489b4f729d05eae39def979a57cc46ef26765.jpg)
211
+ Figure 4: Attention weights $( m )$ for $\mathrm { { N - G C N _ { a } } }$ when trained with feature removal perturbation on the Cora dataset. Removing features shifts the attention weights to the right, suggesting the model is relying more on long range dependencies.
212
+
213
+ # 5 RELATED WORK
214
+
215
+ The field of graph learning algorithms is quickly evolving. We review work most similar to ours.
216
+
217
+ Defferrard et al. (2016) define graph convolutions as a $K$ -degree polynomial of the Laplacian, where the polynomial coefficients are learned. In their setup, the $K$ -th degree Laplacian is a sparse square matrix where entry at $( i , j )$ will be zero if nodes $i$ and $j$ are more than $K$ hops apart. Their sparsity analysis also applies here. A minor difference is the adjacency normalization. We use $\hat { A }$ whereas they use the Laplacian defined as $I - { \hat { A } }$ . Raising $\hat { A }$ to power $K$ will produce a square matrix with entry $( i , j )$ being the probability of random walker ending at node $i$ after $K$ steps from node $j$ . The major difference is the order of random walk versus non-linearity. In particular, their model calculates learns a linear combination of $K$ -degree polynomial and pass through classifier function $g$ , as in $g ( \sum _ { k } q _ { k } { \widetilde { A } } ^ { k } )$ , while our (e.g. N-GCN) model calculates $\textstyle \sum _ { k } q _ { k } g ( \widetilde { A } ^ { k } )$ , where $\widetilde { A }$ is $\hat { A }$ in our model and $I - { \hat { A } }$ in theirs, and our $g$ can be a GCN module. In fact, Defferrard et al. (2016) is also similar to work by Abu-El-Haija et al. (2017), as they both learn polynomial coefficients to some normalized adjacency matrix.
218
+
219
+ Atwood & Towsley (2016) propose DCNN, which calculates powers of the transition matrix and keeps each power in a separate channel until the classification sub-network at the end. Their model is therefore similar to our work in that it also falls under $\begin{array} { r } { \sum _ { k } q _ { k } g ( \widetilde { A } ^ { k } ) } \end{array}$ . However, where their model multiplies features with each power $\smash { \widetilde { A } ^ { k } }$ once, our model makes use of GCN’s (Kipf & Welling, 2017) that multiply by $\smash { \widetilde { A } ^ { k } }$ at every GCN layer (see Eq. 2). Thus, DCNN model (Atwood & Towsley, 2016) is a special case of ours, when GCN module contains only one layer, as explained in Section 3.6.
220
+
221
+ # 6 CONCLUSIONS AND FUTURE WORK
222
+
223
+ In this paper, we propose a meta-model that can run arbitrary Graph Convolution models, such as GCN (Kipf & Welling, 2017) and SAGE (Hamilton et al., 2017), on the output of random walks. Traditional Graph Convolution models operate on the normalized adjacency matrix. We make multiple instantiations of such models, feeding each instantiation a power of the adjacency matrix, and then concatenating the output of all instances into a classification sub-network. Our model, Network of GCNs (and similarly, Network of SAGE), is end-to-end trainable, and is able to directly learn information across near or distant neighbors. We inspect the distribution of parameter weights in our classification sub-network, which reveal to us that our model is effectively able to circumvent adversarial perturbations on the input by shifting weights towards model instances consuming higher powers of the adjacency matrix. For future work, we plan to extend our methods to a stochastic implementation and tackle other (larger) graph datasets.
224
+
225
+ # REFERENCES
226
+
227
+ Mart´ın Abadi, Ashish Agarwal, and TensorFlow Team. TensorFlow: Large-scale machine learning on heterogeneous systems. 2015.
228
+
229
+ Sami Abu-El-Haija, Bryan Perozzi, Rami Al-Rfou, and Alex Alemi. Watch your step: Learning graph embeddings through attention. In arxiv, 2017.
230
+
231
+ James Atwood and Don Towsley. Diffusion-convolutional neural networks. In Advances in Neural Information Processing Systems (NIPS), 2016.
232
+
233
+ Jimmy Ba and Diederik Kingma. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
234
+
235
+ Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps for dimensionality reduction and data representation. In Neural Computation, 2003.
236
+
237
+ Mikhail Belkin, Partha Niyogi, and Vikas Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. In Journal of machine learning research (JMLR), 2006a.
238
+
239
+ Mikhail Belkin, Partha Niyogi, and Vikas Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. In Journal of machine learning research (JMLR), 2006b.
240
+
241
+ J. Bruna, W. Zaremba, A. Szlam, and Y. LeCun. Spectral networks and locally connected networks on graphs. In International Conference on Learning Representations, 2014.
242
+
243
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks ¨ on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems (NIPS), 2016.
244
+
245
+ A. Grover and J. Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2016.
246
+
247
+ W. Hamilton, R. Ying, and J. Leskovec. Inductive representation learning on large graphs. In NIPS, 2017.
248
+
249
+ David K. Hammond, Pierre Vandergheynst, and R. Gribonval. Wavelets on graphs via spectral graph theory. In Applied and Computational Harmonic Analysis, 2011.
250
+
251
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
252
+
253
+ G. Hinton J. Ba, J. Kiros. Layer normalization. In arxiv 1607.06450, 2016.
254
+
255
+ T. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
256
+
257
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 2012.
258
+
259
+ Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, 1998.
260
+
261
+ Omer Levy, Yoav Goldberg, and Ido Dagan. Improving distributional similarity with lessons learned from word embeddings. In Transactions of the Association for Computational Linguistics (TACL), 2015.
262
+
263
+ Qing Lu and Lise Getoor. Link-based classification. In International Conference on Machine Learning (ICML), 2003.
264
+
265
+ Selin Merdan, Christine L. Barnett, and Brian T. Denton. Data analytics for optimal detection of metastatic prostate cancer. 2017.
266
+
267
+ T. Mikolov, I. Sutskever, K. Chen, G. Corrado, and J. Dean. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems, 2013.
268
+
269
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In Conference on Empirical Methods in Natural Language Processing, EMNLP, 2014.
270
+
271
+ B. Perozzi, R. Al-Rfou, and S. Skiena. Deepwalk: Online learning of social representations. In Knowledge Discovery and Data Mining, 2014.
272
+
273
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015.
274
+
275
+ Jason Weston, Frederic Ratle, Hossein Mobahi, and Ronan Collobert. Deeplearning via semisupervised embedding. In Neural Networks: Tricks of the Trade, pp. 639–655, 2012.
276
+
277
+ Z. Yang, W. Cohen, and R. Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. In International Conference on Machine Learning (ICML), 2016.
278
+
279
+ Xiaojin Zhu, Zoubin Ghahramani, and John Lafferty. Semi-supervised learning using gaussian fields and harmonic functions. In International Conference on Machine Learning (ICML), 2003.
280
+
281
+ # 7 APPENDIX
282
+
283
+ # 7.1 ALGORITHM FOR NETWORK OF SAGE
284
+
285
+ Algorithms 4 and 5, respectively, define SAGE Hamilton et al. (2017) and Network of SAGE (NSAGE). Algorithm 4 assumes mean-pool aggregation by Hamilton et al. (2017), which performs on-par to their top performer max-pool aggregation. Further, Algorithm 4 operates in full-batch while Hamilton et al. (2017) offer a stochastic implementation with edge sampling. Nonetheless, their proposed stochastic implementation should be wrapped in a network, though we would need a way to approximate (e.g. sample entries) from dense $\hat { A } ^ { k }$ as $k$ increases. We leave this as future work.
286
+
287
+ <table><tr><td colspan="4">Algorithm 4 SAGE Model (Hamilton et al., 2017) Algorithm 5 N-SAGE</td></tr><tr><td colspan="2">Require: A is a normalization of A</td><td>1: function NSAGE(A, X)</td><td> Sum rows</td></tr><tr><td colspan="2">1: function SAGEMODEL(A, X, L)</td><td>2: D ← diag(A1)</td></tr><tr><td colspan="2">Z←X 2:</td><td>3: A←D-1A</td></tr><tr><td colspan="2">3: fori=1 toL do</td></tr><tr><td>4: Z ←σ([ ziAz]W(i))</td><td>4: return NETWORK(SAGEMODEL, A, X,2)</td></tr><tr><td colspan="2"></td></tr><tr><td>5: Z ← L2NORMALIZEROWS(Z)</td><td></td></tr><tr><td>6: return Z</td><td></td></tr><tr><td colspan="2"></td></tr></table>
288
+
289
+ Using SAGE with mean-pooling aggregation is very similar to a vanilla GCN model but with three differences. First, the choice of adjacency normalization $D ^ { - 1 } A$ versus $D ^ { - { \frac { 1 } { 2 } } } A D ^ { - { \frac { 1 } { 2 } } } ,$ ). Second, the skip connections in line 4, which concatenates the features with the adjacency-multiplied (i.e. diffused) features. We believe this is analogous in intuition of incorporating $\hat { A } ^ { 0 }$ in our model, which keeps the original features. Third, the use of node-wise L2 feature normalization at line 5, which is equivalent to applying a layernorm transformation J. Ba (2016). Nonetheless, it is worth noting Hamilton et al. (2017)’s formulation of SAGE is flexible to allow different aggregations, such as max-pooling or LSTM, which further deviates SAGE from GCN.
290
+
291
+ # 7.2 SENSITIVITY ANALYSIS
292
+
293
+ Earlier, in Table 2, we showed the test performance corresponding to the model performing best on the validation split. The number of labeled nodes are small, and such model selection is important to avoid overfitting. For example, there can be up to $1 0 \%$ relative test accuracy difference when training the same model architecture but with different random seed. In this section, we programatically sweep hyperparameters $r , K$ , choice of classification network $( \in \ \{ \mathrm { f c } , \mathrm { a } \} )$ , and whether or not we enable $\hat { A } ^ { 0 }$ , for both N-GCN and N-SAGE models.
294
+
295
+ The settings when ( $K = 1$ , $r = 1$ , and $\hat { A } ^ { 0 }$ disabled), correspond to the vanilla base model. Further, the settings when $K = 1$ , $r > 1$ , and $\hat { A } ^ { 0 }$ disabled), correspond to an ensemble of the base model. These cases are outperformed when $K > 1$ , showing that unmodified random walks indeed help these convolutional methods perform better, by gathering information from nearby and distant nodes.
296
+
297
+ The automatically generated tables are shown below:
298
+
299
+ $$
300
+ \begin{array} { c c } { \frac { K = 1 } { r = 1 } \left| { \begin{array} { c } { { K = 1 } } \\ { { 7 9 . 0 \pm 0 . 1 6 3 } } \\ { { r = 2 } } \\ { { 7 9 . 1 \pm 0 . 2 8 3 } } \\ { { r = 4 } } \end{array} } \right| { \begin{array} { c } { { K = 2 } } \\ { { 7 9 . 5 \pm 0 . 1 0 0 } } \\ { { 7 9 . 3 \pm 0 . 2 4 1 } } \\ { { 7 9 . 3 \pm 0 . 1 6 1 } } \end{array} } } & { \left| { \begin{array} { c } { { K = 3 } } \\ { { 7 9 . 3 \pm 0 . 3 7 2 } } \\ { { 7 9 . 4 \pm 0 . 1 3 4 } } \\ { { 7 9 . 3 \pm 0 . 1 6 3 } } \end{array} } \right| { \begin{array} { c } { { K = 4 } } \\ { { 7 9 . 4 \pm 0 . 2 3 4 } } \\ { { 7 9 . 4 \pm 0 . 1 3 4 } } \end{array} } } & { \left| { \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 4 \pm 0 . 2 3 4 } } \\ { { 7 9 . 4 \pm 0 . 1 4 6 } } \\ { { 7 9 . 5 \pm 0 . 3 0 2 } } \end{array} } \right| { \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 4 \pm 0 . 3 3 7 } } \\ { { 7 9 . 4 \pm 0 . 1 6 0 } } \end{array} } } & { \left| { \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 5 \pm 0 . 2 3 4 } } \\ { { 7 9 . 4 \pm 0 . 1 6 0 } } \end{array} } \right| { \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 4 \pm 0 . 3 3 7 } } \\ { { 7 9 . 5 \pm 0 . 1 6 0 } } \end{array} } } \end{array}
301
+ $$
302
+
303
+ Table 4: $\mathrm { { N - G C N _ { a } } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ disabled. Top-left entry corresponds to vanilla GCN. Left column corresponds to ensemble of GCN models.
304
+
305
+ Table 5: $\mathbf { N } { \cdot } \mathbf { G C N } _ { \mathrm { a } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ enabled.
306
+
307
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>78.1± 0.339</td><td>79.6± 0.293</td><td>79.8 ± 0.189</td><td>79.7± 0.170</td><td>79.6 ± 0.243</td></tr><tr><td>r=2</td><td>77.3 ± 0.125</td><td>79.7 ± 0.171</td><td>79.6 ± 0.189</td><td>79.6 ± 0.138</td><td>79.9 ± 0.177</td></tr><tr><td>r=4</td><td>77.3 ± 0.287</td><td>79.5 ± 0.396</td><td>79.5 ± 0.219</td><td>79.7 ± 0.149</td><td>79.9 ± 0.189</td></tr></table>
308
+
309
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td></td><td>78.6± 0.723</td><td>78.7± 0.407</td><td>78.7± 0.530</td><td>78.0± 0.690</td></tr><tr><td>r=2</td><td>78.5 ± 0.353</td><td>77.9 ± 0.234</td><td>78.5± 0.724</td><td>78.8 ± 0.562</td><td>79.1 ± 0.267</td></tr><tr><td>r=4</td><td>78.4± 0.499</td><td>78.4 ± 0.716</td><td>78.9 ± 0.306</td><td>78.9 ± 0.385</td><td>79.0 ± 0.228</td></tr></table>
310
+
311
+ Table 6: $\mathbf { N { \mathrm { - G C N } } _ { \mathrm { f c } } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ disabled. Left column corresponds to ensemble of GCN models.
312
+
313
+ Table $7 \colon \mathrm { N - G C N _ { \mathrm { f c } } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ enabled.
314
+
315
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>76.5 ± 1.490</td><td>78.2 ± 1.290</td><td>79.2 ± 1.061</td><td>78.5 ± 0.963</td><td>78.7 ± 1.384</td></tr><tr><td>r=2</td><td>76.1 ± 1.118</td><td>77.1 ± 1.152</td><td>78.8 ± 1.479</td><td>79.4± 0.754</td><td>78.7 ± 0.612</td></tr><tr><td>r=4</td><td>76.0± 0.770</td><td>77.2 ± 0.785</td><td>78.7 ± 0.716</td><td>78.7 ± 0.953</td><td>79.0 ± 0.313</td></tr></table>
316
+
317
+ $$
318
+ \begin{array}{c} \begin{array} { c c } { { } } & { { | \begin{array} { c c } { { K = 1 } } & { { K = 2 } } \\ { { 7 6 . 0 \pm 1 . 2 3 9 } } & { { 7 7 . 0 \pm 0 . 8 5 6 } } \end{array} | 7 7 . 3 \pm 0 . 6 8 2 } } & { { K = 4 } } \\ { { } } & { { | \begin{array} { c c } { { 7 7 . 4 \pm 0 . 1 2 1 9 } } & { { 7 7 . 3 \pm 0 . 9 7 9 } } \\ { { 7 7 . 6 \pm 0 . 5 8 6 3 } } & { { 7 7 . 6 \pm 0 . 5 0 8 } } \end{array} | 7 7 . 6 \pm 0 . 4 1 4 } } & { { 7 7 . 7 \pm 0 . 5 8 6 } } \\ { { } } & { { | \begin{array} { c c } { { 8 . 5 \pm 0 . 8 6 3 } } & { { 7 7 . 3 \pm 0 . 1 9 8 } } \end{array} | 7 7 . 8 \pm 0 . 5 2 5 } } \end{array} | 7 7 . 9 \pm 0 . 5 2 2 2 & { { | \begin{array} { c c } { { K = 5 } } & { { K = 5 } } \\ { { 7 7 . 3 \pm 0 . 4 1 9 } } & { { 7 7 . 3 \pm 0 . 9 7 9 } } \end{array} | 7 7 . 7 3 \pm 0 . 9 7 9 } } \end{array}
319
+ $$
320
+
321
+ Table 8: $\mathrm { N - S A G E _ { a } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ disabled. Top-left entry corresponds to vanilla SAGE. Left column corresponds to ensemble of SAGE models.
322
+
323
+ $$
324
+ \begin{array} { c c } { { \frac { K = 1 } { r = 1 } | \begin{array} { c } { { K = 1 } } \\ { { 7 3 . 4 \pm 1 . 2 6 4 } } \end{array} | \begin{array} { c } { { K = 2 } } \\ { { 7 6 . 1 \pm 0 . 3 0 6 } } \end{array} | \begin{array} { c } { { K = 3 } } \\ { { 7 6 . 8 \pm 0 . 6 4 7 } } \end{array} | \begin{array} { c } { { K = 4 } } \\ { { 7 6 . 6 \pm 0 . 6 2 3 } } \end{array} | \begin{array} { c } { { K = 5 } } \\ { { 7 7 . 0 \pm 0 . 3 4 0 } } \end{array} } } \\ { { \begin{array} { c } { { r = 2 } } \\ { { 7 7 . 2 \pm 0 . 5 9 7 } } \end{array} | \begin{array} { c } { { 7 6 . 0 \pm 0 . 4 5 3 } } \\ { { 7 6 . 8 \pm 0 . 5 3 5 } } \end{array} | \begin{array} { c } { { 7 6 . 4 \pm 0 . 2 4 1 } } \\ { { 7 7 . 0 \pm 0 . 2 8 9 } } \end{array} | \begin{array} { c } { { 7 7 . 2 \pm 0 . 3 0 6 } } \\ { { 7 7 . 5 \pm 0 . 4 0 7 } } \end{array} | \begin{array} { c } { { 7 7 . 3 \pm 0 . 8 6 9 } } \end{array} | \begin{array} { c } { { 8 . 0 9 . 1 \pm 0 . 7 6 } } \\ { { 7 7 . 0 \pm 0 . 8 1 8 } } \end{array} } } \end{array}
325
+ $$
326
+
327
+ Table 9: $\mathrm { N - S A G E _ { a } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ enabled.
328
+
329
+ $$
330
+ \begin{array}{c} \begin{array}{c} \begin{array} { c } { { \begin{array} { c c } { { \frac { K } { r = 1 } | } } & { { K = 1 } } \\ { { \frac { - } { r = 2 } | } } & { { 7 6 . 5 \pm 1 . 5 4 5 } } \\ { { \frac { 7 6 . 6 \pm 1 . 1 9 6 } { r = 4 } | } } & { { 7 7 . 3 \pm 1 . 3 0 9 } } \\ { { 7 6 . 5 \pm 0 . 6 0 2 } } & { { 7 8 . 1 \pm 1 . 2 3 9 } } \end{array} | } } & { { K = 3 } } \end{array} \begin{array} { c } { { K = 4 } } \\ { { 7 6 . 7 \pm 1 . 0 9 8 } } \\ { { 7 7 . 5 \pm 0 . 7 4 6 } } \end{array} | & { { K = 1 . 4 2 7 } } \\ { { 7 6 . 9 \pm 0 . 4 7 2 } } \end{array} 7 . 3 \pm 1 . 0 3 8 \end{array} \end{array} {array} \begin{array}
331
+ $$
332
+
333
+ Table 10 $: \ \mathrm { N } { - } \mathrm { S } \mathrm { A G E } _ { \mathrm { f c } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ disabled. Left column corresponds to ensemble of SAGE models.
334
+
335
+ Table $\mathrm { . 1 { : N - S A G E _ { \mathrm { f c } } } }$ results on Citeseer dataset, with $\hat { A } ^ { 0 }$ enabled.
336
+
337
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>72.9± 0.972</td><td>75.9 ± 0.922</td><td>75.5± 0.499</td><td>76.6 ± 1.641</td><td>76.8± 0.589</td></tr><tr><td>r=2</td><td>75.3 ± 0.879</td><td>76.1 ± 1.237</td><td>76.6 ± 0.579</td><td>76.4 ± 0.383</td><td>76.2 ± 0.626</td></tr><tr><td>r=4</td><td>75.3 ± 1.730</td><td>76.4 ± 1.186</td><td>76.6 ± 0.576</td><td>76.8 ± 0.450</td><td>77.4± 0.712</td></tr></table>
338
+
339
+ $$
340
+ \begin{array} { c } { { \begin{array} { c } { { \kappa = 1 } } \\ { { \tau = 1 } } \\ { { r = 2 } } \\ { { r = 4 } } \end{array} } | \begin{array} { c } { { K = 1 } } \\ { { 7 9 . 0 \pm 0 . 1 6 3 } } \\ { { 7 9 . 1 \pm 0 . 2 8 3 } } \\ { { 7 8 . 9 \pm 0 . 1 8 1 } } \end{array} | \begin{array} { c } { { K = 2 } } \\ { { 7 9 . 5 \pm 0 . 1 0 0 } } \\ { { 7 9 . 3 \pm 0 . 2 4 1 } } \\ { { 7 9 . 3 \pm 0 . 1 6 3 } } \end{array} | \begin{array} { c } { { K = 3 } } \\ { { 7 9 . 3 \pm 0 . 3 7 2 } } \\ { { 7 9 . 4 \pm 0 . 1 3 4 } } \\ { { 7 9 . 3 \pm 0 . 1 6 3 } } \end{array} | \begin{array} { c } { { K = 4 } } \\ { { 7 9 . 4 \pm 0 . 2 3 4 } } \\ { { 7 9 . 4 \pm 0 . 1 4 6 } } \\ { { 7 9 . 5 \pm 0 . 3 0 2 } } \end{array} | \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 4 \pm 0 . 3 3 7 } } \\ { { 7 9 . 4 \pm 0 . 1 6 0 } } \end{array} | \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 5 \pm 0 . 3 3 7 } } \\ { { 7 9 . 4 \pm 0 . 1 6 0 } } \end{array} } \end{array}
341
+ $$
342
+
343
+ Table 12: $\mathrm { { N - G C N _ { a } } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ disabled. Top-left entry corresponds to vanilla GCN. Left column corresponds to ensemble of GCN models.
344
+
345
+ Table $1 3 \colon \mathrm { N \mathrm { \mathrm { - G C N } _ { a } } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ enabled.
346
+
347
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>78.1± 0.339</td><td>79.6± 0.293</td><td>79.8 ± 0.189</td><td>79.7± 0.170</td><td>79.6 ± 0.243</td></tr><tr><td>r=2</td><td>77.3 ± 0.125</td><td>79.7 ± 0.171</td><td>79.6 ± 0.189</td><td>79.6 ± 0.138</td><td>79.9 ± 0.177</td></tr><tr><td>r=4</td><td>77.3 ± 0.287</td><td>79.5 ± 0.396</td><td>79.5 ± 0.219</td><td>79.7 ± 0.149</td><td>79.9 ± 0.189</td></tr></table>
348
+
349
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td></td><td>78.6± 0.723</td><td>78.7± 0.407</td><td>78.7± 0.530</td><td>78.0± 0.690</td></tr><tr><td>r=2</td><td>78.5 ± 0.353</td><td>77.9 ± 0.234</td><td>78.5 ± 0.724</td><td>78.8 ± 0.562</td><td>79.1 ± 0.267</td></tr><tr><td>r=4</td><td>78.4± 0.499</td><td>78.4± 0.716</td><td>78.9 ± 0.306</td><td>78.9 ± 0.385</td><td>79.0 ± 0.228</td></tr></table>
350
+
351
+ Table 14 $: \mathrm { N - G C N _ { \mathrm { f c } } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ disabled. Left column corresponds to ensemble of GCN models.
352
+
353
+ Table 15: $\mathrm { N - G C N _ { \mathrm { f c } } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ enabled.
354
+
355
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>76.5 ± 1.490</td><td>78.2 ± 1.290</td><td>79.2 ± 1.061</td><td>78.5 ± 0.963</td><td>78.7 ± 1.384</td></tr><tr><td>r=2</td><td>76.1 ± 1.118</td><td>77.1 ± 1.152</td><td>78.8 ± 1.479</td><td>79.4± 0.754</td><td>78.7 ± 0.612</td></tr><tr><td>r=4</td><td>76.0± 0.770</td><td>77.2 ± 0.785</td><td>78.7 ± 0.716</td><td>78.7 ± 0.953</td><td>79.0 ± 0.313</td></tr></table>
356
+
357
+ $$
358
+ \begin{array}{c} \begin{array} { c c } { { } } & { { | \begin{array} { c c } { { K = 1 } } & { { K = 2 } } \\ { { 7 6 . 0 \pm 1 . 2 3 9 } } & { { 7 7 . 0 \pm 0 . 8 5 6 } } \end{array} | 7 7 . 3 \pm 0 . 6 8 2 } } & { { K = 4 } } \\ { { } } & { { | \begin{array} { c c } { { 7 7 . 4 \pm 0 . 1 2 1 9 } } & { { 7 7 . 3 \pm 0 . 9 7 9 } } \\ { { 7 7 . 6 \pm 0 . 5 8 6 3 } } & { { 7 7 . 6 \pm 0 . 5 0 8 } } \end{array} | 7 7 . 6 \pm 0 . 4 1 4 } } & { { 7 7 . 7 \pm 0 . 5 8 6 } } \\ { { } } & { { | \begin{array} { c c } { { 8 . 5 \pm 0 . 8 6 3 } } & { { 7 7 . 3 \pm 0 . 1 9 8 } } \end{array} | 7 7 . 8 \pm 0 . 5 2 5 } } \end{array} | 7 7 . 9 \pm 0 . 5 2 2 2 & { { | \begin{array} { c c } { { K = 5 } } & { { K = 5 } } \\ { { 7 7 . 3 \pm 0 . 4 1 9 } } & { { 7 7 . 3 \pm 0 . 9 7 9 } } \end{array} | 7 7 . 7 3 \pm 0 . 9 7 9 } } \end{array}
359
+ $$
360
+
361
+ Table 16: $\mathrm { N - S A G E _ { a } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ disabled. Top-left entry corresponds to vanilla SAGE. Left column corresponds to ensemble of SAGE models.
362
+
363
+ $$
364
+ \begin{array} { c c } { { \frac { K = 1 } { r = 1 } | \begin{array} { c } { { K = 1 } } \\ { { 7 3 . 4 \pm 1 . 2 6 4 } } \end{array} | \begin{array} { c } { { K = 2 } } \\ { { 7 6 . 1 \pm 0 . 3 0 6 } } \end{array} | \begin{array} { c } { { K = 3 } } \\ { { 7 6 . 8 \pm 0 . 6 4 7 } } \end{array} | \begin{array} { c } { { K = 4 } } \\ { { 7 6 . 6 \pm 0 . 6 2 3 } } \end{array} | \begin{array} { c } { { K = 5 } } \\ { { 7 7 . 0 \pm 0 . 3 4 0 } } \end{array} } } \\ { { \begin{array} { c } { { r = 2 } } \\ { { 7 7 . 2 \pm 0 . 5 9 7 } } \end{array} | \begin{array} { c } { { 7 6 . 0 \pm 0 . 4 5 3 } } \\ { { 7 6 . 8 \pm 0 . 5 3 5 } } \end{array} | \begin{array} { c } { { 7 6 . 4 \pm 0 . 2 4 1 } } \\ { { 7 7 . 0 \pm 0 . 2 8 9 } } \end{array} | \begin{array} { c } { { 7 7 . 2 \pm 0 . 3 0 6 } } \\ { { 7 7 . 5 \pm 0 . 4 0 7 } } \end{array} | \begin{array} { c } { { 7 7 . 3 \pm 0 . 8 6 9 } } \end{array} | \begin{array} { c } { { 8 . 0 9 . 1 \pm 0 . 7 6 } } \\ { { 7 7 . 0 \pm 0 . 8 1 8 } } \end{array} } } \end{array}
365
+ $$
366
+
367
+ Table 17 $: \mathrm { N - S A G E _ { a } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ enabled.
368
+
369
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>1</td><td>76.3 ± 1.545</td><td>76.7 ± 1.098</td><td>78.0 ± 1.427</td><td>77.3 ± 1.038</td></tr><tr><td>r=2</td><td>76.6 ± 1.196</td><td>77.3 ± 1.309</td><td>77.8 ± 0.746</td><td>77.5 ± 0.836</td><td>77.5 ± 0.298</td></tr><tr><td>r=4</td><td>76.5 ± 0.602</td><td>78.1 ± 1.239</td><td>77.6 ± 0.287</td><td>76.9 ± 0.472</td><td>77.7 ± 1.119</td></tr></table>
370
+
371
+ Table $1 8 \colon \mathrm { N } { \cdot } \mathrm { S } \mathrm { A G E } _ { \mathrm { f c } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ disabled. Left column corresponds to ensemble of SAGE models.
372
+
373
+ Table $9 \colon \mathrm { N } { \cdot } \mathrm { S } \mathrm { A G E } _ { \mathrm { f c } }$ results on Cora dataset, with $\hat { A } ^ { 0 }$ enabled.
374
+
375
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>72.9± 0.972</td><td>75.9± 0.922</td><td>75.5 ± 0.499</td><td>76.6 ± 1.641</td><td>76.8± 0.589</td></tr><tr><td>r=2</td><td>75.3 ± 0.879</td><td>76.1 ± 1.237</td><td>76.6 ± 0.579</td><td>76.4 ± 0.383</td><td>76.2 ± 0.626</td></tr><tr><td>r=4</td><td>75.3 ± 1.730</td><td>76.4 ± 1.186</td><td>76.6 ± 0.576</td><td>76.8 ± 0.450</td><td>77.4 ± 0.712</td></tr></table>
376
+
377
+ $$
378
+ \begin{array} { c } { { \begin{array} { c } { { \kappa = 1 } } \\ { { \tau = 1 } } \\ { { r = 2 } } \\ { { r = 4 } } \end{array} } | \begin{array} { c } { { K = 1 } } \\ { { 7 9 . 0 \pm 0 . 1 6 3 } } \\ { { 7 9 . 1 \pm 0 . 2 8 3 } } \\ { { 7 8 . 9 \pm 0 . 1 8 1 } } \end{array} | \begin{array} { c } { { K = 2 } } \\ { { 7 9 . 5 \pm 0 . 1 0 0 } } \\ { { 7 9 . 3 \pm 0 . 2 4 1 } } \\ { { 7 9 . 3 \pm 0 . 1 6 3 } } \end{array} | \begin{array} { c } { { K = 3 } } \\ { { 7 9 . 3 \pm 0 . 3 7 2 } } \\ { { 7 9 . 4 \pm 0 . 1 3 4 } } \\ { { 7 9 . 3 \pm 0 . 1 6 3 } } \end{array} | \begin{array} { c } { { K = 4 } } \\ { { 7 9 . 4 \pm 0 . 2 3 4 } } \\ { { 7 9 . 4 \pm 0 . 1 4 6 } } \\ { { 7 9 . 5 \pm 0 . 3 0 2 } } \end{array} | \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 4 \pm 0 . 3 3 7 } } \\ { { 7 9 . 4 \pm 0 . 1 6 0 } } \end{array} | \begin{array} { c } { { K = 5 } } \\ { { 7 9 . 5 \pm 0 . 3 3 7 } } \\ { { 7 9 . 4 \pm 0 . 1 6 0 } } \end{array} } \end{array}
379
+ $$
380
+
381
+ Table 20: $\mathbf { N } { \cdot } \mathbf { G C N } _ { \mathbf { a } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ disabled. Top-left entry corresponds to vanilla GCN. Left column corresponds to ensemble of GCN models.
382
+
383
+ Table 21: $\mathbf { N } { \cdot } \mathbf { G C N } _ { \mathrm { a } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ enabled.
384
+
385
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>78.1 ± 0.339</td><td>79.6± 0.293</td><td>79.8± 0.189</td><td>79.7 ± 0.170</td><td>79.6± 0.243</td></tr><tr><td>r=2</td><td>77.3 ± 0.125</td><td>79.7 ± 0.171</td><td>79.6 ± 0.189</td><td>79.6 ± 0.138</td><td>79.9 ± 0.177</td></tr><tr><td>r=4</td><td>77.3 ± 0.287</td><td>79.5 ± 0.396</td><td>79.5 ± 0.219</td><td>79.7 ± 0.149</td><td>79.9 ± 0.189</td></tr></table>
386
+
387
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>1</td><td>78.6± 0.723</td><td>78.7± 0.407</td><td>78.7± 0.530</td><td>78.0± 0.690</td></tr><tr><td>r=2</td><td>78.5 ± 0.353</td><td>77.9 ± 0.234</td><td>78.5± 0.724</td><td>78.8 ± 0.562</td><td>79.1 ± 0.267</td></tr><tr><td>r=4</td><td>78.4± 0.499</td><td>78.4± 0.716</td><td>78.9 ± 0.306</td><td>78.9 ± 0.385</td><td>79.0 ± 0.228</td></tr></table>
388
+
389
+ Table 22: ${ \bf N } { \mathrm { - G C N _ { \mathrm { f c } } } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ disabled. Left column corresponds to ensemble of GCN models.
390
+
391
+ Table 23: $\mathbf { N { \mathrm { - G C N } } _ { \mathrm { f c } } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ enabled.
392
+
393
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>76.5 ± 1.490</td><td>78.2 ± 1.290</td><td>79.2 ± 1.061</td><td>78.5 ± 0.963</td><td>78.7 ± 1.384</td></tr><tr><td>r=2</td><td>76.1 ± 1.118</td><td>77.1 ± 1.152</td><td>78.8 ± 1.479</td><td>79.4± 0.754</td><td>78.7 ± 0.612</td></tr><tr><td>r=4</td><td>76.0± 0.770</td><td>77.2 ± 0.785</td><td>78.7 ± 0.716</td><td>78.7 ± 0.953</td><td>79.0 ± 0.313</td></tr></table>
394
+
395
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>76.0±1.239</td><td>77.0± 0.856</td><td>77.3 ± 0.682</td><td>77.4± 0.419</td><td>77.3± 0.979</td></tr><tr><td>r=2</td><td>76.4 ± 1.219</td><td>77.6 ± 0.508</td><td>77.6 ± 0.414</td><td>77.7 ± 0.586</td><td>78.0± 0.250</td></tr><tr><td>r=4</td><td>76.5 ± 0.863</td><td>77.3 ± 0.198</td><td>77.8 ± 0.525</td><td>77.9 ± 0.522</td><td>77.6 ± 0.393</td></tr></table>
396
+
397
+ Table 24: $\mathrm { N - S A G E _ { a } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ disabled. Top-left entry corresponds to vanilla SAGE. Left column corresponds to ensemble of SAGE models.
398
+
399
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>73.4 ± 1.264</td><td>76.1 ± 0.306</td><td>76.8 ± 0.647</td><td>76.6± 0.623</td><td>77.0± 0.340</td></tr><tr><td>r=2</td><td>75.2 ± 0.597</td><td>76.0 ± 0.453</td><td>76.4 ± 0.241</td><td>77.2 ± 0.306</td><td>77.3 ± 0.869</td></tr><tr><td>r=4</td><td>74.9 ± 0.530</td><td>76.8± 0.535</td><td>77.0± 0.289</td><td>77.5 ± 0.407</td><td>77.3 ± 0.318</td></tr></table>
400
+
401
+ Table 25: $\mathrm { N - S A G E _ { a } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ enabled.
402
+
403
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>1</td><td>76.3 ± 1.545</td><td>76.7 ± 1.098</td><td>78.0± 1.427</td><td>77.3 ± 1.038</td></tr><tr><td>r=2</td><td>76.6 ± 1.196</td><td>77.3 ± 1.309</td><td>77.8 ± 0.746</td><td>77.5 ± 0.836</td><td>77.5 ± 0.298</td></tr><tr><td>r=4</td><td>76.5 ± 0.602</td><td>78.1 ± 1.239</td><td>77.6 ± 0.287</td><td>76.9 ± 0.472</td><td>77.7 ± 1.119</td></tr></table>
404
+
405
+ Table 26: ${ \mathrm { N } { \mathrm { - } } } { \mathrm { S } } { \mathrm { A G E } } _ { \mathrm { f c } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ disabled. Left column corresponds to ensemble of SAGE models.
406
+
407
+ <table><tr><td></td><td>K=1</td><td>K=2</td><td>K=3</td><td>K=4</td><td>K=5</td></tr><tr><td>r=1</td><td>72.9 ± 0.972</td><td>75.9 ± 0.922</td><td>75.5 ± 0.499</td><td>76.6 ± 1.641</td><td>76.8 ± 0.589</td></tr><tr><td>r=2</td><td>75.3 ± 0.879</td><td>76.1 ± 1.237</td><td>76.6 ± 0.579</td><td>76.4 ± 0.383</td><td>76.2 ± 0.626</td></tr><tr><td>r=4</td><td>75.3 ± 1.730</td><td>76.4 ± 1.186</td><td>76.6 ± 0.576</td><td>76.8 ± 0.450</td><td>77.4± 0.712</td></tr></table>
408
+
409
+ Table $2 7 { : } \mathrm { N } { \cdot } \mathrm { S } \mathrm { A G E } _ { \mathrm { f c } }$ results on Pubmed dataset, with $\hat { A } ^ { 0 }$ enabled.
md/train/SkeAaJrKDS/SkeAaJrKDS.md ADDED
@@ -0,0 +1,539 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COMBINING Q-LEARNING AND SEARCH WITH AMORTIZED VALUE ESTIMATES
2
+
3
+ Jessica B. Hamrick DeepMind jhamrick@google.com
4
+
5
+ Victor Bapst
6
+ DeepMind
7
+ vbapst@google.com
8
+
9
+ Alvaro Sanchez-Gonzalez DeepMind alvarosg@google.com
10
+
11
+ Tobias Pfaff
12
+ DeepMind
13
+ tpfaff@google.com
14
+
15
+ Theophane Weber ´ DeepMind theophane@google.com
16
+
17
+ Lars Buesing
18
+ DeepMind
19
+ lbuesing@google.com
20
+ Peter W. Battaglia
21
+ DeepMind
22
+ peterbattaglia@google.com
23
+
24
+ # ABSTRACT
25
+
26
+ We introduce “Search with Amortized Value Estimates” (SAVE), an approach for combining model-free Q-learning with model-based Monte-Carlo Tree Search (MCTS). In SAVE, a learned prior over state-action values is used to guide MCTS, which estimates an improved set of state-action values. The new Q-estimates are then used in combination with real experience to update the prior. This effectively amortizes the value computation performed by MCTS, resulting in a cooperative relationship between model-free learning and model-based search. SAVE can be implemented on top of any Q-learning agent with access to a model, which we demonstrate by incorporating it into agents that perform challenging physical reasoning tasks and Atari. SAVE consistently achieves higher rewards with fewer training steps, and—in contrast to typical model-based search approaches—yields strong performance with very small search budgets. By combining real experience with information computed during search, SAVE demonstrates that it is possible to improve on both the performance of model-free learning and the computational cost of planning.
27
+
28
+ # 1 INTRODUCTION
29
+
30
+ Model-based methods have been at the heart of reinforcement learning (RL) since its inception (Bellman, 1957), and have recently seen a resurgence in the era of deep learning, with powerful function approximators inspiring a variety of effective new approaches (Silver et al., 2018; Chua et al., 2018; Hamrick, 2019; Wang et al., 2019). Despite the success of model-free RL in reaching state-of-the-art performance in challenging domains (e.g. Kapturowski et al., 2018; Haarnoja et al., 2018), model-based methods hold the promise of allowing agents to more flexibly adapt to new situations and efficiently reason about what will happen to avoid potentially bad outcomes. The two key components of any such system are the model, which captures the dynamics of the world, and the planning algorithm, which chooses what computations to perform with the model in order to produce a decision or action (Sutton & Barto, 2018).
31
+
32
+ Much recent work on model-based RL places an emphasis on model learning rather than planning, typically using generic off-the-shelf planners like Monte-Carlo rollouts or search (see Hamrick (2019); Wang et al. (2019) for recent surveys). Yet, with most generic planners, even a perfect model of the world may require large amounts of computation to be effective in high-dimensional, sparse reward settings. For example, recent methods which use Monte-Carlo Tree Search (MCTS) require 100s or 1000s of model evaluations per action during training, and even upwards of a million simulations per time step at test time (Anthony et al., 2017; Silver et al., 2018). These large search budgets are required, in part, because much of the computation performed during planning—such as the estimation of action values—is coarsely summarized in behavioral traces such as visit counts (Anthony et al., 2017; Silver et al., 2018), or discarded entirely after an action is selected (Bapst et al., 2019; Azizzadenesheli et al., 2018). However, large search budgets are a luxury that is not always available: many real-world simulators are expensive and may only be feasible to query a handful of times. In this paper, we explore preserving the value estimates that were computed by search by amortizing them via a neural network and then using this network to guide future search, resulting in an approach which works well even with very small search budgets.
33
+
34
+ We propose a new method called “Search with Amortized Value Estimates” (SAVE) which uses a combination of real experience as well as the results of past searches to improve overall performance and reduce planning cost. During training, SAVE uses MCTS to estimate the Q-values at encountered states. These Q-values are used along with real experience to fit a Q-function, thus amortizing the computation required to estimate values during search. The Q-function is then used as a prior for subsequent searches, resulting in a symbiotic relationship between model-free learning and MCTS. At test time, SAVE uses MCTS guided by the learned prior to produce effective behavior, even with very small search budgets and in environments with tens of thousands of possible actions per state—settings which are very challenging for traditional planners.
35
+
36
+ # 2 BACKGROUND AND MOTIVATION
37
+
38
+ Unifying the complementary approaches of learning and search has been of interest to the RL and planning communities for many years (e.g. Gelly & Silver, 2007; Guo et al., 2014; Gu et al., 2016; Silver et al., 2016). SAVE is motivated in particular by two threads in this body of work: one which uses planning in-the-loop to produce experience for Q-learning, and one which learns a policy prior for guiding search. As we will describe next, both of these previous approaches can suffer from issues with training stability which are alleviated by SAVE by simultaneously using MCTS to strengthen an action-value function, and Q-learning to strengthen MCTS.
39
+
40
+ # 2.1 LEARNING FROM PLANNED ACTIONS
41
+
42
+ A number of methods have explored learning from planned actions. Guo et al. (2014) trained a model-free policy to imitate the actions produced by an MCTS agent. Other methods use planning in-the-loop to recommend actions, which are then executed in the environment to gather experience for model-free learning (Silver et al., 2008; Gu et al., 2016; Azizzadenesheli et al., 2018; Shen et al., 2018; Lowrey et al., 2018; Bapst et al., 2019; Kartal et al., 2019). However, problems can arise when learning with actions that were produced via planning, even with off-policy algorithms like Q-learning. As noted by both Gu et al. (2016) and Azizzadenesheli et al. (2018), planning avoids suboptimal actions, resulting in a highly biased action distribution consisting of mostly good actions; information about suboptimal actions therefore does not get propagated back to the Q-function. As an example, consider the case where a Q-function recommends taking action $a$ . During planning, this action is explored and is found to yield lower reward than expected. The planner will end up recommending some other action $a ^ { \prime }$ , which is executed in the environment and later used to update the Q-function. However, this means that the original action $a$ is never actually experienced and thus is never downweighed in the Q-function, resulting in poorly approximated Q-values.
43
+
44
+ One way to deal with this problem is to use a mixture of both on-policy and planned actions (Gu et al., 2016). However, this throws away information about poor actions which is acquired during the planning process. In SAVE, we instead make use of this information by using the values estimated during search to help fit the Q-function. If the search finds that a particular action is worse than previously thought, this information will be reflected by the estimated values and will thus ultimately get propagated back to the Q-function. We explicitly test and confirm this hypothesis in Section 4.2.
45
+
46
+ # 2.2 USING PRIOR KNOWLEDGE IN SEARCH
47
+
48
+ Much research has leveraged prior knowledge in the context of MCTS (Gelly & Silver, 2007; 2011; Silver et al., 2016; Segler et al., 2018; Silver et al., 2017b; 2018; Anthony et al., 2017; 2019). Some of the most successful methods (Anthony et al., 2017; Silver et al., 2018) use a prior policy to guide search, the results of which are used to further improve the policy. However, such methods use information about past behavior to learn a policy prior—namely, the visit counts of actions during search—and discard other search information such as inferred Q-values. We might anticipate one potential failure mode of such “count-based policy learning” approaches. Consider an environment with sparse rewards, where most actions are highly suboptimal. In the limit of infinite search, actions which have highest value will be visited most frequently, resulting in a policy that guides search towards regions of high value. However, in the regime of small search budgets, the search may very well end up exploring mostly suboptimal actions. These actions have higher visit counts, and so are reinforced, leading to the agent being more likely to explore poor actions.
49
+
50
+ Rather than implicitly biasing search towards value through the use of visit counts, SAVE relies on a prior that explicitly encodes knowledge about value. If SAVE ends up searching poor actions, it will learn that they have low values and this knowledge will be reflected in future searches. Thus, in contrast to count-based approaches, a SAVE agent will be less likely to visit poor actions in the future despite having frequently visited them in the past. We explicitly test and confirm this hypothesis in Section 4.1.
51
+
52
+ # 2.3 OTHER RELATED WORK
53
+
54
+ Finding effective ways of combining model-based and model-free experience has been of interest to the RL community for decades. Most famously, the Dyna algorithm (Sutton, 1990) proposes using real experience to learn a model and then using the model to train a model-free policy. A number of more recent works have explored how to incorporate this idea into deep architectures (Kalweit & Boedecker, 2017; Feinberg et al., 2018; Buckman et al., 2018; Serban et al., 2018; Kurutach et al., 2018; Kaiser et al., 2019), with an emphasis on dealing with the errors that are introduced by approximate models. In these approaches, the policy or value function is typically trained using on-policy rollouts from the model without using additional planning. Another way to combine model-free and model-based approaches is “implicit planning”, in which the computation of a planner is built into the architecture of a neural network itself (Weber et al., 2017; Buesing et al., 2018; Pascanu et al., 2017; Silver et al., 2017b; Oh et al., 2017; Guez et al., 2018; Farquhar et al., 2018; Hamrick et al., 2017; Srinivas et al., 2018; Yu et al., 2019; Tamar et al., 2016; Karkus et al., 2017). While SAVE is not an implicit planning method, it shares similarities with such methods in that it also tightly integrates planning and learning.
55
+
56
+ # 3 METHOD
57
+
58
+ SAVE features two main components (Figure 1). First, we use a search policy that incorporates the Q-function $Q _ { \theta } ( s , a )$ as a prior over Q-values that are estimated during search. Second, to train the Qfunction we rely on an objective function that combines both the TD-error from Q-learning with an amortization loss that amortizes the value computation performed by the search. The amortization loss, combined with the prior over Q-values, thus enables future searches to build on previous ones, resulting in stronger search performance overall.
59
+
60
+ # 3.1 STANDARD MCTS
61
+
62
+ Before explaining how SAVE leverages search, we briefly describe the standard MCTS algorithm (Kocsis & Szepesvari, 2006; Coulom, 2006). While we´ focus here on the single-player setting, we note that the formulation of MCTS (and by extension, SAVE) is similar for two-player settings. MCTS uses a simulator or model of the environment to explore possible future states and actions, with the aim of finding a good action to execute from the current state, $s _ { 0 }$ . In MCTS, we assume access to a budget of $K$ iterations (or simulations). The $k ^ { \mathrm { t h } }$ iteration of MCTS consists of three phases: selection, expansion, and backup. In the selection phase, we expand a search tree beginning with the current state and taking actions according to a search policy:
63
+
64
+ ![](images/970cb96cfe8a17444f7f3be06c5da8ab9dc079793222741b5ef12d707a1d92e6.jpg)
65
+ Figure 1: Illustration of SAVE. When acting, the agent uses a Q-function, $Q _ { \theta }$ , as a prior for the Q-values estimated during MCTS. Over $K$ steps of search, $Q _ { 0 } ~ \equiv ~ Q _ { \theta }$ is built up to $Q _ { K }$ , which is returned as $Q _ { \mathrm { M C T S } }$ (Equations 1 and 4). From $Q _ { \mathrm { M C T S } }$ , an action $a$ is selected via epsilon-greedy and the resulting experience $( s , \bar { a } , r , s ^ { \bar { \prime } } , Q _ { \mathrm { M C T S } } )$ is added to a replay buffer. When learning, the agent uses real experience to update $Q _ { \theta }$ via Q-learning $( \mathcal { L } _ { Q } )$ as well as an amortization loss $( { \mathcal { L } } _ { A } )$ which regresses $Q _ { \theta }$ towards the $\mathrm { Q }$ -values estimated during search (Equation 6).
66
+
67
+ $$
68
+ \pi _ { k } ( s ) = \arg \operatorname* { m a x } _ { a } \left( Q _ { k } ( s , a ) + U _ { k } ( s , a ) \right) ,
69
+ $$
70
+
71
+ where $Q _ { k }$ is the currently estimated value of taking action $a$ while in state $s$ , which will be explained further below. $U _ { k } ( s , a )$ is the UCT exploration term:
72
+
73
+ $$
74
+ U _ { k } ( s , a ) = c _ { \mathrm { U C T } } \sqrt { \frac { \log \left( \sum _ { a } N _ { k } ( s , a ) \right) } { N _ { k } ( s , a ) } } ,
75
+ $$
76
+
77
+ where $N _ { k } ( s , a )$ is the number of times we have explored taking action $a$ from state $s$ and $c _ { \mathrm { U C T } }$ is a constant that encourages exploration. This selection procedure is repeated for $T - 1$ times, until a new action $a T { - } 1$ that had not previously been explored is chosen from state $s T - 1$ . This begins the expansion phase, during which $a T { - 1 }$ is executed in the simulator, resulting in a reward $r _ { T - 1 }$ and new state $s _ { T }$ . The new state $s _ { T }$ is added to the search tree, and its value $V ( s _ { T } )$ is estimated either via a state-value function or (more traditionally) via a Monte-Carlo rollout. At this point the backup phase begins, during which the value of $s _ { T }$ is used to update (or “back up”) the values of its parent states earlier in the tree. Specifically, for state $s _ { t }$ , the $i ^ { \mathrm { t h } }$ backed up return is estimated as:
78
+
79
+ $$
80
+ R _ { i } ( s _ { t } , a _ { t } ) = \gamma ^ { T - t } V ( s _ { T } ) + \sum _ { j = t } ^ { T - 1 } \gamma ^ { j - t } r _ { j } ,
81
+ $$
82
+
83
+ where $\gamma$ is the discount factor and $r _ { j }$ was the reward obtained after executing $a _ { j }$ in $s _ { j }$ when traversing ps are then used to estimate the Q-function in Equation 1 as . $Q _ { k } ( s , a ) \bar { = }$ $\begin{array} { r } { \sum _ { i = 1 } ^ { N _ { k } ( s , a ) } R _ { i } ( s , a ) / N _ { k } ( s , a ) . } \end{array}$
84
+
85
+ # 3.2 INCORPORATING A PRIOR DURING SEARCH
86
+
87
+ SAVE makes several changes to the standard MCTS procedure. First, it assumes it has visited every state and action pair once by initializing $N ( s , a ) = 1$ for all states and actions.1 Second, for each of these state-action pairs, it assumes a prior estimate of its value, $Q _ { \theta } ( s , a )$ , and uses this as an initial estimate for $Q _ { k }$ , similar to Gelly & Silver (2007; 2011):
88
+
89
+ $$
90
+ Q _ { k } ( s , a ) = \frac { Q _ { \theta } ( s , a ) + \sum _ { i = 1 } ^ { N _ { k } ( s , a ) - 1 } R _ { i } ( s , a ) } { N _ { k } ( s , a ) } .
91
+ $$
92
+
93
+ where $Q _ { 0 } ( s , a ) : = Q _ { \theta } ( s , a )$ . Third, rather than using a separate state-value function or Monte-Carlo rollouts to estimate the value of new states, SAVE uses the same state-action value function, i.e. $V ( s ) : = \operatorname* { m a x } _ { a } Q _ { \theta } ( s , a )$ . These three changes provide a mechanism for incorporating Q-based prior knowledge into MCTS: specifically, SAVE acts as if it has visited every state-action pair once, with the estimated values being given by $Q _ { \theta }$ . Roughly speaking, this can be interpreted as using MCTS to perform Bayesian inference over $\mathrm { Q }$ -values, with the prior specified by $Q _ { \theta }$ with a weight equivalent to a pseudocount of one. This set of changes contrasts with UCT, which does not incorporate prior knowledge, as well as PUCT (Rosin, 2011; Silver et al., 2017a; 2018), which incorporates prior knowledge via a policy in the exploration term $U _ { k } ( s , a )$ .
94
+
95
+ After $K$ iterations, we return $Q _ { \mathrm { M C T S } } ( s , a ) : = Q _ { K } ( s , a )$ and select an action to execute in the environment via epsilon-greedy over $Q _ { \mathrm { M C T S } } ( s _ { 0 } , a )$ . After the action is executed, we store the resulting experience along with a copy of $Q _ { \mathrm { M C T S } } ( s _ { 0 } , \cdot ) \equiv \{ Q _ { \mathrm { M C T S } } ( s _ { 0 } , a _ { i } ) \} _ { i }$ in the replay buffer. This process is illustrated in Figure 1 (left).
96
+
97
+ # 3.3 Q-LEARNING WITH AN AMORTIZATION LOSS
98
+
99
+ During learning, the results of the search are amortized into an updated prior $Q _ { \theta ^ { \prime } }$ (Figure 1, right). We impose an amortization loss $\mathcal { L } _ { A }$ which encourages the distribution of Q-values output by the neural network to be similar to those estimated by MCTS. The amortization loss is defined to be the cross-entropy between the softmax of the Q-values before $\left( Q _ { \theta } \right)$ and after $\mathrm { \Delta } Q _ { \mathrm { M C T S } } )$ ) MCTS. This cross-entropy loss achieves better performance than alternatives like L2, as described in Section 4.2. Setting $\begin{array} { r } { \mathbf { \partial } _ { \mathrm { M C T S } } \ = \ \mathrm { s o f t m a x } _ { \tau } ( Q _ { \mathrm { M C T S } } ( s , \cdot ) ) } \end{array}$ and $\mathbf { p } _ { \theta } = \mathrm { s o f t m a x } _ { \tau } ( Q _ { \theta } ( s , \cdot ) )$ , where $\tau = 1$ is the softmax temperature, the loss is defined as:
100
+
101
+ ![](images/4f840fe1f8159e7305d9de7084db9a7c5011a8f454af09a946cb9f52535b7c8b.jpg)
102
+ Figure 2: Results on Tightrope. (a-c) Tabular results comparing SAVE, PUCT, UCT, and Q-learning (with MCTS at test time) for varying percentages of terminal actions on the $x$ -axes and for different search budgets. The $y$ -axes show reward for either the sparse or dense reward setting of Tightrope. Lines show medians across 20 seeds, with error bars showing $9 5 \%$ confidence intervals. (d) Results on Tightrope when using function approximation, comparing SAVE with PUCT and Q-learning. Lines show medians across 10 seeds, with shaded regions indicating min and max seeds.
103
+
104
+ $$
105
+ \mathcal { L } _ { A } ( \theta , \mathcal { D } ) = - \frac { 1 } { N } \sum _ { \mathcal { D } } ( \mathbf { p } _ { \mathrm { M C T S } } ) ^ { \top } \log \mathbf { p } _ { \theta } ,
106
+ $$
107
+
108
+ where $\mathcal { D }$ is a batch of $N$ experience tuples $( s _ { t } , a _ { t } , r _ { t } , s _ { t + 1 } , Q _ { \mathrm { M C T S } } ( s _ { t } , \cdot ) )$ sampled from the replay buffer. This amortization loss is linearly combined with a Q-learning loss,
109
+
110
+ $$
111
+ \mathcal { L } ( \boldsymbol { \theta } , \mathcal { D } ) = \beta _ { Q } \mathcal { L } _ { Q } ( \boldsymbol { \theta } , \mathcal { D } ) + \beta _ { A } \mathcal { L } _ { A } ( \boldsymbol { \theta } , \mathcal { D } ) ,
112
+ $$
113
+
114
+ where $\beta _ { Q }$ and $\beta _ { A }$ are coefficients to scale the loss terms. $\mathcal { L } _ { Q }$ may be any value-based loss function, such as that based on 1-step TD targets, $n$ -step TD targets, or $\lambda$ -returns (Sutton, 1988). The amortization loss does make SAVE more sensitive to off-policy experience, as the values of $Q _ { \mathrm { M C T S } }$ stored in the replay buffer will become less useful and potentially misleading as $Q _ { \theta }$ improves; however, we did not find this to be an issue in practice.
115
+
116
+ # 4 EXPERIMENTS
117
+
118
+ We evaluated SAVE in four distinct settings that vary in their branching factor, sparsity of rewards, and episode length. First, we demonstrate through a new Tightrope environment that SAVE performs well in settings where count-based policy approaches struggle, as discussed in Section 2.2. Next, we show that SAVE scales to the challenging Construction domain (Bapst et al., 2019) and that it alleviates the problem with off-policy actions discussed in Section 2.1. We also perform several ablations to tease apart the details of SAVE. Finally, we demonstrate that SAVE dramatically improves over Q-learning in a new and even more difficult construction task called Marble Run, as well as in more standard environments like Atari (Bellemare et al., 2013). In all our experiments we use SAVE with a perfect model of the environment, though we expect our approach would work with learned models as well.
119
+
120
+ # 4.1 TIGHTROPE
121
+
122
+ In Section 2.2, we hypothesized that approaches which use count-based policy learning rather than value-based learning (e.g. Anthony et al., 2017; Silver et al., 2018) may suffer in environments with large branching factors, many suboptimal actions, and small search budgets. To test this hypothesis, we developed a toy environment called Tightrope with these characteristics. Tightrope is a deterministic MDP consisting of 11 labeled states linked together in a chain. At each state, there are 100 actions to take, $M \%$ of which are terminal (meaning that when taken they cause the episode to end).
123
+
124
+ The other non-terminal actions will cause the state to transition to the next state in the chain. We considered two settings of the reward function: dense rewards, in which case the agent receives a reward of 0.1 when making it to the next state in the chain and 0 otherwise; and sparse rewards, in which case the agent receives a reward of 1 only when making it to the final state. In the sparse reward setting, we randomly selected one state in the chain to be the “final” state to form a curriculum over the length of the chain. With the exception of the final state in the sparse reward setting, the transition function of the MDP is exactly the same across episodes, with the same actions always having the same behavior.
125
+
126
+ Tabular Results We first examined the behavior of SAVE on Tightrope in a tabular setting to eliminate potential concerns about function approximation (see Section B.2). We compared SAVE to three other agents. UCT is a pure-search agent which runs MCTS using a UCT search policy with no prior. It uses Monte-Carlo rollouts following a random policy to estimate $V ( s )$ . PUCT is based on AlphaZero (Silver et al., 2018) and uses a policy prior (which is learned from visit counts during MCTS) and state-value function (which is learned from Monte-Carlo returns). During search, the policy is used in the PUCT exploration term and the value function is used for bootstrapping. More details on PUCT in general are provided in Section A.3. Q-Learning performs one-step tabular Q-learning during training, and MCTS at test time using the same search procedure as SAVE.
127
+
128
+ Figure 2a-c illustrates the results in the tabular setting after 500 episodes. UCT, which does not use any learning, illustrates the difficulty of using brute-force search. Q-learning, which does not use any search during training, is slow to converge to a solution within the 500 episodes, particularly in the sparse reward setting; additionally, adding search at test time does not substantially improve things. Although the incorporation of learning with PUCT does improve the results, we can see that with small search budgets and high proportions of terminal actions, PUCT struggles to remember which actions are safe (nonterminal), especially in the sparse reward setting. In contrast, SAVE solves the Tightrope environment in all of the dense reward settings and most of the sparse reward settings. As the search budget increases, we see that both PUCT and SAVE reliably converge to a solution; thus, if a large search budget is available both methods may fare equally well. However, if only a small search budget is available, SAVE results in much more reliable performance.
129
+
130
+ Function Approximation Results We also looked at the ability of SAVE and PUCT to solve the Tightrope environment when using function approximation, along with a model-free Q-learning baseline (see Section B.3). We evaluated all agents on the sparse reward version of Tightrope with $9 5 \%$ terminal actions, and used a search budget of 10 (except for Q-learning, which used a test budget of zero). The results, shown in Figure 2d, follow the same pattern as in the tabular setting.
131
+
132
+ # 4.2 CONSTRUCTION
133
+
134
+ We next evaluated SAVE in three of the Construction tasks explored by Bapst et al. (2019), in which the goal is to stack blocks to achieve a functional objective while avoiding collisions with obstacles. In Connecting, the goal is to connect a target point in the sky to the floor. In Covering, the goal is to cover obstacles from above without touching them. Covering Hard is the same as Covering, except that only a limited number of blocks may be used. The Construction tasks are challenging for modelfree approaches because there is a combinatorial space of possible scenes and the physical dynamics are challenging to predict. However, they are also difficult for traditional search methods, as they have huge branching factors with up to tens of thousands of possible actions per state. Additionally, the simulator in the Construction tasks is expensive to query, making it infeasible to use with search budgets of more than 10-20.
135
+
136
+ To implement SAVE, we used the same agent architecture as Bapst et al. (2019). We compared SAVE to a baseline version of SAVE without amortization loss (i.e., ${ \mathcal { L } } ( \theta , { \mathcal { D } } ) = \beta _ { Q } { \mathcal { L } } _ { Q } ( \theta , { \mathcal { D } } ) )$ , similar to the MCTS agent described in Bapst et al. (2019). We also compared to a Q-learning baseline which performs pure model-free learning during training (but which may also utilize MCTS at test time using the same search procedure as SAVE), as well as a UCT baseline which did not use any learning (but which did use a pretrained value function for bootstrapping). For SAVE-based agents, we used a training budget of 10 simulations and varied the budget at test time; for UCT, we used a constant budget of 1000 simulations at test time (see Appendix C).
137
+
138
+ ![](images/1cd6b8f2a6de4ab275790ed82968c3d59e15c8617bc9906b548c0d539e341809.jpg)
139
+ Figure 3: Results on Construction. (a-c) Each subplot shows results for SAVE, SAVE without amortization loss, Q-learning with MCTS at test time, and pure search (UCT). The $x$ -axis shows the effect of increasing the number of MCTS simulations at test time. During training, SAVE with and without amortization loss used a search budget of 10 simulations. UCT used a search budget of 1000 simulations. Points show medians across 10 seeds, and error bars indicate min and max seeds. (d) Ablation experiments on the Covering task. We compare SAVE to variants that do not have an amortization loss, which use an L2 amortization loss, which do not use the Q-Learning loss, and which use PUCT rather than UCT. Results are shown at the hardest level of difficulty for the Covering task with a test budget of 10. The colored bars show median reward across 10 seeds, and error bars show min and max seed.
140
+
141
+ Results Figure 3a-c shows the results on the three construction tasks. The poor performance of UCT (dotted lines) highlights the need for prior knowledge to manage the huge branching factor in these domains. While model-free Q-learning improves performance, simply performing search on top of the learned Q-values only results in small gains in performance, if any. The performance of SAVE without amortization loss highlights exactly the issue discussed in Section 2.1. Without the amortization loss, the Q-learning component of SAVE only learns about actions which have been selected via search, and thus rarely sees highly suboptimal actions, resulting in a poorly approximated Q-function. Indeed, as we can see in the case where the search budget is zero, the agent’s performance falls off dramatically, suggesting that the underlying Q-values are poor. Using search at test time can make up for this problem to some degree, but only when used with a budget very close to that with which it was trained: large search budgets can actually result in worse search performance (e.g. in Covering and Covering Hard) because the poor Q-values are also being used for bootstrapping during the search. It is only by leveraging search during training time and incorporating an amortization loss do we see a synergistic result: using SAVE results in higher rewards across all tasks, strongly outperforming the other agents.
142
+
143
+ Ablation Experiments In the past two sections, we compared SAVE to alternatives which do not include an amortization loss, or which use count-based policy learning rather than value-based learning. However, a number of additional questions remain regarding the architectural choices in SAVE. To address these, we ran a number of ablation experiments on the Covering task, with the results shown in Figure 3d. Specifically, we compared SAVE with versions that use an L2 loss (rather than cross entropy), that do not use the Q-learning loss, and that use the Q-values to guide search via PUCT rather than initializing $Q _ { 0 }$ . Overall, we find that the choices made in SAVE result in the highest levels of performance. Of particular note is the ablation that uses the L2 loss, indicating that the softmax cross entropy loss plays an important role in SAVE’s performance. We speculate this is true for two reasons. First, because we use small search budgets, the estimated $Q _ { \mathrm { M C T S } }$ is likely to be noisy, and thus it may be more robust to preserve just the relative magnitudes of action values rather than exact quantities. Second, the cross entropy loss means that $Q _ { \theta }$ need not represent the values of poor actions exactly, thus freeing up capacity in the neural network to more precisely represent the values of good actions. Details and further discussion is provided in Section C.3. We also compared to a policy-based PUCT agent like that described in Section 4.1, but found this did not achieve positive reward on the harder tasks like Covering. This result again highlights the same problem with count-based policy training and small search budgets, as discussed in Section 2.2.
144
+
145
+ ![](images/b90911caa02e4b43bc72969e95d24674d26462302e1d850c18bc581a3e99ddee.jpg)
146
+ Figure 4: (a-b) Results on the Marble Run environment for model-free Q-Learning as well as SAVE as a function of curriculum difficulty level, for two different settings of the cost of “sticky” blocks. Points indicate medians across 10 seeds, and error bars show min and max seeds. (c-d) Structures built by SAVE which solve the same scene for two different costs of sticky blocks (difficulty 6). Additional videos showing agent behavior are available at https://tinyurl.com/yxm4ma47.
147
+
148
+ # 4.3 MARBLE RUN
149
+
150
+ SAVE is able to achieve near-ceiling levels of performance on the original Construction tasks. Thus, we developed a new task in the style of the previous Construction tasks called Marble Run which is even more challenging in that it involves sparser rewards and a more complex reward function. Specifically, the goal in Marble Run is to stack blocks to enable a marble to get from its original starting position to a goal location, while avoiding obstacles. At each step, the agent may choose from a number of differently shaped rectangular blocks as well as ramp shapes, and may choose to make these blocks “sticky” (for a price) so that they stick to other objects in the scene. The episode ends once the agent has created a structure that would get the marble to the goal. The agent receives a reward of one if it solves the scene, and zero otherwise.
151
+
152
+ We used the same agent architecture and training setup as with the Construction tasks, except for the curriculum. Specifically, we found it was important to train agents on this task using an adaptive curriculum over difficulty levels rather than a fixed linear curriculum. Under the adaptive curriculum, we only allowed an agent to progress to the next level of difficulty after it was able to solve at least $50 \%$ of the scenes at the current level of difficulty. Further details of the Marble Run task and the curriculum are given in Appendix D.
153
+
154
+ Results Figure 4 shows the results for SAVE and Q-learning for the two different costs of sticky blocks, as as well as some example constructions. SAVE progresses more quickly through the curriculum and reaches higher levels of difficulty (see Figure D.1) and overall achieves much higher levels of reward at every difficulty level. Additionally, we found that the Q-learning agent reliably becomes unstable and collapses at around difficulty 4-5 (see Figure D.2), while SAVE does not have this problem. Qualitatively (Figure 4c-d), SAVE is able to build structures which allow the marble to reach targets that are raised above the floor while also spanning multiple obstacles.
155
+
156
+ These results on Marble Run also allow us to address the trade-off between model-free experience versus planned experience. Specifically, with a search budget of 10, SAVE effectively sees 10 times as many transitions as a model-free agent trained on the same number of environment interactions. Would a model-free agent trained for 10 times as long achieve equivalent performance? As can be seen in Figure D.2, this is not the case: the model-free agent sees more episodes but results in worse performance. We find the same result in other Construction tasks as well (see Section C.4). This highlights the positive interaction that occurs when learning both from experience generated from planned actions and from the values estimated during search.
157
+
158
+ # 4.4 ATARI
159
+
160
+ To demonstrate that SAVE is applicable to more standard environments, we also evaluated it on a subset of Atari games (Bellemare et al., 2013). We implemented SAVE on top of R2D2, a distributed Q-learning agent that achieves state-of-the-art results on Atari (Kapturowski et al., 2018). To allow for a fair comparison2 between purely model-free R2D2 and a version with SAVE, we controlled R2D2 to have the same replay ratio as SAVE and then tuned its hyperparameters to have approximately the same level of performance as the baseline version of R2D2 (see Appendix E). We find that SAVE outperforms or equals this controlled version of R2D2 in all games, with particularly high performance on Frostbite, Alien, and Zaxxon (shown in Figure 5). SAVE also outperforms the baseline version of R2D2 (see Table E.1 and Figure E.1).
161
+
162
+ # 5 DISCUSSION
163
+
164
+ We introduced SAVE, a method for combining model-free Q-learning with MCTS. During training, SAVE leverages MCTS to infer a set of Q-values, and then uses a combination of real experience plus the estimated Q-values to fit a Qfunction, thus amortizing the value computation of previous searches via a neural network. The Q-function is used as a prior to guide future searches, enabling even stronger search performance, which in turn is further amortized via the Qfunction. At test time, SAVE can be used to achieve high levels of reward with only very small search budgets, which we demonstrate across four distinct domains: Tightrope, Construction (Bapst et al., 2019), Marble Run, and Atari (Bellemare et al., 2013; Kapturowski et al., 2018). These results suggest that SAVEing the experience generated by search in an explicit Q-function, and initializing future searches with that information, offers important advantages for model-based RL.
165
+
166
+ ![](images/bdcb6611e360d3064ebe44181d5880d2dcc1119588566415c4b56c545d6fb874.jpg)
167
+ Figure 5: Results on Atari.
168
+
169
+ When combining Q-values estimated both from prior searches and real experience, it may also be useful to account for the quality or confidence of the estimated Q-values. Count-based policy methods (Anthony et al., 2017; Silver et al., 2018) do this by leveraging an estimate of confidence based on visit counts: actions with high visit counts should both have high value (or else they would not have been visited so much) and high confidence (because they have been explored extensively). However, as we have shown, relying solely on visit counts can result in poor performance when using small search budgets (Section 4.1). A key future direction will be to amortize both the computation of value and of reliability, achieving the best of both SAVE and count-based methods. Encoding confidence estimates into the Q-values may also be helpful for applying SAVE to settings with learned models, which may have non-trivial approximation errors. In particular, it may be helpful to attenuate the contribution of search-estimated Q-values to the Q-prior both when an action has not been sufficiently explored and when model error is high.
170
+
171
+ Our work demonstrates the value of amortizing the Q-estimates that are generated during MCTS. Indeed, we have shown that by doing so, SAVE reaches higher levels of performance than modelfree approaches while using less computation than is required by other model-based methods. More broadly, we suggest that SAVE can be interpreted as a framework for ensuring that the valuable computation performed during search is preserved, rather than being used only for the immediate action or summarized indirectly via frequency statistics of the search policy. By following this philosophy and tightly integrating planning and learning, we expect that even more powerful hybrid approaches can be achieved.
172
+
173
+ # 6 ACKNOWLEDGEMENTS
174
+
175
+ We would like to thank GB Parascandolo, George Papamakarios, Nicolas Heess, Ioannis Antonoglou, Thomas Hubert, Julian Schrittweiser, and David Silver for helpful comments and feedback on this project.
176
+
177
+ # REFERENCES
178
+
179
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for largescale machine learning. In 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 16), pp. 265–283, 2016.
180
+
181
+ Thomas Anthony, Zheng Tian, and David Barber. Thinking fast and slow with deep learning and tree search. In Advances in Neural Information Processing Systems, pp. 5360–5370, 2017.
182
+
183
+ Thomas Anthony, Robert Nishihara, Philipp Moritz, Tim Salimans, and John Schulman. Policy gradient search: Online planning and expert iteration without search trees. arXiv preprint arXiv:1904.03646, 2019.
184
+
185
+ Kamyar Azizzadenesheli, Brandon Yang, Weitang Liu, Emma Brunskilland Zachary C Lipton, and Animashree Anandkumar. Surprising negative results for generative adversarial tree search. arXiv preprint arXiv:1806.05780, pp. 1–25, 2018.
186
+
187
+ Victor Bapst, Alvaro Sanchez-Gonzalez, Carl Doersch, Kimberly L Stachenfeld, Pushmeet Kohli, Peter W Battaglia, and Jessica B Hamrick. Structured agents for physical construction. In Proceedings of the International Conference on Machine Learning (ICML), 2019.
188
+
189
+ Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, pp. 1–38, 2018.
190
+
191
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013.
192
+
193
+ Richard Bellman. Dynamic programming. Princeton University Press, 1957.
194
+
195
+ Jacob Buckman, Danijar Hafner, George Tucker, Eugene Brevdo, and Honglak Lee. Sampleefficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pp. 8224–8234, 2018.
196
+
197
+ Lars Buesing, Theophane Weber, S ´ ebastien Racani ´ ere, S. M. Ali Eslami, Danilo Rezende, David P. \` Reichert, Fabio Viola, Fred´ eric Besse, Karol Gregor, Demis Hassabis, and Daan Wierstra. ´ Learning and querying fast generative models for reinforcement learning. arXiv preprint arXiv:1802.03006, pp. 1–15, 2018.
198
+
199
+ Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Proceedings of the 32nd Conference on Neural Information Processing Systems (NeurIPS 2018), 2018.
200
+
201
+ Remi Coulom. Efficient selectivity and backup operators in Monte-Carlo tree search. In ´ International conference on computers and games, pp. 72–83. Springer, 2006.
202
+
203
+ Gregory Farquhar, Tim Rocktaschel, Maximilian Igl, and Shimon Whiteson. TreeQN and ATreeC: ¨ Differentiable tree planning for deep reinforcement learning. In Proceedings of the 6th International Conference on Learning Representations (ICLR 2018), 2018.
204
+
205
+ Vladimir Feinberg, Alvin Wan, Ion Stoica, Michael I. Jordan, Joseph E. Gonzalez, and Sergey Levine. Model-based value expansion for efficient model-free reinforcement learning. In Proceedings of the 35th International Conference on Machine Learning (ICML 2018), 2018.
206
+
207
+ Sylvain Gelly and David Silver. Combining online and offline knowledge in UCT. In Proceedings of the 24th international conference on Machine learning, pp. 273–280. ACM, 2007.
208
+
209
+ Sylvain Gelly and David Silver. Monte-carlo tree search and rapid action value estimation in computer go. Artificial Intelligence, 175(11):1856–1875, 2011.
210
+
211
+ Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep Q-learning with model-based acceleration. In Proceedings of the 33rd International Conference on Machine Learning (ICML 2016), 2016.
212
+
213
+ Arthur Guez, Theophane Weber, Ioannis Antonoglou, Karen Simonyan, Oriol Vinyals, Daan Wier- ´ stra, Remi Munos, and David Silver. Learning to search with MCTSnets. In ´ Proceedings of the 35th International Conference on Machine Learning (ICML 2018), 2018.
214
+
215
+ Arthur Guez, Mehdi Mirza, Karol Gregor, Rishabh Kabra, Sebastien Racani ´ ere, Th \` eophane Weber, ´ David Raposo, Adam Santoro, Laurent Orseau, Tom Eccles, et al. An investigation of model-free planning. arXiv preprint arXiv:1901.03559, 2019.
216
+
217
+ Xiaoxiao Guo, Satinder Singh, Honglak Lee, Richard L Lewis, and Xiaoshi Wang. Deep learning for real-time Atari game play using offline Monte-Carlo tree search planning. In Advances in neural information processing systems, pp. 3338–3346, 2014.
218
+
219
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018.
220
+
221
+ Jessica B Hamrick. Analogues of mental simulation and imagination in deep learning. Current Opinion in Behavioral Sciences, 29:8–16, 2019.
222
+
223
+ Jessica B. Hamrick, Andrew J. Ballard, Razvan Pascanu, Oriol Vinyals, Nicolas Heess, and Peter W. Battaglia. Metacontrol for adaptive imagination-based optimization. In Proceedings of the 5th International Conference on Learning Representations (ICLR 2017), 2017.
224
+
225
+ Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Model-based reinforcement learning for Atari. arXiv preprint arXiv:1903.00374, 2019.
226
+
227
+ Gabriel Kalweit and Joschka Boedecker. Uncertainty-driven imagination for continuous deep reinforcement learning. In Proceedings of the 1st Conference on Robot Learning (CoRL 2017), 2017.
228
+
229
+ Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent experience replay in distributed reinforcement learning. In Proceedings of the International Conference on Learning Representations, 2018.
230
+
231
+ Peter Karkus, David Hsu, and Wee Sun Lee. QMDP-Net: Deep learning for planning under partial observability. In Proceedings of the 31st Conference on Neural Information Processing Systems (NeurIPS 2017), 2017.
232
+
233
+ Bilal Kartal, Pablo Hernandez-Leal, and Matthew E Taylor. Action guidance with mcts for deep reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment, volume 15, pp. 153–159, 2019.
234
+
235
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
236
+
237
+ Levente Kocsis and Csaba Szepesvari. Bandit based Monte-Carlo planning. In ´ European conference on machine learning, pp. 282–293. Springer, 2006.
238
+
239
+ Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-ensemble trust-region policy optimization. In Proceedings of the 6th International Conference on Learning Representations (ICLR 2018), 2018.
240
+
241
+ Kendall Lowrey, Aravind Rajeswaran, Sham Kakade, Emanuel Todorov, and Igor Mordatch. Plan online, learn offline: Efficient learning and exploration via model-based control. arXiv preprint arXiv:1811.01848, 2018.
242
+
243
+ 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.
244
+
245
+ Junhyuk Oh, Satinder Singh, and Honglak Lee. Value prediction network. In Proceedings of the 31st Conference on Neural Information Processing Systems (NeurIPS 2017), 2017.
246
+
247
+ Razvan Pascanu, Yujia Li, Oriol Vinyals, Nicolas Heess, Lars Buesing, Sebastien Racaniere, David \` Reichert, Theophane Weber, Daan Wierstra, and Peter Battaglia. Learning model-based planning ´ from scratch. arXiv preprint arXiv:1707.06170, pp. 1–13, 2017.
248
+
249
+ Malcolm Reynolds, Gabriel Barth-Maron, Frederic Besse, Diego de Las Casas, Andreas Fidjeland, Tim Green, Adria Puigdom \` enech, S \` ebastien Racani ´ ere, Jack Rae, and Fabio Viola. Open sourcing \` Sonnet - a new library for constructing neural networks. https://deepmind.com/blog/ open-sourcing-sonnet/, 2017.
250
+
251
+ Christopher D Rosin. Multi-armed bandits with episode context. Annals of Mathematics and Artificial Intelligence, 61(3):203–230, 2011.
252
+
253
+ Marwin HS Segler, Mike Preuss, and Mark P Waller. Planning chemical syntheses with deep neural networks and symbolic AI. Nature, 555(7698):604, 2018.
254
+
255
+ Iulian Vlad Serban, Chinnadhurai Sankar, Michael Pieper, Joelle Pineau, and Yoshua Bengio. The bottleneck simulator: a model-based deep reinforcement learning approach. arXiv preprint arXiv:1807.04723, 2018.
256
+
257
+ Yelong Shen, Jianshu Chen, Po-Sen Huang, Yuqing Guo, and Jianfeng Gao. M-Walk: Learning to walk over graphs using monte carlo tree search. In Advances in Neural Information Processing Systems, pp. 6786–6797, 2018.
258
+
259
+ David Silver, Richard S Sutton, and Martin Muller. Sample-based learning and search with perma- ¨ nent and transient memories. In Proceedings of the 25th international conference on Machine learning, pp. 968–975. ACM, 2008.
260
+
261
+ David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529:484–489, 2016.
262
+
263
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of Go without human knowledge. Nature, 550:354–359, 2017a.
264
+
265
+ David Silver, Hado van Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel Dulac-Arnold, David Reichert, Neil Rabinowitz, Andre Barreto, and Thomas Degris. The predictron: End-to-end learning and planning. In Proceedings of the 34th International Conference on Machine Learning (ICML 2017), 2017b.
266
+
267
+ David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters Chess, Shogi, and Go through self-play. Science, 362(6419): 1140–1144, 2018.
268
+
269
+ Aravind Srinivas, Allan Jabri, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Universal planning networks. In Proceedings of the 35th International Conference on Machine Learning (ICML 2018), 2018.
270
+
271
+ Richard S Sutton. Learning to predict by the methods of temporal differences. Machine learning, 3 (1):9–44, 1988.
272
+
273
+ Richard S Sutton. Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. In Proceedings of the 7th International Conference on Machine Learning (ICML 1990), 1990.
274
+
275
+ Richard S. Sutton and Andrew G. Barto. Reinforcement Learning. MIT Press, 2nd edition, 2018.
276
+
277
+ Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In Proceedings of the 30th Conference on Neural Information Processing Systems (NeurIPS 2016), 2016.
278
+
279
+ Tingwu Wang, Xuchan Bao, Ignasi Clavera, Jerrick Hoang, Yeming Wen, Eric Langlois, Shunshi Zhang, Guodong Zhang, Pieter Abbeel, and Jimmy Ba. Benchmarking model-based reinforcement learning. arXiv preprint arXiv:1907.02057, 2019.
280
+
281
+ Theophane Weber, S ´ ebastien Racani ´ ere, David P. Reichert, Lars Buesing, Arthur Guez, Danilo \` Rezende, Adria Puigdomenech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, Razvan Pascanu, \` Peter Battaglia, Demis Hassabis David Silver, and Daan Wierstra. Imagination-augmented agents for deep reinforcement learning. In Proceedings of the 31st Conference on Neural Information Processing Systems (NeurIPS 2017), 2017.
282
+
283
+ Tianhe Yu, Gleb Shevchuk, Dorsa Sadigh, and Chelsea Finn. Unsupervised visuomotor control through distributional planning networks. arXiv preprint arXiv:1902.05542, 2019.
284
+
285
+ # A FURTHER AGENT DETAILS
286
+
287
+ In all experiments except Tabular Tightrope (see Section B.2) and Atari (see Appendix E), we use a distributed training setup with 1 GPU learner and 64 CPU actors. Our setup was implemented using TensorFlow (Abadi et al., 2016) and Sonnet (Reynolds et al., 2017), and gradient descent was performed using the Adam optimizer (Kingma & Ba, 2014) with the TensorFlow default parameter settings (except learning rate).
288
+
289
+ # A.1 Q-LEARNING
290
+
291
+ Except for in Atari (see Appendix E), we used a 1-step implementation of Q-learning, with the standard setup with experience replay and a target network (Mnih et al., 2015). We controlled the rate of experience processed by the learner such that the average number of times each transition was replayed (the “replay ratio”) was kept constant. For all experiments, we used a batch size of 16, a learning rate of 0.0002, a replay size of 4000 transitions (with a minimum history of 100 transitions), a replay ratio of 4, and updated the target network every 100 learning steps.
292
+
293
+ We used a variant of epsilon-greedy exploration described by Bapst et al. (2019) in which epsilon is changed adaptively over the course of an episode such that it is lower earlier in the episode and higher later in the episode, with an average value of $\epsilon$ over the whole episode. We annealed the average value of $\epsilon$ from 1 to 0.01 over 1e4 episodes.
294
+
295
+ # A.2 SAVE
296
+
297
+ <table><tr><td colspan="2">Algorithm A.1 Pseudocode for the SAVE algorithm.</td></tr><tr><td colspan="2">1: procedure SAVE(θ)</td></tr><tr><td>2:</td><td>while true do</td></tr><tr><td>3:</td><td>Begin episode at s</td></tr><tr><td>4:</td><td>while acting do</td></tr><tr><td>5:</td><td>Estimate QmCTs(s,:) ← MCTS(s, Qθ)</td></tr><tr><td>6:</td><td>Select a using epsilon-greedy from QMCTs(s,:)</td></tr><tr><td>7: 8:</td><td>Execute a in environment and receive s&#x27;,r</td></tr><tr><td>9:</td><td>Add (s,a,r,s&#x27;,QmCTs(s,·)) to replay buffer</td></tr><tr><td></td><td>s↑s`</td></tr><tr><td>10:</td><td>while learning do</td></tr><tr><td>11:</td><td>Sample minibatch of experience from the replay buffer</td></tr><tr><td>12:</td><td>Update θ to minimize Equation 6</td></tr><tr><td colspan="2">13:</td></tr><tr><td>14:</td><td>procedure MCTS(so, Qθ)</td></tr><tr><td>15:</td><td>Qo(s,a)←Qe(s,a) forall s,a</td></tr><tr><td>16:</td><td>No(s,a) ←1for all s,a</td></tr><tr><td>17:</td><td>k←0</td></tr><tr><td>18: 19:</td><td>while search budget remains (k &lt; K) do</td></tr><tr><td>20:</td><td>Traverse the search tree with πk (Equation 1)</td></tr><tr><td>21:</td><td>Expand new state sT and add it to the search tree</td></tr><tr><td>22:</td><td>Evaluate maxa Qe(sT,a) and backup returns (Equation 3)</td></tr><tr><td>23:</td><td>Set Nk+1(s,a) ← Nk(s,a) and then increment counts of visited states and actions</td></tr><tr><td></td><td>Compute estimates for Qk+1(s,a) (Equation 4)</td></tr><tr><td>24:</td><td>k←k+1</td></tr><tr><td>25:</td><td>Return {Qk(so,ai)}i</td></tr></table>
298
+
299
+ The SAVE agent is implemented as described in Section 3 and Algorithm A.1 provides additional pseudocode explaining the algorithm. In Algorithm A.1, we provide an example of using SAVE in an episode setting where learning happens after every episode; however, SAVE can be used in any Q-learning setup including in distributed setups where separate processes are concurrently acting and learning. In particular, in our experiments we use the distributed setup described in Section A.1. Note that when performing epsilon-greedy exploration (Line 6 of Algorithm A.1), we either choose an action uniformly at random with probability $\epsilon$ , and otherwise choose the action with the highest value of $Q _ { \mathrm { M C T S } }$ out of the actions which were explored during search (i.e., we do not consider actions that were not explored, even if they have a higher $Q _ { \mathrm { M C T S } } )$ . In all experiments (except tabular Tightrope), we use a UTC exploration constant of $c = 2$ , though we have found SAVE’s performance to be relatively robust to this parameter setting.
300
+
301
+ # A.3 PUCT
302
+
303
+ The PUCT search policy is based on that described by Silver et al. (2017a) and Silver et al. (2018). Specifically, we choose actions during search according to Equation 1, with:
304
+
305
+ $$
306
+ \begin{array} { c } { { Q _ { k } = \displaystyle \frac { \sum _ { i = 1 } ^ { N _ { k } ( s , a ) } R _ { i } ( s , a ) } { N _ { k } ( s , a ) } } } \\ { { { } } } \\ { { U _ { k } ( s , a ) = c \cdot \pi ( s , a ) \displaystyle \frac { \sqrt { \sum _ { a } N _ { k } ( s , a ) } } { N _ { k } ( s , a ) + 1 } } } \end{array}
307
+ $$
308
+
309
+ where $c$ is an exploration constant, $\pi ( s , a )$ is the prior policy, and $N _ { k } ( s , a )$ is the total number of times action $a$ had been taken from state $s$ at iteration $k$ of the search. Like Silver et al. (2017a; 2018), we add Dirichlet noise to the prior policy:
310
+
311
+ $$
312
+ \pi ( s , a ) = ( 1 - \epsilon ) \cdot \pi _ { \theta } ( s , a ) + \epsilon \eta ,
313
+ $$
314
+
315
+ where $\eta \sim \mathrm { D i r } ( 1 / n _ { \mathrm { a c t i o n s } } )$ . In our experiments we set $\epsilon = 0 . 2 5$ and $c = 2$ . During training, after search is complete, we sample an action to execute in the environment from $\pi _ { \mathrm { M C T S } } ( s _ { 0 } , a ) =$ $\begin{array} { r } { N _ { K } ( s _ { 0 } , a ) / \sum _ { a } { N _ { K } ^ { - } ( s _ { 0 } , a ) } } \end{array}$ . At test time, we select the action which has the maximum visit count (with random tie-breaking).
316
+
317
+ To train the PUCT agent, we used separate policy $\pi _ { \theta } ( s , a )$ and value $V _ { \theta } ( s )$ heads which were trained using a combined loss (Equation 6), with:
318
+
319
+ $$
320
+ \begin{array} { l } { \displaystyle \mathcal { L } _ { Q } = \frac { 1 } { N } \sum _ { \mathcal { D } } \big \| V _ { \boldsymbol { \theta } } ( s ) - R \big \| _ { 2 } } \\ { \displaystyle \mathcal { L } _ { A } = - \frac { 1 } { N } \sum _ { \mathcal { D } } \pi _ { \mathrm { M C T S } } ( s , \cdot ) ^ { \top } \log \pi _ { \boldsymbol { \theta } } ( s , \cdot ) } \end{array}
321
+ $$
322
+
323
+ where $R$ is the Monte-Carlo return observed from state $s$ . We used fixed values of $\beta _ { Q } = 0 . 5$ and $\beta _ { A } = 0 . 5$ in all our experiments with PUCT. We used the same replay and training setup as used in the Q-learning and SAVE agents, with two exceptions. First, we additionally include episodic Monte-Carlo returns $R$ and policies $\pi _ { \mathrm { M C T S } }$ in the replay buffer so they can be used during learning. Second, we did not use $\epsilon$ -greedy exploration (because the Dirichlet noise in the PUCT term already enables sufficient exploration).
324
+
325
+ We tried several different hyperparameter settings and variants of the PUCT agent to attempt to improve the results. For example, we tried using a 1-step TD error for learning the values, which should have lower variance and thus result in more stable learning of values. We also tried reducing the replay ratio to 1 and the replay size to 400 in order to make the experience for training more on-policy. However, we did not find that these changes improved the results. We also tried different settings of $\epsilon$ for the Dirichlet noise, but found that lower values resulted in too little exploration, while higher values resulted in too much exploration.
326
+
327
+ # B DETAILS ON TIGHTROPE
328
+
329
+ # B.1 ENVIRONMENT
330
+
331
+ The Tightrope environment has 11 states which are connected together in a chain. Each state has 100 actions, $M \%$ of which will cause the episode to terminate when executed and the rest of which will cause the environment to transition to the next state. Each state is represented using a vector of 50 random values drawn from a standard normal distribution, which are the same across episodes. The indices of terminal actions are selected randomly and are different for each state but are consistent across episodes. Agents always begin in the first state of the chain.
332
+
333
+ In the sparse reward setting, we randomly select one of the states in the chain to be the “final” state (excluding the first state), to enable the agent to sometimes train on easy problems and sometimes train on hard problems. If the agent reaches this final state, it receives a reward of 1 and the episode terminates. If it takes a non-terminal action, it transitions to the next state in the chain and receives a reward of 0. Otherwise, if it takes a terminal action, the episode terminates and the agent receives a reward of 0.
334
+
335
+ In the dense reward setting, the “final” state is always chosen to be the last state in the chain. If the agent reaches the final state in the chain, it receives a reward of 0.1 and the episode terminates. If it takes a non-terminal action, it transitions to the next state in the chain and receives a reward of 0.1. Otherwise, if it takes a terminal action, the episode terminates with a reward of 0.
336
+
337
+ # B.2 TABULAR EXPERIMENTS
338
+
339
+ During training, we execute each tabular agent in the environment until the episode terminates. Then, we perform a learning step using the experience generated from the previous episode. This process repeats for some number of episodes (in our experiments, 500). After training, we execute each agent in the environment 100 times and compute the average reward achieved across these 100 episodes. For all cases in which search is used, we use a UCT exploration constant of $c = 0 . 1$ .
340
+
341
+ Q-Learning Tabular Q-learning begins with a table of state-action values initialized to zero. We perform epsilon-greedy exploration with $\epsilon = 0 . 1$ , and add the resulting experience to a replay buffer with maximum size of 1000 transitions. We perform episodic learning, where during each episode the Q-values are fixed and after the episode is complete we update the Q-values by performing a single pass through the experience in the replay buffer in a random order. We use a learning rate of $\beta _ { Q } = 0 . 0 1$ . At test time, the Q-learning agent uses MCTS in the same manner as SAVE.
342
+
343
+ SAVE Tabular SAVE begins with a table of state-action values initialized to zero. During search, values are looked up in this table and used to initialize $Q _ { 0 }$ . The values are also for bootstrapping. During learning, we perform both Q-learning (as described in the Q-learning agent) as well as an update based on the gradient of the cross-entropy amortization loss (Equation 6). We use $\beta _ { Q } = 0 . 0 1$ and $\beta _ { A } = 1$ .
344
+
345
+ PUCT Tabular PUCT begins with two tables; one with state values (initialized to zero) and one with action probabilities (initialized to the uniform distribution). During search, action probabilities are looked and used in the PUCT term, while state values are looked up and used for bootstrapping. Search proceeds as described in Section A.3. During learning, $\pi _ { \mathrm { M C T S } }$ is copied back into the action probability table (this is equivalent to an L2 update with a learning rate of 1); we also experimented with doing an update based on the cross entropy loss but found this resulted in worse performance. The value at episode $t$ is given by:
346
+
347
+ $$
348
+ V _ { t } ( s ) = ( 1 - \alpha ) V _ { t - 1 } ( s ) + \alpha R _ { t - 1 } ( s ) ,
349
+ $$
350
+
351
+ where $R _ { t - 1 } ( s )$ is the return obtained after visiting state $s$ during episode $t - 1$ . In our experiments we used $\alpha = 0 . 5$ . We also experimented with using Q-learning rather than Monte-Carlo returns, but found that these resulted in similar levels of performance.
352
+
353
+ UCT The UCT agent is as described in Section 3.1, with $V ( s )$ at unexplored nodes estimated via a Monte-Carlo rollout under a uniform random policy. The only difference from regular UCT is that we did not require all actions to be visited before descending down the search tree; unvisited actions were initialized to a value of zero. For Tightrope, this is the optimal setting of the default Q-values because all possible rewards are greater than or equal to zero. Once an action is found with non-zero reward the best option is to stick with it, so it would not make sense to set the values optimistically. Actions that cause the episode to terminate have a reward of zero, so it would also not make sense to set the values pessimistically as this would lead to over-exploring terminal actions. Setting the values to the average of the parent would either have the effect of setting to zero or setting optimistically (if the parent had positive reward).
354
+
355
+ To select the final action to execute in the environment, the UCT agent selects a visited action with the maximum estimated value. We could consider alternate approaches here, such as selecting uniformly at random from unexplored actions if none of the visited actions have high enough expected values. We experimented with this approach, using a threshold value of zero (which is the expected value for bad actions in Tightrope), and find that this indeed improves performance $\mathit { p } = 0 . 0 2 )$ , though the effect size is quite small: on the dense setting with $\bar { M } = 9 \bar { 5 } \%$ we achieve a median reward of 0.08 (using this thresholding action selection policy) versus 0.07 (selecting the max of visited actions).
356
+
357
+ ![](images/69e2b140907abcc2661c55e2c7a60c7d8314c127da7a48db91fa330dfabf6c29.jpg)
358
+ Figure C.1: Learning curves on the Covering task. Each plot shows median performance across 10 seeds, with shaded regions showing the min and max seed.
359
+
360
+ # B.3 FUNCTION APPROXIMATION EXPERIMENTS
361
+
362
+ We used the same learning setup for the Q-learning, SAVE, and PUCT agents as described in Appendix A. For the network architecture of our agents, we used a shared multilayer perceptron (MLP) torso with two layers of size 64 and ReLU activations. To predict Q-values, we used an MLP head with two layers of size 64 and ReLU activations, with a final layer of size 100 (the number of actions) with a linear activation. To predict a policy in the PUCT agent, we used the same network architecture as the $\mathrm { Q }$ -value head. To predict state values in the PUCT agent, we used a separate MLP head with two layers of size 64 and ReLU activations, and a final layer of size 1 with a linear activation. All network weights were initialized using the default weight initialization scheme in Sonnet (Reynolds et al., 2017). For both the SAVE and PUCT agents we used loss coefficients of $\beta _ { Q } = 0 . 5$ and $\beta _ { A } = 0 . 5$ .
363
+
364
+ We trained each agent 10 times and report results after 1e6 episodes in a version of Tightrope that has $9 5 \%$ terminal actions Figure 2, right). During training, the SAVE and PUCT agents had access to a search budget of 10 simulations; the Q-learning agent did not use search. We also explored training agents with different numbers of terminal actions and different budgets. Qualitatively, we found the same results as in the tabular setting: the PUCT agent can perform well for larger budgets $( 5 0 + )$ , but struggles with small budgets, underperforming the model-free Q-learning agent. In contrast, SAVE performed well in all our experiments, even for small budgets like 5 or 10.
365
+
366
+ # C DETAILS ON CONSTRUCTION
367
+
368
+ # C.1 AGENT DETAILS
369
+
370
+ SAVE For SAVE, we annealed $\beta _ { Q }$ from 1 to 0.1 and $\beta _ { \mathrm { P I } }$ from 0 to 4.5 over the course of 5e4 episodes. We found this allowed the agent to rely more on Q-learning early on in training to build a good Q-value prior, and then more on MCTS later in training once a good prior had already been established.
371
+
372
+ ![](images/8360ebb11c4809ad4104a610431719b8e0e3c6323295ebdd44cd59dea77e01b7.jpg)
373
+ Figure C.2: Detailed final results on the Covering task. Each plot shows median performance across 10 seeds, with error bars showing the min and max seed.
374
+
375
+ Q-Learning The Q-Learning agent is as described in Section A.1. In particular, we follow the same setup as the GN-DQN agent described in Bapst et al. (2019). During training, we use pure Q-learning with no search. At test time, we may allow the Q-learning agent to additionally perform MCTS, using the same search procedure as that used by SAVE (i.e., initializing the Q-values using the trained Q-function and initializing the visit counts to one).
376
+
377
+ SAVE without Amortization Loss The SAVE without an amortization loss is the same as the basic SAVE agent, except that it includes no amortization loss (i.e., $\mathcal { L } ( \boldsymbol { \theta } , \mathcal { D } ) = \beta _ { Q } \mathcal { L } _ { Q } ( \boldsymbol { \theta } , \mathcal { D } ) )$ . This is equivalent to the GN-DQN-MCTS agent described by Bapst et al. (2019).
378
+
379
+ UCT UCT is as described in Section 3.1, with $V ( s )$ at unexplored nodes estimated via using a pretrained action-value function (trained using the same setup as the Q-learning agent). Additionally, unlike standard UCT we did not require all actions to be visited before descending down the search tree.
380
+
381
+ SAVE with L2 SAVE with an L2 loss is identical to SAVE except that it uses a different amortizaton loss:
382
+
383
+ $$
384
+ \mathcal { L } _ { A } ( \theta , \mathcal { D } ) = \frac { 1 } { N } \sum _ { D } \bigl \| Q _ { \mathrm { M C T S } } ( s , \cdot ) - Q _ { \theta } ( s , \cdot ) \bigr \| _ { 2 }
385
+ $$
386
+
387
+ Similar to the SAVE agent, we anneal $\beta _ { Q }$ from 1 to 0.1 and $\beta _ { A }$ from 0 to 0.045 over the course of 5e4 episodes.
388
+
389
+ SAVE without Q-Learning SAVE without the Q-learning loss is identical to SAVE except that we do not use Q-learning and we use the L2 amortization loss described in the previous paragraph:
390
+
391
+ $$
392
+ \mathcal { L } ( \boldsymbol { \theta } , \mathcal { D } ) = \beta _ { A } \mathcal { L } _ { A } ( \boldsymbol { \theta } , \mathcal { D } )
393
+ $$
394
+
395
+ where we set $\beta _ { A } = 0 . 0 2 5$ . The reason we use the L2 loss rather than the cross-entropy loss is that otherwise the Q-values will not actually be real Q-values, in that they will not have grounding in the actual scale of rewards. We did experiment with using only the cross-entropy loss with no Q-learning, and found slightly worse performance than when using the L2 loss and no Q-learning.
396
+
397
+ SAVE with PUCT SAVE with PUCT uses the same learning procedure as SAVE but a different search policy. Specifically, we use the PUCT search policy described in Section A.3 and Equation 7. To do this, we set $\pi ( s , a ) = \sigma ( Q _ { \theta } ( s , a ) )$ , where $\sigma$ is the softmax over actions with a temperature of 1. We use the same settings for Dirchlet noise to encourage exploration during search. After search is complete, we select an action using the same epsilon-greedy action procedure used by the SAVE agent rather than selecting based on visit counts. We experimented with selecting based on visit counts instead, but found this resulted in the same level of performance.
398
+
399
+ # C.2 EXPERIMENTAL SETUP
400
+
401
+ Observations are given as graphs representing the scene, with objects in the scene corresponding to nodes in the graph and edges between every pair of objects. All agents use the same network architecture (Battaglia et al., 2018) described in Bapst et al. (2019) to process these graphs. Briefly, we use a graph network architecture which takes a graph as input and returns a graph with Q-values on the edges of the graph. Each edge corresponds to a relative object-based action like “pick up block B and put it on block D”. Each edge additionally has multiple actions associated with it which correspond to particular offset locations where the block should be placed, such as “on the top left”.
402
+
403
+ Bapst et al. (2019) describe four Construction tasks: Silhouette, Connecting, Covering, and Covering Hard. We reported results on three of these tasks in the main text (Connecting, Covering, and Covering Hard). The agents in Bapst et al. (2019) already reached ceiling performance on Silhouette and thus we do not report results for that task here, except to report that SAVE also reaches ceiling performance.
404
+
405
+ The agents used 10 MCTS simulations during training and were evaluated on 0 to 50 simulations at test time, with the exception of the UCT agent, which always used 1000 simulations at test time, and the Q-learning agent, which did not peform search during learning. We trained 10 seeds per agent and report results after 1e6 episodes. Figure C.1 show details of learning progress for each of the agents compared in the ablation experiments on the Covering task (Section 4.2), and Figure C.2 shows detailed final performances evaluated at different test budgets. We evaluated all agents on the hardest level of difficulty of the particular task they were trained on for either 10000 episodes (Figure 3a-c) or 1000 episodes (Figure 3d and Figure C.2). In general, while we find that search at test time can provide small boosts in performance, the main gains are achieved by incorporating search during training.
406
+
407
+ # C.3 DISCUSSION OF ABLATION RESULTS
408
+
409
+ Here we expand on the results presented in the main text and in Figure 3d and Figure C.2.
410
+
411
+ Cross-entropy vs. L2 loss While the L2 loss (Figure C.2, orange) can result in equivalent performance as the cross-entropy loss (Figure C.2, green), this is at the cost of higher variance across seeds and lower performance on average. This is likely because the L2 loss encourages the Q-function to exactly match the Q-values estimated by search. However, with a search budget of 10, those Qvalues will be very noisy. In contrast, the cross-entropy loss only encourages the Q-function to match the overall distribution shape of the Q-values estimated by search. This is a less strong constraint that allows the information acquired during search to be exploited while not relying on it too strongly. Indeed, we can observe that the agent with L2 amortization loss actually performs worse than the agent that has no amortization loss at all (Figure C.2, purple) when using a search budget of 10, suggesting that trying to match the Q-values during search too closely can harm performance.
412
+
413
+ Additionally, we can consider an interesting interaction between Q-learning and the amortization loss. Due to the search locally avoiding poor actions, Q-learning will rarely actually operate on low-valued actions, meaning most of its computation is spent refining the estimates for high-valued actions. The softmax cross entropy loss ensures that low-valued actions have lower values than high-valued actions, but does not force these values to be exact. Thus, in this regime we should have good estimates of value for high-valued actions and worse estimates of value for low-valued actions. In contrast, an L2 loss would require the values to be exact for both low and high valued actions. By using cross entropy instead, we can allow the neural network to spend more of its capacity representing the high-valued actions and less capacity representing the low-valued actions, which we care less about in the first place anyway.
414
+
415
+ With vs. without Q-learning Without Q-learning (Figure C.2, teal), the SAVE agent’s performance suffers dramatically. As discussed in the previous section, the Q-values estimated during search are very noisy, meaning it is not necessarily a good idea to try to match them exactly. Additionally, $Q _ { \mathrm { M C T S } }$ is on-policy experience and can become stale if $Q _ { \theta }$ changes too much between when $Q _ { \mathrm { M C T S } }$ was computed and when it is used for learning. Thus, removing the Q-learning loss makes the learning algorithm much more on-policy and therefore susceptible to the issues that come with on-policy training. Indeed, without the Q-learning loss, we can only rely on the Q-values estimated during search, resulting in much worse performance than when Q-learning is used.
416
+
417
+ ![](images/1f5e33bb46f76b1f1c89c0b748ea76c3e9b2d263bf57fe86ab3e388311e54802.jpg)
418
+ Figure C.3: Performance of different exploration strategies on the Covering task.
419
+
420
+ ![](images/61d5c03ec3b322f1b510939a9e061824c3d3241008b92e8eb4b483a0d2e8818f.jpg)
421
+ Figure C.4: Performance of SAVE and Q-learning on Covering, controlling for the same number of environment interactions (including those seen during search).
422
+
423
+ UCT vs. PUCT Finally, we compared to a variant which utilizes prior knowledge by transforming the Q-values into a policy via a softmax and then using this policy as a prior with PUCT, rather than using it to initialize the Q-values (Figure C.2, brown). With large amounts of search, the initial setting of the Q-values should not matter much, but in the case of small search budgets (as seen here), the estimated Q-values do not change much from their initial values. Thus, if the initial values are zero, then the final values will also be close to zero, which later results in the Q-function being regressed towards a nearly uniform distribution of value. By initializing the Q-values with the Qfunction, the values that are regressed towards may be similar to the original Q-function but will not be uniform. Thus, we can more effectively reuse knowledge across multiple searches by initializing the Q-values with UCT rather than incorporating prior knowledge via PUCT.
424
+
425
+ # C.4 ADDITIONAL RESULTS
426
+
427
+ We performed several other experiments to tease apart the questions regarding exploration strategy and data efficiency.
428
+
429
+ Exploration strategy When selecting the final action to perform in the environment, SAVE uses an epsilon-greedy exploration strategy. However, many other exploration strategies might be considered, such as UCB, categorical sampling from the softmax of estimated Q-values, or categorical sampling from the normalized visit counts. We evaluated how well each of these exploration strategies work, with the results shown in Figure C.3. We find that using epsilon-greedy works the best out of these exploration strategies by a substantial margin. We speculate that this may be because it is important for the Q-function to be well approximated across all actions, so that it is useful during MCTS backups. However, UCB and categorical methods will not uniformly sample the action space, meaning that some actions are very unlikely to be ever learned from. The amortization loss will not help either, as these actions will not be explored during search either. The error in the Q-values for unexplored actions will grow over time (due to catastrophic forgetting), leading to a poorly approximated Q-function that is unreliable. In contrast, epsilon-greedy consistently spends a little bit of time exploring these actions, preventing their values from becoming too inaccurate. We expect this would be less of a problem if we were to use a separate state-value function for bootstrapping (as is done by AlphaZero).
430
+
431
+ Data efficiency With a search budget of 10, SAVE effectively sees 10 times as many transitions as a model-free agent trained on the same number of environment interactions. To more carefully compare the data efficiency of SAVE, we compared its performance to that of the Q-learning agent on the Covering task, controlling for the same number of environment interactions (including those seen during search). The results are shown in Figure C.4, illustrating that SAVE converges to higher rewards given the same amount of data. We find similar results in the Marble Run environment, shown in Figure D.2.
432
+
433
+ # D DETAILS ON MARBLE RUN
434
+
435
+ # D.1 SCENE GENERATION
436
+
437
+ Scenes contain the following types of objects (similar to Bapst et al. (2019)):
438
+
439
+ • Floor (in black) that supports the blocks placed by the agent.
440
+ • Available blocks (row of blue blocks at the bottom) that the agent picks and place in the scene (with replacement).
441
+ Blocks (blue blocks above the floor) that the agent has already placed. They may take a lighter blue color to indicate that they are sticky. A sticky block gets glued to anything it touches.
442
+ • Goal (blue dot) that the agent has to reach with the marble.
443
+ • Marble (green circle) that the agent has to route to the goal.
444
+ • Obstacles (red blocks, including two vertical walls), that the agent has to avoid, by not touching them neither with the blocks or the marble.
445
+
446
+ All the initial positions for obstacles in the scene are sampled from a tessellation (similar to the Silhouette task in Bapst et al. (2019)) made of rows with random sequences of blocks with sizes of 1 discretization unit in height and 1 or 2 discretization units in width (a discretization unit corresponds to the side of the first available block). The sampling process goes as follows:
447
+
448
+ 1. Set the vertical position of the goal to the specified discrete height (according to level) corresponding to the center of one of the tessellation rows, and the vertical position of the marble 2 rows above that.
449
+ 2. Uniformly sample a horizontal distance between the marble and the goal from a predefined range, and uniformly sample the absolute horizontal positions respecting that absolute distance.
450
+ 3. Sample a number of obstacles (according to level) from the tessellation spanning up to the vertical position of the marble.
451
+
452
+ Obstacles are sampled from the tessellation sequentially. Before each obstacle is sampled, all objects in the tessellation that are too close ( $\pm 2$ layers vertically and with less than 2 discretization units of clearance sideways) to the goal, the target, or previously placed obstacles, are removed from the tessellation in order to prevent unsolvable scenes. Then probabilities are assigned to all of the remaining objects in the tessellation according to one of the following criteria (the criteria itself is also picked randomly with different weights) designed to avoid generating trivial scenes:
453
+
454
+ • (Weigh $^ { - 4 }$ ) Pick uniformly a tessellation object lying exactly on the floor and between the marble and the goal horizontally, since those objects prevent the marble from rolling freely on the floor (only applicable if the tessellation still has objects of this kind available).
455
+
456
+ • (Weight=1) Pick a tessellation object that is close (horizontally) to the marble. Probabilities proportional to $\frac { 1 } { ( d / \tau ) ^ { 2 } + 0 . 1 }$ (where $d$ is the horizontal distance between each object and the marble scaled by the width of the scene and $\tau$ is a temperature set to 0.1) are assigned to all objects left in the tessellation, and one of them is picked. (Weight=1) Pick a tessellation object that is close (horizontally) to the goal. Identical to the previous one, but using the distance to the goal. (Weight=1) Pick a tessellation object that is close (horizontally) to the middle point between the ball and the goal. Identical to the previous one, but using the distance to the middle point, and a temperature of 0.2.
457
+ • (Weigh $^ { = 1 }$ ) Pick any object remaining in the tessellation with uniform probability (to increase diversity).
458
+
459
+ # D.2 CURRICULUM DIFFICULTY
460
+
461
+ We used a curriculum to sample scenes of increasing difficulty (Fig. D.1) according to:
462
+
463
+ <table><tr><td>Level</td><td>Goal height (discretization units)</td><td>Marble/Goal distance (scene width fraction)</td><td>#obstacles</td><td>Max # steps </td></tr><tr><td>0</td><td>0</td><td>[0.03,0.3]</td><td>1</td><td>20</td></tr><tr><td>1</td><td>0</td><td>[0.36,0.49]</td><td>1</td><td>20</td></tr><tr><td>2</td><td>0</td><td>[0.50,0.63]</td><td>2</td><td>20</td></tr><tr><td>3</td><td>0</td><td>[0.69,0.82]</td><td>2</td><td>20</td></tr><tr><td>4</td><td>0</td><td>[0.83,1]</td><td>3</td><td>20</td></tr><tr><td>5</td><td>1</td><td>[0.83,1]</td><td>3</td><td>25</td></tr><tr><td>6</td><td>2</td><td>[0.83,1]</td><td>4</td><td>30</td></tr></table>
464
+
465
+ During both training and testing, episodes at a certain curriculum level are sampled not only from that difficulty, but also from all of the previous difficulty levels, using a truncated geometric distribution with a decay of 0.5. This means that at each level, about half of the episodes correspond to that level, half of the remaining episodes correspond to the previous level, half of the remaining to the level before that, and so on. By truncated we mean that, because it is not possible to sample episodes for negative levels, so we truncate the probabilities there and re-normalize.
466
+
467
+ # D.3 ADAPTIVE CURRICULUM
468
+
469
+ Given the complexity and the sparsity of rewards in this task, we trained agents using an adaptive curriculum to avoid presenting unnecessarily hard levels to the agent until the agent is able to solve the simpler levels. Specifically at each level of the curriculum we keep track and bin past episode results according to all possible combinations of scene properties consisting of:
470
+
471
+ • Height of the target (discretized to tessellation rows).
472
+ Horizontal distance $d$ between marble and goal (discretized to $d < 1 / 3 , 1 / 3 < d < 2 / 3$ , or $d > 2 / 3$ , where d is normalized by the width of the scene).
473
+ • Number of obstacles.
474
+ Height of the highest obstacle (discretized to tessellation rows).
475
+ • Height of the lowest obstacle (discretized to tessellation rows).
476
+
477
+ and require the agents to have solved at least $50 \%$ of scenes of the last 50 episodes in each bin individually, but simultaneously in all bins3. before we allow the agent to progress to the next level of difficulty. This is a very strict criteria, which effectively means the agent has to find solutions for all representative variations of the task at that level before is allowed to progress to the next level.
478
+
479
+ ![](images/73434849cbf58103169317201357eab76f82be757de72ff23fcf5942065ba358.jpg)
480
+ Figure D.1: Scenes samples at each curriculum level for the marble run task. During training, the $n$ -th level of the curriculum consists of scenes sampled from the rows up to the $n$ -th row with a truncated geometric distribution with a decay of 0.5.
481
+
482
+ # D.4 AGENT STEP, ACTION AND REWARD EVALUATION
483
+
484
+ Each agent step consists of four phases:
485
+
486
+ 1. Block placement phase: The agent picks one object from the available objects and places it into the scene. If the block placed by the agent was sticky the agent will receive a negative reward according to the cost (which may be either 0 or 0.04).
487
+ 2. Block settlement phase: The physics simulation (keeping the marble frozen) is run until the placed blocks settle (up to a maximum of $2 0 ~ \mathrm { s }$ ). During this phase the new block may affect the position of previously placed blocks.
488
+ 3. Marble dynamics phase: The physics simulation including the marble is run until the marble collides with 8 objects, with a timeout of $1 0 \mathrm { ~ s ~ }$ at each collision, that is a maximum of 80s. This phase may terminate early if the marble reaches the goal (task is solved and episode terminated with a reward of 1.), but also if the marble or any of the blocks touch an obstacle.
489
+ 4. Restore state phase: After the marble dynamics phase, the marble and all of the blocks are moved back to the position where they were at the end of the block settlement phase. This is to prevent the agent from using the marble to indirectly move the blocks with a persistent effect across steps.
490
+
491
+ The block placement phase and block settlement phase, as well as the action space is identical to those in Bapst et al. (2019).
492
+
493
+ # D.5 OBSERVATION
494
+
495
+ The observation is identical to the Construction tasks in Bapst et al. (2019), with an additional one-hot encoding of the object shape (e.g. rectangle vs triangle vs circle) and includes all blocks positions and the initial marble position at the end of the block settlement phase. Note that the agent never actually gets to observe the marble’s dynamics, and therefore does not get direct feedback about why the marble does or does not make it to the goal (such that it is getting stuck in a hole). An interesting direction for future work would be to incorporate this information into the agent’s learning as well.
496
+
497
+ ![](images/05af1617a829618fa498ba3ef7dd9f1b4b7ebc8c92b10cf0766a3ed88b0320c8.jpg)
498
+ Figure D.2: Learning curves for the Marble Run environment. Each line shows the median reward across 10 seeds, and the shaded regions show min and max seed performance. Each color corresponds to a different level of curriculum difficulty. Difficulties less than the final difficulty are only evaluated while the agent is training at that curriculum level; the final level of difficulty is always evaluated.
499
+
500
+ # D.6 TERMINATION CONDITION
501
+
502
+ There are several episode termination conditions that may be triggered before the task is solved:
503
+
504
+ • An agent places a block in a position that overlaps with an existing block or obstacle.
505
+ • An agent has placed a block that during the settlement phase touches an obstacle.
506
+ • An agent has placed a block that, at the end of the block settlement phase overlaps with the initial marble position.
507
+ • Maximum number of steps is reached.
508
+
509
+ Note that touching obstacles during the marble dynamics phase does not terminate the episode because we are purely evaluating the reward function and, during the restore state phase, all objects are returned to there previous locations. This makes it possible for the agent to correct for any obstacle collisions that happened during the marble dynamics phase, by placing additional blocks that re-route the marble.
510
+
511
+ # D.7 ADDITIONAL RESULTS
512
+
513
+ We used the same experimental setup as in the other Construction tasks (Appendix C). In particular, during training, for each seed of each agent we checkpoint the weights which achieve the highest reward on the highest curriculum level, and then use these checkpoints to evaluate performance in Figure 4. Figure D.2 additionally shows details of the training performance at each level of difficulty in the curriculum. We can see that at around difficulty level 4-5, the Q-learning agent becomes unstable and crashes, while the SAVE agent stays stable and continues to improve. Indeed, as shown in Figure D.3, the Q-learning agent never makes it to difficulty level 6 (when sticky blocks are free) or even difficulty level 5 (when sticky blocks have a moderate cost). The SAVE agent is able to reach harder levels of difficulty, and does so with fewer learning steps.
514
+
515
+ ![](images/6ef3964a8dd071a751378825546bc84fa5109025b3ae3c6a7093f181f4d1dac8.jpg)
516
+ Figure D.3: Curriculum progress in Marble Run. Light lines show individual curriculum progress per seed, and dark lines are computed over the median of these seeds. The $x$ -axis shows the particular curriculum level and the $y$ -axis indicates at which episode that level of difficulty was reached.
517
+
518
+ <table><tr><td></td><td rowspan=1 colspan=1>Level</td><td rowspan=1 colspan=1>Baseline Controlled SAVE</td><td rowspan=1 colspan=1>% Change</td></tr><tr><td></td><td rowspan=1 colspan=1>Alien</td><td rowspan=1 colspan=1>71925.1 96013.5 280227.3</td><td rowspan=1 colspan=1>191.9%</td></tr><tr><td></td><td rowspan=1 colspan=1>Asteroids</td><td rowspan=1 colspan=1>251033.3 266306.7 274431.7</td><td rowspan=1 colspan=1>3.1%</td></tr><tr><td></td><td rowspan=1 colspan=1>Beam Rider</td><td rowspan=1 colspan=1>96654.4 113930.6 195703.8</td><td rowspan=1 colspan=1>71.8%</td></tr><tr><td></td><td rowspan=1 colspan=1>Centipede</td><td rowspan=1 colspan=1>517332.2 562742.3 767206.6</td><td rowspan=1 colspan=1>36.3%</td></tr><tr><td></td><td rowspan=1 colspan=1>Crazy Climber</td><td rowspan=1 colspan=1>311203.8 271151.5 324726.4</td><td rowspan=1 colspan=1>19.8%</td></tr><tr><td></td><td rowspan=1 colspan=1>Frostbite</td><td rowspan=1 colspan=1>15814.2 11052.3 202744.2</td><td rowspan=1 colspan=1>1734.4%</td></tr><tr><td></td><td rowspan=1 colspan=1>Gravitar</td><td rowspan=1 colspan=1>7854.0 11314.3 11484.1</td><td rowspan=1 colspan=1>1.5%</td></tr><tr><td></td><td rowspan=1 colspan=1>Hero</td><td rowspan=1 colspan=1>30515.9 44574.3 44796.0</td><td rowspan=1 colspan=1>0.5%</td></tr><tr><td></td><td rowspan=1 colspan=1>Ms.Pacman</td><td rowspan=1 colspan=1>25377.4 27776.3 47186.0</td><td rowspan=1 colspan=1>69.9%</td></tr><tr><td></td><td rowspan=1 colspan=1>Name This Game</td><td rowspan=1 colspan=1>45027.1 40790.0 58621.1</td><td rowspan=1 colspan=1>43.7%</td></tr><tr><td rowspan=4 colspan=2>River RaidSpace InvadersUp &#x27;n&#x27; DownZaxxon</td><td rowspan=1 colspan=1>River Raid</td><td rowspan=1 colspan=1>33819.5 32720.8 41031.6</td></tr><tr><td rowspan=1 colspan=1>3639.2 42387.4 63684.7</td><td rowspan=1 colspan=1>50.2%</td></tr><tr><td rowspan=1 colspan=1>563661.0 568735.6 585475.6</td><td rowspan=2 colspan=1>2.9%192.0%</td></tr><tr><td rowspan=1 colspan=1>116892.6 73073.1 213370.4</td></tr><tr><td></td><td rowspan=1 colspan=1>Median</td><td rowspan=1 colspan=1>58476.1 58823.7 199224.0</td><td rowspan=2 colspan=1>40.0%174.5%</td></tr><tr><td rowspan=1 colspan=2>Mean</td><td rowspan=1 colspan=1>149339.3 154469.2 222192.1</td></tr></table>
519
+
520
+ Table E.1: Results on Atari. Scores are final performance averaged over 3 seeds. “Baseline” is the standard version of R2D2 (Kapturowski et al., 2018). “Controlled” is our version that is controlled to have the same replay ratio as SAVE. The rightmost column reports the percent change in reward of SAVE over the controlled version of R2D2. Bold scores indicate scores that are within $5 \%$ of the best score on a particular game. The last two rows show median and mean scores, respectively. The percentages in the last two rows show the median and mean across percent change, rather than the percent change of the median/mean scores.
521
+
522
+ # E DETAILS ON ATARI
523
+
524
+ # E.1 EXPERIMENTAL SETUP
525
+
526
+ We evaluated SAVE on a set of 14 Atari games in the Arcade Learning Environment (Bellemare et al., 2013). The games were chosen as a combination of classical action Atari games such as $A s \mathrm { . }$ - teroids and Space Invaders, and games with a stronger strategic component such as Ms. Pacman and Frostbite, which are commonly used as evaluation environments for model-based agents (Buesing et al., 2018; Farquhar et al., 2018; Oh et al., 2017; Guez et al., 2019).
527
+
528
+ SAVE was implemented on top of the R2D2 agent (Kapturowski et al., 2018) as described in Algorithm A.1. Concretely, this means we evaluate the function $Q _ { \mathrm { M C T S } }$ instead of $Q _ { \theta }$ to select an action in the actors, and optimize the combined loss function (Equation 6) instead of the TD loss in the learner. For hyperparameters, we used a search budget of 10, and $\beta _ { Q } = 1$ , $\beta _ { A } = 1 0$ . We did very little tuning to select these hyperparameters, only sweeping over two values of $\beta _ { A } \in \{ 1 , 1 0 \}$ . We found while both of these settings resulted in similar performance, $\beta _ { A } = 1 0$ worked slightly better. It is likely that with further tuning of these parameters, even larger increases in reward be achieved, as $\mathcal { L } _ { Q }$ and $\mathcal { L } _ { A }$ will have very different relative magnitudes depending on the scale of the rewards in each game.
529
+
530
+ ![](images/03bacb7187a33f04b5b5d9901ef20369346792cd6471411b0a075b40a820d82f.jpg)
531
+ Figure E.1: Learning curves on Atari games. Solid lines show the average over 3 seeds, and shaded regions show min and max seeds.
532
+
533
+ All hyper-parameters of R2D2 remain unchanged from the original paper, with the exception of actor speed compensation. By running MCTS, multiple environment interactions need to be evaluated for each actor step, which means transition tuples are added to the replay buffer at a slower rate, changing the replay ratio. To account for this, we increase the number of actors from 256 to 1024, and change the actor parameter update interval from 400 to 40 steps.
534
+
535
+ # E.2 EVALUATION
536
+
537
+ The learning curves of our experiment are shown in Figure E.1, and Table E.1 shows the final performance in tabular form. We ran three seeds for each of the Baseline, Controlled and SAVE agents for each game and computed final scores as the average score over the last 2e4 episodes of training. The Baseline agent represents the unchanged R2D2 agent from (Kapturowski et al., 2018). The Controlled agent is a R2D2 agent controlled to have the same replay ratio as SAVE, which we achieve by running MCTS in the actors but then discarding the results. As in SAVE, we use 1024 actors with update interval 40 for the controlled agent.
538
+
539
+ We can observe that in the majority of games, SAVE performs not only better than the controlled agent but also better than the original R2D2 baseline. While we see big improvements in the strategic games such as Ms. Pacman, we also notice a gain in many of the action games. This suggests that model-based methods like SAVE can be useful even in domains that do not require as much longterm reasoning.
md/train/Sy0GnUxCb/Sy0GnUxCb.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENT COMPLEXITY VIA MULTI-AGENT COMPETITION
2
+
3
+ Trapit Bansal∗ UMass Amherst
4
+
5
+ Jakub Pachocki OpenAI
6
+
7
+ Szymon Sidor OpenAI
8
+
9
+ Ilya Sutskever OpenAI
10
+
11
+ Igor Mordatch OpenAI
12
+
13
+ # ABSTRACT
14
+
15
+ Reinforcement learning algorithms can train agents that solve problems in complex, interesting environments. Normally, the complexity of the trained agent is closely related to the complexity of the environment. This suggests that a highly capable agent requires a complex environment for training. In this paper, we point out that a competitive multi-agent environment trained with self-play can produce behaviors that are far more complex than the environment itself. We also point out that such environments come with a natural curriculum, because for any skill level, an environment full of agents of this level will have the right level of difficulty.
16
+
17
+ This work introduces several competitive multi-agent environments where agents compete in a 3D world with simulated physics. The trained agents learn a wide variety of complex and interesting skills, even though the environment themselves are relatively simple. The skills include behaviors such as running, blocking, ducking, tackling, fooling opponents, kicking, and defending using both arms and legs. A highlight of the learned behaviors can be found here: https://goo.gl/eR7fbX.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Reinforcement Learning (RL) is exciting because good reinforcement learning algorithms exist (Mnih et al., 2015; Silver et al., 2016; Schulman et al., 2015a; Mnih et al., 2016; Schulman et al., 2015b; Lillicrap et al., 2015; Schulman et al., 2017), allowing us to train agents that accomplish a great variety of interesting tasks. We can train an agent to play Atari games from pixels (Mnih et al., 2015) or get humanoids to walk (Schulman et al., 2017). RL is exciting partly because it is easy to envision an RL algorithm producing a broadly competent agent when trained on an appropriate curriculum of environments.
22
+
23
+ In general, training an agent to perform a highly complex task requires a highly complex environment, and these can be difficult to create. However, there exists a class of environments where the behavior produced by the agents can be far more complex than the environments; this is the class of the competitive multi-agent environments trained with self-play. Such environments have two very attractive properties: (1) Even very simple competitive multi-agent environments can produce extremely complex behaviors. For example, the game of Go has very simple rules, but the strategies needed to win are extremely complex. This is because the complexity of these environments is produced by the competing agents that act in it. Thus, as the other agents become more competent, the environment effectively becomes more complex. (2) When trained with self-play, the competitive multi-agent environment provides the agents with a perfect curriculum. This happens because no matter how weak or strong an agent is, an environment populated with other agents of comparable strength provides the right challenge to the agent, facilitating maximally rapid learning and avoiding getting stuck.
24
+
25
+ Self-play in competitive multi-agent environments is not a new idea – it has already been explored in TD-gammon (Tesauro, 1995) and refined in AlphaGo (Silver et al., 2016) and Dota 2 (OpenAI). In both cases, the resulting behavior was far more complex than the environment itself, and the self-play approach provided the agents with a perfectly tuned curriculum for each task. In this paper, we investigate whether the idea of competitive multi-agent environments can yield fruit in other domains: specifically, in the domain of continuous control, where balance, dexterity, and manipulation are the key skills.
26
+
27
+ In more detail, we introduce several multi-agent tasks with competing goals in a 3D world with simulated physics, using the MuJoCo framework (Todorov et al., 2012), where the agents would need to learn highly developed motor skills in order to succeed in the competitive environment. We train the agents using a distributed implementation of a recent policy gradient algorithm, Proximal Policy Optimization (Schulman et al., 2017). By adding a simple exploration curriculum to aid exploration in the environment we find that agents learn a high level of dexterity in order to achieve their goals, in particular we find numerous emergent skills for which it may be difficult to engineer a reward. Specifically, the agents learned a wide variety of skills and behaviors that include running, blocking, ducking, tackling, fooling opponents, kicking, and defending using arms and legs. Highlight of the learned behaviors on the various tasks can be found here: https://goo.gl/eR7fbX
28
+
29
+ # 2 PRELIMINARIES
30
+
31
+ In this section, we review some background on policy gradient methods, Proximal Policy Optimization and related work in the multi-agent reinforcement learning domain.
32
+
33
+ Notation: We consider multi-agent Markov games (Littman, 1994). A Markov game for $N$ agents is a partially observable Markov decision process (MDP) defined by: a set of states $s$ describing the state of the world and the possible joint configuration of all the agents, a set of observations $\mathcal { O } ^ { 1 } , \ldots , \mathcal { O } ^ { N }$ of each agent, a set of actions of each agent $\mathcal { A } ^ { 1 } , \ldots , \mathcal { A } ^ { \tilde { N } }$ , a transition function $\tau :$ $\mathcal { S } \times \mathcal { A } ^ { 1 } \cdot \cdot \cdot \mathcal { A } ^ { N } \to \mathcal { S }$ determining distribution over next states, and a reward for each agent $i$ which is a function of the state and the agent’s action $r ^ { i } : \mathcal { S } \times \mathcal { A } ^ { i } \to \mathbb { R }$ . Agents choose their actions according to a stochastic policy $\pi _ { \theta ^ { i } } : \mathcal { O } ^ { i } \times \mathcal { A } ^ { i } [ 0 , 1 ]$ , where $\theta ^ { i }$ are the parameters of the policy. For continuous control problems considered here, $\pi _ { \theta }$ is Gaussian where the mean and variance are deep neural networks with parameter $\theta$ . Each agent $i$ aims to maximize its own total expected return $\begin{array} { r } { R ^ { i } = \sum _ { t = 0 } ^ { T } \gamma ^ { t } r _ { t } ^ { i } } \end{array}$ , where $\gamma$ is a discount factor and $T$ is the time horizon
34
+
35
+ Policy Gradient: Policy gradient methods work by directly computing an estimate of the gradient of policy parameters in order to maximize the expected return using stochastic gradient descent. These methods are behind much of the recent success in using deep neural networks for control (Schulman et al., 2015b; Heess et al., 2017; Lillicrap et al., 2015; Silver et al., 2016). Such methods are also attractive because they don’t require an explicit model of the world. There are several different expressions for the policy gradient estimator which have the form $g : = \mathbb { E } \left[ A _ { t } \nabla _ { \theta } \log \pi _ { \theta } \right]$ . Different choices of $A _ { t }$ lead to different algorithms, for example taking the sample return of a trajectory $\boldsymbol { A } _ { t } = \sum _ { t } \boldsymbol { r } _ { t }$ leads to the REINFORCE algorithm (Williams, 1992). However, such algorithms suffer from high variance in the gradient estimates and it’s typical to use a baseline, such as a value function baseline, to ameliorate the high variance. Generalized advantage estimation (Schulman et al., 2015b) takes this approach of using a learned value function to reduce variance at the cost of some bias and using an exponentially weighted estimator of the advantage function.
36
+
37
+ Proximal Policy Optimization (PPO): Achieving good results with policy gradient algorithms requires carefully tuning the step-size (Schulman et al., 2015a). Moreover, most policy gradient methods perform one gradient update per sampled trajectory and have high sample complexity. Recently, Schulman et al. (2017) proposed the PPO algorithm which addresses both these problems. This uses a surrogate objective which is maximized while penalizing large changes to the policy. Let $\begin{array} { r } { l _ { t } ( \theta ) ~ = ~ \frac { \pi _ { \theta } ^ { - } \left( a _ { t } | s _ { t } \right) ^ { - } } { \pi _ { \theta _ { o l d } } \left( a _ { t } | s _ { t } \right) } } \end{array}$ denote the likelihood ratio. Then PPO optimizes the objective: $L = \mathbb { E } \left[ \operatorname* { m i n } ( l _ { t } ( \theta ) \hat { A } _ { t } , \operatorname { c l i p } ( l _ { t } ( \theta ) , 1 - \epsilon , 1 + \epsilon ) \hat { A } _ { t } ) \right]$ , where $\hat { A } _ { t }$ is the generalized advantage estimate and $\mathrm { c l i p } ( l _ { t } ( \theta ) , 1 - \epsilon , 1 + \epsilon )$ clips $l _ { t } ( \theta )$ in the interval $[ 1 - \epsilon , 1 + \epsilon ]$ . The algorithm alternates between sampling multiple trajectories from the policy and performing several epochs of SGD on the sampled dataset to optimize this surrogate objective. Since the state value function is also simultaneously approximated, the error for the value function approximation is also added to the surrogate objective to compute the complete objective function (Schulman et al., 2017).
38
+
39
+ Related Work: Tan (1993) explored the multi-agent setting with independently learning agents using Q-learning, in particular exploring advantages of cooperative agents over independent agents in a 2D grid world. This was further explored by Matignon et al. (2012) again in the cooperative setting. A lot of the work on multi-agent RL is focused on cooperative settings, see Busoniu et al. (2008) for a review of multi-agent RL and Panait & Luke (2005) for a review focused on cooperative settings. Stanley & Miikkulainen (2004) trained agents in a competitive 2D world, using evolutionary strategies to evolve both weights and structure of policies with competition as a fitness measure. Tampuu et al. (2017) studied the application of deep Q-learning to train Pong agents with competitive and collaborative rewarding schemes. He et al. (2016) used deep Q-learning to model competitive games where only one agent is learning and the Q network implicitly models the opponent. Silver et al. (2016) used self-play with deep reinforcement learning techniques to master the game of Go. Sukhbaatar et al. (2017) introduced a self-play method for generating an automatic training curriculum in single-agent environments. From a game-theoretic perspective, Heinrich & Silver (2016) studied fictitious self-play for achieving approximate Nash equilibrium in zero-sum games like Poker. Recently, Foerster et al. (2017a) introduced an algorithm which explicitly accounts for the fact that the opponent is also learning and showed that it can achieve cooperation in iterated prisoner’s dilemma, however the algorithm requires access to the opponent’s parameters. Recently, Lowe et al. (2017) and Foerster et al. (2017b) proposed methods for centralized learning in multi-agent domains, where the idea is to use an actor-critic method with a central critic which can observe the joint state and actions of all agents in order to reduce variance, evaluating on 2D games and StarCraft. In this work, we do not rely on centralized training and address the variance problem by using very large batchsize through a distributed implementation of the PPO algorithm. Moreover, we study fully competitive settings in a 3D world with simulated physics whereas prior applications have focused on toy 2D worlds or game-theoretic problems. Recent work on learning dexterous locomotion skills in 3D environments by adding complexity in the agent’s environment (Heess et al., 2017) is also related. However, whereas Heess et al. (2017) learn complex behaviours by engineering complexity into the environment design and by engineering dense reward functions for these environments, the resultant complexity in our work is due to the presence of other learning agents in a simple environment. Our work is also related to early work in the graphics community (Sims, 1994) on evolving creature morphology in varying environments using genetic algorithm and work in animation (Wampler et al., 2010) for adversarial games. The competitive multi-agent learning framework is also related to generative adversarial networks (Goodfellow et al., 2014) and work on learning robust grasping policies through an adversary (Pinto et al., 2017).
40
+
41
+ # 3 COMPETITIVE ENVIRONMENTS
42
+
43
+ ![](images/0bc53a965370e58dc6fba3823a2d9d3f433c6c327fbd86c872932af6f33f371e.jpg)
44
+ Figure 1: Illustrations of competitive environments we consider in our work: Run to Goal, You Shall Not Pass, Sumo, and Kick and Defend.
45
+
46
+ We introduce four competitive environments and experiment with two types of agents. In this paper we focus on two agent worlds, that is 1-vs-1 games, though these environments can be extended to include multiple agents for a mixed competitive and co-operative setup. We will now describe the four environments and the competitive rewards in each environment. Figure 1 shows a rendering of the environments. We consider two three-dimensional agent bodies: ant and humanoid. The ant is a quadrupedal body with $1 2 \mathrm { D o F }$ and 8 actuated joints. Humanoid has 23 DoF and 17 actuated joints.
47
+
48
+ Run to Goal: The agents start by facing each other in a 3D world and they each have goals on the opposite side of the word (see Fig.1a). The agent that reaches its goal first wins. Reaching the goal before the opponent gives a reward of $+ 1 0 0 0$ to the agent and -1000 to the opponent. If no agent reaches its goal then they both get -1000.
49
+
50
+ You Shall Not Pass: This is the same world as the previous task, but one agent (the blocker) now has the objective of blocking the other agent from reaching it’s goal while not falling down. If the blocker is successful in preventing the opponent from reaching the goal and is standing at the end of episode then it gets $+ 1 0 0 0$ reward, if it is not standing then it gets 0 reward, and the opponent gets -1000 reward. If the opponent is successful in reaching it’s goal then it gets $+ 1 0 0 0$ reward and the blocker gets -1000 reward.
51
+
52
+ Sumo: The agents compete on a round arena (see Fig.1c) and the goal of each agent is to either knock the other agent to the ground or to push them out of the ring. The winner gets $+ 1 0 0 0$ and the other agent gets -1000. If there is a draw then both agents get -1000.
53
+
54
+ Kick and Defend: This a standard penalty shootout (see Fig.1d). One agent has to kick a ball through the goal, which has a fixed width of 6 units, while the other agent defends. Successful kick or defend gives the agent $+ 1 0 0 0$ reward and the opponent -1000 reward. The defender cannot go beyond the goal-keeping area which is a distance 3 units from the goal, doing so terminates the game with a penalty of -1000 for the defender. We give two additional rewards for defender: if defender is successful and it made contact with the ball then it gets additional $+ 5 0 0$ reward, and if the defender is successful and still standing at the end of the game then it gets another additional reward of $+ 5 0 0$ . We found the latter two rewards to yield more realistic looking defending behaviors.
55
+
56
+ # 4 TRAINING COMPETITIVE AGENTS
57
+
58
+ In this section we describe the multi-agent training framework. We use a policy gradient algorithm, Proximal Policy Optimization (PPO) (Schulman et al., 2017), described previously. We adopt a decentralized training approach and use a distributed implementation of PPO for very large scale multi-agent training. This allows us to use really large batch-sizes during training ameliorating the variance problem to some extent while also aiding in exploration. Our distributed PPO implementation is similar to the implementation of Heess et al. (2017), where instead of the KL penalty we used the clipped objective as proposed in PPO (Schulman et al., 2017). We do multiple rollouts in parallel for each agent and have separate optimizers for each agent. We collect a large amount of rollouts from the parallel workers and for each agent optimize the objective with the collected batch on 4 GPUs. The approach is same as synchronous actor critic of Mnih et al. (2016). Instead of estimating a truncated generalized advantage estimate (GAE) from a small number of steps per rollout, as in Schulman et al. (2017); Heess et al. (2017), we estimate GAE from the full rollouts. This is important as the competition reward is a sparse reward given at the termination of the episode.
59
+
60
+ There are further challenges in applying distributed PPO to train multiple competitive agents. One is the problem of exploration with sparse reward and second is the choice of opponent during training which effects the stability of training. We now turn our attention to these issues.
61
+
62
+ # 4.1 EXPLORATION CURRICULUM
63
+
64
+ The success of agents in the competitive games requires the agents to occasionally solve the task (i.e. win the competition) by random actions. The probability of this happening in most games is minuscule as they require as a prerequisite some fundamental motor skills like the ability to walk. For example, the only way a kicker in the kick-and-defend task would achieve any positive reward is if it moves towards the ball and causes sufficient displacement to it so as to make it go past the goal boundaries which is also obstructed by a defender. This is a problem of training from sparse reward which is an active area of current research (Andrychowicz et al., 2017). To overcome this problem, we can use simple dense rewards at each step to allow the agents to learn basic motor skills initially. Such rewards have been previously researched for tasks like walking forward and standing up, see for e.g. Schulman et al. (2015b) and Duan et al. (2016). However, engineering such dense rewards for the competitive tasks is not straight forward. Moreover, such engineered rewards defeat the purpose of the competitive multi-agent training as we would like the agents to benefit from the natural curriculum arising from the multi-agent training. To overcome this chicken-and-egg problem, we instead propose to use a simple curriculum for training.
65
+
66
+ We use a dense reward at every step in the beginning phase of the training to allow agents to learn basic motor skills, like walking forward or being able to stand, which would increase the probability of random actions from the agent yielding a positive reward. We refer to this reward as the exploration reward. The exploration reward is gradually annealed to zero, in favor of the competition reward, to allow the agents to train for the majority of the training using the sparse competition reward. This is achieved using a linear annealing factor $\alpha$ . So, at time-step $t$ , if the exploration reward is $s _ { t }$ , the competition reward is $R$ and $T$ is the termination time-step, then the reward is:
67
+
68
+ ![](images/611e1d088992578d7def0edfa3a82e9cac54d0c160389f20d84a21b79c6c4f59.jpg)
69
+ Figure 2: Opponent Sampling: Training rewards for two opponent sampling strategies.
70
+
71
+ $$
72
+ r _ { t } = \alpha _ { t } s _ { t } + ( 1 - \alpha _ { t } ) \mathbb { I } [ t = = T ] R
73
+ $$
74
+
75
+ This ameliorates the problem of exploration with the sparse reward, which is particularly tough in a 3D world with simulated physics and complex agents like humanoid, while still benefiting from training for the sparse competition reward for the majority of the training. During a typical training run, the agents would train on the dense reward for only about $10 \mathrm { - } 1 5 \%$ of the training epochs. The dense rewards used are described in the Appendix A and are generally composed of the following terms: distance to goal, velocity in $\mathbf { X }$ -direction, control cost, impact cost, standing reward. These rewards are adopted from existing work and we did not tune weights on the various reward terms. In particular, it is important to note that there is no dense reward term for many of the complex emergent behaviors and we also show in the experiment section how the learned behaviors are affected if we do not anneal the dense reward to benefit from optimizing the sparse competition reward.
76
+
77
+ # 4.2 OPPONENT SAMPLING
78
+
79
+ In the competitive multi-agent framework, all agents are simultaneously training in opponent pairs. Thus, the skill of opponents encountered during training could have significant impact on the learning of the agents. We found that training agents against the most recent opponent leads to imbalance in training where one agent becomes more skilled than the other agent early in training and the other agent is unable to recover. Fig. 2a shows the rewards during training with this naive approach (for the “run to goal” task with ant). Instead, we found that training against random old versions of the opponent to work much better. Thus, during training, for each rollout for an agent we sample old parameters for the opponent. Fig. 2b shows the rewards for agents trained using this strategy. This leads to more stable training and more robust policies. We further analyze the effect of this opponent sampling in the experiments section. Note that for self-play this means that the policy at any time should be able to defeat random older versions of itself, thus ensuring continual learning.
80
+
81
+ # 5 EXPERIMENTS
82
+
83
+ We train agents for the four competitive tasks using the training methods described previously. Our aim is to show that competitive multi-agent training provides a natural curriculum during learning which allows agents to learn complex behaviors. We provide additional training details and analyze various aspects of the competitive multi-agent training in this section. A highlight of the learned behaviors can be seen in the videos. Code for the environments as well as learned policy parameters for agents on all the environments are available: https://github.com/openai/multiagent-competition.
84
+
85
+ # 5.1 EXPERIMENTAL DETAILS
86
+
87
+ Policies and Value Functions: We compare both MLP and LSTM for the policies and the value functions. MLP had 2 hidden layers with 128 units each. For LSTM networks, the input was first projected to a 128 dimensional embedding using a fully connected layer with ReLU activation which is then fed into a single-layer LSTM with 128 hidden state dimension and the output is projected to the action dimension using another fully connected layer. We used Gaussian policies with mean given by the output of the networks and a diagonal covariance matrix whose entries are also treated as trianable parameters. The policy outputs are clipped to lie within the control range. We used
88
+
89
+ MLP policy and value functions for the run-to-goal and you-shall-not-pass environments, and LSTM policy and value function for sumo and kick-and-defend. This is because earlier experiments did not yield good results with MLP policy on these tasks. For LSTM policy we used truncated BPTT with a truncation of 10 timesteps. The policy and the value functions have separate parameters. For the asymmetric games, you-shall-not-pass and kick-and-defend, we use separate policies for the two agents in a game.
90
+
91
+ Observations: For the Ant body we use all the joint angles of the agent, its velocity of all its joints, the contact forces acting on the body and the relative position and all the joint angles for the opponent. For the Humanoid body, in addition to the above we also give the centre-of-mass based inertia tensor, velocity vector and the actuator forces for the body. In addition to these, there are other environment specific observations. For the Sumo environment, we give the torso’s orientation vector as the input, the radial distance from the edge of the ring of all the agents and the time remaining in the game. For kick-and-defend, we give the relative position of the ball from the agent, the relative distance of the ball from goal and the relative position of the ball from the two goal posts. Note that none of the agents observe the complete global state of the multi-agent world and only observe relevant sub-parts of the state vector to keep observations as close to real-world scenarios as possible.
92
+
93
+ Algorithm Parameters: We use Adam (Kingma & Ba, 2014) with learning rate 0.001. The clipping parameter in PPO $\epsilon = 0 . 2$ , discounting factor $\gamma = 0 . 9 9 5$ and generalized advantage estimate parameter $\lambda = 0 . 9 5$ . Each iteration, we collect 409600 samples from the parallel rollouts and perform multiple epochs of PPO training in mini-batches consisting of 5120 samples. For MLP policies we did 6 epochs of SGD per iteration and for LSTM policies we did 3 epochs. We don’t use any entropy bonus. We found $l _ { 2 }$ regularization of the policy and value network parameters to be useful. The co-efficient $\alpha _ { t }$ in eq. 1 for the exploration reward is annealed to 0 in 500 iterations for all the environments except for kick-and-defend in which it is annealed in 1000 iterations.
94
+
95
+ # 5.2 LEARNED BEHAVIORS
96
+
97
+ We observe numerous interesting learned behaviors demonstrated by the agents as a result of the complexity arising out of the competitive multi-agent training. Different random seeds often lead to somewhat different behaviors. Refer to the videos for highlights of the learned policies on all the tasks. On Run-to-Goal, we observe the quadruped Ants demonstrate behaviors like blocking, standing robustly, using legs to topple the opponent and running towards the goal. Humanoids try to avoid each other and run towards their goal really fast, occasionally they will bump into each other with force and try to recover from the impact. On You-Shall-Not-Pass, we observe the blocking humanoid learn to block by raising its hand while the other humanoid eventually learned to duck in order to cross. On Sumo, we observe multiple different strategies used by the Ant and Humanoid. Humanoids, for example, demonstrate a stable fighting stance and learned to knock the opponent using their heads. In a different run, we observe that one agent learned to charge towards the opponent whereas the opponent tried to fool it by stepping out of the opponents way at the edge of the ring. On kick-and-defend, we observe that the kicker learned a good kicking policy where it can go towards random ball positions, uses its feet to kick the ball high and tries to avoid the defender. We also see a fooling behavior in the kicker’s motions where it moves left and right quickly once close to the ball to fool the defender. The defender learned to defend by moving in response to the motion of the kicker and using its hands and legs to obstruct the ball.
98
+
99
+ These movement strategies are not just useful in competition, for example the skills learned in the Sumo can transfer to other situations even without other agents. In one case, we took the agent trained on the multi-agent Sumo task and faced it with the task of standing while being perturbed by wind forces. The agent receives the zero vector for parts of the opponent observation. We found that the agent managed to stay upright despite never seeing the windy environment or observing wind forces. Please see Appendix B.1 for details of the experiment and quantitative results. Refer to the video for a demonstration.
100
+
101
+ # 5.3 EFFECT OF EXPLORATION CURRICULUM
102
+
103
+ In section 4.1 we introduced an exploration curriculum to help agents explore in a 3D world. One question that arises is the extent to which the outcome of learning is affected by this exploration reward and to explore the benefit of this exploration reward. As already argued, we found the exploration reward to be crucial for learning as otherwise the agents are unable to explore the sparse competition reward. However, the learned behaviors are mostly a result of the natural curriculum arising out of the multi-agent competition and not due to the dense exploration reward. To see this, first note that we do not give any reward for many of the complex learned behaviours described previously. We further test this by not annealing the exploration reward and always having a dense reward which is a sum of the exploration reward and the competition reward. We take these agents trained without curriculum and pit them against agents trained with exploration curriculum. We plot the average win-rates over 800 games at various intervals during training in Fig. 3, for the sumo and kick-and-defend environments. For kick-and-defend there are two plots, one where kicker is trained with curriculum while keeper without it and vice versa. Observe that the agents trained with curriculum beat the non-curriculum agents by a margin. We found agents trained without curriculum exhibit either non-optimal behaviors for the competition or end up optimizing for a particular component of the dense reward. For example, for Sumo, the agents just learn to stand and move towards center of the arena, and for kick-and-defend, the defender optimizes for being able to stand up but doesn’t learn to defend while the kicker learns a non-optimal strategy of carrying the ball with itself to the goal (rather than kicking) – a policy which is easily defeated by a defender trained with curriculum. Moreover, training without curriculum also takes more samples to learn. We also show these behaviours qualitatively in the videos. These results echo some recent findings (albeit in the single agent case), like Andrychowicz et al. (2017) who found that optimizing for the sparse reward yields better return than optimizing for hand crafted dense rewards. For the competitive multi-agent case, these results shed further light on the importance of the natural curriculum.
104
+
105
+ ![](images/b945f11d066fc08722a430402c33d364604cc71ecf37dc98786df3ca4e0addcf.jpg)
106
+ Figure 3: Effect for exploration curriculum: win-rate of agents trained by annealing the exploration reward against agents which constantly receive the dense exploration reward. The agents which optimized for the sparse competition reward benefit from the natural curriculum of multi-agent training and defeat the other agent by a margin.
107
+
108
+ <table><tr><td>8 1.0 0.8 0.5</td><td>1.0 - 0.36 0.36</td><td>0.8 0.37 1 0.39</td><td>0.5 0.35 0.38 1</td><td>0.0 0.29 0.33 0.33</td><td>E[Win] 0.34 0.36 0.36</td></tr><tr><td>0.0 E[Loss]</td><td>0.51 0.41</td><td>0.49 0.42</td><td>0.49 0.41</td><td>- 0.32</td><td>0.50 1</td></tr></table>
109
+
110
+ Table 1: The effect of opponent sampling. $\mathbb { E } [ \mathrm { L o s s } ]$ and $\mathbb { E } [ \mathrm { W i n } ]$ are the expected loss and win-rates for agents trained with a particular $\delta$ as described in 5.4. For humanoid $\delta \ : = \ : 0 . 5$ gives highest win-rate and lowest loss, whereas for Ant $\delta = 0$ was best.
111
+
112
+ <table><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1>0.8</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>E[Win]</td></tr><tr><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.26</td><td rowspan=1 colspan=1>0.13</td><td rowspan=1 colspan=1>0.37</td><td rowspan=1 colspan=1>0.25</td></tr><tr><td rowspan=2 colspan=1>0.80.5</td><td rowspan=1 colspan=1>0.46</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.22</td><td rowspan=1 colspan=1>0.52</td><td rowspan=3 colspan=1>0.400.630.35</td></tr><tr><td rowspan=1 colspan=1>0.59</td><td rowspan=1 colspan=1>0.58</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.73</td></tr><tr><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>0.55</td><td rowspan=1 colspan=1>0.36</td><td rowspan=1 colspan=1>0.16</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>E[Loss]</td><td rowspan=1 colspan=1>0.53</td><td rowspan=1 colspan=1>0.40</td><td rowspan=1 colspan=1>0.17</td><td rowspan=1 colspan=1>0.54</td><td rowspan=1 colspan=1>1</td></tr></table>
113
+
114
+ # 5.4 EFFECT OF OPPONENT SAMPLING
115
+
116
+ In section 4.2, we introduced the past opponent sampling method for training competitive agents simultaneously. This choice of opponent could be important as it affects the natural curriculum for the agents. We test different opponent sampling strategies by considering a threshold on the oldest opponent for each agent. That is, instead of uniform random over the entire history, we can consider sampling opponent from $\mathrm { U n i f o r m } ( \delta v , v )$ where $v$ is the iteration number for the latest available parameters of the opponent and $\delta \in [ 0 , 1 ]$ is a threshold. Thus, $\delta = 1 . 0$ corresponds to the latest available opponent and $\delta = 0 . 0$ corresponds to uniform sampling over the entire history. We train agents on the Sumo task via self-play, using a $\delta \in \{ 1 . 0 , 0 . 8 , \bar { 0 . 5 } , \bar { 0 . 0 } \}$ and pit the four agents against each other to understand which sampling strategy leads to more robust policies. Since the agents have different skills and strengths at various points during training, we compute a Monte Carlo estimate of the expected win-rate for two agents that have seen the same number of samples taken at a random point during training. This is done by taking average of the win-rates of 30 agents at intervals of 100 iterations after a burn-in of 3000 iterations, where each win-rate is computed from an average over 800 episodes. Table 1a reports the results for Humanoid and Table 1b reports the results for Ant. First note that training against the latest opponent leads to worst performance, as argued earlier. Surprisingly, we found that uniform random $\delta = 0 . 0$ ) over the entire history to have the highest win-rate for Ant and $\delta = 0 . 5$ to have the highest win-rate for Humanoid. This could be because Ant with random policy on a small arena is still a good opponent while a Humanoid with random policy is unable to stand and thus always looses in a few steps. The differences in these win-rates for different sampling strategies show that the choice of the opponent during sampling is important and care must be taken while designing training algorithms for such competitive environments.
117
+
118
+ # 5.5 LEARNING ROBUST POLICIES
119
+
120
+ Over-fitting to a particular dataset is often a problem in supervised learning. Similar problems can arise in reinforcement learning setups when there is no or little variation in the environment. We discovered two such problems in our competitive multi-agent training framework and we analyze and propose solutions to address these issues.
121
+
122
+ # 5.5.1 RANDOMIZATION IN WORLD
123
+
124
+ In order to learn robust policies which generalize better we can introduce randomness in the environment, for example the arena radius for the sumo environment can be randomized, the ball position for the kick-and-defend environment can be randomized, agent start positions can be randomized. However, we found that while randomization is crucial to learn policies which generalize better, it might hinder learning early on as there might be too many things for the agents to explore. Indeed, we observe that in kick-and-defend the agents are unable to learn to kick with a lot of randomization in both the ball and agent positions, whereas when trained with no randomization the learned policies are overfit to the particular position of the ball (see Fig. 4). Thus, in order to learn policies that generalize well, we introduce a simple curriculum in the randomization where we start with a small amount of randomization which is easier to solve and then gradually increase the randomization during training. We found this curriculum to work well for all the environments.
125
+
126
+ # 5.5.2 COMPETING AGAINST ENSEMBLE OF POLICIES
127
+
128
+ Another related problem that we observed is over-fitting to the behavior of the opponent when trained for very long. This results in policies which are good against particular types of opponents but do not generalize to other opponents (say opponents trained with a different random seed). This overfitting can also be observed in win-rates against opponent during training, where one would see oscillations as agents try to adapt to their particular opponent and changes in their strategies. To overcome this we propose learning multiple policies simultaneously. Thus, there is a pool of policies and in each rollout for a particular policy one of the other policies is selected at random as the opponent (in symmetric games, the same policy can also be an opponent). This is similar to multi-task learning (Caruana, 1998) where the same network is used to model multiple related tasks which allows sharing of statistical strength among tasks and reduces overfitting. In this case, the pool of all policies as opponents – current and throughout the history of training – creates a natural distribution over related tasks for multi-task learning. We found random policy initialization to provide enough diversity between agent policies, however techniques that explicitly encourage diversity (Liu & Wang, 2016) can potentially be incorporated in the future.
129
+
130
+ In order to test the robustness of training policies in an ensemble, we experiment on the Sumo environment with Ant and Humanoid bodies. We train a pool of three policies in an ensemble and take the policy with the highest average training reward in the last 500 iterations as the best ensemble policy. We also train three independent policies via self-play, that is just a single policy is trained in a run, and again take the policy with the highest average training reward in last 500 iterations as the best self-play policy. Then we pit the best ensemble policy against the best self-play policy and record average win-rates over 800 games. Fig. 5 shows the win-rates over training iterations (after 1000 iterations of training). We find that training in ensemble performs significantly better for the humanoid body, whereas for ant the performance is similar to training a single policy. Again we suspect this is because there is not enough variability in the behavior of ant across different runs. While training single policies might occasionally get stuck in a local minima and learn suboptimal behaviors, we found that when training in an ensemble to be more robust to such minima. Qualitatively, we see more robust behavior of the humanoid trained in ensemble (see video).
131
+
132
+ ![](images/152bfacb47e873bf346837e201498b80a5c6447de979e7d7bfc9455e1f8b8c6a.jpg)
133
+ Figure 4: Win-rate of kicker vs iterations with full randomization
134
+
135
+ ![](images/f5e400e02f6c6d1d2a0808d79e102f4c6f33d5a9225e9a4aafd4f4d34c22885b.jpg)
136
+ Figure 5: $\%$ Win-rate of agents trained in ensemble vs agents trained with just a single policy. Humanoid Sumo (left) and Ant Sumo (right).
137
+
138
+ # 6 CONCLUSION
139
+
140
+ We have presented several new competitive multi-agent 3D physically simulated environments. We demonstrate the development of highly complex skills in simple environments with simple rewards. In future work, it would be interesting to conduct larger scale experiments in more complex environments that encourage agents to both compete and cooperate with each other. Incorporation of additional skills, such as reasoning about other agents, potentially via techniques from Foerster et al. (2017a), may also be important in our setting.
141
+
142
+ # REFERENCES
143
+
144
+ Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. arXiv preprint arXiv:1707.01495, 2017.
145
+ Lucian Busoniu, Robert Babuska, and Bart De Schutter. A comprehensive survey of multiagent reinforcement learning. IEEE Transactions on Systems, Man, And Cybernetics-Part C: Applications and Reviews, 38 (2), 2008, 2008.
146
+ Rich Caruana. Multitask learning. In Learning to learn, pp. 95–133. Springer, 1998.
147
+ 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.
148
+ Jakob Foerster, Richard Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. arXiv preprint arXiv:1709.04326, 2017a.
149
+ Jakob Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. arXiv preprint arXiv:1705.08926, 2017b.
150
+ 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.
151
+ He He, Jordan Boyd-Graber, Kevin Kwok, and Hal Daume III. Opponent modeling in deep rein- ´ forcement learning. In International Conference on Machine Learning, pp. 1804–1813, 2016.
152
+ Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
153
+
154
+ Johannes Heinrich and David Silver. Deep reinforcement learning from self-play in imperfectinformation games. arXiv preprint arXiv:1603.01121, 2016.
155
+
156
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
157
+
158
+ 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.
159
+
160
+ Michael L Littman. Markov games as a framework for multi-agent reinforcement learning. In Proceedings of the eleventh international conference on machine learning, volume 157, pp. 157– 163, 1994.
161
+
162
+ 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.
163
+
164
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actorcritic for mixed cooperative-competitive environments. arXiv preprint arXiv:1706.02275, 2017.
165
+
166
+ Laetitia Matignon, Guillaume J Laurent, and Nadine Le Fort-Piat. Independent reinforcement learners in cooperative Markov games: a survey regarding coordination problems. The Knowledge Engineering Review, 27(1):1–31, 2012.
167
+
168
+ 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.
169
+
170
+ 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.
171
+
172
+ OpenAI. OpenAI Dota 2 1v1 bot, 2017. URL https://openai.com/ the-international/.
173
+
174
+ Liviu Panait and Sean Luke. Cooperative multi-agent learning: The state of the art. Autonomous agents and multi-agent systems, 11(3):387–434, 2005.
175
+
176
+ Lerrel Pinto, James Davidson, and Abhinav Gupta. Supervision via competition: Robot adversaries for learning tasks. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 1601–1608. IEEE, 2017.
177
+
178
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015a.
179
+
180
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015b.
181
+
182
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
183
+
184
+ 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.
185
+
186
+ Karl Sims. Evolving virtual creatures. In Proceedings of the 21st annual conference on Computer graphics and interactive techniques, pp. 15–22. ACM, 1994.
187
+
188
+ Kenneth O Stanley and Risto Miikkulainen. Competitive coevolution through evolutionary complexification. Journal of Artificial Intelligence Research, 21:63–100, 2004.
189
+
190
+ Sainbayar Sukhbaatar, Ilya Kostrikov, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. arXiv preprint arXiv:1703.05407, 2017.
191
+
192
+ Ardi Tampuu, Tambet Matiisen, Dorian Kodelja, Ilya Kuzovkin, Kristjan Korjus, Juhan Aru, Jaan Aru, and Raul Vicente. Multiagent cooperation and competition with deep reinforcement learning. PloS one, 12(4):e0172395, 2017.
193
+
194
+ Ming Tan. Multi-agent reinforcement learning: Independent vs. cooperative agents. In Proceedings of the tenth international conference on machine learning, pp. 330–337, 1993.
195
+
196
+ Gerald Tesauro. Temporal difference learning and td-gammon. Communications of the ACM, 38(3): 58–68, 1995.
197
+
198
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
199
+
200
+ Kevin Wampler, Erik Andersen, Evan Herbst, Yongjoon Lee, and Zoran Popovic. Character anima- ´ tion in two-player adversarial games. ACM Transactions on Graphics (TOG), 29(3):26, 2010.
201
+
202
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
203
+
204
+ # A EXPLORATION REWARDS
205
+
206
+ We define the dense exploration rewards used for the tasks in this section. Our exploration reward terms are based on adapting the rewards defined previously for the training humanoids and quadrupeds to walk (Duan et al., 2016; Schulman et al., 2015b). We first review this locomotion reward and then define the task-specific dense rewards. These rewards take the form $r _ { t } ( s , a ) = v _ { f w d } + c _ { t } ( s , a ) + C _ { a l i v e }$ where $v _ { f w d }$ is the velocity in the forward direction, a bonus for standing $C _ { a l i v e }$ and costs for impact and action $c _ { t } ( s , a )$ . We considered the following locomotion reward defined for Humanoid-v1 environment in OpenAI Gym package:
207
+
208
+ $$
209
+ r _ { t } ^ { h } ( s , a ) = v _ { f w d } + c ^ { h } ( s , a ) + C _ { a l i v e } = v _ { f w d } - 0 . 1 | a | | ^ { 2 } - 5 \cdot 1 0 ^ { - 7 } | | F _ { i m p a c t } | | ^ { 2 } + C _ { a l i v e }
210
+ $$
211
+
212
+ where $F _ { i m p a c t }$ is the contact force vector clipped to values between 1 and 1, and $C _ { a l i v e }$ is a bonus for the center of the body being at a certain height, defined as $C _ { a l i v e } = + 5$ if $2 . 0 \geq z _ { b o d y } \geq 1 . 0$ , else 0.
213
+
214
+ Similarly, the following is the reward for quadruped locomotion:
215
+
216
+ $$
217
+ r _ { t } ^ { q } ( s , a ) = v _ { f w d } + c ^ { q } ( s , a ) = v _ { f w d } - 0 . 5 | a | | ^ { 2 } - 5 \cdot 1 0 ^ { - 4 } | | F _ { i m p a c t } | | ^ { 2 } + C _ { a l i v e }
218
+ $$
219
+
220
+ where $C _ { a l i v e } = + 1$ if $1 . 0 \geq z _ { b o d y } \geq 0 . 2$ , else 0.
221
+
222
+ In the following, superscript $h$ refers to humanoid agents and superscript $q$ refers to quadruped. We redefine $C _ { a l i v e }$ to be $+ 5$ if $z _ { b o d y } \ge 1 . 0$ , else $- 5$ for humanoid, and $C _ { a l i v e } = + 1$ if $z _ { b o d y } \ge 0 . 2 8$ else $- 1$ for quadruped.
223
+
224
+ Run to Goal For humanoids, reward is $r ^ { h } ( s , a ) - | x - g |$ where $x - g$ is the $l _ { 1 }$ distance of the agent from the goal $g$ along the $x$ -axis. For ant, reward is similar $r ^ { q } ( s , a ) - | x - g |$ .
225
+
226
+ You Shall not Pass For the agent whose goal is to reach the other side, the reward is same as for run-to-goal. For the blocking agent, the reward for humanoid is $c ^ { h } ( s , a ) + C _ { a l i v e } + | x ^ { \prime } - g |$ where $| x ^ { \prime } - g |$ is the distance of opponent to the goal.
227
+
228
+ Sumo For humanoids, reward is $c ^ { h } ( s , a ) + C _ { a l i v e } - ( x ^ { 2 } + y ^ { 2 } ) ^ { 0 . 5 }$ , where the last term is distance from the center of the ring. Similarly for ant: $c ^ { q } ( s , a ) + C _ { a l i v e } - ( x ^ { 2 } + y ^ { 2 } ) ^ { 0 . 5 }$
229
+
230
+ Kick and Defend: For kicker, reward is $r ^ { h } ( s , a ) - | | x - b | | - | b _ { x } - g |$ , where $b$ is the $( x , y )$ position of the ball, $b _ { x }$ is the $x$ -coordinate of the ball and $g$ is the $x$ -coordinate of the goal-post. For defender, reward is $c ^ { h } ( s , a ) + C _ { a l i v e } + | b _ { x } - g |$ where for $C _ { a l i v e }$ we only gave positive reward if the defender was in front of the goal area.
231
+
232
+ Table 2: Average number of steps before agent falls. Sumo Agent refers to the agent trained in Sumo environment whereas Walker Agent refers to the agent trained to walk in a single agent environment.
233
+
234
+ <table><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=5>Force Magnitude</td></tr><tr><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>300</td><td rowspan=1 colspan=1>400</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>600</td></tr><tr><td rowspan=1 colspan=1>Sumo Agent</td><td rowspan=1 colspan=1>372 ± 146</td><td rowspan=1 colspan=1>327±150</td><td rowspan=1 colspan=1>247± 143</td><td rowspan=1 colspan=1>181 ± 114</td><td rowspan=1 colspan=1>123 ± 57</td></tr><tr><td rowspan=1 colspan=1>Walker Agent</td><td rowspan=1 colspan=1>179± 54</td><td rowspan=1 colspan=1>139± 42</td><td rowspan=1 colspan=1>116± 32</td><td rowspan=1 colspan=1>103±23</td><td rowspan=1 colspan=1>95 ± 20</td></tr></table>
235
+
236
+ # B ADDITIONAL RESULTS
237
+
238
+ # B.1 TRANSFER RESULTS
239
+
240
+ We took the agent trained on the multi-agent Sumo task and faced it with the task of standing while being perturbed by wind forces. The agent receives a zero vector for parts of the observation space which correspond to the opponent. We calculate the number of steps before the agent falls down (i.e. when $z _ { b o d y } \le 0 . 5$ ) or the agent is pushed out of the arena and report the average steps over 200 episodes. Episodes last a maximum of 500 time steps. In half the episodes the wind force is applied in a radially outwards direction and in the remaining half it is applied in the radially inwards direction. We allow 50 steps for the agent to stabilize and apply the force at intervals of 50 steps where in between the intervals the force magnitude is decayed at a constant rate:
241
+
242
+ $$
243
+ F _ { t } = { \left\{ \begin{array} { l l } { \qquad F } & { { \mathrm { i f ~ } } t \equiv 0 { \pmod { 5 0 } } } \\ { 0 . 9 * F _ { t - 1 } } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
244
+ $$
245
+
246
+ where $F \in \{ 2 0 0 , 3 0 0 , 4 0 0 , 5 0 0 , 6 0 0 \}$ .
247
+
248
+ We compare with a humanoid agent trained in a single agent environment for the task of walking. We used same LSTM policy architecture as used for the Sumo agent and trained the humanoid in the publicly available OpenAI Gym Humanoid-v1 environment using PPO. We then apply force on this agent using the same method as above where the direction of the force is in the direction the agent is walking in half the episodes and opposite to it in the remaining half. We record average number of steps to fall using the same condition as for the Sumo agent.
249
+
250
+ Table 2 shows the average number of steps over 200 episodes along with the standard deviation. We see that the humanoid trained in Sumo is more robust to adversarial forces and able to withstand large magnitude of force for many steps.
md/train/Syx79eBKwr/Syx79eBKwr.md ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A MUTUAL INFORMATION MAXIMIZATION PERSPECTIVE OF LANGUAGE REPRESENTATION LEARNING
2
+
3
+ Lingpeng $\mathbf { K o n g } ^ { \alpha }$ , Cyprien de Masson d’Autume♠, Wang Ling♠, Lei $\mathbf { V } \mathbf { u } ^ { \pmb { \alpha } }$ , Zihang Dai♥♣
4
+ Dani Yogatama♠
5
+ DeepMind♠, Carnegie Mellon University♥, Google Brain♣
6
+ London, United Kingdom
7
+ {lingpenk,cyprien,lingwang,leiyu,zihangd,dyogatama}@google.com
8
+
9
+ # ABSTRACT
10
+
11
+ We show state-of-the-art word representation learning methods maximize an objective function that is a lower bound on the mutual information between different parts of a word sequence (i.e., a sentence). Our formulation provides an alternative perspective that unifies classical word embedding models (e.g., Skip-gram) and modern contextual embeddings (e.g., BERT, XLNet). In addition to enhancing our theoretical understanding of these methods, our derivation leads to a principled framework that can be used to construct new self-supervised tasks. We provide an example by drawing inspirations from related methods based on mutual information maximization that have been successful in computer vision, and introduce a simple self-supervised objective that maximizes the mutual information between a global sentence representation and $n$ -grams in the sentence. Our analysis offers a holistic view of representation learning methods to transfer knowledge and translate progress across multiple domains (e.g., natural language processing, computer vision, audio processing).
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Advances in representation learning have driven progress in natural language processing. Performance on many downstream tasks have improved considerably, achieving parity with human baselines in benchmark leaderboards such as SQuAD (Rajpurkar et al., 2016; 2018) and GLUE (Wang et al., 2019). The main ingredient is the “pretrain and fine-tune” approach, where a large text encoder is trained on an unlabeled corpus with self-supervised training objectives and used to initialize a task-specific model. Such an approach has also been shown to reduce the number of training examples that is needed to achieve good performance on the task of interest (Yogatama et al., 2019).
16
+
17
+ In contrast to first-generation models that learn word type embeddings (Mikolov et al., 2013; Pennington et al., 2014), recent methods have focused on contextual token representations—i.e., learning an encoder to represent words in context. Many of these encoders are trained with a language modeling objective, where the representation of a context is trained to be predictive of a target token by maximizing the log likelihood of predicting this token (Dai & Le, 2015; Howard & Ruder, 2018; Radford et al., 2018; 2019). In a vanilla language modeling objective, the target token is always the next token that follows the context. Peters et al. (2018) propose an improvement by adding a reverse objective that also predicts the word token that precedes the context. Following this trend, current state-of-the-art encoders such as BERT (Devlin et al., 2018) and XLNet (Yang et al., 2019) are also trained with variants of the language modeling objective: masked language modeling and permutation language modeling.
18
+
19
+ In this paper, we provide an alternative view and show that these methods also maximize a lower bound on the mutual information between different parts of a word sequence. Such a framework is inspired by the InfoMax principle (Linsker, 1988) and has been the main driver of progress in self-supervised representation learning in other domains such as computer vision, audio processing, and reinforcement learning (Belghazi et al., 2018; van den Oord et al., 2019; Hjelm et al., 2019;
20
+
21
+ Bachman et al., 2019; O’Connor & Veeling, 2019). Many of these methods are trained to maximize a particular lower bound called InfoNCE (van den Oord et al., 2019)—also known as contrastive learning (Arora et al., 2019). The main idea behind contrastive learning is to divide an input data into multiple (possibly overlapping) views and maximize the mutual information between encoded representations of these views, using views derived from other inputs as negative samples. In $\ S 2$ , we provide an overview of representation learning with mutual information maximization. We then show how the skip-gram objective (§3.1; Mikolov et al. 2013), masked language modeling (§3.2; Devlin et al. 2018), and permutation language modeling (§3.3; Yang et al. 2019), fit in this framework.
22
+
23
+ In addition to providing a principled theoretical understanding that bridges progress in multiple areas, our proposed framework also gives rise to a general class of word representation learning models which serves as a basis for designing and combining self-supervised training objectives to create better language representations. As an example, we show how to use this framework to construct a simple self-supervised objective that maximizes the mutual information between a sentence and $n$ -grams in the sentence (§4). We combine it with a variant of the masked language modeling objective and show that the resulting representation performs better, particularly on tasks such as question answering and linguistics acceptability (§5).
24
+
25
+ # 2 MUTUAL INFORMATION MAXIMIZATION
26
+
27
+ Mutual information measures dependencies between random variables. Given two random variables $A$ and $B$ , it can be understood as how much knowing $A$ reduces the uncertainty in $B$ or vice versa. Formally, the mutual information between $A$ and $B$ is:
28
+
29
+ $$
30
+ I ( A , B ) = H ( A ) - H ( A \mid B ) = H ( B ) - H ( B \mid A ) .
31
+ $$
32
+
33
+ Consider $A$ and $B$ to be different views of an input data (e.g., a word and its context, two different partitions of a sentence). Consider a function $f$ that takes $A = a$ and $B = b$ as its input. The goal of training is to learn parameters of the function $f$ that maximizes $I ( A , B )$ .
34
+
35
+ Maximizing mutual information directly is generally intractable when the function $f$ consists of modern encoders such as neural networks (Paninski, 2003), so we need to resort to a lower bound on $I ( A , B )$ . One particular lower bound that has been shown to work well in practice is InfoNCE (Logeswaran $\&$ Lee, 2018; van den Oord et al., 2019),1 which is based on Noise Contrastive Estimation (NCE; Gutmann & Hyvarinen, 2012).2 InfoNCE is defined as:
36
+
37
+ $$
38
+ I ( A , B ) \geq \mathbb { E } _ { p ( A , B ) } \left[ f _ { \pmb { \theta } } ( a , b ) - \mathbb { E } _ { \pmb { q } ( \tilde { \mathfrak { B } } ) } \left[ \log \sum _ { \tilde { b } \in \tilde { \mathfrak { B } } } \exp f _ { \pmb { \theta } } ( a , \tilde { b } ) \right] \right] + \log | \tilde { \mathfrak { B } } | ,
39
+ $$
40
+
41
+ where $a$ and $b$ are different views of an input sequence, $f _ { \pmb { \theta } } \in \mathbb { R }$ is a function parameterized by $\pmb \theta$ (e.g., a dot product between encoded representations of a word and its context, a dot product between encoded representations of two partitions of a sentence), and $\tilde { \mathcal { B } }$ is a set of samples drawn from a proposal distribution $q ( \tilde { \mathcal { B } } )$ . The set $\tilde { \mathcal { B } }$ contains the positive sample $b$ and $| \tilde { \mathcal { B } } | - 1$ negative samples.
42
+
43
+ Learning representations based on this objective is also known as contrastive learning. Arora et al. (2019) show representations learned by such a method have provable performance guarantees and reduce sample complexity on downstream tasks.
44
+
45
+ We note that InfoNCE is related to cross-entropy. When $\tilde { \mathcal { B } }$ always includes all possible values of the random variable $B$ (i.e., ${ \tilde { \mathcal { B } } } = { \mathcal { B } }$ ) and they are uniformly distributed, maximizing InfoNCE is analogous to maximizing the standard cross-entropy loss:
46
+
47
+ $$
48
+ \mathbb { E } _ { p ( A , B ) } \left[ f _ { \pmb { \theta } } ( a , b ) - \log \sum _ { \tilde { b } \in \mathcal { B } } \exp f _ { \pmb { \theta } } ( a , \tilde { b } ) \right] .
49
+ $$
50
+
51
+ Eq. 2 above shows that InfoNCE is related to maximizing $p _ { \theta } ( b \ | \ a )$ , and it approximates the summation over elements in $\mathcal { B }$ (i.e., the partition function) by negative sampling. As a function of the negative samples, the InfoNCE bound is tighter when $\tilde { \mathcal { B } }$ contains more samples (as can be seen in Eq. 1 above by inspecting the $\log | \tilde { \mathcal { B } } |$ term). Approximating a softmax over a large vocabulary with negative samples is a popular technique that has been widely used in natural language processing in the past. We discuss it here to make the connection under this framework clear.
52
+
53
+ # 3 MODELS
54
+
55
+ We describe how Skip-gram, BERT, and XLNet fit into the mutual information maximization framework as instances of InfoNCE. In the following, we assume that $f _ { \pmb { \theta } } ( a , b ) = g _ { \psi } ( b ) ^ { \top } g _ { \pmb { \omega } } ( a )$ , where $\pmb \theta = \{ \omega , \psi \}$ . Denote the vocabulary set by $\mathcal { V }$ and the size of the vocabulary by $V$ . For word representation learning, we seek to learn an encoder parameterized by $\omega$ to represent each word in a sequence $\pmb { x } = \{ x _ { 1 } , x _ { 1 } , \dots , x _ { T } \}$ in $d$ dimensions. For each of the models we consider in this paper, $a$ and $b$ are formed by taking different parts of $_ { \textbf { \em x } }$ (e.g., $a : = x _ { 0 }$ and $b : = x _ { T }$ ).
56
+
57
+ # 3.1 SKIP-GRAM
58
+
59
+ We first start with a simple word representation learning model Skip-gram (Mikolov et al., 2013). Skip-gram is a method for learning word representations that relies on the assumption that a good representation of a word should be predictive of its context. The objective function that is maximized in Skip-gram is: $\mathbb { E } _ { p ( x _ { i } , x _ { j } ^ { i } ) } \left[ p ( x _ { j } ^ { i } \mid \bar { x } _ { i } ) \right]$ , where $x _ { i }$ is a word token and $\boldsymbol { x } _ { j } ^ { i }$ is a context word of $x _ { i }$ .
60
+
61
+ Let $b$ be the context word to be predicted $x _ { j } ^ { i }$ and $a$ be the input word $x _ { i }$ . Recall that $f _ { \theta } ( a , b )$ is $g _ { \psi } ( b ) ^ { \top } g _ { \omega } ( a )$ . The skip-gram objective function can be written as an instance of InfoNCE (Eq. 1) where $g _ { \psi } ( b )$ and $g _ { \omega } ( a )$ are embedding lookup functions that map each word type to $\mathbb { R } ^ { d }$ . (i.e., $g _ { \psi } ( b ) , g _ { \omega } ( a ) : \mathcal { V } \to \mathbb { R } ^ { d } )$ .
62
+
63
+ $p ( x _ { j } ^ { i } \mid x _ { i } )$ can either be computed using a standard softmax over the entire vocabulary or with negative sampling (when the vocabulary is very large). These two approaches correspond to different choices of $\bar { \mathcal { B } }$ . In the softmax approach, $\tilde { \mathcal { B } }$ is the full vocabulary set $\mathcal { V }$ and each word in $\mathcal { V }$ is uniformly distributed. In negative sampling, $\tilde { \mathcal { B } }$ is a set of negative samples drawn from e.g., a unigram distribution.
64
+
65
+ While Skip-gram has been widely accepted as an instance contrastive learning (Mikolov et al., 2013; Mnih & Kavukcuoglu, 2013), we include it here to illustrate its connection with modern approaches such as BERT and XLNet described subsequently. We can see that the two views of an input sentence that are considered in Skip-gram are two words that appear in the same sentence, and they are encoded using simple lookup functions.
66
+
67
+ # 3.2 BERT
68
+
69
+ Devlin et al. (2018) introduce two self-supervised tasks for learning contextual word representations: masked language modeling and next sentence prediction. Previous work suggests that the next sentence prediction objective is not necessary to train a high quality BERT encoder and the masked language modeling appears to be the key to learn good representations (Liu et al., 2019; Joshi et al., 2019; Lample & Conneau, 2019), so we focus on masked language modeling here. However, we also show how next sentence prediction fits into our framework in Appendix A.
70
+
71
+ In masked language modeling, given a sequence of word tokens of length $T$ , $\pmb { x } = \{ x _ { 1 } , \dots , x _ { T } \}$ , BERT replaces $15 \%$ of the tokens in the sequence with (i) a mask symbol $80 \%$ of the time, (ii) a random word $10 \%$ of the time, or (iii) its original word. For each replaced token, it introduces a term in the masked language modeling training objective to predict the original word given the perturbed sequence $\pmb { \hat { x } } _ { i } = \{ x _ { 1 } , \ldots , x _ { i } , \ldots , x _ { T } \}$ (i.e., the sequence $_ { \textbf { \em x } }$ masked at $x _ { i }$ ). This training objective can be written as: $\mathbb { E } _ { p ( x _ { i } , \hat { { \pmb x } } _ { i } ) } [ p ( x _ { i } \mid \hat { { \pmb x } } _ { i } ) ]$ .
72
+
73
+ Following our notation in $\ S 2$ , we have $f _ { \pmb { \theta } } ( a , b ) = g _ { \psi } ( b ) ^ { \top } g _ { \pmb { \omega } } ( a )$ . Let $b$ be a masked word $x _ { i }$ and $a$ be the masked sequence $\hat { \mathbf { x } } _ { i }$ . Consider a Transformer encoder parameterized by $\omega$ and denote $g _ { \omega } ( \hat { x } _ { i } ) \in \mathbb R ^ { d }$ as a function that returns the final hidden state corresponding to the $i$ -th token (i.e., the masked token) after running $\hat { \mathbf { x } } _ { i }$ through the Transformer. Let $g _ { \psi } : \bar { \mathcal { V } } \to \mathbb { R } ^ { \bar { d } }$ be a lookup function that maps each word type into a vector and ${ \tilde { \mathcal { B } } } = { \mathcal { B } }$ be the full vocabulary set $\mathcal { V }$ . Under this formulation, the masked language modeling objective maximizes Eq. 1 and different choices of masking probabilities can be understood as manipulating the joint distributions $\textstyle p ( a , b )$ . In BERT, the two views of a sentence correspond to a masked word in the sentence and its masked context.
74
+
75
+ Contextual vs. non-contextual. It is generally understood that the main difference between Skipgram and BERT is that Skip-gram learns representations of word types (i.e., the representation for a word is always the same regardless of the context it appears in) and BERT learns representations of word tokens. We note that under our formulation for either Skip-gram or BERT, the encoder that we want to learn appears in $g _ { \omega }$ , and $g _ { \psi }$ is not used after training. We show that Skip-gram and BERT maximizes a similar objective, and the main difference is in the choice of the encoder that forms $g _ { \omega }$ —a context dependent Transformer encoder that takes a sequence as its input for BERT and a simple word embedding lookup for Skip-gram.
76
+
77
+ # 3.3 XLNET
78
+
79
+ Yang et al. (2019) propose a permutation language modeling objective to learn contextual word representations. This objective considers all possible factorization permutations of a joint distribution of a sentence. Given a sentence $\pmb { x } = \{ x _ { 1 } , \dots , x _ { T } \}$ , there are $T !$ ways to factorize its joint distribution.3 Given a sentence $_ { \textbf { \em x } }$ , denote a permutation by $z \in { \mathcal { Z } }$ . XLNet optimizes the objective function:
80
+
81
+ $$
82
+ \mathbb { E } _ { p ( \pmb { x } ) } \left[ \mathbb { E } _ { p ( \pmb { z } ) } \left[ \sum _ { t = 1 } ^ { T } \log p ( x _ { t } ^ { z } \mid \pmb { x } _ { < t } ^ { z } ) \right] \right] .
83
+ $$
84
+
85
+ As a running example, consider a permutation order $3 , 1 , 5 , 2 , 4$ for a sentence $x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } , x _ { 5 }$ . Given the order, XLNet is only trained to predict the last $S$ tokens in practice. For $S = 1$ , the context sequence used for training is $x _ { 1 } , x _ { 2 } , x _ { 3 } , _ { - } , x _ { 5 }$ , with $x _ { 4 }$ being the target word.
86
+
87
+ In addition to replacing the Transformer encoder with Transformer XL (Dai et al., 2019), a key architectural innovation of XLNet is the two-stream self-attention. In two-stream self attention, a shared encoder is used to compute two sets of hidden representations from one original sequence. They are called the query stream and the content stream. In the query stream, the input sequence is masked at the target position, whereas the content stream sees the word at the target position. Words at future positions for the permutation order under consideration are also masked in both streams. These masks are implemented as two attention mask matrices. During training, the final hidden representation for a target position from the query stream is used to predict the target word.
88
+
89
+ Since there is only one set of encoder parameters for both streams, we show that we can arrive at the permutation language modeling objective from the masked language modeling objective with an architectural change in the encoder. Denote a hidden representation by $\mathbf { h } _ { t } ^ { k }$ , where $t$ indexes the position and $k$ indexes the layer, and consider the training sequence $x _ { 1 } , x _ { 2 } , x _ { 3 } , _ { - } , x _ { 5 }$ and the permutation order 3,1,5,2,4. In BERT, we compute attention scores to obtain $\mathbf { h } _ { t } ^ { k }$ from $\mathbf { h } _ { t } ^ { k - 1 }$ for every $t$ (i.e., $t = 1 , \dots , T )$ , where ${ \bf h } _ { 4 } ^ { 0 }$ is the embedding for the mask symbol. In XLNet, the attention scores for future words in the permutation order are masked to 0. For example, when we compute $\mathbf { h } _ { 1 } ^ { k }$ , only the attention score from $\mathbf { h } _ { 3 } ^ { k - 1 }$ is considered (since the permutation order is 3,1,5,2,4). For $\mathbf { h } _ { 5 } ^ { k }$ , we use $\mathbf { h } _ { 1 } ^ { k - 1 }$ and $\mathbf { h } _ { 3 } ^ { k - 1 }$ . XLNet does not require a mask symbol embedding since the attention score from a masked token is always zeroed out with an attention mask (implemented as a matrix). As a result, we can consider XLNet training as masked language modeling with stochastic attention masks in the encoder.
90
+
91
+ It is now straightforward to see that the permutation language modeling objective is an instance of Eq.1, where $b$ is a target token $x _ { i }$ and $a$ is a masked sequence $\pmb { \hat { x } } _ { i } = \{ x _ { 1 } , \ldots , \hat { x } _ { i } , \ldots , x _ { T } \}$ . Similar to
92
+
93
+ Table 1: Summary of methods as instances of contrastive learning. See text for details.
94
+
95
+ <table><tr><td>Objective</td><td>a</td><td>b</td><td>p(a,b)</td><td>g</td><td>g</td></tr><tr><td>Skip-gram</td><td>word</td><td>word</td><td>word and its context</td><td>lookup</td><td>lookup</td></tr><tr><td>MLM</td><td>context</td><td>masked word</td><td>masked tokens probability</td><td>Transformer</td><td>lookup</td></tr><tr><td>NSP</td><td>sentence</td><td>sentence</td><td>(non-)consecutive sentences</td><td>Transformer</td><td>lookup</td></tr><tr><td>XLNet</td><td>context</td><td>masked word</td><td>factorization permutation</td><td>TXL++</td><td>lookup</td></tr><tr><td>DIM</td><td>context</td><td>masked n-grams</td><td>sentence and its n-grams</td><td>Transformer</td><td>not used</td></tr></table>
96
+
97
+ BERT, we have a Transformer encoder parameterized by $\omega$ and denote $g _ { \omega } ( \hat { x } _ { i } ) \in \mathbb R ^ { d }$ as a function that returns the final hidden state corresponding to the $i$ -th token (i.e., the masked token) after running $\hat { \mathbf { x } } _ { i }$ through the Transformer. Let $g _ { \psi } : \bar { \mathcal { V } } \to \bar { \mathbb { R } ^ { d } }$ be a lookup function that maps each word type into a vector and ${ \tilde { \mathcal { B } } } = { \mathcal { B } }$ be the full vocabulary set $\mathcal { V }$ . The main difference between BERT and XLNet is that the encoder that forms $g _ { \omega }$ used in XLNet implements attention masking based on a sampled permutation order when building its representations. In addition, XLNet and BERT also differ in the choice of $\textstyle p ( a , b )$ since each of them has its own masking procedure. However, we can see that both XLNet and BERT maximize the same objective.
98
+
99
+ # 4 INFOWORD
100
+
101
+ Our analysis on Skip-Gram, BERT, and XLNet shows that their objective functions are different instances of InfoNCE in Eq.1, although they are typically trained using the entire vocabulary set for $\tilde { \mathcal { B } }$ instead of negative sampling. These methods differ in how they choose which views of a sentence they use as $a$ and $b$ , the data distribution $\textstyle p ( a , b )$ , and the architecture of the encoder for computing $g _ { \omega }$ which we summarize in Table 1. Seen under this unifying framework, we can observe that progress in the field has largely been driven by using a more powerful encoder to represent $g _ { \omega }$ . While we only provide derivations for Skip-gram, BERT, and XLNet, it is straightforward to show that other language-modeling-based pretraining-objectives such as those used in ELMo (Peters et al., 2018) and GPT-2 (Radford et al., 2019) can be formulated under this framework.
102
+
103
+ Our framework also allows us to draw connections to other mutual information maximization representation learning methods that have been successful in other domains (e.g., computer vision, audio processing, reinforcement learning). In this section, we discuss an example derive insights to design a simple self-supervised objective for learning better language representations.
104
+
105
+ Deep InfoMax (DIM; Hjelm et al., 2019) is a mutual information maximization based representation learning method for images. DIM shows that maximizing the mutual information between an image representation and local regions of the image improves the quality of the representation. The complete objective function that DIM maximizes consists of multiple terms. Here, we focus on a term in the objective that maximizes the mutual information between local features and global features. We describe the main idea of this objective for learning representations from a one-dimensional sequence, although it is originally proposed to learn from a two-dimensional object.
106
+
107
+ Given a sequence $\pmb { x } = \{ x _ { 1 } , x _ { 2 } , \dots , x _ { T } \}$ , we consider the “global” representation of the sequence to be the hidden state of the first token (assumed to be a special start of sentence symbol) after contextually encoding the sequence $g _ { \omega } ( { \pmb x } )$ ,4 and the local representations to be the encoded representations of each word in the sequence $g _ { \psi } ( x _ { t } )$ . We can use the contrastive learning framework to design a task that maximizes the mutual information between this global representation vector and its corresponding “local” representations using local representations from other sequences $g _ { \psi } ( \hat { x } _ { t } )$ as negative samples. This is analogous to training the global representation vector of a sentence to choose which words appear in the sentence and which words are from other sentences.5 However, if we feed the original sequence $_ { \textbf { \em x } }$ to the encoder and take the hidden state of the first token as the global representation, the task becomes trivial since the global representation is built using all the words in the sequence. We instead use a masked sequence $\boldsymbol { a } : = \hat { \mathbf { x } } _ { t } = \{ x _ { 1 } , \ldots , \hat { x } _ { t } , \ldots , x _ { T } \}$ and $b : = x _ { t }$ .
108
+
109
+ State-of-the-art methods based on language modeling objectives consider all negative samples since the second view of the input data (i.e., the part denoted by $b$ in Eq. 1) that are used is simple and it consists of only a target word—hence the size of the negative set is still manageable. A major benefit of the contrastive learning framework is that we only need to be able to take negative samples for training. Instead of individual words, we can use $n$ -grams as the local representations.6 Denote an $n$ -gram by $\boldsymbol { x } _ { i : j }$ and a masked sequence masked at position $i$ to $j$ by $\hat { \mathbf { \mathscr { x } } } _ { i : j }$ We define $\mathcal { I } _ { \mathrm { D I M } }$ as:
110
+
111
+ $$
112
+ \mathfrak { I } _ { \mathrm { D I M } } = \mathbb { E } _ { p ( \hat { \pmb { x } } _ { i : j } , \pmb { x } _ { i : j } ) } \left[ g _ { \omega } ( \hat { \pmb { x } } _ { i : j } ) ^ { \top } g _ { \omega } ( \pmb { x } _ { i : j } ) - \log \sum _ { \tilde { \pmb { x } } _ { i : j } \in \tilde { \pmb { \mathscr { S } } } } \exp ( g _ { \omega } ( \hat { \pmb { x } } _ { i : j } ) ^ { \top } g _ { \omega } ( \tilde { \pmb { x } } _ { i : j } ) ) \right] ,
113
+ $$
114
+
115
+ where $\hat { \mathbf { \mathscr { x } } } _ { i : j }$ is a sentence masked at position $i$ to $j$ , $\boldsymbol { x } _ { i : j }$ is an $n$ -gram spanning from $i$ to $j$ , and $\tilde { \mathbf { \ b { x } } } _ { i : j }$ is an $n$ -gram from a set ˜S that consists of the positive sample $\scriptstyle { \pmb { x } } _ { i : j }$ and negative $n$ -grams from other sentences in the corpus. We use one Transformer to encode both views, so we do not need $g _ { \psi }$ here.
116
+
117
+ Since the main goal of representation learning is to train an encoder parameterized by $\omega$ , it is possible to combine multiple self-supervised tasks into an objective function in the contrastive learning framework. Our model, which we denote INFOWORD, combines the above objective—which is designed to improve sentence and span representations—with a masked language modeling objective $\mathcal { I } _ { \mathrm { M L M } }$ for learning word representations. The only difference between our masked language modeling objective and the standard masked language modeling objective is that we use negative sampling to construct $\tilde { \mathcal { V } }$ by sampling from the unigram distribution. We have:
118
+
119
+ $$
120
+ \mathcal { I } _ { \mathrm { M L M } } = \mathbb { E } _ { p ( \hat { \pmb { x } } _ { i } , { \pmb { x } } _ { i } ) } \left[ g _ { \omega } ( \hat { \pmb { x } } _ { i } ) ^ { \top } g _ { \psi } ( \pmb { x } _ { i } ) - \log \sum _ { \tilde { \pmb { x } } _ { i } \in \tilde { \mathcal { V } } } \exp ( g _ { \omega } ( \hat { \pmb { x } } _ { i } ) ^ { \top } g _ { \psi } ( \tilde { \pmb { x } } _ { i } ) ) \right] ,
121
+ $$
122
+
123
+ where $\hat { \mathbf { x } } _ { i }$ a sentence masked at position $i$ and $x _ { i }$ is the $i$ -th token in the sentence.
124
+
125
+ Our overall objective function is a weighted combination of the two terms above:
126
+
127
+ $$
128
+ \mathrm { \mathcal { I } _ { I N F O W o R D } } = \lambda _ { \mathrm { M L M } } \mathrm { \mathcal { I } _ { M L M } } + \lambda _ { \mathrm { D I M } } \mathrm { \mathcal { I } _ { D I M } } ,
129
+ $$
130
+
131
+ where $\lambda _ { \mathrm { M L M } }$ and $\lambda _ { \mathrm { D I M } }$ are hyperparameters that balance the contribution of each term.
132
+
133
+ # 5 EXPERIMENTS
134
+
135
+ In this section, we evaluate the effects of training masked language modeling with negative sampling and adding $\mathcal { I } _ { \mathrm { D I M } }$ to the quality of learned representations.
136
+
137
+ # 5.1 SETUP
138
+
139
+ We largely follow the same experimental setup as the original BERT model (Devlin et al., 2018). We have two Transformer architectures similar to $\mathbf { B E R T _ { B A S E } }$ and BERTLARGE. BERTBASE has 12 hidden layers, 768 hidden dimensions, and 12 attention heads (110 million parameters); whereas BERTLARGE has 24 hidden layers, 1024 hidden dimensions, and 16 attention heads (340 million parameters).
140
+
141
+ For each of the Transformer variant above, we compare three models in our experiments:
142
+
143
+ • BERT: The original BERT model publicly available in https://github.com/ google-research/bert.
144
+ • BERT-NCE: Our reimplementation of BERT. It differs from the original implementation in several ways: (1) we only use the masked language modeling objective and remove next sentence prediction, (2) we use negative sampling instead of softmax, and (3) we only use one sentence for each training example in a batch.
145
+
146
+ • INFOWORD: Our model described in $\ S 4$ . The main difference between INFOWORD and BERT-NCE is the addition of $\mathcal { I } _ { \mathrm { D I M } }$ to the objective function. We discuss how we mask the data for $\mathcal { I } _ { \mathrm { D I M } }$ in $\ S 5 . 2$ .
147
+
148
+ # 5.2 PRETRAINING
149
+
150
+ We use the same training corpora and apply the same preprocessing and tokenization as BERT. We create masked sequences for training with $\mathcal { I } _ { \mathrm { D I M } }$ as follows. We iteratively sample $n$ -grams from a sequence until the masking budget ( $15 \%$ of the sequence length) has been spent. At each sampling iteration, we first sample the length of the $n$ -gram (i.e., $n$ in $n$ -grams) from a Gaussian distribution $\Re ( 5 , 1 )$ clipped at 1 (minimum length) and 10 (maximum length). Since BERT tokenizes words into subwords, we measure the $n$ -gram length at the word level and compute the masking budget at the subword level. This procedure is inspired by the masking approach in Joshi et al. (2019).
151
+
152
+ For negative sampling, we use words and $n$ -grams from other sequences in the same batch as negative samples (for MLM and DIM respectively). There are approximately 70,000 subwords and 10,000 $n$ -grams (words and phrases) in a batch. We discuss hyperparameter details in Appendix B.
153
+
154
+ # 5.3 FINE-TUNING
155
+
156
+ We evaluate on two benchmarks: GLUE (Wang et al., 2019) and SQuAD(Rajpurkar et al., 2016). We train a task-specific decoder and fine-tune pretrained models for each dataset that we consider. We describe hyperparameter details in Appendix B.
157
+
158
+ GLUE is a set of natural language understanding tasks that includes sentiment analysis, linguistic acceptability, paraphrasing, and natural language inference. Each task is formulated as a classification task. The tasks in GLUE are either a single-sentence classification task or a sentence pair classification task. We follow the same setup as the original BERT model and add a start of sentence symbol (i.e., the CLS symbol) to every example and use a separator symbol (i.e., the SEP symbol) to separate two concatenated sentences (for sentence pair classification tasks). We add a linear transformation and a softmax layer to predict the correct label (class) from the representation of the first token of the sequence.
159
+
160
+ SQuAD is a reading comprehension dataset constructed from Wikipedia articles. We report results on SQuAD 1.1. Here, we also follow the same setup as the original BERT model and predict an answer span—the start and end indices of the correct answer in the context. We use a standard span predictor as the decoder, which we describe in details in Appendix C.
161
+
162
+ # 5.4 RESULTS
163
+
164
+ We show our main results in Table 2 and Table 3. Our BERT reimplementation with negative sampling underperforms the original BERT model on GLUE but is significantly better on SQuAD. However, we think that the main reasons for this performance discrepancy are the different masking procedures (we use span-based masking instead of whole-word masking) and the different ways training examples are presented to the model (we use one consecutive sequence instead of two sequences separated by the separator symbol). Comparing BERT-NCE and INFOWORD, we observe the benefit of the new self-supervised objective $\mathcal { I } _ { \mathrm { D I M } }$ (better overall GLUE and SQuAD results), particularly on tasks such as question answering and linguistics acceptability that seem to require understanding of longer phrases. In order to better understand our model, we investigate its performance with varying numbers of training examples and different values of $\lambda _ { \mathrm { D I M } }$ on the SQuAD development set and show the results in Figure 1 (for models with the BASE configuration). We can see that INFOWORD consistently outperforms BERT-NCE and the performance gap is biggest when the dataset is smallest, suggesting the benefit of having better pretrained representations when there are fewer training examples.
165
+
166
+ Table 2: Summary of results on GLUE.
167
+
168
+ <table><tr><td colspan="2">Model</td><td>CoLA</td><td>SST-2</td><td>MRPC</td><td>QQP</td><td>MNLI (M/MM)</td><td>QNLI</td><td>RTE</td><td>GLUE AVG</td></tr><tr><td rowspan="3">BAAE</td><td>BERT</td><td>52.1</td><td>93.5</td><td>88.9</td><td>71.2</td><td>84.6/83.4</td><td>90.5</td><td>66.4</td><td>78.8</td></tr><tr><td>BERT-NCE</td><td>50.8</td><td>93.0</td><td>88.6</td><td>70.5</td><td>83.2/83.0</td><td>90.9</td><td>65.9</td><td>78.2</td></tr><tr><td>INFOWORD</td><td>53.3</td><td>92.5</td><td>88.7</td><td>71.0</td><td>83.7/82.4</td><td>91.4</td><td>68.3</td><td>78.9</td></tr><tr><td rowspan="3">JAREE</td><td>BERT</td><td>60.5</td><td>94.9</td><td>89.3</td><td>72.1</td><td>86.7/85.9</td><td>92.7</td><td>70.1</td><td>81.5</td></tr><tr><td>BERT-NCE</td><td>54.7</td><td>93.1</td><td>89.5</td><td>71.2</td><td>85.8/85.0</td><td>92.7</td><td>72.5</td><td>80.6</td></tr><tr><td>INFOWORD</td><td>57.5</td><td>94.2</td><td>90.2</td><td>71.3</td><td>85.8/84.8</td><td>92.6</td><td>72.0</td><td>81.1</td></tr></table>
169
+
170
+ Table 3: Summary of results on SQuAD 1.1.
171
+
172
+ <table><tr><td rowspan="2">Model</td><td colspan="2">DEV</td><td colspan="2">TEST</td></tr><tr><td>F1</td><td>EM</td><td>F1</td><td>EM</td></tr><tr><td rowspan="2">JAAC</td><td>BERT BERT-NCE</td><td>88.5 90.2</td><td>80.8 83.3</td><td>=</td><td>1 84.4</td></tr><tr><td>INFOWORD</td><td>90.7</td><td>84.0</td><td>90.9 91.4</td><td>84.7</td></tr><tr><td>JAEEE</td><td>BERT BERT-NCE INFOWORD</td><td>90.9 92.0 92.6</td><td>84.1 85.9 86.6</td><td>91.3 92.7 93.1</td><td>84.3 86.6 87.3</td></tr></table>
173
+
174
+ # 5.5 DISCUSSION
175
+
176
+ Span-based models. We show how to design a simple self-supervised task in the InfoNCE framework that improves downstream performance on several datasets. Learning language representations to predict contiguous masked tokens has been explored in other context, and the objective introduced in $\mathcal { I } _ { \mathrm { D I M } }$ is related to these span-based models such as SpanBERT (Joshi et al., 2019) and MASS (Song et al., 2019). While our experimental goal is to demonstrate the benefit of contrastive learning for constructing self-supervised tasks, we note that INFOWORD is simpler to train and exhibits similar trends to SpanBERT that outperforms baseline models. We leave exhaustive comparisons to these methods to future work.
177
+
178
+ Mutual information maximization. A recent study has questioned whether the success of InfoNCE as an objective function is due to its property as a lower bound on mutual information and provides an alternative hypothesis based on metric learning (Tschannen et al., 2019). Regardless of the prevailing perspective, InfoNCE is widely accepted as a good representation learning objective, and formulating state-of-the-art language representation learning methods under this framework offers valuable insights that unifies many popular representation learning methods.
179
+
180
+ Regularization. Image representation learning methods often incorporate a regularization term in its objective function to encourage learned representations to look like a prior distribution (Hjelm et al., 2019; Bachman et al., 2019). This is useful for incorporating prior knowledge into a representation learning model. For example, the DeepInfoMax model has a term in its objective that encourages the learned representation from the encoder to match a uniform prior. Regularization is not commonly used when learning language representations. Our analysis and the connection we draw to representation learning methods used in other domains provide an insight into possible ways to incorporate prior knowledge into language representation learning models.
181
+
182
+ Future directions. The InfoNCE framework provides a holistic way to view progress in language representation learning. The framework is very flexible and suggests several directions that can be explored to improve existing methods. We show that progress in the field has been largely driven by innovations in the encoder which forms $g _ { \omega }$ . InfoNCE is based on maximizing the mutual information between different views of an input data, and it facilitates training on structured views as long as we can perform negative sampling (van den Oord et al., 2019; Bachman et al., 2019). Our analysis demonstrates that existing methods based on language modeling objectives only consider a single target word as one of the views. We think that incorporating more complex views (e.g., higher-order or skip $n$ -grams, syntactic and semantic parses, etc.) and designing appropriate self-supervised tasks is a promising future direction. A related area that is also underexplored is designing methods to obtain better negative samples.
183
+
184
+ ![](images/72ec514322e1e2b86a4c954ec3bc132ad81ebcabab62e8d81b0d098a9abafaf5.jpg)
185
+ Figure 1: The left plot shows $F _ { 1 }$ scores of BERT-NCE and INFOWORD as we increase the percentage of training examples on SQuAD (dev). The right plot shows $F _ { 1 }$ scores of INFOWORD on SQuAD (dev) as a function of $\lambda _ { \mathrm { D I M } }$ .
186
+
187
+ # 6 CONCLUSION
188
+
189
+ We analyzed state-of-the-art language representation learning methods from the perspective of mutual information maximization. We provided a unifying view of classical and modern word embedding models and showed how they relate to popular representation learning methods used in other domains. We used this framework to construct a new self-supervised task based on maximizing the mutual information between the global representation and local representations of a sentence. We demonstrated the benefit of this new task via experiments on GLUE and SQuAD.
190
+
191
+ # REFERENCES
192
+
193
+ Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis, and Nikunj Saunshi. A theoretical analysis of contrastive unsupervised representation learning. In Proc. of ICML, 2019.
194
+
195
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. arXiv preprint 1906.00910, 2019.
196
+
197
+ Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and R Devon Hjelm. Mine: Mutual information neural estimation. In Proc. of ICML, 2018.
198
+
199
+ Andrew M. Dai and Quoc V. Le. Semi-supervised sequence learning. In Proc. of NIPS, 2015.
200
+
201
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. In Proc. of ACL, 2019.
202
+
203
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proc. of NAACL, 2018.
204
+
205
+ M. D. Donsker and S. R. S. Varadhan. Asymptotic evaluation of certain markov process expectations for large time. iv. Communications on Pure and Applied Mathematics, 36(2):183––212, 1983.
206
+
207
+ Michael U. Gutmann and Aapo Hyvarinen. Noise-contrastive estimation of unnormalized statistical models, with applications to natural image statistics. Journal of Machine Learning Research, 13: 307––361, 2012.
208
+
209
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In Proc. of ICLR, 2019.
210
+
211
+ Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In Proc. of ACL, 2018.
212
+
213
+ Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, and Omer Levy. SpanBERT: Improving pre-training by representing and predicting spans. arXiv preprint 1907.10529, 2019.
214
+
215
+ Diederik P. Kingma and Jimmy Lei Ba. Adam: a method for stochastic optimization. In Proc. of ICLR, 2015.
216
+
217
+ Guillaume Lample and Alexis Conneau. Cross-lingual language model pretraining. arXiv preprint 1901.07291, 2019.
218
+
219
+ Ralph Linsker. Self-organization in a perceptual network. Computer, 21(3):105–117, 1988.
220
+
221
+ 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 1907.11692, 2019.
222
+
223
+ Lajanugen Logeswaran and Honglak Lee. An efficient framework for learning sentence representations. In Proc. of ICLR, 2018.
224
+
225
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In Proc. of NIPS, 2013.
226
+
227
+ Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Proc. of NIPS, 2013.
228
+
229
+ Sebastian Nowozin, Botond Cseke, , and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Proc. of NIPS, 2016.
230
+
231
+ Sindy Lowe Peter O’Connor and Bastiaan S. Veeling. Greedy infomax for biologically plausible self-supervised representation learning. In Proc. of NeurIPS, 2019.
232
+
233
+ Liam Paninski. Estimation of entropy and mutual information. Neural computation, 15(6):1191—- 1253, 2003.
234
+
235
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In Proc. of EMNLP, 2014.
236
+
237
+ Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proc. of NAACL, 2018.
238
+
239
+ Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A. Alemi, and George Tucker. On variational lower bounds of mutual information. In Proc. of ICML, 2019.
240
+
241
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. Technical report, OpenAI, 2018.
242
+
243
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. Technical report, OpenAI, 2019.
244
+
245
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proc. of EMNLP, 2016.
246
+
247
+ Pranav Rajpurkar, Robin Jia, and Percy Liang. Know what you don’t know: Unanswerable questions for squad. In Proc. of ACL, 2018.
248
+
249
+ Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie-Yan Liu. MASS: Masked sequence to sequence pre-training for language generation. In Proc. of ICML, 2019.
250
+
251
+ Michael Tschannen, Josip Djolonga, Paul K. Rubenstein, and Sylvain Gelly. On mutual information maximization for representation learning. arXiv preprint 1907.13625, 2019.
252
+
253
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint 1807.03748, 2019.
254
+
255
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understainding. In Proc. of ICLR, 2019.
256
+
257
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. XLNet: Generalized autoregressive pretraining for language understanding. arXiv preprint 1906.08237, 2019.
258
+
259
+ Dani Yogatama, Cyprien de Masson d’Autume, Jerome Connor, Tomas Kocisky, Mike Chrzanowski, Lingpeng Kong, Angeliki Lazaridou, Wang Ling, Lei Yu, Chris Dyer, and Phil Blunsom. Learning and evaluating general linguistic intelligence. arXiv preprint 1901.11373, 2019.
260
+
261
+ # A NEXT SENTENCE PREDICTION
262
+
263
+ We show that the next sentence prediction objective used in BERT is an instance of contrastive learning in this section. In next sentence prediction, given two sentences $\mathbf { x } ^ { 1 }$ and $\scriptstyle { \pmb x } ^ { 2 }$ , the task is to predict whether these are two consecutive sentences or not. Training data for this task is created by sampling a random second sentence $\hat { \pmb x } ^ { 2 }$ from the corpus to be used as a negative example $50 \%$ of the time.
264
+
265
+ Consider a discriminator (i.e., a classifier with parameters $\phi$ ) that takes encoded representations of concatenated $\scriptstyle { \mathbf { { x } } } ^ { 1 }$ and $\scriptstyle { \boldsymbol { x } } ^ { 2 }$ and returns a score. We denote this discriminator by $d _ { \phi } ( \pmb { x } ^ { 1 } , \pmb { x } ^ { 2 } )$ . The next sentence prediction objective function is:
266
+
267
+ $$
268
+ \mathbb { E } _ { p ( { \pmb x } ^ { 1 } , { \pmb x } ^ { 2 } ) } \left[ \log d _ { \phi } ( g _ { \omega } ( [ { \pmb x } ^ { 1 } , { \pmb x } ^ { 2 } ) ] ) + \log ( 1 - d _ { \phi } ( g _ { \omega } ( [ { \pmb x } ^ { 1 } , \tilde { { \pmb x } } ^ { 2 } ] ) ) ) \right] .
269
+ $$
270
+
271
+ This objective function—which is used for training BERT—is known in the literature as “local” Noise Contrastive Estimation (Gutmann & Hyvarinen, 2012). Since summing over all possible negative sentences is intractable, BERT approximates this by using a binary classifier to distinguish real samples and noisy samples.
272
+
273
+ An alternative approximation to using a binary classifier is to use “global NCE”, which is what InfoNCE is based on. Here, we have:
274
+
275
+ $$
276
+ \mathbb { E } _ { p ( { \pmb x } ^ { 1 } , { \pmb x } ^ { 2 } ) } \left[ \psi ^ { \top } g _ { \omega } ( [ { \pmb x } ^ { 1 } , { \pmb x } ^ { 2 } ) ] ) - \log \sum _ { \tilde { { \pmb x } } ^ { 2 } \in \tilde { \mathcal { X } } ^ { 2 } } \exp ( \psi ^ { \top } ( g _ { \omega } ( [ { \pmb x } ^ { 1 } , \tilde { { \pmb x } } ^ { 2 } ] ) ) ) \right] ,
277
+ $$
278
+
279
+ where we sample negative sentences from the corpus and combine it with the positive sentence to construct ${ \tilde { \mathcal { X } } } ^ { 2 }$ . To make the connection of this objective function with InfoNCE in Eq. 1 explicit, let $a$ and $b$ be two consecutive sentences $\scriptstyle { \mathbf { \mathscr { x } } } _ { 1 }$ and $\mathbf { x } _ { 2 }$ . Let $f _ { \theta } ( a , b )$ be $\psi ^ { \top } g _ { \omega } ( [ a , b ] )$ , where $\boldsymbol { \psi } \in \mathbb { R } ^ { d }$ is a trainable parameter, $[ a , b ]$ denotes a concatenation of $a$ and $b$ . Consider a Transformer encoder parameterized by $\omega$ , and let $g _ { \omega } ( [ a , b ] ) \in \mathbb { R } ^ { d }$ be a function that returns the final hidden state of the first token after running the concatenated sequence to the Transformer. Note that the encoder that we want to learn only depends on $g _ { \omega }$ , so both of these approximations can be used for training next sentence prediction.
280
+
281
+ # B HYPERPARAMETERS
282
+
283
+ Pretraining. We use Adam (Kingma & Ba, 2015) with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 8$ and $\epsilon = 1 e - 6$ . The batch size for training is 1024 with a maximum sequence length of 512. We train for 400,000 steps (including 18,000 warmup steps) with a weight decay rate of 0.01. We set the learning rate to $4 e ^ { - 4 }$ for all variants of the BASE models and $1 e ^ { - \overline { { 4 } } }$ for the LARGE models. We set $\lambda _ { \mathrm { M L M } }$ to 1.0 and tune $\lambda _ { \mathrm { D I M } } \in \{ 0 . 4 , 0 . 6 , 0 . 8 , 1 . 0 \}$ .
284
+
285
+ GLUE. We set the maximum sequence length to 128. For each GLUE task, we use the respective development set to choose the learning rate from $\{ 5 e ^ { - 6 } , 1 e ^ { - 5 } , 2 e ^ { - 5 } , 3 e ^ { - 5 } , 5 e ^ { - 5 } \}$ , and the batch size from $\{ 1 6 , 3 2 \}$ . The number of training epochs is set to 4 for CoLA and 10 for other tasks, following Joshi et al. (2019). We run each hyperparameter configuration 5 times and evaluate the best model on the test set (once).
286
+
287
+ SQuAD. We set the maximum sequence length to 512 and train for 4 epochs. We use the development set to choose the learning rate from $\{ 5 e ^ { - 6 } , 1 e ^ { - 5 } , 2 e ^ { - 5 } , 3 e ^ { - 5 } , 5 e ^ { - 5 } \}$ and the batch size from $\{ 1 6 , 3 2 \}$ .
288
+
289
+ # C QUESTION ANSWERING DECODER
290
+
291
+ We use a standard span predictor as follows. Denote the length of the context paragraph by $M$ , and $\pmb { x } ^ { \mathrm { c o n t e x t } } = \{ x _ { 1 } ^ { \mathrm { c o n t e x t } } , \allowbreak . \cdot . . , x _ { M } ^ { \mathrm { c o n t e x t } } \}$ . Denote the encoded representation of the $m$ -th token in the and xt by . Th $\mathbf { x } _ { t , m } ^ { \mathrm { c o n t e x t } }$ . The question answering decoder introduces two sets of parameters: bility of each context token being the start of the answer is comput $\mathbf { w } _ { \mathrm { s t a r t } }$ $\mathbf { w } _ { \mathrm { e n d } }$
292
+ $\begin{array} { r } { p ( \mathsf { s t a r t } = x _ { t , m } ^ { \mathrm { c o n t e x t } } \mid x _ { t } ) = \frac { \exp ( \mathbf { w } _ { \mathrm { s t a r t } } ^ { \top } \mathbf { x } _ { t , m } ^ { \mathrm { c o n t e x t } } ) } { \sum _ { n = 0 } ^ { M } \exp ( \mathbf { w } _ { \mathrm { s t a r t } } ^ { \top } \mathbf { x } _ { t , n } ^ { \mathrm { c o n t e x t } } ) } . } \end{array}$ The probability of the end index of the answer is computed analogously using $\mathbf { w } _ { \mathrm { e n d } }$ . The predicted answer is the span with the highest probability after multiplying the start and end probabilities.
md/train/SyxtJh0qYm/SyxtJh0qYm.md ADDED
@@ -0,0 +1,580 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VARIATIONAL AUTOENCODER WITH ARBITRARY CONDITIONING
2
+
3
+ Oleg Ivanov
4
+ Samsung AI Center Moscow Moscow, Russia
5
+ tigvarts@gmail.com Michael Figurnov
6
+ National Research University Higher School of Economics ∗ Moscow, Russia
7
+ michael@figurnov.ru Dmitry Vetrov
8
+ Samsung-HSE Laboratory, National Research University Higher School of Economics Samsung AI Center Moscow Moscow, Russia
9
+ vetrovd@yandex.ru
10
+
11
+ # ABSTRACT
12
+
13
+ We propose a single neural probabilistic model based on variational autoencoder that can be conditioned on an arbitrary subset of observed features and then sample the remaining features in “one shot”. The features may be both real-valued and categorical. Training of the model is performed by stochastic variational Bayes. The experimental evaluation on synthetic data, as well as feature imputation and image inpainting problems, shows the effectiveness of the proposed approach and diversity of the generated samples.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ In past years, a number of generative probabilistic models based on neural networks have been proposed. The most popular approaches include variational autoencoder (Kingma & Welling, 2013) (VAE) and generative adversarial net (Goodfellow et al., 2014) (GANs). They learn a distribution over objects $p ( x )$ and allow sampling from this distribution.
18
+
19
+ In many cases, we are interested in learning a conditional distribution $p ( x | y )$ . For instance, if $x$ is an image of a face, $y$ could be the characteristics describing the face (are glasses present or not; length of hair, etc.) Conditional variational autoencoder (Sohn et al., 2015) and conditional generative adversarial nets (Mirza & Osindero, 2014) are popular methods for this problem.
20
+
21
+ In this paper, we consider the problem of learning all conditional distributions of the form $p ( x _ { I } | x _ { U \setminus I } )$ , where $U$ is the set of all features and $I$ is its arbitrary subset. This problem generalizes both learning the joint distribution $p ( x )$ and learning the conditional distribution $p ( x | y )$ . To tackle this problem, we propose a Variational Autoencoder with Arbitrary Conditioning (VAEAC) model. It is a latent variable model similar to VAE, but allows conditioning on an arbitrary subset of the features. The conditioning features affect the prior on the latent Gaussian variables which are used to generate unobserved features. The model is trained using stochastic gradient variational Bayes (Kingma & Welling, 2013).
22
+
23
+ We consider two most natural applications of the proposed model. The first one is feature imputation where the goal is to restore the missing features given the observed ones. The imputed values may be valuable by themselves or may improve the performance of other machine learning algorithms which process the dataset. Another application is image inpainting in which the goal is to fill in an unobserved part of an image with an artificial content in a realistic way. This can be used for removing unnecessary objects from the images or, vice versa, for complementing the partially closed or corrupted object.
24
+
25
+ The experimental evaluation shows that the proposed model successfully samples from the conditional distributions. The distribution over samples is close to the true conditional distribution. This property is very important when the true distribution has several modes. The model is shown to be effective in feature imputation problem which helps to increase the quality of subsequent discriminative models on different problems from UCI datasets collection (Lichman, 2013). We demonstrate that model can generate diverse and realistic image inpaintings on MNIST (LeCun et al., 1998), Omniglot (Lake et al., 2015) and CelebA (Liu et al., 2015) datasets, and works even better than the current state of the art inpainting techniques in terms of peak signal to noise ratio (PSNR).
26
+
27
+ The paper is organized as follows. In section 2 we review the related works. In section 3 we briefly describe variational autoencoders and conditional variational autoencoders. In section 4 we define the problem, describe the VAEAC model and its training procedure. In section 5 we evaluate VAEAC. Section 6 concludes the paper. Appendix contains additional explanations, theoretical analysis, and experiments for VAEAC.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Universal Marginalizer (Douglas et al., 2017) is a model based on a feed-forward neural network which approximates marginals of unobserved features conditioned on observable values. A related idea of an autoregressive model of joint probability was previously proposed in Germain et al. (2015) and Uria et al. (2016). The description of the model and comparison with VAEAC are available in section 5.3.
32
+
33
+ Yoon et al. (2018) propose a GANs-based model called GAIN which solves the same problem as VAEAC. In contrast to VAEAC, GAIN does not use unobserved data during training, which makes it easier to apply to the missing features imputation problem. Nevertheless, it turns into a disadvantage when the fully-observed training data is available but the missingness rate at the testing stage is high. For example, in inpainting setting GAIN cannot learn the conditional distribution over MNIST digits given one horizontal line of the image while VAEAC can (see appendix D.4). The comparison of VAEAC and GAIN on the missing feature imputation problem is given in section 5.1 and appendix D.2.
34
+
35
+ Rezende et al. (2014) [Appendix F], Sohl-Dickstein et al. (2015), Goyal et al. (2017), and Bordes et al. (2017) propose to fill missing data with noise and run Markov chain with a learned transition operator. The stationary distribution of such chains approximates the true conditional distribution of the unobserved features. Bachman & Precup (2015) consider missing feature imputation in terms of Markov decision process and propose LSTM-based sequential decision making model to solve it. Nevertheless, these methods are computationally expensive at the test time and require fully-observed training data.
36
+
37
+ Image inpainting is a classic computer vision problem. Most of the earlier methods rely on local and texture information or hand-crafted problem-specific features (Bertalmio et al., 2000). In past years multiple neural network based approaches have been proposed.
38
+
39
+ Pathak et al. (2016), Yeh et al. (2016) and Yang et al. (2017) use different kinds and combinations of adversarial, reconstruction, texture and other losses. Li et al. (2017) focuses on face inpainting and uses two adversarial losses and one semantic parsing loss to train the generative model. In Yeh et al. (2017) GANs are first trained on the whole training dataset. The inpainting is an optimization procedure that finds the latent variables that explain the observed features best. Then, the obtained latents are passed through the generative model to restore the unobserved portion of the image. We can say that VAEAC is a similar model which uses prior network to find a proper latents instead of solving the optimization problem.
40
+
41
+ All described methods aim to produce a single realistic inpainting, while VAEAC is capable of sampling diverse inpaintings. Additionally, Yeh et al. (2016), Yang et al. (2017) and Yeh et al. (2017) have high testtime computational complexity of inpainting, because they require an optimization problem to be solved. On the other hand, VAEAC is a “single-shot” method with a low computational cost.
42
+
43
+ # 3 BACKGROUND
44
+
45
+ # 3.1 VARIATIONAL AUTOENCODER
46
+
47
+ Variational autoencoder (Kingma & Welling, 2013) (VAE) is a directed generative model with latent variables. The generative process in variational autoencoder is as follows: first, a latent variable $z$ is generated from the prior distribution $p ( z )$ , and then the data $x$ is generated from the generative distribution $p _ { \theta } ( x | z )$ , where $\theta$ are the generative model’s parameters. This process induces the distribution $p _ { \theta } ( x ) = \mathbb { E } _ { p ( z ) } p _ { \theta } ( x | z )$ . The distribution $p _ { \theta } ( x | z )$ is modeled by a neural network with parameters $\theta$ . $p ( z )$ is a standard Gaussian distribution.
48
+
49
+ The parameters $\theta$ are tuned by maximizing the likelihood of the training data points $\{ x _ { i } \} _ { i = 1 } ^ { N }$ from the true data distribution $p _ { d } ( x )$ . In general, this optimization problem is challenging due to intractable posterior inference. However, a variational lower bound can be optimized efficiently using backpropagation and stochastic gradient descent:
50
+
51
+ $$
52
+ \begin{array} { r l } & { \log p _ { \theta } ( x ) = \mathbb { E } _ { q _ { \phi } ( z | x ) } \log \frac { p _ { \theta } ( x , z ) } { q _ { \phi } ( z | x ) } + D _ { \mathrm { K L } } \big ( q _ { \phi } ( z | x ) \| p ( z | x , \theta ) \big ) } \\ & { \qquad \quad \ge \mathbb { E } _ { q _ { \phi } ( z | x ) } \log p _ { \theta } ( x | z ) - D _ { \mathrm { K L } } \big ( q _ { \phi } ( z | x ) \| p ( z ) \big ) = L _ { V A E } \big ( x ; \theta , \phi \big ) } \end{array}
53
+ $$
54
+
55
+ Here $q _ { \phi } ( z | x )$ is a proposal distribution parameterized by neural network with parameters $\phi$ that approximates the posterior $p ( z | x , \theta )$ . Usually this distribution is Gaussian with a diagonal covariance matrix. The closer $q _ { \phi } ( z | x )$ to $p ( z | x , \theta )$ , the tighter variational lower bound $L _ { V A E } ( \theta , \phi )$ . To compute the gradient of the variational lower bound with respect to $\phi$ , reparameterization trick is used: $z = \bar { \mu } _ { \phi } ( x ) + \bar { \varepsilon } \sigma _ { \phi } ( x )$ where $\varepsilon \sim \mathcal { N } ( 0 , I )$ and $\mu _ { \phi }$ and $\sigma _ { \phi }$ are deterministic functions parameterized by neural networks. So the gradient can be estimated using Monte-Carlo method for the first term and computing the second term analytically:
56
+
57
+ $$
58
+ \frac { \partial L _ { V A E } ( x ; \theta , \phi ) } { \partial \phi } = \mathbb { E } _ { \varepsilon \sim \mathcal { N } ( 0 , I ) } \frac { \partial } { \partial \phi } \log p _ { \theta } ( x | \mu _ { \phi } ( x ) + \varepsilon \sigma _ { \phi } ( x ) ) - \frac { \partial } { \partial \phi } D _ { \mathrm { K L } } ( q _ { \phi } ( z | x ) \| p ( z ) ) .
59
+ $$
60
+
61
+ So $L _ { V A E } ( \theta , \phi )$ can be optimized using stochastic gradient ascent with respect to $\phi$ and $\theta$
62
+
63
+ # 3.2 CONDITIONAL VARIATIONAL AUTOENCODER
64
+
65
+ Conditional variational autoencoder (Sohn et al., 2015) (CVAE) approximates the conditional distribution $p _ { d } ( x | y )$ . It outperforms deterministic models when the distribution $p _ { d } ( x | y )$ is multi-modal (diverse $x \mathbf { s }$ are probable for the given $y$ ). For example, assume that $x$ is a real-valued image. Then, a deterministic regression model with mean squared error loss would predict the average blurry value for $x$ . On the other hand, CVAE learns the distribution of $x$ , from which one can sample diverse and realistic objects.
66
+
67
+ Variational lower bound for CVAE can be derived similarly to VAE by conditioning all considered distributions on $y$ :
68
+
69
+ $$
70
+ L _ { C V A E } ( x , y ; \theta , \psi , \phi ) = \mathbb { E } _ { q _ { \phi } ( z | x , y ) } \log p _ { \theta } ( x | z , y ) - D _ { \mathrm { K L } } ( q _ { \phi } ( z | x , y ) | | p _ { \psi } ( z | y ) ) \leq \log p _ { \theta , \psi } ( x | y )
71
+ $$
72
+
73
+ Similarly to VAE, this objective is optimized using the reparameterization trick. Note that the prior distribution $p _ { \psi } ( z | y )$ is conditioned on $y$ and is modeled by a neural network with parameters $\psi$ . Thus, CVAE uses three trainable neural networks, while VAE only uses two.
74
+
75
+ Also authors propose such modifications of CVAE as Gaussian stochastic neural network and hybrid model. These modifications can be applied to our model as well. Nevertheless, we don’t use them, because of their disadvantage which is described in appendix C.
76
+
77
+ # 4 VARIATIONAL AUTOENCODER WITH ARBITRARY CONDITIONING
78
+
79
+ # 4.1 PROBLEM STATEMENT
80
+
81
+ Consider a distribution $p _ { d } ( x )$ over a $D$ -dimensional vector $x$ with real or categorical components. The components of the vector are called features.
82
+
83
+ Let binary vector $b \in \{ 0 , 1 \} ^ { D }$ be the binary mask of unobserved features of the object. Then we describe the vector of unobserved features as $x _ { b } = \{ x _ { i : b _ { i } = 1 } \}$ . For example, $x _ { ( 0 , 1 , 1 , 0 , 1 ) } = ( x _ { 2 } , x _ { 3 } , x _ { 5 } )$ . Using this notation we denote $x _ { 1 - b }$ as a vector of observed features.
84
+
85
+ Our goal is to build a model of the conditional distribution $p _ { \psi , \theta } ( x _ { b } | x _ { 1 - b } , b ) \approx p _ { d } ( x _ { b } | x _ { 1 - b } , b )$ for an arbitrary $b$ , where $\psi$ and $\theta$ are parameters that are used in our model at the testing stage.
86
+
87
+ However, the true distribution $p _ { d } ( x _ { b } | x _ { 1 - b } , b )$ is intractable without strong assumptions about $p _ { d } ( x )$ . Therefore, our model $p _ { \psi , \theta } ( x _ { b } | x _ { 1 - b } , b )$ has to be more precise for some $b$ and less precise for others. To formalize our requirements about the accuracy of our model we introduce the distribution $p ( b )$ over different unobserved feature masks. The distribution $p ( b )$ is arbitrary and may be defined by the user depending on the problem. Generally it should have full support over $\{ 0 , 1 \} ^ { D }$ so that $p _ { \psi , \theta } ( x _ { b } | x _ { 1 - b } , b )$ can evaluate arbitrary conditioning. Nevertheless, it is not necessary if the model is used for specific kinds of conditioning (as we do in section 5.2).
88
+
89
+ Using $p ( b )$ we can introduce the following log-likelihood objective function for the model:
90
+
91
+ $$
92
+ \operatorname* { m a x } _ { \psi , \theta } \mathbb { E } _ { p _ { d } ( \boldsymbol { x } ) } \mathbb { E } _ { p ( \boldsymbol { b } ) } \log p _ { \psi , \theta } \big ( x _ { b } | \boldsymbol { x } _ { 1 - \boldsymbol { b } } , \boldsymbol { b } \big )
93
+ $$
94
+
95
+ The special cases of the objective (4) are variational autoencoder $( b _ { i } = 1 \forall i \in \{ 1 , \ldots , D \} )$ and conditional variational autoencoder $^ { \textit { b } }$ is constant).
96
+
97
+ # 4.2 MODEL DESCRIPTION
98
+
99
+ The generative process of our model is similar to the generative process of CVAE: for each object firstly we generate $z \sim p _ { \psi } ( z | x _ { 1 - b } , b )$ using prior network, and then sample unobserved features $x _ { b } ~ \sim ~ p _ { \theta } ( x _ { b } | z , x _ { 1 - b } , b )$ using generative network. This process induces the following model distribution over unobserved features:
100
+
101
+ $$
102
+ p _ { \psi , \theta } ( x _ { b } | x _ { 1 - b } , b ) = \mathbb { E } _ { z \sim p _ { \psi } ( z | x _ { 1 - b } , b ) } p _ { \theta } ( x _ { b } | z , x _ { 1 - b } , b )
103
+ $$
104
+
105
+ We use $z ~ \in ~ \mathbb { R } ^ { d }$ , and Gaussian distribution $p _ { \psi }$ over $z$ , with parameters from a neural network with weights $\psi$ : $p _ { \psi } ( z | x _ { 1 - b } , b , \psi ) = \mathcal { N } ( z | \mu _ { \psi } ( x _ { 1 - b } , b ) , \sigma _ { \psi } ^ { 2 } ( x _ { 1 - b } , b ) I )$ . The real-valued components of distribution $p _ { \theta } ( x _ { b } | \boldsymbol { z } , x _ { 1 - b } , b )$ are defined likewise. Each categorical component $i$ of distribution $p _ { \theta } ( x _ { i } | \boldsymbol { z } , x _ { 1 - b } , b )$ is parameterized by a function $w _ { i , \theta } ( z , x _ { 1 - b } , b )$ , whose outputs are logits of probabilities for each category: $x _ { i } \sim \mathrm { C a t } [ \mathrm { S o f t m a x } ( w _ { i , \theta } ( z , x _ { 1 - b } , b ) ) ]$ . Therefore the components of the latent vector $z$ are conditionally independent given $x _ { 1 - b }$ and $b$ , and the components of $x _ { b }$ are conditionally independent given $z , x _ { 1 - b }$ and $b$ .
106
+
107
+ The variables $x _ { b }$ and $x _ { 1 - b }$ have variable length that depends on $b$ . So in order to use architectures such as multi-layer perceptron and convolutional neural network we consider $x _ { 1 - b } = x \circ ( 1 - b )$ where $\circ$ is an element-wise product. So in implementation $x _ { 1 - b }$ has fixed length. The output of the generative network also has a fixed length, but we use only unobserved components to compute likelihood.
108
+
109
+ The theoretical analysis of the model is available in appendix B.1.
110
+
111
+ # 4.3 LEARNING VARIATIONAL AUTOENCODER WITH ARBITRARY CONDITIONING
112
+
113
+ # 4.3.1 VARIATIONAL LOWER BOUND
114
+
115
+ We can derive a lower bound for $\log p _ { \psi , \theta } ( x _ { b } | x _ { 1 - b } , b )$ as for variational autoencoder:
116
+
117
+ $$
118
+ \begin{array} { r l } & { \log p _ { \psi , \theta } ( x _ { b } | x _ { 1 - b } , b ) = \mathbb { E } _ { q _ { \phi } ( z | x , b ) } \log \frac { p _ { \psi , \theta } ( x _ { b } , z | x _ { 1 - b } , b ) } { q _ { \phi } ( z | x , b ) } + D _ { \mathrm { K L } } ( q _ { \phi } ( z | x , b ) | | p _ { \psi , \theta } ( z | x , b ) ) } \\ & { \qquad \geq \mathbb { E } _ { q _ { \phi } ( z | x , b ) } \log p _ { \theta } ( x _ { b } | z , x _ { 1 - b } , b ) - D _ { \mathrm { K L } } ( q _ { \phi } ( z | x , b ) | | p _ { \psi } ( z | x _ { 1 - b } , b ) ) = L _ { V A E A C } ( x , b ; \theta , \psi , \phi ) } \end{array}
119
+ $$
120
+
121
+ Therefore we have the following variational lower bound optimization problem:
122
+
123
+ $$
124
+ \operatorname* { m a x } _ { \theta , \psi , \phi } \mathbb { E } _ { p _ { d } ( x ) } \mathbb { E } _ { p ( b ) } L _ { V A E A C } ( x , b ; \theta , \psi , \phi )
125
+ $$
126
+
127
+ We use fully-factorized Gaussian proposal distribution $q _ { \phi }$ which allows us to perform reparameterization trick and compute KL divergence analytically in order to optimize (7).
128
+
129
+ # 4.3.2 PRIOR IN LATENT SPACE
130
+
131
+ During the optimization of objective (7) the parameters $\mu _ { \psi }$ and $\sigma _ { \psi }$ of the prior distribution of $z$ may tend to infinity, since there is no penalty for large values of those parameters. We usually observe the growth of $\left. z \right. _ { 2 }$ during training, though it is slow enough. To prevent potential numerical instabilities, we put a Normal-Gamma prior on the parameters of the prior distribution to prevent the divergence. Formally, we redefine $p _ { \psi } ( z | x _ { 1 - b } , b )$ as follows:
132
+
133
+ $$
134
+ p _ { \psi } ( z , \mu _ { \psi } , \sigma _ { \psi } | x _ { 1 - b } , b ) = \mathcal { N } ( z | \mu _ { \psi } , \sigma _ { \psi } ^ { 2 } ) \mathcal { N } ( \mu _ { \psi } | 0 , \sigma _ { \mu } ) \mathrm { G a m m a } ( \sigma _ { \psi } | 2 , \sigma _ { \sigma } )
135
+ $$
136
+
137
+ As a result, the regularizers $- \frac { \mu _ { \psi } ^ { 2 } } { 2 \sigma _ { \mu } ^ { 2 } }$ and $\sigma _ { \sigma } ( \log ( \sigma _ { \psi } ) - \sigma _ { \psi } )$ are added to the model log-likelihood. Hyperparameter $\sigma _ { \mu }$ is chosen to be large $( 1 0 ^ { 4 } )$ and $\sigma _ { \sigma }$ is taken to be a small positive number $( 1 0 ^ { - 4 } )$ . This distribution is close to uniform near zero, so it doesn’t affect the learning process significantly.
138
+
139
+ # 4.3.3 MISSING FEATURES
140
+
141
+ The optimization objective (7) requires all features of each object at the training stage: some of the features will be observed variables at the input of the model and other will be unobserved features used to evaluate the model. Nevertheless, in some problem settings the training data contains missing features too. We propose the following slight modification of the problem (7) in order to cover such problems as well.
142
+
143
+ The missing values cannot be observed so $x _ { i } = \omega \Rightarrow b _ { i } = 1$ , where $\omega$ describes the missing value in the data. In order to meet this requirement, we redefine mask distribution as conditioned on $x$ : $p ( b )$ turns into $p ( b | x )$ in (4) and (7). In the reconstruction loss (5) we simply omit the missing features, i. e. marginalize them out:
144
+
145
+ $$
146
+ \log p _ { \theta } ( x _ { b } | z , x _ { 1 - b } , b ) = \sum _ { \substack { i : b _ { i } = 1 , x _ { i } \neq \omega } } \log p _ { \theta } ( x _ { i } | z , x _ { 1 - b } , b )
147
+ $$
148
+
149
+ The proposal network must be able to determine which features came from real object and which are just missing. So we use additional missing features mask which is fed to proposal network together with unobserved features mask $b$ and object $x$ .
150
+
151
+ The proposed modifications are evaluated in section 5.1.
152
+
153
+ Table 1: NRMSE (for continuous datasets) or PFC (for categorical ones) of imputations. Less is better.
154
+
155
+ <table><tr><td>Method/Dataset</td><td>WhiteWine</td><td>Yeast</td><td>Mushroom</td><td>Zoo</td><td>Phishing</td></tr><tr><td>MICE</td><td>0.964± 0.007</td><td>1.01 ± 0.01</td><td>0.334± 0.002</td><td>0.19±0.03</td><td>0.422± 0.006</td></tr><tr><td>MissForest</td><td>0.878 ± 0.009</td><td>1.02 ± 0.06</td><td>0.249 ± 0.006</td><td>0.16 ±0.02</td><td>0.422 ± 0.009</td></tr><tr><td>GAIN</td><td>0.97 ± 0.02</td><td>0.99 ± 0.03</td><td>0.271 ± 0.003</td><td>0.20± 0.02</td><td>0.427 ± 0.010</td></tr><tr><td>VAEAC</td><td>0.850 ± 0.007</td><td>0.94 ± 0.01</td><td>0.244 ± 0.002</td><td>0.16 ± 0.02</td><td>0.394± 0.006</td></tr></table>
156
+
157
+ # 5 EXPERIMENTS
158
+
159
+ In this section we validate the performance of VAEAC using several real-world datasets. In the first set of experiments we evaluate VAEAC missing features imputation performance using various UCI datasets (Lichman, 2013). We compare imputations from our model with imputations from such classical methods as MICE (Buuren & Groothuis-Oudshoorn, 2010) and MissForest (Stekhoven & Buhlmann, 2011) and recently ¨ proposed GANs-based method GAIN (Yoon et al., 2018). In the second set of experiments we use VAEAC to solve image inpainting problem. We show inpainitngs generated by VAEAC and compare our model with models from papers Pathak et al. (2016), Yeh et al. (2017) and Li et al. (2017) in terms of peak signal-to-noise ratio (PSNR) of obtained inpaintings on CelebA dataset (Liu et al., 2015) . And finally, we evaluate VAEAC against the competing method called Universal Marginalizer (Douglas et al., 2017). Additional experiments can be found in appendices C and D. The code is available at https://github.com/tigvarts/ vaeac.
160
+
161
+ # 5.1 MISSING FEATURES IMPUTATION
162
+
163
+ The datasets with missing features are widespread. Consider a dataset with $D$ -dimensional objects $x$ where each feature may be missing (which we denote by $x _ { i } ~ = ~ \omega$ ) and their target values $y$ . The majority of discriminative methods do not support missing values in the objects. The procedure of filling in the missing features values is called missing features imputation.
164
+
165
+ In this section we evaluate the quality of imputations produced by VAEAC. For evaluation we use datasets from UCI repository (Lichman, 2013). Before training we drop randomly $50 \%$ of values both in train and test set. After that we impute missing features using MICE (Buuren & Groothuis-Oudshoorn, 2010), MissForest (Stekhoven & Buhlmann, 2011), GAIN (Yoon et al., 2018) and VAEAC trained on the observed data. The ¨ details of GAIN implementation are described in appendix A.4.
166
+
167
+ Our model learns the distribution of the imputations, so it is able to sample from this distribution. We replace each object with missing features by $n = 1 0$ objects with sampled imputations, so the size of the dataset increases by $n$ times. This procedure is called missing features multiple imputation. MICE and GAIN are also capable of multiple imputation (we use $n = 1 0$ for them in experiments as well), but MissForest is not.
168
+
169
+ For more details about the experimental setup see appendices A.1, A.2, and A.4.
170
+
171
+ In table 1 we report NRMSE (i.e. RMSE normalized by the standard deviation of each feature and then averaged over all features) of imputations for continuous datasets and proportion of falsely classified (PFC) for categorical ones. For multiple imputation methods we average imputations of continuous variables and take most frequent imputation for categorical ones for each object.
172
+
173
+ We also learn linear or logistic regression and report the regression or classification performance after applying imputations of different methods in table 2. For multiple imputation methods we average predictions for continuous targets and take most frequent prediction for categorical ones for each object in test set.
174
+
175
+ Table 2: R2-score (for continuous targets) or accuracy (for categorical ones) of post-imputation regression or classification. Higher is better.
176
+
177
+ <table><tr><td>Method /Dataset</td><td>WhiteWine</td><td>Yeast</td><td>Mushroom</td><td>Z00</td><td>Phishing</td></tr><tr><td>MICE</td><td>0.13±0.02</td><td>0.41 ±0.02</td><td>0.92± 0.01</td><td>0.78± 0.05</td><td>0.75 ±0.02</td></tr><tr><td>MissForest</td><td>0.17 ± 0.01</td><td>0.42 ± 0.02</td><td>0.972 ± 0.003</td><td>0.71 ± 0.07</td><td>0.73 ± 0.02</td></tr><tr><td>GAIN</td><td>0.11 ± 0.01</td><td>0.39 ± 0.06</td><td>0.969 ± 0.005</td><td>0.67 ± 0.06</td><td>0.74 ± 0.03</td></tr><tr><td>VAEAC</td><td>0.17 ± 0.01</td><td>0.43 ± 0.01</td><td>0.983 ± 0.002</td><td>0.8 ± 0.1</td><td>0.74 ± 0.02</td></tr></table>
178
+
179
+ As can be seen from the tables 1 and 2, VAEAC can learn joint data distribution and use it for missing feature imputation. The imputations are competitive with current state of the art imputation methods in terms of RMSE, PFC, post-imputation regression R2-score and classification accuracy. Nevertheless, we don’t claim that our method is state of the art in missing features imputation; for some datasets MICE or MissForest outperform it. The additional experiments can be found in appendix D.2.
180
+
181
+ # 5.2 IMAGE INPAINTING
182
+
183
+ The image inpainting problem has a number of different formulations. The formulation of our interest is as follows: some of the pixels of an image are unobserved and we want to restore them in a natural way. Unlike the majority of papers, we want to restore not just one most probable inpainting, but the distribution over all possible inpaintings from which we can sample. This distribution is extremely multi-modal because often there is a lot of different possible ways to inpaint the image.
184
+
185
+ Unlike the previous subsection, here we have uncorrupted images without missing features in the training set, so $p ( b | x ) = p ( b )$ .
186
+
187
+ As we show in section 2, state of the art results use different adversarial losses to achieve more sharp and realistic samples. VAEAC can be adapted to the image inpainting problem by using a combination of those adversarial losses as a part of reconstruction loss $p _ { \theta } ( x _ { b } | \boldsymbol { z } , x _ { 1 - b } , b )$ . Nevertheless, such construction is out of scope for this research, so we leave it for the future work. In the current work we show that the model can generate both diverse and realistic inpaintings.
188
+
189
+ In figures 1, 2, 3 and 4 we visualize image inpaintings produced by VAEAC on binarized MNIST (LeCun et al., 1998), Omniglot (Lake et al., 2015) and CelebA (Liu et al., 2015). The details of learning procedure and description of datasets are available in appendixes A.1 and A.3.
190
+
191
+ To the best of our knowledge, the most modern inpainting papers don’t consider the diverse inpainting problem, where the goal is to build diverse image inpaintings, so there is no straightforward way to compare with these models. Nevertheless, we compute peak signal-to-noise ratio (PSNR) for one random inpainting from VAEAC and the best PSNR among 10 random inpaintings from VAEAC. One inpainting might not be similar to the original image, so we also measure how good the inpainting which is most similar to the original image reconstructs it. We compare these two metrics computed for certain masks with the PSNRs for the same masks on CelebA from papers Yeh et al. (2017) and Li et al. (2017). The results are available in tables 3 and 4.
192
+
193
+ We observe that for the majority of proposed masks our model outperforms the competing methods in terms of PSNR even with one sample, and for the rest (where the inpaintings are significantly diverse) the best PSNR over 10 inpaintings is larger than the same PSNR of the competing models. Even if PSNR does not reflect completely the visual quality of images and tends to encourage blurry VAE samples instead of realistic GANs samples, the results show that VAEAC is able to solve inpainting problem comparably to the state of the art methods. The disadvantage of VAEAC compared to Yeh et al. (2017) and Li et al. (2017) (but not Pathak et al. (2016)) is that it needs the distribution over masks at the training stage to be similar to the distribution over them at the test stage. However, it is not a very strict limitation for the practical usage.
194
+
195
+ Table 3: PSNR of inpaintings for different masks for Context Encoder (Pathak et al., 2016), model from “Semantic Image Inpainting with Deep Generative Models” (Yeh et al., 2017) and VAEAC. Higher is better.
196
+
197
+ <table><tr><td>Method/Masks</td><td>Center</td><td>Pattern</td><td>Random</td><td>Half</td></tr><tr><td>Context Encoder 1</td><td>21.3</td><td>19.2</td><td>20.6</td><td>15.5</td></tr><tr><td>SIIDGM 1</td><td>19.4</td><td>17.4</td><td>22.8</td><td>13.7</td></tr><tr><td>VAEAC, 1 sample</td><td>22.1</td><td>21.4</td><td>29.3</td><td>14.9</td></tr><tr><td>VAEAC,10 samples</td><td>23.7</td><td>23.3</td><td>29.3</td><td>17.4</td></tr></table>
198
+
199
+ Table 4: PSNR of inpaintings for different masks for Context Encoder (Pathak et al., 2016), model from “Generative Face Completion” (Li et al., 2017) and VAEAC. Higher is better.
200
+
201
+ <table><tr><td>Method/Masks</td><td>01</td><td>02</td><td>03</td><td>04</td><td>05</td><td>06</td></tr><tr><td>Context Encoder2</td><td>18.6</td><td>18.4</td><td>17.9</td><td>19.0</td><td>19.1</td><td>19.3</td></tr><tr><td>GFC ²</td><td>20.0</td><td>19.8</td><td>18.8</td><td>19.7</td><td>19.5</td><td>20.2</td></tr><tr><td>VAEAC,1 sample</td><td>20.8</td><td>21.0</td><td>19.5</td><td>20.3</td><td>20.3</td><td>21.0</td></tr><tr><td>VAEAC,10 samples</td><td>22.0</td><td>22.2</td><td>20.8</td><td>21.7</td><td>21.8</td><td>22.2</td></tr></table>
202
+
203
+ # 5.3 UNIVERSAL MARGINALIZER
204
+
205
+ Universal Marginalizer (Douglas et al., 2017) (UM) is a model which uses a single neural network to estimate the marginal distributions over the unobserved features. So it optimizes the following objective:
206
+
207
+ $$
208
+ \operatorname* { m a x } _ { \theta } \mathbb { E } _ { x \sim p _ { d } ( x ) } \mathbb { E } _ { b \sim p ( b ) } \sum _ { i = 1 } ^ { D } b _ { i } \log p _ { \theta } \big ( x _ { i } | x _ { 1 - b } , b \big )
209
+ $$
210
+
211
+ For given mask $b$ we fix a permutation of its unobserved components: $( i _ { 1 } , i _ { 2 } , \dots , i _ { | b | } )$ , where $| b |$ is a number of unobserved components. Using the learned model and the permutation we can generate objects from joint distribution and estimate their probability using chain rule.
212
+
213
+ $$
214
+ \log p _ { \theta } ( x _ { b } | x _ { 1 - b } , b ) = \sum _ { j = 1 } ^ { | b | } \log p _ { \theta } ( x _ { i _ { j } } | x _ { 1 - ( b - \sum _ { k = 1 } ^ { j - 1 } e _ { i _ { k } } ) } , b - \sum _ { k = 1 } ^ { j - 1 } e _ { i _ { k } } )
215
+ $$
216
+
217
+ For example, $p _ { \theta } ( x _ { 1 } , x _ { 4 } , x _ { 5 } | x _ { 2 } , x _ { 3 } ) = p _ { \theta } ( x _ { 4 } | x _ { 2 } , x _ { 3 } ) p _ { \theta } ( x _ { 1 } | x _ { 2 } , x _ { 3 } , x _ { 4 } ) p _ { \theta } ( x _ { 5 } | x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } ) .$
218
+
219
+ Conditional sampling or conditional likelihood estimation for one object requires $| b |$ requests to UM to compute $p _ { \theta } ( x _ { i } | x _ { 1 - b } , b )$ . Each request is a forward pass through the neural network. In the case of conditional sampling those requests even cannot be paralleled because the input of the next request contains the output of the previous one.
220
+
221
+ We propose a slight modification of the original UM training procedure which allows learning UM efficiently for any kind of masks including those considered in this paper. The details of the modification are described in appendix B.3.
222
+
223
+ ![](images/d8e3304c44f6641f3fcf46844d8ec076bf559af92021199814e73a3e8e86af57.jpg)
224
+ Figure 1: MNIST inpaintings.
225
+
226
+ ![](images/696a7457eff5fb7c33faf339e1df45fda1cdfba4264c7adccc10fee5a551d327.jpg)
227
+ Figure 2: Omniglot inpaintings.
228
+
229
+ ![](images/22952789d3ea86e1798ed0fcb93d6b5ec6a1f7740b49980530ccffa387686d74.jpg)
230
+ Figure 3: CelebA inpaintings.
231
+
232
+ ![](images/1a5cbe58c9eb61a7543d31d330e9a0fdd262a2099e64f42864b8627f3f719b25.jpg)
233
+ Figure 4: CelebA inpaintings with masks from (Yeh et al., 2017).
234
+
235
+ Left: input. The gray pixels are unobserved. Middle: samples from VAEAC. Right: ground truth.
236
+
237
+ Table 5: VAEAC and UM comparison on MNIST.
238
+
239
+ <table><tr><td>Method</td><td>VAEAC</td><td>UM</td></tr><tr><td>Negative log-likelihood</td><td>61</td><td>41</td></tr><tr><td>Training time (30 epochs)</td><td>5min 47s</td><td>3min 14s</td></tr><tr><td>Test time (1OO samples generation)</td><td>0.7ms</td><td>1s</td></tr></table>
240
+
241
+ The results of using this modification of UM are provided in table 5. We can say that the relation between VAEAC and UM is similar to the relation between VAE and PixelCNN. The second one is much slower at the testing stage, but it easily takes into account local dependencies in data while the first one is faster but assumes conditional independence of the outputs. Nevertheless, there are a number of cases where UM cannot learn the distribution well while VAEAC can. For example, when the data is real-valued and marginal distributions have many local optima, there is no straightforward parametrization which allows UM to approximate them, and, therefore also the conditioned joint distribution. An example of such distribution and more illustrations for comparison of VAEAC and UM are available in appendix D.5.
242
+
243
+ # 6 CONCLUSION
244
+
245
+ In this paper we consider the problem of simultaneous learning of all conditional distributions for a vector. This problem has a number of different special cases with practical applications. We propose neural network based probabilistic model for distribution conditioning learning with Gaussian latent variables. This model is scalable and efficient in inference and learning. We propose several tricks to improve optimization and give recommendations about hyperparameters choice. The model is successfully applied to feature imputation and inpainting tasks. The experimental results show that the model is competitive with state of the art methods for both missing features imputation and image inpainting problems.
246
+
247
+ # REFERENCES
248
+
249
+ Philip Bachman and Doina Precup. Data generation as sequential decision making. In Advances in Neural Information Processing Systems, pp. 3249–3257, 2015.
250
+
251
+ Marcelo Bertalmio, Guillermo Sapiro, Vincent Caselles, and Coloma Ballester. Image inpainting. In Proceedings of the 27th Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH ’00, pp. 417–424, New York, NY, USA, 2000. ACM Press/Addison-Wesley Publishing Co. ISBN 1- 58113-208-5.
252
+
253
+ Florian Bordes, Sina Honari, and Pascal Vincent. Learning to generate samples from noise through infusion training. In International Conference on Learning Representations, 2017.
254
+
255
+ Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
256
+
257
+ S van Buuren and Karin Groothuis-Oudshoorn. mice: Multivariate imputation by chained equations in r. Journal of statistical software, pp. 1–68, 2010.
258
+
259
+ Laura Douglas, Iliyan Zarov, Konstantinos Gourgoulias, Chris Lucas, Chris Hart, Adam Baker, Maneesh Sahani, Yura Perov, and Saurabh Johri. A universal marginalizer for amortized inference in generative models. arXiv preprint arXiv:1711.00695, 2017.
260
+
261
+ Mathieu Germain, Karol Gregor, Iain Murray, and Hugo Larochelle. Made: Masked autoencoder for distribution estimation. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 881–889, Lille, France, 07–09 Jul 2015. PMLR. URL http://proceedings.mlr.press/v37/germain15. html.
262
+
263
+ 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.
264
+
265
+ Anirudh Goyal Alias Parth Goyal, Nan Ke, Surya Ganguli, and Yoshua Bengio. Variational walkback: Learning a transition operator as a stochastic recurrent net. In Advances in Neural Information Processing Systems, pp. 4392–4402, 2017.
266
+
267
+ 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.
268
+
269
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
270
+
271
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2013.
272
+
273
+ Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
274
+
275
+ Yann LeCun, Corinna Cortes, and Christopher JC Burges. The mnist database of handwritten digits, 1998.
276
+
277
+ Yijun Li, Sifei Liu, Jimei Yang, and Ming-Hsuan Yang. Generative face completion. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume 1, pp. 3, 2017.
278
+
279
+ M. Lichman. UCI machine learning repository, 2013. URL http://archive.ics.uci.edu/ml.
280
+
281
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
282
+
283
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, and Ian Goodfellow. Adversarial autoencoders. In International Conference on Learning Representations, 2016. URL http://arxiv.org/abs/1511. 05644.
284
+
285
+ Xiaojiao Mao, Chunhua Shen, and Yu-Bin Yang. Image restoration using very deep convolutional encoderdecoder networks with symmetric skip connections. In Advances in neural information processing systems, pp. 2802–2810, 2016.
286
+
287
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. CoRR, abs/1411.1784, 2014.
288
+
289
+ Deepak Pathak, Philipp Krahenb ¨ uhl, Jeff Donahue, Trevor Darrell, and Alexei Efros. Context encoders: ¨ Feature learning by inpainting. In Computer Vision and Pattern Recognition (CVPR), 2016.
290
+
291
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pp. 1278– 1286, 2014.
292
+
293
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234–241. Springer, 2015.
294
+
295
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 2256–2265, Lille, France, 07–09 Jul 2015. PMLR. URL http://proceedings.mlr. press/v37/sohl-dickstein15.html.
296
+
297
+ Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 3483–3491. Curran Associates, Inc., 2015.
298
+
299
+ Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. Ladder variational autoencoders. In Advances in neural information processing systems, pp. 3738–3746, 2016.
300
+
301
+ Daniel J Stekhoven and Peter Buhlmann. Missforest - non-parametric missing value imputation for mixed-¨ type data. Bioinformatics, 28(1):112–118, 2011.
302
+
303
+ Benigno Uria, Marc-Alexandre Cotˆ e, Karol Gregor, Iain Murray, and Hugo Larochelle. Neural autoregres- ´ sive distribution estimation. The Journal of Machine Learning Research, 17(1):7184–7220, 2016.
304
+
305
+ C. Yang, X. Lu, Z. Lin, E. Shechtman, O. Wang, and H. Li. High-resolution image inpainting using multiscale neural patch synthesis. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4076–4084, July 2017. doi: 10.1109/CVPR.2017.434.
306
+
307
+ Raymond Yeh, Chen Chen, Teck-Yian Lim, Mark Hasegawa-Johnson, and Minh N. Do. Semantic image inpainting with perceptual and contextual losses. CoRR, abs/1607.07539, 2016.
308
+
309
+ Raymond A Yeh, Chen Chen, Teck Yian Lim, Alexander G Schwing, Mark Hasegawa-Johnson, and Minh N Do. Semantic image inpainting with deep generative models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5485–5493, 2017.
310
+
311
+ Jinsung Yoon, James Jordon, and Mihaela van der Schaar. GAIN: Missing data imputation using generative adversarial nets. 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. 5689–5698, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr. press/v80/yoon18a.html.
312
+
313
+ # APPENDIX
314
+
315
+ # A EXPERIMENTAL DETAILS
316
+
317
+ A.1 NEURAL NETWORK ARCHITECTURES
318
+
319
+ In all experiments we use optimization method Adam (Kingma & Ba, 2014), skip-connections between prior network and generative network inspired by (Mao et al., 2016), (Sønderby et al., 2016) and (Ronneberger et al., 2015), and convolutional neural networks based on ResNet blocks (He et al., 2016).
320
+
321
+ Without skip-connections all information for decoder goes through the latent variables. In image inpainting we found skip-connections very useful in both terms of log-likelihood improvement and the image realism, because latent variables are responsible for the global information only while the local information passes through skip-connections. Therefore the border between image and inpainting becomes less conspicuous.
322
+
323
+ The main idea of neural networks architecture is reflected in figure 5.
324
+
325
+ ![](images/5b67d91960752eb18692b5b61ef536a092947e8d387abb82437625c2d41f393a.jpg)
326
+ Figure 5: Neural network architecture for inpainting.
327
+
328
+ The number of hidden layers, their widths and structure may be different.
329
+
330
+ The neural networks we used for image inpainting have He-Uniform initialization of convolutional ResNet blocks, and the skip-connections are implemented using concatenation, not addition. The proposal network structure is exactly the same as the prior network except skip-connections.
331
+
332
+ Also one could use much simpler fully-connected networks with one hidden layer as a proposal, prior and generative networks in VAEAC and still obtain nice inpaintings on MNIST.
333
+
334
+ # A.2 MISSING FEATURES IMPUTATION
335
+
336
+ We split the dataset into train and test set with size ratio 3:1. Before training we drop randomly $50 \%$ of values both in train and test set. We repeat each experiment 5 times with different train-test splits and dropped features and then average results and compute their standard deviation.
337
+
338
+ As we show in appendix B.2, the better results can be achieved when the model learns the concatenation of objects features $x$ and targets $y$ . So we treat $y$ as an additional feature that is always unobserved during the testing time.
339
+
340
+ To train our model we use distribution $p ( b _ { i } | x )$ in which $p ( b _ { i } | x _ { i } = \omega ) = 1$ and $p ( b _ { i } | x ) = 0 . 2$ otherwise. Also for VAEAC trainig we normalize real-valued features, fix $\sigma _ { \theta } = 1$ in the generative model of VAEAC in order to optimize RMSE, and use $2 5 \%$ of training data as validation set to select the best model among all epochs of training.
341
+
342
+ For the test set, the classifier or regressor is applied to each of the $n$ imputed objects and the predictions are combined. For regression problems we report R2-score of combined predictions, so we use averaging as a combination method. For classification problem we report accuracy, and therefore choose the mode. We consider the workflow where the imputed values of $y$ are not fed to the classifier or regressor to make a fair comparison of feature imputation quality.
343
+
344
+ Table 6: Generative Face Completion (Li et al., 2017) masks. Image size is 128x128.
345
+
346
+ <table><tr><td>Mask</td><td>Meaning</td><td>X1</td><td>x2</td><td>y1</td><td>y2</td></tr><tr><td>01</td><td>Left half of the face</td><td>33</td><td>70</td><td>52</td><td>115</td></tr><tr><td>02</td><td>Right half of the face</td><td>57</td><td>70</td><td>95</td><td>115</td></tr><tr><td>03</td><td>Two eyes</td><td>29</td><td>98</td><td>52</td><td>73</td></tr><tr><td>04</td><td>Left eye</td><td>29</td><td>66</td><td>52</td><td>73</td></tr><tr><td>05</td><td>Right eye</td><td>61</td><td>99</td><td>52</td><td>73</td></tr><tr><td>06</td><td>Lower half of the face</td><td>40</td><td>87</td><td>86</td><td>123</td></tr></table>
347
+
348
+ NRMSE or PFC for dataset is computed as an average of NRMSE or PFC of all features of this dataset. NRMSE of a feature is just RMSE of imputations divided by the standard deviation of this feature. PFC of a feature is a proportion of imputations which are incorrect.
349
+
350
+ # A.3 IMAGE INPAINTING DATASETS AND MASKS
351
+
352
+ MNIST is a dataset of 60000 train and 10000 test grayscale images of digits from 0 to 9 of size $2 8 \mathbf { x } 2 8$ . We binarize all images in the dataset. For MNIST we consider Bernoulli log-likelihood as the reconstruction loss: $\begin{array} { r } { \log p _ { \theta } ( x _ { b } | z , x _ { 1 - b } , b ) = \sum _ { i : b _ { i } = 1 } \log \mathrm { B e r n o u l l i } ( x _ { i } | p _ { \theta , i } ( z , x _ { 1 - b } , b ) ) } \end{array}$ where $p _ { \theta , i } ( z , x _ { 1 - b } , b )$ is an output of the generative neural network. We use 16 latent variables. In the mask for this dataset the observed pixels form a three pixels wide horizontal line which position is distributed uniformly.
353
+
354
+ Omniglot is a dataset of 19280 train and 13180 test black-and-white images of different alphabets symbols of size $1 0 5 \mathrm { x } 1 0 5$ . As in previous section, the brightness of each pixel is treated as a Bernoulli probability of it to be 1. The mask we use is a random rectangular which is described below. We use 64 latent variables. We train model for 50 epochs and choose best model according to IWAE log-likelihood estimation on the validation set after each epoch.
355
+
356
+ CelebA is a dataset of 162770 train, 19867 validation and 19962 test color images of faces of celebrities of size $1 7 8 \mathrm { x } 2 1 8$ . Before learning we normalize the channels in dataset. We use logarithm of fully-factorized Gaussian distribution as reconstruction loss. The mask we use is a random rectangular which is describe below. We use 32 latent variables.
357
+
358
+ Rectangular mask is the common shape of unobserved region in image inpainting. We use such mask for Omniglot and Celeba. We sample the corner points of rectangles uniprobably on the image, but reject those rectangles which area is less than a quarter of the image area.
359
+
360
+ In Li et al. (2017) six different masks O1–O6 are used on the testing stage. We reconstruct the positions of masks from the illustrations in the paper and give their coordinates in table 6. The visualizations of the masks are available in figure 10.
361
+
362
+ At the training stage we used a rectangle mask with uniprobable random corners. We reject masks with width or height less than 16pt. We use 64 latent variables and take the best model over 50 epochs based on the validation IWAE log-likelihood estimation. We can obtain slightly higher PSNR values than reported in table 4 if use only masks O1–O6 at the training stage.
363
+
364
+ In Yeh et al. (2017) four types of masks are used. Center mask is just an unobserved $3 2 \mathrm { x } 3 2 $ square in the center of 64x64 image. Half mask mean that one of upper, lower, left or right half of the image is unobserved. All these types of a half are equiprobable. Random mask means that we use pixelwise-independent Bernoulli distribution with probability 0.8 to form a mask of unobserved pixels. Pattern mask is proposed in Pathak et al. (2016). As we deduced from the code 3, the generation process is follows: firstly we generate $6 0 0 \times 6 0 0$ one-channel image with uniform distribution over pixels, then bicubically interpolate it to image of size $1 0 0 0 0 \mathrm { x } 1 0 0 0 0$ , and then apply Heaviside step function $H ( x - 0 . 2 5 )$ (i. e. all points with value less than 0.25 are considered as unobserved). To sample a mask we sample a random position in this $1 0 0 0 0 \mathrm { x } 1 0 0 0 0$ binary image and crop $6 4 \mathrm { x } 6 4$ mask. If less than $20 \%$ or more than $30 \%$ of pixel are unobserved, than the mask is rejected and the position is sampled again. In comparison with this paper in section 5.2 we use the same distribution over masks at training and testing stages. We use VAEAC with 64 latent variables and take the best model over 50 epochs based on the validation IWAE log-likelihood estimation.
365
+
366
+ # A.4 GAIN IMPLEMENTATION DETAILS
367
+
368
+ For missing feature imputation we reimplemented GAIN in PyTorch based on the paper (Yoon et al., 2018) and the available TensorFlow source code for image inpainting 4.
369
+
370
+ For categorical features we use one-hot encoding. We observe in experiments that it works better in terms of NRMSE and PFC than processing categorical features in GAIN as continuous ones and then rounding them to the nearest category.
371
+
372
+ For categorical features we also use reconstruction loss $\begin{array} { r } { L _ { M } ( x _ { i } , x _ { i } ^ { \prime } ) = - \frac { 1 } { | X _ { i } | } \sum _ { j = 1 } ^ { | X _ { i } | } x _ { i , j } \log ( x _ { i , j } ^ { \prime } ) } \end{array}$ $\left| X _ { i } \right|$ the number of categories of the $i$ -th feature, and $x _ { i , j }$ is the $j$ -th component of one-hot encoding of the feature $x _ { i }$ . Such $L _ { M }$ enforces equal contribution of each categorical feature into the whole reconstruction loss.
373
+
374
+ We use one more modification of $L _ { M } ( x , x ^ { \prime } )$ for binary and categorical features. Cross-entropy loss in $L _ { M }$ penalizes incorrect reconstructions of categorical and binary features much more than incorrect reconstructions for continuous ones. To avoid such imbalance we mixed L2 and cross-entropy reconstruction losses for binary and categorical features with weights 0.8 and 0.2 respectively:
375
+
376
+ We observe in experiments that this modification also works better in terms of NRMSE and PFC than the original model.
377
+
378
+ We use validation set which contains $5 \%$ of the observed features for the best model selection (hyperparameter is the number of iterations).
379
+
380
+ In the original GAIN paper authors propose to use cross-validation for hyper-parameter $\alpha \in \{ 0 . 1 , 0 . 5 , 1 , 2 , 1 0 \}$ . We observe that using $\alpha ~ = ~ 1 0$ and a hint $h \ = \ b \circ \ m \ + \ 0 . 5 ( 1 \ - \ b )$ where vector $b$ is sampled from Bernoulli distribution with $p = 0 . 0 1$ provides better results in terms of NRMSE and PFC than the original model with every $\alpha \in \{ 0 . 1 , 0 . 5 , 1 , 2 , 1 0 \}$ . Such hint distribution makes model theoretically inconsistent but works well in practice (see table 7).
381
+
382
+ Table 7 shows that our modifications provide consistently not worse or even better imputations than the original GAIN (in terms of NRMSE and PFC, on the considered datasets). So in this paper for the missing feature imputation problem we report the results of our modification of GAIN.
383
+
384
+ Table 7: NRMSE (for continuous datasets) or PFC (for categorical ones) of imputations for different GAIN modifications. Less is better. “Our modification” includes the reconstruction loss $L _ { M } ^ { \prime }$ (12), Bernoulli distribution over $b$ in the hint generation procedure, and fixed $\alpha = 1 0$ . Other columns refers original GAIN without these modifications and with different values of $\alpha$ .
385
+
386
+ <table><tr><td>Dataset</td><td>Our modification</td><td>α=10</td><td>α=2</td><td>α=1</td><td>α= 0.5</td><td>α=0.1</td></tr><tr><td>Boston</td><td>0.78±0.03</td><td>0.87±0.02</td><td>1.0 ± 0.1</td><td>1.0 ± 0.1</td><td>1.02 ± 0.05</td><td>1.6±0.2</td></tr><tr><td>Breast</td><td>0.67 ± 0.01</td><td>0.80±0.05</td><td>1.00 ± 0.05</td><td>1.10 ± 0.07</td><td>1.19 ± 0.05</td><td>1.52 ± 0.06</td></tr><tr><td>Concrete</td><td>0.96 ± 0.01</td><td>0.98 ± 0.02</td><td>1.02 ± 0.02</td><td>1.13 ± 0.06</td><td>1.17 ± 0.04</td><td>1.3 ± 0.1</td></tr><tr><td>Diabetes</td><td>0.911 ± 0.009</td><td>0.93 ±0.03</td><td>1.05 ± 0.04</td><td>1.07 ± 0.07</td><td>1.21 ± 0.07</td><td>1.6 ± 0.1</td></tr><tr><td>Digits</td><td>0.79 ± 0.02</td><td>0.88 ± 0.01</td><td>1.05 ± 0.02</td><td>1.13 ± 0.02</td><td>1.24 ± 0.08</td><td>1.4± 0.2</td></tr><tr><td>Glass</td><td>1.06 ± 0.05</td><td>1.04 ± 0.05</td><td>1.19 ± 0.06</td><td>1.4 ± 0.2</td><td>1.6 ± 0.1</td><td>1.81 ± 0.10</td></tr><tr><td>Iris</td><td>0.72 ±0.04</td><td>0.73±0.06</td><td>0.83 ±0.08</td><td>0.97 ± 0.09</td><td>1.2 ± 0.2</td><td>1.3±0.2</td></tr><tr><td>Mushroom</td><td>0.271 ± 0.003</td><td>0.404 ± 0.004</td><td>0.52 ± 0.05</td><td>0.55 ± 0.01</td><td>0.56 ± 0.03</td><td>0.64± 0.06</td></tr><tr><td>Orthopedic</td><td>0.91 ± 0.03</td><td>0.91 ±0.08</td><td>1.1 ± 0.1</td><td>1.2 ± 0.1</td><td>1.34 ± 0.08</td><td>1.6 ± 0.2</td></tr><tr><td>Phishing</td><td>0.427 ± 0.010</td><td>0.52 ±0.02</td><td>0.54±0.02</td><td>0.543 ± 0.010</td><td>0.56 ± 0.01</td><td>0.57 ± 0.04</td></tr><tr><td>WallRobot</td><td>0.907 ± 0.005</td><td>0.924± 0.005</td><td>0.933 ± 0.008</td><td>0.95 ± 0.01</td><td>1.00 ± 0.02</td><td>1.26 ± 0.04</td></tr><tr><td>WhiteWine</td><td>0.97±0.02</td><td>1.02 ± 0.04</td><td>1.2 ± 0.1</td><td>1.3 ± 0.1</td><td>1.6 ± 0.1</td><td>1.86 ± 0.08</td></tr><tr><td>Yeast</td><td>0.99 ±0.03</td><td>1.3±0.2</td><td>1.6 ± 0.1</td><td>1.83 ± 0.09</td><td>1.9 ±0.1</td><td>2.4± 0.4</td></tr><tr><td>Zoo</td><td>0.20 ±0.02</td><td>0.24± 0.05</td><td>0.35 ± 0.06</td><td>0.36 ± 0.03</td><td>0.43 ± 0.04</td><td>0.433 ± 0.004</td></tr></table>
387
+
388
+ # B THEORY
389
+
390
+ # B.1 VAEAC UNIVERSALITY
391
+
392
+ The theoretical guarantees that VAEAC can model arbitrary distribution are based on the same guarantees for Condtitional Variational Autoencoder (CVAE). We prove below that if CVAE can model each of the conditional distributions $p ( x _ { b } | x _ { 1 - b } )$ , then VAEAC can model all of them.
393
+
394
+ We can imagine $2 ^ { D }$ CVAEs learned each for the certain mask. Because neural networks are universal approximators, VAEAC networks could model the union of CVAE networks, so that VAEAC network performs transformation defined by the same network of the corresponding to the given mask CVAE.
395
+
396
+ $$
397
+ p _ { \psi , V A E A C } ( z | x _ { 1 - b } , b ) = p _ { \psi , C V A E , 1 - b } ( z | x _ { 1 - b } ) \forall x , b
398
+ $$
399
+
400
+ $$
401
+ p _ { \theta , V A E A C } ( x _ { b } | z , x _ { 1 - b } , b ) = p _ { \theta , C V A E , 1 - b } ( x _ { b } | z , x _ { 1 - b } ) \forall z , x , b
402
+ $$
403
+
404
+ So if CVAE models any distribution $p ( x | y )$ , VAEAC also do.
405
+
406
+ The guarantees for CVAE in the case of continuous variables are based on the point that every smooth distribution can be approximated with a large enough mixture of Gaussians, which is a special case of CVAE’s generative model. These guarantees can be extended on the case of categorical-continuous variables also. Actually, there are distributions over categorical variables which CVAE with Gaussian prior and proposal distributions cannot learn. Nevertheless, this kind of limitation is not fundamental and is caused by poor proposal distribution family.
407
+
408
+ # B.2 WHY VAEAC NEEDS TARGET VALUES FOR MISSING FEATURES IMPUTATION?
409
+
410
+ Consider a dataset with $D$ -dimensional objects $x$ where each feature may be missing (which we denote by $x _ { i } = \omega$ ) and their target values $y$ . In this section we show that the better results are achieved when our model learns the concatenation of objects features $x$ and targets $y$ . The example that shows the necessity of it is following. Consider a dataset where $x _ { 1 } = 1$ , $x _ { 2 } \sim \mathcal { N } ( \bar { x } _ { 2 } | y , 1 )$ , $p _ { d } ( y = \mathrm { { 0 } ) = { { p } ( y = 5 ) = 0 . 5 } }$ . In this case $p _ { d } ( x _ { 2 } | x _ { 1 } = 1 ) = 0 . 5 \mathcal { N } ( x _ { 2 } | 0 , 1 ) + 0 . 5 \mathcal { N } ( x _ { 2 } | 5 , 1 )$ . We can see that generating data from $p _ { d } ( x _ { 2 } | x _ { 1 } )$ may only confuse the classifier, because with probability 0.5 it generates $x _ { 2 } \sim \bar { \mathcal { N } } ( 0 , 1 )$ for $y = 5$ and $x _ { 2 } \sim \mathcal { N } ( 5 , 1 )$ for $y = 0$ . On the other hand, $p _ { d } ( x _ { 2 } | x _ { 1 } , y ) = \mathcal { N } ( x _ { 2 } | y , 1 )$ . Filling gaps using $p _ { d } ( x _ { 2 } | x _ { 1 } , y )$ may only improve classifier or regressor by giving it some information from the joint distribution $p _ { d } ( x , y )$ and thus simplifying the dependence to be learned at the training time. So we treat $y$ as an additional feature that is always unobserved during the testing time.
411
+
412
+ # B.3 UNIVERSAL MARGINALIZER: TRAINING PROCEDURE MODIFICATION
413
+
414
+ The problem authors did not address in the original paper is the relation between the distribution of unobserved components $p ( b )$ at the testing stage and the distribution of masks in the requests to UM ${ \hat { p } } ( b )$ . The distribution over masks $p ( b )$ induces the distribution ${ \hat { p } } ( b )$ , and in the most cases $p ( b ) \neq { \hat { p } } ( b )$ . The distribution ${ \hat { p } } ( b )$ also depends on the permutations $( i _ { 1 } , i _ { 2 } , \dots , i _ { | b | } )$ that we use to generate objects.
415
+
416
+ We observed in experiments, that UM must be trained using unobserved mask distribution ${ \hat { p } } ( b )$ . For example, if all masks from $p ( b )$ have a fixed number of unobserved components (e. g., $\begin{array} { l } { { \frac { D } { 2 } } } \end{array}$ ), then UM will never see an example of mask with $\begin{array} { r } { { 1 , 2 , \ldots , \frac { D } { 2 } - 1 } } \end{array}$ unobserved components, which is necessary to generate a sample conditioned on $\textstyle { \frac { D } { 2 } }$ components. That leads to drastically low likelihood estimate for the test set and unrealistic samples.
417
+
418
+ We developed an easy generative process for ${ \hat { p } } ( b )$ for arbitrary $p ( b )$ if the permutation of unobserved components $( i _ { 1 } , i _ { 2 } , \dots , i _ { | b | } )$ is chosen randomly and equiprobably: firstly we generate $b _ { 0 } \sim p ( b )$ , $u \sim U [ 0 , 1 ]$ , then $b _ { 1 } \sim ( \mathrm { B e r n o u l l i } ( u ) ) ^ { D }$ and $b = b _ { 0 } \circ b _ { 1 }$ . More complicated generative process exists for a sorted permutation where $i _ { j - 1 } < i _ { j } \forall j : 2 \le j \le | b |$ .
419
+
420
+ In experiments we use uniform distribution over the permutations.
421
+
422
+ # C GAUSSIAN STOCHASTIC NEURAL NETWORK
423
+
424
+ Gaussian stochastic neural network (13) and hybrid model (14) are originally proposed in the paper on Conditional VAE (Sohn et al., 2015). The motivation authors mention in the paper is as follows. During training the proposal distribution $q _ { \phi } ( z | x , y )$ is used to generate the latent variables $z$ , while during the testing stage the prior $p _ { \psi } ( z | y )$ is used. KL divergence tries to close the gap between two distributions but, according to authors, it is not enough. To overcome the issue authors propose to use a hybrid model (14), a weighted mixture of variational lower bound (3) and a single-sample Monte-Carlo estimation of log-likelihood (13). The model corresponding to the second term is called Gaussian Stochastic Neural Network (13), because it is a feed-forward neural network with a single Gaussian stochastic layer in the middle. Also GSNN is a special case of CVAE where $q _ { \phi } ( z | x , y ) = p _ { \psi } ( z | y )$ .
425
+
426
+ $$
427
+ \begin{array} { r } { L _ { G S N N } ( x , y ; \theta , \psi ) = \mathbb { E } _ { p _ { \psi } ( z | y ) } \log p _ { \theta } ( x | z , y ) \qquad } \\ { L ( x , y ; \theta , \psi , \phi ) = \alpha L _ { C V A E } ( x , y ; \theta , \psi , \phi ) + ( 1 - \alpha ) L _ { G S N N } ( x , y ; \theta , \psi ) , \quad \alpha \in [ 0 , 1 ] } \end{array}
428
+ $$
429
+
430
+ Authors report that hybrid model and GSNN outperform CVAE in terms of segmentation accuracy on the majority of datasets.
431
+
432
+ We can also add that this technique seems to soften the “holes problem” (Makhzani et al., 2016). In Makhzani et al. (2016) authors observe that vectors $z$ from prior distribution may be different enough from all vectors $z$ from the proposal distribution at the training stage, so the generator network may be confused at the testing stage. Due to this problem CVAE can have good reconstructions of $y$ given $z \sim q _ { \phi } ( z | x , y )$ , while samples of $y$ given $z \sim p _ { \psi } ( z | x )$ are not realistic.
433
+
434
+ The same trick is applicable to our model as well:
435
+
436
+ $$
437
+ \begin{array} { r l } & { L _ { G S N N } ( x , b ; \theta , \psi ) = \mathbb { E } _ { p _ { \psi } ( z | x _ { 1 - b } , b ) } \log p _ { \theta } ( x _ { b } | z , x _ { 1 - b } , b ) } \\ & { L ( x , b ; \theta , \psi , \phi ) = \alpha L _ { V A E A C } ( x , b ; \theta , \psi , \phi ) + ( 1 - \alpha ) L _ { G S N N } ( x , b ; \theta , \psi ) , \quad \alpha \in [ 0 , 1 ] } \end{array}
438
+ $$
439
+
440
+ In order to reflect the difference between sampling $z$ from prior and proposal distributions, authors of CVAE use two methods of log-likelihood estimation:
441
+
442
+ $$
443
+ \log p _ { \theta , \psi } ( x | y ) \approx \log \frac { 1 } { S } \sum _ { i = 1 } ^ { S } p _ { \theta } ( x | z _ { i } , y ) , ~ z _ { i } \sim p _ { \psi } ( z | y )
444
+ $$
445
+
446
+ $$
447
+ \log p _ { \theta , \psi } ( x | y ) \approx \log \frac { 1 } { S } \sum _ { i = 1 } ^ { S } \frac { p _ { \theta } ( x | z _ { i } , y ) p _ { \psi } ( z _ { i } | y ) } { q _ { \phi } ( z _ { i } | x , y ) } , ~ z _ { i } \sim q _ { \phi } ( z | x , y )
448
+ $$
449
+
450
+ The first estimator is called Monte-Carlo estimator and the second one is called Importance Sampling estimator (also known as IWAE). They are asymptotically equivalent, but in practice the Monte-Carlo estimator requires much more samples to obtain the same accuracy of estimation. Small $S$ leads to underestimation of the log-likelihood for both Monte-Carlo and Importance Sampling (Burda et al., 2015), but for Monte-Carlo the underestimation is expressed much stronger.
451
+
452
+ We perform an additional study of GSNN and hybrid model and show that they have drawbacks when the target distribution $p ( x | y )$ is has multiple different local maximums.
453
+
454
+ # C.1 THEORETICAL STUDY
455
+
456
+ In this section we show why GSNN cannot learn distributions with several different modes and leads to a blurry image samples.
457
+
458
+ For the simplicity of the notation we consider hybrid model for a standard VAE:
459
+
460
+ $$
461
+ L ( x ; \phi , \psi , \theta ) = \alpha \mathbb { E } _ { z \sim q _ { \phi } ( z \mid x ) } \log \frac { p _ { \theta } ( x \mid z ) p _ { \psi } ( z ) } { q _ { \phi } ( z \mid x ) } + ( 1 - \alpha ) \mathbb { E } _ { z \sim p _ { \psi } ( z ) } \log p _ { \theta } ( x \mid z )
462
+ $$
463
+
464
+ The hybrid model (16) for VAEAC can be obtained from (19) by replacing $x$ with $x _ { b }$ and conditioning all distributions on $x _ { 1 - b }$ and $b$ . The validity of the further equations and conclusions remains for VAEAC after this replacement.
465
+
466
+ Consider now a categorical latent variable $z$ which can take one of $K$ values. Let $x$ be a random variable witfor $p _ { d } ( x )$ to be modele some values following true data distribut. So the true distribution has n: d $\begin{array} { r } { p _ { d } ( x = x _ { i } ) = \frac { 1 } { K } } \end{array}$ $i \in \{ 1 , 2 , \ldots , K \}$ $x _ { 1 } , x _ { 2 } , \dotsc , x _ { K }$ $K$ able modes. Suppose the generator network $N N _ { \theta }$ which models mapping from $z$ to some vector of parameters $\begin{array} { r l r } { v _ { z } } & { { } = } & { \bar { N } N _ { \theta } ( z ) } \end{array}$ . Thus, we define generative distribution as some function of these parameters: $p _ { \theta } ( x | z ) \ : = \ : f ( x , v _ { z } )$ . Therefore, the parameters $\theta$ are just the set of $v _ { 1 } , v _ { 2 } , \dotsc , v _ { K }$ .
467
+
468
+ For the simplicity of the model we assume $\begin{array} { r } { p _ { \psi } ( z ) = \frac { 1 } { K } } \end{array}$ . Taking into account $\begin{array} { r } { p _ { \psi } ( z ) = \frac { 1 } { K } } \end{array}$ , we obtain optimal $\begin{array} { r } { q ( z = i | x ) = \frac { f ( x , v _ { i } ) } { \sum _ { j = 1 } ^ { K } f ( x , v _ { j } ) } } \end{array}$ Using (19) and the above formulas for $q _ { \phi } , p _ { \psi }$ and $p _ { \theta }$ we obtain the following optimization problem:
469
+
470
+ $$
471
+ \operatorname* { m a x } _ { v _ { 1 } , v _ { 2 } , \ldots , v _ { K } } \frac { 1 } { K } \sum _ { i = 1 } ^ { K } \left[ \alpha \sum _ { j = 1 } ^ { K } \frac { f ( x _ { i } , v _ { j } ) } { \sum _ { k = 1 } ^ { K } f ( x _ { i } , v _ { k } ) } \log \frac { f ( x _ { i } , v _ { j } ) \frac { 1 } { K } } { \frac { f ( x _ { i } , v _ { j } ) } { \sum _ { k = 1 } ^ { K } f ( x _ { i } , v _ { k } ) } } + ( 1 - \alpha ) \sum _ { j = 1 } ^ { K } \frac { 1 } { K } \log f ( x _ { i } , v _ { j } ) \right]
472
+ $$
473
+
474
+ Table 8: Negative log-likelihood estimation of a hybrid model on the synthetic data. IS- $S$ refers to Importance Sampling log-likelihood estimation with $S$ samples for each object (18). MC- $S$ refers to Monte-Carlo log-likelihood estimation with $S$ samples for each object (17).
475
+
476
+ <table><tr><td>VAEAC weight</td><td>IS-10</td><td>MC-10</td></tr><tr><td>a=1</td><td>0.22</td><td>85</td></tr><tr><td>α = 0.99</td><td>0.35</td><td>11</td></tr><tr><td>α = 0.9</td><td>0.62</td><td>1.7</td></tr></table>
477
+
478
+ It is easy to show that (20) is equivalent to the following optimization problem:
479
+
480
+ $$
481
+ \operatorname* { m a x } _ { v _ { 1 } , v _ { 2 } , \ldots , v _ { K } } \sum _ { i = 1 } ^ { K } \left[ \alpha \log \frac { \sum _ { j = 1 } ^ { K } f ( x _ { i } , v _ { j } ) } { K } + ( 1 - \alpha ) \sum _ { j = 1 } ^ { K } \frac { 1 } { K } \log f ( x _ { i } , v _ { j } ) \right]
482
+ $$
483
+
484
+ It is clear from (21) that when $\alpha = 1$ the log-likelihood of the initial model is optimized. On the other hand, when influe $\alpha = 0$ the optimal point is generative process, a $v _ { 1 } = v _ { 2 } = \cdots = v _ { K } = \operatorname { a r g m a x } _ { v } \sum _ { i = 1 } ^ { K } \log f ( x _ { i } , v ) .$ , i. e. mizes $z$ doesn’telihood $z$ $v$
485
+ estimation of the generative model $f ( x , v )$ for the given dataset of $x$ ’s. For Bernoulli and Gaussian generative distributions $f$ such $v$ is just average of all modes $x _ { 1 } , x _ { 2 } , \dotsc , x _ { K }$ . That explains why further we observe blurry images when using GSNN model.
486
+
487
+ The same conclusion holds for for continuous latent variables instead of categorical. Given $K$ different modes in true data distribution, VAE uses proposal network to separate prior distribution into $K$ components (i. e. regions in the latent space), so that each region corresponds to one mode. On the other hand, in GSNN $z$ is sampled independently on the mode which is to be reconstructed from it, so for each $z$ the generator have to produce parameters suitable for all modes.
488
+
489
+ From this point of view, there is no difference between VAE and VAEAC. If the true conditional distribution has several different modes, then VAEAC can fit them all, while GSNN learns their average. If true conditional distribution has one mode, GSNN and VAEAC are equal, and GSNN may even learn faster because it has less parameters.
490
+
491
+ Hybrid model is a trade-off between VAEAC and GSNN: the closer $\alpha$ to zero, the more blurry and closer to the average is the distribution of the model. The exact dependence of the model distribution on $\alpha$ can be derived analytically for the simple data distributions or evaluated experimentally. We perform such experimental evaluation in the next sections.
492
+
493
+ # C.2 SYNTHETIC DATA
494
+
495
+ In this section we show that VAEAC is capable of learning a complex multimodal distribution of synthetic
496
+ data while GSNN and hybrid model are not. Let $x \in \mathbb { R } ^ { \bar { 2 } }$ and $p ( \bar { b } _ { 1 } = 1 ) = p ( b _ { 2 } = 1 ) = 0 . 5$ . $p _ { d } ( x ) =$
497
+ $\begin{array} { r l } { \frac { 1 } { 8 } \sum _ { i = 1 } ^ { 8 } \mathcal { N } ( x | \mu _ { i } , \frac { 1 } { 1 0 } I ) } & { { } } \end{array}$ where s samp $\mu _ { i } \sim \mathcal N ( \mu _ { i } | 0 , I )$ . The distribution e use multi-layer p $p ( x )$ is plotted in figure 6. The datasetptron with four ReLU layers of size $p _ { d } ( x )$
498
+ 400-200-100-50, 25-dimensional Gaussian latent variables.
499
+
500
+ For different mixture coefficients $\alpha$ we visualize samples from the learned distributions $p _ { \psi , \theta } ( x _ { 1 } , x _ { 2 } )$ , $p _ { \psi , \theta } ( x _ { 1 } | x _ { 2 } )$ , and $p _ { \psi , \theta } ( x _ { 2 } | x _ { 1 } )$ . The observed features for the conditional distributions are generated from the marginal distributions $p ( x _ { 2 } )$ and $p ( x _ { 1 } )$ respectively.
501
+
502
+ We see in table 8 and in figure 7, that even with very small weight GSNN prevents model from learning distributions with several local optimas. GSNN also increases Monte-Carlo log-likelihood estimation with a few samples and decreases much more precise Importance Sampling log-likelihood estimation. When $\alpha = 0 . 9$ the whole distribution structure is lost.
503
+
504
+ ![](images/7407e71d027399c997ec577ddb914586b76471425f58bff6404a5cd035d567fc.jpg)
505
+ Figure 6: Probability density function of synthetic data distribution.
506
+
507
+ ![](images/a4bd4e815fbae18fb3e5afb3429dcbb43b07bb985c3a0166b18e1666e16f7080.jpg)
508
+ Figure 7: VAEAC for synthetic data.
509
+
510
+ ![](images/54463305da3093916463d301746c0407e7d8d2daa9a2e48291c407dc4d828109.jpg)
511
+ Figure 8: MNIST inpaintings. Left: input. The gray pixels are unobserved. Middle: samples from the model. Right: ground truth.
512
+
513
+ We see that using $\alpha \neq 1$ ruins multimodality of the restored distribution, so we highly recommend to use $\alpha = 1$ or at least $\alpha \approx 1$ .
514
+
515
+ Table 9: Average negative log-likelihood of inpaintings for 1000 objects. IS- $S$ refers to Importance Sampling log-likelihood estimation with $S$ samples for each object (18). MC- $S$ refers to Monte-Carlo log-likelihood estimation with $S$ samples for each object (17). Naive Bayes is a baseline method which assumes pixels and colors independence.
516
+
517
+ <table><tr><td>Method</td><td>MNIST</td><td>Omniglot</td><td>CelebA</td></tr><tr><td>VAEAC IS-102</td><td>61±1</td><td>275±17</td><td>34035 ± 1609</td></tr><tr><td>VAEAC MC-104</td><td>94±4</td><td>1452 ± 109</td><td>41513 ± 2163</td></tr><tr><td>VAEAC MC-102</td><td>156 ±1</td><td>2203 ± 150</td><td>53904 ± 3121</td></tr><tr><td>GSNN MC-104</td><td>141 ±7</td><td>1199 ± 62</td><td>53427 ± 2208</td></tr><tr><td>GSNN MC-10²</td><td>141 ±1</td><td>1200 ± 62</td><td>53486 ± 2210</td></tr><tr><td>Naive Bayes</td><td>205</td><td>2490</td><td>269480</td></tr></table>
518
+
519
+ ![](images/3126337f9f6dd982a9196015b6247be9dab5083bb45c2e9eb0945400c4c56f31.jpg)
520
+ Figure 9: Convergence of VAE and VAEAC on MNIST dataset.
521
+
522
+ C.3 COMPARISON ON THE IMAGE INPAINTING PROBLEM
523
+
524
+ In figure 8 we can see that the inpaintings produced by GSNN are smooth, blurry and not diverse compared with VAEAC.
525
+
526
+ Table 9 shows that VAEAC learns distribution over inpaintings better than GSNN in terms of test loglikelihood. Nevertheless, Monte-Carlo estimations with a small number of samples sometimes are better for GSNN, which means less local modes in the learned distribution and more blurriness in the samples.
527
+
528
+ # D ADDITIONAL EXPERIMENTS
529
+
530
+ # D.1 CONVERGENCE SPEED
531
+
532
+ In figure 9 one can see that VAEAC has similar convergence speed to VAE in terms of iterations on MNIST dataset. In our experiments we observed the same behaviour for other datasets. Each iteration of VAEAC is about 1.5 times slower than VAE due to usage of three networks instead of two.
533
+
534
+ Table 10: NRMSE (for continuous datasets) or PFC (for categorical ones) of imputations. Less is better.
535
+
536
+ <table><tr><td>Dataset</td><td>MICE</td><td>MissForest</td><td>GAIN</td><td>VAEAC</td><td>GSNN</td><td>NN</td></tr><tr><td>Boston</td><td>0.69 ± 0.02</td><td>0.58±0.02</td><td>0.78 ± 0.03</td><td>0.71 ± 0.02</td><td>0.70 ± 0.01</td><td>0.69 ± 0.01</td></tr><tr><td>Breast</td><td>0.58 ±0.02</td><td>0.515 ± 0.008</td><td>0.67 ±0.01</td><td>0.55±0.02</td><td>0.55 ± 0.02</td><td>0.52 ±0.02</td></tr><tr><td>Concrete</td><td>0.850 ± 0.007</td><td>0.78 ± 0.01</td><td>0.96 ±0.01</td><td>0.84 ±0.02</td><td>0.85 ± 0.01</td><td>2±3</td></tr><tr><td>Diabetes</td><td>0.80 ±0.01</td><td>0.84±0.02</td><td>0.911 ± 0.009</td><td>0.90 ±0.03</td><td>0.91 ± 0.03</td><td>0.90 ±0.02</td></tr><tr><td>Digits</td><td>0.69 ±0.02</td><td>0.61± 0.02</td><td>0.79±0.02</td><td>0.69 ±0.02</td><td>0.69 ± 0.02</td><td>0.67 ±0.02</td></tr><tr><td>Glass</td><td>0.91 ±0.02</td><td>0.83± 0.04</td><td>1.06 ±0.05</td><td>0.91 ±0.04</td><td>0.91 ± 0.05</td><td>0.87 ± 0.04</td></tr><tr><td>Iris</td><td>0.59 ± 0.02</td><td>0.62 ± 0.04</td><td>0.72 ± 0.04</td><td>0.64± 0.04</td><td>0.62 ± 0.04</td><td>0.61± 0.02</td></tr><tr><td>Mushroom</td><td>0.334 ± 0.002</td><td>0.249 ±0.006</td><td>0.271 ±0.003</td><td>0.241 ± 0.002</td><td>0.2412 ± 0.0009</td><td>0.239 ± 0.001</td></tr><tr><td>Orthopedic</td><td>0.76 ±0.02</td><td>0.79±0.03</td><td>0.91±0.03</td><td>0.80±0.03</td><td>0.81 ±0.03</td><td>0.81 ±0.02</td></tr><tr><td>Phishing</td><td>0.422 ± 0.006</td><td>0.422 ±0.009</td><td>0.427 ± 0.010</td><td>0.397 ± 0.010</td><td>0.392 ±0.009</td><td>0.41 ± 0.01</td></tr><tr><td>WallRobot</td><td>0.885 ± 0.003</td><td>0.640 ± 0.003</td><td>0.907 ± 0.005</td><td>0.78 ±0.01</td><td>0.776 ±0.007</td><td>0.757± 0.005</td></tr><tr><td>WhiteWine</td><td>0.964 ± 0.007</td><td>0.878 ±0.009</td><td>0.97 ± 0.02</td><td>0.850 ± 0.005</td><td>0.848 ± 0.007</td><td>0.85 ± 0.01</td></tr><tr><td>Yeast</td><td>0.98±0.02</td><td>1.00 ± 0.02</td><td>0.99 ±0.03</td><td>0.95 ± 0.01</td><td>0.958 ± 0.007</td><td>0.97 ± 0.03</td></tr><tr><td>Zoo</td><td>0.19 ± 0.03</td><td>0.16 ±0.02</td><td>0.20 ±0.02</td><td>0.16±0.02</td><td>0.17 ±0.02</td><td>0.16 ±0.01</td></tr></table>
537
+
538
+ Table 11: R2-score (for continuous targets) or accuracy (for categorical ones) of post-imputation regression or classification. Higher is better.
539
+
540
+ <table><tr><td>Dataset</td><td>MICE</td><td>MissForest</td><td>GAIN</td><td>VAEAC</td><td>GSNN</td><td>NN</td></tr><tr><td>Boston</td><td>0.57 ± 0.08</td><td>0.6 ± 0.1</td><td>0.50 ± 0.10</td><td>0.5 ± 0.1</td><td>0.5± 0.1</td><td>0.50±0.09</td></tr><tr><td>Breast</td><td>0.96 ± 0.02</td><td>0.95 ± 0.02</td><td>0.94± 0.01</td><td>0.95 ± 0.02</td><td>0.96 ± 0.02</td><td>0.95 ± 0.02</td></tr><tr><td>Concrete</td><td>0.35 ± 0.05</td><td>0.33 ± 0.04</td><td>0.28±0.06</td><td>0.30 ± 0.08</td><td>0.32 ± 0.05</td><td>0±1</td></tr><tr><td>Diabetes</td><td>0.37 ± 0.06</td><td>0.34±0.06</td><td>0.34±0.03</td><td>0.34± 0.04</td><td>0.33 ±0.04</td><td>0.27±0.06</td></tr><tr><td>Digits</td><td>0.86±0.02</td><td>0.887 ±0.008</td><td>0.83 ±0.03</td><td>0.892 ± 0.010</td><td>0.895 ± 0.010</td><td>0.912 ± 0.010</td></tr><tr><td>Glass</td><td>0.44 ±0.08</td><td>0.53 ±0.05</td><td>0.37±0.05</td><td>0.49 ±0.09</td><td>0.47 ±0.09</td><td>0.48 ±0.09</td></tr><tr><td>Iris</td><td>0.81± 0.02</td><td>0.84±0.02</td><td>0.66 ±0.06</td><td>0.84±0.05</td><td>0.82±0.06</td><td>0.73±0.09</td></tr><tr><td>Mushroom</td><td>0.92 ±0.01</td><td>0.972 ± 0.003</td><td>0.969 ± 0.005</td><td>0.987 ± 0.001</td><td>0.986 ± 0.002</td><td>0.989 ± 0.003</td></tr><tr><td>Orthopedic</td><td>0.71 ± 0.02</td><td>0.72 ± 0.03</td><td>0.60±0.03</td><td>0.71 ±0.02</td><td>0.70± 0.04</td><td>0.61±0.04</td></tr><tr><td>Phishing</td><td>0.75 ± 0.02</td><td>0.73±0.03</td><td>0.74± 0.03</td><td>0.75 ± 0.01</td><td>0.74±0.04</td><td>0.73±0.02</td></tr><tr><td>WallRobot</td><td>0.55 ±0.01</td><td>0.697 ± 0.005</td><td>0.56 ±0.01</td><td>0.62±0.02</td><td>0.62 ± 0.01</td><td>0.64±0.02</td></tr><tr><td>WhiteWine</td><td>0.13 ± 0.02</td><td>0.17 ± 0.01</td><td>0.11± 0.01</td><td>0.18 ±0.02</td><td>0.17 ± 0.01</td><td>0.15 ± 0.03</td></tr><tr><td>Yeast</td><td>0.42 ±0.02</td><td>0.41 ±0.02</td><td>0.39 ±0.06</td><td>0.42 ± 0.01</td><td>0.425 ± 0.010</td><td>0.33±0.03</td></tr><tr><td>Zoo</td><td>0.78 ± 0.06</td><td>0.71 ±0.08</td><td>0.67±0.06</td><td>0.77 ± 0.09</td><td>0.8±0.1</td><td>0.83 ± 0.08</td></tr></table>
541
+
542
+ # D.2 MISSING FEATURES IMPUTATION
543
+
544
+ We evaluate the quality of imputations on different datasets (mostly from UCI (Lichman, 2013)). The evaluation is performed for VAEAC, GSNN (15) and NN (neural network; can be considered as a special case of GSNN where $p _ { \theta } ( z | x _ { 1 - b } , b )$ is delta-function; produces single imputation). We compare these methods with MICE (Buuren & Groothuis-Oudshoorn, 2010), MissForest (Stekhoven & Buhlmann, 2011), and GAIN ¨ (Yoon et al., 2018).
545
+
546
+ We see that for some datasets MICE and MissForest outperform VAEAC, GSNN and NN. The reason is that for some datasets random forest is more natural structure than neural network.
547
+
548
+ The results also show that VAEAC, GSNN and NN show similar imputation performance in terms of NRMSE, PFC, post-imputation R2-score and accuracy. Given the result from appendix C we can take this as a weak evidence that the distribution of imputations has only one local maximum for datasets from (Lichman, 2013).
549
+
550
+ ![](images/21041c7b3c7fc1baa4707c17e3944ec8fc55aadb337ff273f13ec39db52954c7.jpg)
551
+ Figure 10: CelebA inpaintings with masks from (Li et al., 2017). ft: input. The gray pixels are unobserved. Middle: samples from VAEAC. Right: ground truth.
552
+
553
+ # D.3 FACE INPAINTINGS
554
+
555
+ In figure 10 we provide samples of VAEAC on the CelebA dataset for the masks from (Li et al., 2017).
556
+
557
+ # D.4 GAIN FOR IMAGE INPAINTING
558
+
559
+ GAIN (Yoon et al., 2018) doesnt use unobserved data during training, which makes it easier to apply to the missing features imputation problem. Nevertheless, it turns into a disadvantage when the fully-observed training data is available but the missingness rate at the testing stage is high.
560
+
561
+ We consider the horizontal line mask for MNIST which is described in appendix A.3. We use the released GAIN code 5 with a different mask generator. The inpaintings from VAEAC which uses the unobserved pixels during training are available in figure 1. The inpaintings from GAIN which ignores unobserved pixels are provided in figure 11. As can be seen in figure 11, GAIN fails to learn conditional distribution for given mask distribution ${ \dot { p } } ( b )$ .
562
+
563
+ Nevertheless, we don’t claim that GAIN is not suitable for image inpainting. As it was shown in the supplementary of (Yoon et al., 2018) and in the corresponding code, GAIN is able to learn conditional distributions when $p ( b )$ is pixel-wise independent Bernoulli distribution with probability 0.5.
564
+
565
+ ![](images/77978a748fdfece774bbdba6a454e4caa9d264c220caf33b0d01dfee4003f59b.jpg)
566
+ Figure 11: MNIST inpaintings from GAIN.
567
+
568
+ Left: input. The gray pixels are unobserved. Middle: samples from the model. Right: ground truth.
569
+
570
+ ![](images/3addba9b5d9e7527dc59c64b67c88b55ee2d758e97d2f9f04dcf482aada3e5b6.jpg)
571
+ Figure 12: MNIST inpaintings. Left: input. The gray pixels are unobserved. Middle: samples from the model. Right: ground truth.
572
+
573
+ # D.5 UNIVERSAL MARGINALIZER: ILLUSTRATIONS
574
+
575
+ In figure 12 we provide samples of Universal Marginalizer (UM) and VAEAC for the same inputs.
576
+
577
+ Consider the case when UM marginal distributions are parametrized with Gaussians. The most simple example of a distribution, which UM cannot learn but VAEAC can, is given in figure 13.
578
+
579
+ ![](images/34b2efedea65ec8dd1cd6662835f9b38b5a648676328c4f707b65cec76fc2de2.jpg)
580
+ Figure 13: Distribution learning: VAEAC vs UM.
md/train/UVH3Ucewd-IXZ/UVH3Ucewd-IXZ.md ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Deep learning for neuroimaging: a validation study
2
+
3
+ Sergey M. Plis The Mind Research Network Albuquerque, NM 87106 s.m.plis@gmail.com
4
+
5
+ Devon R. Hjelm
6
+ University of New Mexico
7
+ Albuquerque, NM 87131
8
+ dhjelm@mrn.org
9
+
10
+ Ruslan Salakhutdinov University of Toronto Toronto, Ontario M5S 2E4 rsalakhu@cs.toronto.edu
11
+
12
+ Vince D. Calhoun The Mind Research Network Albuquerque, NM 87106 vcalhoun@mrn.org
13
+
14
+ # Abstract
15
+
16
+ Deep learning methods have recently made notable advances in the tasks of classification and representation learning. These tasks are important for brain imaging and neuroscience discovery, making the methods attractive for porting to a neuroimager’s toolbox. Success of these methods is, in part, explained by the flexibility of deep learning models. However, this flexibility makes the process of porting to new areas a difficult parameter optimization problem. In this work we demonstrate our results (and feasible parameter ranges) in application of deep learning methods to structural and functional brain imaging data. We also describe a novel constraint-based approach to visualizing high dimensional data. We use it to ana- lyze the effect of parameter choices on data transformations. Our results show that deep learning methods are able to learn physiologically important representations and detect latent relations in neuroimaging data.
17
+
18
+ # 1 Introduction
19
+
20
+ One of the main goals of brain imaging and neuroscience—and, possibly, of most natural sciences— is to improve understanding of the investigated system based on data. In our case, this amounts to inference of descriptive features of brain structure and function from non-invasive measurements. Brain imaging field has come a long way from anatomical maps and atlases towards data driven feature learning methods, such as seed-based correlation [2], canonical correlation analysis [33], and independent component analysis (ICA) [1, 24]. These methods are highly successful in revealing known brain features with new details [3] (supporting their credibility), in recovering features that differentiate patients and controls [28] (assisting diagnosis and disease understanding), and starting a “resting state” revolution after revealing consistent patters in data from uncontrolled resting experiments [29, 35]. Classification is often used merely as a correctness checking tool, as the main emphasis is on learning about the brain. A perfect oracle that does not explain its conclusions would be useful, but mainly to facilitate the inference of the ways the oracle draws these conclusions.
21
+
22
+ As an oracle, deep learning methods are breaking records taken over the areas of speech, signal, image, video and text mining and recognition by improving state of the art classification accuracy by, sometimes, more than $30 \%$ where the prior decade struggled to obtain a $1 \%$ improvements [19, 21]. What differentiates them from other classifiers, however, is the automatic feature learning from data which largely contributes to improvements in accuracy. Presently, this seems to be the closest solution to an oracle that reveals its methods — a desirable tool for brain imaging.
23
+
24
+ Another distinguishing feature of deep learning is the depth of the models. Based on already acceptable feature learning results obtained by shallow models—currently dominating neuroimaging field—it is not immediately clear what benefits would depth have. Considering the state of multimodal learning, where models are either assumed to be the same for analyzed modalities [26] or cross-modal relations are sought at the (shallow) level of mixture coefficients [23], deeper models better fit the intuitive notion of cross-modality relations, as, for example, relations between genetics and phenotypes should be indirect, happening at a deeper conceptual level.
25
+
26
+ In this work we present our recent advances in application of deep learning methods to functional and structural magnetic resonance imaging (fMRI and sMRI). Each consists of brain volumes but for sMRI these are static volumes—one per subject/session,—while for fMRI a single subject dataset is comprised of multiple volumes capturing the changes during an experimental session. Our goal is to validate feasibility of this application by $a$ ) investigating if a building block of deep generative models—a restricted Boltzmann machine (RBM) [17]—is competitive with ICA (a representative model of its class) (Section 2); $b$ ) examining the effect of the depth in deep learning analysis of structural MRI data (Section 3.3); and $c$ ) determining the value of the methods for discovery of latent structure of a large-scale (by neuroimaging standards) dataset (Section 3.4). The measure of feature learning performance in a shallow model (a) is comparable with existing methods and known brain physiology. However, this measure cannot be used when deeper models are investigated. As we further demonstrate, classification accuracy does not provide the complete picture either. To be able to visualize the effect of depth and gain an insight into the learning process, we introduce a flexible constraint satisfaction embedding method that allows us to control the complexity of the constraints (Section 3.2). Deliberately choosing local constraints we are able to reflect the transformations that the deep belief network (DBN) [15] learns and applies to the data and gain additional insight.
27
+
28
+ # 2 A shallow belief network for feature learning
29
+
30
+ Prior to investigating the benefits of depth of a DBN in learning representations from fMRI and sMRI data, we would like to find out if a shallow (single hidden layer) model–which is the RBM— from this family meets the field’s expectations. As mentioned in the introduction, a number of methods are used for feature learning from neuroimaging data: most of them belong to the single matrix factorization (SMF) class. We do a quick comparison to a small subset of SMF methods on simulated data; and continue with a more extensive comparison against ICA as an approach trusted in the neuroimaging field. Similarly to RBM, ICA relies on the bipartite graph structure, or even is an artificial neural network with sigmoid hidden units as is in the case of Infomax ICA [1] that we compare against. Note the difference with RBM: ICA applies its weight matrix to the (shorter) temporal dimension of the data imposing independence on the spatial dimension while RBM applies its weight matrix (hidden units “receptive fields”) to the high dimensional spatial dimension instead (Figure 2).
31
+
32
+ # 2.1 A restricted Boltzmann machine
33
+
34
+ A restricted Boltzmann machine (RBM) is a Markov random field that models data distribution parameterizing it with the Gibbs distribution over a bipartite graph between visible $\pmb { v }$ and hidden variables $^ { h }$ [10]: $\begin{array} { r } { p ( \pmb { v } ) = \sum _ { \pmb { h } } p ( \pmb { v } , \pmb { h } ) = \sum _ { \pmb { h } } 1 / Z \exp ( - E ( \pmb { v } , \pmb { h } ) ) } \end{array}$ , where $\begin{array} { r } { Z = \sum v \sum _ { h } e ^ { - E ( { \pmb v } , { \pmb h } ) } } \end{array}$ is the normalization term (the partition function) and $E ( v , h )$ is the energy of the system. Each visible variable in the case of fMRI data represents a voxel of an fMRI scan with a real-valued and approximately Gaussian distribution. In this case, the energy is defined as:
35
+
36
+ $$
37
+ E ( v , h ) = - \sum _ { i j } \frac { v _ { j } } { \sigma _ { j } } W _ { j i } h _ { i } - \sum _ { j } \frac { ( a _ { j } - v _ { j } ) ^ { 2 } } { \sigma _ { j } ^ { 2 } } - \sum _ { i } b _ { i } h _ { i } ,
38
+ $$
39
+
40
+ where $a _ { j }$ and $b _ { j }$ are biases and $\sigma _ { j }$ is the standard deviation of a parabolic containment function for each visible variable $v _ { j }$ centered on the bias $a _ { j }$ . In general, the parameters $\sigma _ { i }$ need to be learned along with the other parameters. However, in practice normalizing the distribution of each voxel to have zero mean and unit variance is faster and yet effective [27]. A number of choices affect the quality of interpretation of the representations learned from fMRI by an RBM. Encouraging sparse features via the $L _ { 1 }$ -regularization: $\lambda \| W \| _ { 1 }$ ( $\lambda = 0 . 1$ gave best results) and using hyperbolic tangent for hidden units non-linearity are essential settings that respectively facilitate spatial and temporal interpretation of the result. The weights were updated using the truncated Gibbs sampling method called contrastive divergence (CD) with a single sampling step (CD-1). Further information on RBM model can be found in [16, 17].
41
+
42
+ # 2.2 Synthetic data
43
+
44
+ ![](images/03e5dc7c4b4fc13894498eac8e135ded37c71d1069aa60fab7dab98ab2c17ad8.jpg)
45
+
46
+ a: Average spatial map (SM) and time course (TC) correlations to ground truth for RBM and SMF models (gray box).
47
+
48
+ b: Ground truth (GT) SMs and estimates obtained by RBM and ICA (thresholded at 0.4 height). Colors are consistent across the methods. Grey indicates background or areas without SMs above threshold.
49
+
50
+ c: Spatial, temporal, and cross correlation (FNC) accuracy for ICA (red) and RBM (blue), as a function of spatial overlap of the true sources from 1b. Lines indicate the average correlation to GT, and the color-fill indicates $\pm 2$ standard errors around the mean.
51
+
52
+ Figure 1: Comparison of RBM estimation accuracy of features and their time courses with SMFs.
53
+
54
+ In this section we summarize our comparisons of RBM with SMF models—including Infomax ICA [1], PCA [14], sparse PCA (sPCA) [37], and sparse NMF (sNMF) [18]—on synthetic data with known spatial maps generated to simulate fMRI.
55
+
56
+ Figure 1a shows the correlation of spatial maps (SM) and time course (TC) estimates to the ground truth for RBM, ICA, PCA, sPCA, and sNMF. Correlations are averaged across all sources and datasets. RBM and ICA showed the best overall performance. While sNMF also estimated SMs well, it showed inferior performance on TC estimation, likely due to the non-negativity constraint. Based on these results and the broad adoption of ICA in the field, we focus on comparing Infomax ICA and RBM.
57
+
58
+ Figure 1b shows the full set of ground truth sources along with RBM and ICA estimates for a single representative dataset. SMs are thresholded and represented as contours for visualization. Results over all synthetic datasets showed similar performance for RBM and ICA (Figure 1c), with a slight advantage for ICA with regard to SM estimation, and a slight advantage for RBM with regards to TC estimation. RBM and ICA also showed comparable performance estimating cross correlations also called functional network connectivity (FNC).
59
+
60
+ # 2.3 An fMRI data application
61
+
62
+ ![](images/a669dc66ad09d2234094b6f0a2361707082acab0f3b05effb83465e7d44334c7.jpg)
63
+ Figure 2: The processes of feature learning and time course computation from fMRI data by an RBM. The visible units are voxels and a hidden unit receptive field covers an fMRI volume.
64
+
65
+ Data used in this work comprised of task-related scans from 28 (five females) healthy participants, all of whom gave written, informed, IRB-approved consent at Hartford Hospital and were compensated for participation1. All participants were scanned during an auditory oddball task (AOD) involving the detection of an infrequent target sound within a series of standard and novel sounds2.
66
+
67
+ Scans were acquired at the Olin Neuropsychiatry Research Center at the Institute of Living/Hartford Hospital on a Siemens Allegra 3T dedicated head scanner equipped with $4 0 \mathrm { m T } / \mathrm { m }$ gradients and a standard quadrature head coil [4, 9]. The AOD consisted of two 8-min runs, and 249 scans (volumes) at 2 second TR $0 . 5 \ \mathrm { H z }$ sampling rate) were used for the final dataset. Data were post-processed using the SPM5 software package [12], motion corrected using INRIalign [11], and subsampled to $5 3 \times 6 3 \times 4 6$ voxels. The complete fMRI dataset was masked below mean and the mean image across the dataset was removed, giving a complete dataset of size 70969 voxels by 6972 volumes. Each voxel was then normalized to have zero mean and unit variance.
68
+
69
+ The RBM was constructed using 70969 Gaussian visible units and 64 hyperbolic tangent hidden units. The hyper parameters $\epsilon$ (0.08 from the searched $[ 1 \times 1 0 ^ { - 4 } , 1 \times 1 \dot { 0 } ^ { - 1 } ]$ range) for learning rate and $\lambda$ (0.1 from the searched range $[ 1 \times \mathrm { { 1 0 ^ { - 2 } , 1 \times 1 0 ^ { - 1 } } } ] )$ for $L _ { 1 }$ weight decay were selected as those that showed a reduction of reconstruction error over training and a significant reduction in span of the receptive fields respectively. Parameter value outside the ranges either resulted in unstable or slow learning () or uninterpretable features $( \lambda )$ . The RBM was then trained with a batch size of 5 for approximately 100 epochs to allow for full convergence of the parameters.
70
+
71
+ ![](images/70ccc1f25a64c86a603394c7ffb5b0be3ebecdbb876b304f5e099240f7dd66be.jpg)
72
+ Figure 3: Intrinsic brain networks estimated by ICA and RBM.
73
+
74
+ After flipping the sign of negative receptive fields, we then identified and labeled spatially distinct features as corresponding to brain regions with the aid of AFNI [5] excluding features which had a high probability of corresponding to white matter, ventricles, or artifacts (eg. motion, edges).
75
+
76
+ We normalized the fMRI volume time series to mean zero and used the trained RBM in feed-forward mode to compute time series for each fMRI feature. This was done to better compare to ICA, where the mean is removed in PCA preprocessing.
77
+
78
+ The work-flow is outlined in Figure 2, while Figure 3 shows comparison of resulting features with those obtained by Infomax ICA. In general, RBM performs competitively with ICA, while providing–perhaps, not surprisingly due to the used $L _ { 1 }$ regularization—sharper and more localized features. While we recognize that this is a subjective measure we list more features in Figure S2 of Section 5 and note that RBM features lack negative parts for corresponding features. Note, that in the case of $L _ { 1 }$ regularized weights RBM algorithms starts to resemble some of the ICA approaches (such as the recent RICA by Le at al. [20]), which may explain the similar performance. However, the differences and possible advantages are the generative nature of the RBM and no enforcement of component orthogonality (not explicit at the least). Moreover, the block structure of the correlation matrix (see below the Supplementary material section) of feature time courses provide a grouping that is more physiologically supported than that provided by ICA. For example, see Figure S1 in the supplementary material section below. Perhaps, because ICA working hard to enforce spatial independence subtly affects the time courses and their cross-correlations in turn. We have observed comparable running times of the (non GPU) ICA (http://www.nitrc.org/projects/gift) and a GPU implementation of the RBM (https://github.com/nitishsrivastava/deepnet).
79
+
80
+ # 3 Validating the depth effect
81
+
82
+ Since the RBM results demonstrate a feature-learning performance competitive with the state of the art (or better), we proceed to investigating the effects of the model depth. To do that we turn from fMRI to sMRI data. As it is commonly assumed in the deep learning literature [22] the depth is often improving classification accuracy. We investigate if that is indeed true in the sMRI case. Structural data is convenient for the purpose as each subject/session is represented only by a single volume that has a label: control or patient in our case. Compare to 4D data where hundreds of volumes belong to the same subject with the same disease state.
83
+
84
+ # 3.1 A deep belief network
85
+
86
+ A DBN is a sigmoidal belief network (although other activation functions may be used) with an RBM as the top level prior. The joint probability distribution of its visible and hidden units is
87
+
88
+ parametrized as follows:
89
+
90
+ $$
91
+ P ( v , h ^ { 1 } , h ^ { 2 } , \dots , h ^ { l } ) = P ( v | h ^ { 1 } ) P ( h ^ { 1 } | h ^ { 2 } ) \cdots P ( h ^ { l - 2 } , h ^ { l - 1 } ) P ( h ^ { l - 1 } , h ^ { l } ) ,
92
+ $$
93
+
94
+ where $l$ is the number of hidden layers, $P ( h ^ { l - 1 } , h ^ { l } )$ is an RBM, and $P ( h ^ { i } | h ^ { i + 1 } )$ factor into individual conditionals:
95
+
96
+ $$
97
+ P ( h ^ { i } | h ^ { i + 1 } ) = \prod _ { j = 1 } ^ { n _ { i } } P ( h _ { j } ^ { i } | h ^ { i + 1 } )
98
+ $$
99
+
100
+ The important property of DBN for our goals of feature learning to facilitate discovery is its ability to operate in generative mode with fixed values on chosen hidden units thus allowing one to investigate the features that the model have learned and/or weighs as important in discriminative decisions. We, however, not going to use this property in this section, focusing instead on validating the claim that a network’s depth provides benefits for neuroimaging data analysis. And we will do this using discriminative mode of DBN’s operation as it provides an objective measure of the depth effect.
101
+
102
+ DBN training splits into two stages: pre-training and discriminative fine tuning. A DBN can be pre-trained by treating each of its layers as an RBM—trained in an unsupervised way on inputs from the previous layer—and later fine-tuned by treating it as a feed-forward neural network. The latter allows supervised training via the error back propagation algorithm. We use this schema in the following by augmenting each DBN with a soft-max layer at the fine-tuning stage.
103
+
104
+ # 3.2 Nonlinear embedding as a constraint satisfaction problem
105
+
106
+ A DBN and an RBM operate on data samples, which are brain volumes in the fMRI and sMRI case. A five-minute fMRI experiment with 2 seconds sampling rate yields 150 of these volumes per subject. For sMRI studies number of participating subjects varies but in this paper we operate with a 300 and a 3500 subject-volumes datasets. Transformations learned by deep learning methods do not look intuitive in the hidden node space and generative sampling of the trained model does not provide a sense if a model have learned anything useful in the case of MRI data: in contrast to natural images, fMRI and sMRI images do not look very intuitive. Instead, we use a nonlinear embedding method to control whether a model learned useful information and to assist in investigation of what have it, in fact, learned.
107
+
108
+ One of the purposes of an embedding is to display a complex high dimensional dataset in a way that is $i$ ) intuitive, and $\Ddot { u }$ ) representative of the data sample. The first requirement usually leads to displaying data samples as points in a 2-dimensional map, while the second is more elusive and each approach addresses it differently. Embedding approaches include relatively simple random linear projections—provably preserving some neighbor relations [6]—and a more complex class of nonlinear embedding approaches [30, 32, 34, 36]. In an attempt to organize the properties of this diverse family we have aimed at representing nonlinear embedding methods under a single constraint satisfaction problem (CSP) framework (see below). We hypothesize that each method places the samples in a map to satisfy a specific set of constraints. Although this work is not yet complete, it proven useful in our current study. We briefly outline the ideas in this section to provide enough intuition of the method that we further use in Section 3.
109
+
110
+ Since we can control the constraints in the CSP framework, to study the effect of deep learning we choose them to do the least amount of work—while still being useful—letting the DBN do (or not) the hard part. A more complicated method such as t-SNE [36] already does complex processing to preserve the structure of a dataset in a 2D map – it is hard to infer if the quality of the map is determined by a deep learning method or the embedding. While some of the existing method may have provided the “least amount of work” solutions as well we chose to go with the CSP framework. It explicitly states the constraints that are being satisfied and thus lets us reason about deep learning effects within the constraints, while with other methods—where the constraints are implicit—this would have been harder.
111
+
112
+ A constraint satisfaction problem (CSP) is one requiring a solution that satisfies a set of constraints. One of the well known examples is the boolean satisfiability problem (SAT). There are multiple other important CSPs such as the packing, molecular conformations, and, recently, error correcting codes [7]. Freedom to setup per point constraints without controlling for their global interactions makes a CSP formulation an attractive representation of the nonlinear embedding problem. Pursuing this property we use the iterative “divide and concur” (DC) algorithm [13] as the solver for our representation. In DC algorithm we treat each point on the solution map as a variable and assign a set of constraints that this variable needs to satisfy (more on these later). Then each points gets a “replica” for each constraint it is involved into. Then DC algorithm alternates the divide and concur projections. The divide projection moves each “replica” points to the nearest locations in the 2D map that satisfy the constraint they participate in. The concur projection concurs locations of all “replicas” of a point by placing them at the average location on the map. The key idea is to avoid local traps by combining the divide and concur steps within the difference map [8]. A single location update is represented by:
113
+
114
+ $$
115
+ \begin{array} { r l } & { x _ { c } = P _ { c } ( ( 1 + 1 / \beta ) * P _ { d } ( x ) - 1 / \beta * x ) } \\ & { x _ { d } = P _ { d } ( ( 1 - 1 / \beta ) * P _ { c } ( x ) + 1 / \beta * x ) } \\ & { x = x + \beta * ( x _ { c } - x _ { d } ) , } \end{array}
116
+ $$
117
+
118
+ where $P _ { d } ( \cdot )$ and $P _ { c } ( \cdot )$ denote the divide and concur projections and $\beta$ is a user-defined parameter.
119
+
120
+ While the concur projection will only differ by subsets of “replicas” across different methods representable in DC framework, the divide projection is unique and defines the algorithm behavior. In this paper, we choose a divide projection that keeps $k$ nearest neighbors of each point in the higher dimensional space also its neighbors in the 2D map. This is a simple local neighborhood constraint that allows us to assess effects of deep learning transformation leaving most of the mapping decisions to the deep learning.
121
+
122
+ Note, that for a general dataset we may not be able to satisfy this constraint: each point has exactly the same neighbors in 2D as in the original space (and this is what we indeed observe). The DC algorithm, however, is only guaranteed to find the solution if it exists and oscillates otherwise. Oscillating behavior is detectable and may be used to stop the algorithm. We found informative watching the 2D map in dynamics, as the points that keep oscillating provide additional information into the structure of the data. Another practically important feature of the algorithm: it is deterministic. Given the same parameters ( $\beta$ and the parameters of $P _ { d } ( \cdot )$ ) it converges to the same solution regardless of the initial point. If each of the points participates in each constraint then complexity of the algorithm is quadratic. With our simple $k$ neighborhood constraints it is $O ( k n )$ , for $n$ samples/points.
123
+
124
+ # 3.3 A schizophrenia structural MRI dataset
125
+
126
+ We use a combined data from four separate schizophrenia studies conducted at Johns Hopkins University (JHU), the Maryland Psychiatric Research Center (MPRC), the Institute of Psychiatry, London, UK (IOP), and the Western Psychiatric Institute and Clinic at the University of Pittsburgh (WPIC) (the data used in Meda et al. [25]). The combined sample comprised 198 schizophrenia patients and 191 matched healthy controls and contained both first episode and chronic patients [25]. At all sites, whole brain MRIs were obtained on a $1 . 5 \mathrm { T }$ Signa GE scanner using identical parameters and software. Original structural MRI images were segmented in native space and the resulting gray and white matter images then spatially normalized to gray and white matter templates respectively to derive the optimized normalization parameters. These parameters were then applied to the whole brain structural images in native space prior to a new segmentation. The obtained 60465 voxel gray matter images were used in this study. Figure 4 shows example orthogonal slice views of the gray matter data samples of a patient and a healthy control.
127
+
128
+ ![](images/c4b5a343fc1e4cb85c20d34f23973aa6ac9d95e1c2b63880dbf4b1bc1bf866da.jpg)
129
+ Figure 4: A smoothed gray matter segmentation of a patient and a healthy control: each is a training sample.
130
+
131
+ The main question of this Section is to evaluate the effect of the depth of a DBN on sMRI. To answer this question, we investigate if classification rates improve with the depth. For that we sequentially investigate DBNs of 3 depth. From RBM experiments we have learned that even with a larger number of hidden units (72, 128 and 512) RBM tends to only keep around 50 features driving the rest to zero. Classification rate and reconstruction error still slightly improves, however, when the number of hidden units increases. These observations affected our choice of 50 hidden units of the first two layers and 100 for the third. Each hidden unit is connected to all units in the previous layer which results in an all to all connectivity structure between the layers, which is a more common and conventional approach to constructing these models. Note, larger networks (up to double the umber of units) lead to similar results. We pre-train each layer via an unsupervised RBM and discriminatively fine-tune models of depth 1 (50 hidden units in the top layer), 2 (50-50 hidden units in the first and the top layer respectively), and 3 (50-50-100 hidden units in the first, second and the top layer respectively) by adding a softmax layer on top of each of these models and training via the back propagation.
132
+
133
+ We estimate the accuracy of classification via 10-fold cross validation on fine-tuned models splitting the 389 subject dataset into 10 approximately class-balanced folds. We train the rbf-kernel SVM, logistic regression and a k-nearest neighbors (knn) classifier using activations of the top-most hidden layers in fine-tuned models to the training data of each fold as their input. The testing is performed likewise but on the test data. We also perform the same 10-fold cross validation on the raw data. Table 1 summarizes the precision and recall values in the F-scores and their standard deviations.
134
+
135
+ All models demonstrate a similar trend when the accuracy only slightly increases from depth-1 to depth-2 DBN and then improves signifi
136
+
137
+ <table><tr><td>depth</td><td>raw</td><td>1</td><td>2</td><td>3</td></tr><tr><td>SVMF-score</td><td>0.68 ±0.01</td><td>0.66 ±0.09</td><td>0.62 ±0.12</td><td>0.90±0.14</td></tr><tr><td>LRF-score</td><td>0.63 ± 0.09</td><td>0.65 ±0.11</td><td>0.61±0.12</td><td>0.91±0.14</td></tr><tr><td>KNNF-score</td><td>0.61 ± 0.11</td><td>0.55 ± 0.15</td><td>0.58 ± 0.16</td><td>0.90±0.16</td></tr></table>
138
+
139
+ Table 1: Classification on fine-tuned models (test data)
140
+
141
+ cantly. Table 1 supports the general claim of deep learning community about improvement of classification rate with the depth even for sMRI data. Improvement in classification even for the simple knn classifier indicates the character of the transformation that the DBN learns and applies to the data: it may be changing the data manifold to organize classes by neighborhoods. Ideally, to make general conclusion about this transformation we need to analyze several representative datasets. However, even working with the same data we can have a closer view of the depth effect using the method introduced in Section 3.2. Although it may seem that the DBN does not provide significant improvements in sMRI classification from depth-1 to depth-2 in this model, it keeps on learning potentially useful transformaions of the data. We can see that using our simple local neighborhoodbased embedding. Figure 5 displays 2D maps of the raw data, as well as the depth 1, 2, and 3 activations (of a network trained on 335 subjects): the deeper networks place patients and control groups further apart. Additionally, Figure 5 displays the 54 subjects that the DBN was not train on. These hold out subjects are also getting increased separation with depth. This DBN’s behavior is potentially useful for generalization, when larger and more diverse data become available.
142
+
143
+ ![](images/476d7f9ec0679dcbfd04d1eaf746d79f5ea4d2c6d16e5a4e64ca1d42cdbab586.jpg)
144
+ Figure 5: Effect of a DBN’s depth on neighborhood relations. Each map is shown at the same iteration of the algorithm with the same $k = 5 0$ . The color differentiates the classes (patients and controls) and the training (335 subjects) from validation (54 subjects) data. Although the data becomes separable at depth 1 and more so at depth 2, the DBN continues distilling details that pull the classes further apart.
145
+
146
+ Our new mapping method has two essential properties to facilitate the conclusion and provide confidence in the result: its already mentioned local properties and the deterministic nature of the algorithm. The latter leads to independence of the resulting maps from the starting point. The map only depends on the models parameter $k$ —the size of the neighborhood—and the data.
147
+
148
+ # 3.4 A large-scale Huntington disease data
149
+
150
+ In this section we focus on sMRI data collected from healthy controls and Huntington disease (HD) patients as part of the PREDICT-HD project (www.predict-hd. net). Huntington disease is a genetic neurodegenerative disease that results in degeneration of neurons in certain areas of the brain. The project is focused on identifying the earliest detectable changes in thinking skills, emotions and brain structure as a person begins the transition from health to being diagnosed with Huntington disease. We would like to know if deep learning methods can assist in answering that question.
151
+
152
+ For this study T1-weighted scans were collected at multiple sites (32 international sites), representing multiple field strengths (1.5T and 3.0T) and multiple manufactures (Siemens, Phillips, and GE). The 1.5T T1 weighted scans were an axial 3D volumetric spoiled-gradient echo series $( \approx 1 \times 1 \times 1 . 5 ~ \mathrm { m m }$ voxels), and the 3.0T T1 weighted scans were a 3D Volumetric MPRAGE series $( \approx 1 \times 1 \times 1 \ : \mathrm { m n }$ m voxels).
153
+
154
+ ![](images/73650e39fcfeef56626cab5dffbf6d664648d47ea362e5822a60fc11d81800a5.jpg)
155
+ Figure 6: A gray matter of MRI scans of an HD patient and a healthy control.
156
+
157
+ The images were segmented in the native space and the normalized to a common template. After correlating
158
+
159
+ $$
160
+ \begin{array}{c} \begin{array} { r l } { \mathsf { d e p t h } } & { { } \parallel \mathsf { r a w } } \\ { S V M F ^ { - s c o r e } } \\ { L R F ^ { - s c o r e } } \end{array} \left\| \begin{array} { l l } { \mathrm { \Delta ~ n w ~ } } & { { } 0 . 6 5 \pm 0 . 0 1 } \\ { 0 . 7 5 } & { { } 0 . 6 5 \pm 0 . 0 1 } \end{array} \right. & { 0 . 6 5 \pm 0 . 0 1 \quad 1 . 0 0 \pm 0 . 0 0 } \\ { 0 . 6 5 \pm 0 . 0 1 } & { { } 0 . 6 5 \pm 0 . 0 1 } \end{array}
161
+ $$
162
+
163
+ Table 2: Classification on fine-tuned models (HD data)
164
+
165
+ the normalized gray matter segmentation with the template and eliminating poorly correlating scans we obtain a dataset of 3500 scans, where 2641 were from patients and 859 from healthy controls. We have used all of the scans in this imbalanced sample to pre-train and fine tune the same model architecture (50-50-100) as in Section 3.3 for all three depths3.
166
+
167
+ Table 2 lists the average F-score values for both classes at the raw data and all depth levels. Note the drop from the raw data and then a recovery at depth 3. The limited capacity of levels 1 and 2 has reduced the network ability to differentiate the groups but representational capacity of depth 3 network compensates for the initial bottleneck. This, confirms our previous observation on the depth effect, however, does not yet help the main question of the PREDICT-HD study. Note, however, while Table 1 in the previous section evaluates generalization ability of the DBN, Table 2 here only demonstrates changes in DBN’s representational capacity with the depth as we use no testing data. To further investigate utility of the deep learning approach for scientific discovery we again augment it with the embedding method of Section 3.2. Figure 7 shows the map of 3500 scans of HD patients and healthy controls. Each point on the map is an sMRI volume, shown in Figures 6 and 7. Although we have used the complete data to train the DBN, discriminative fine-tuning had access only to binary label: control or patient. In addition to that, we have information about severity of the disease from low to high. We have color coded this information in Figure 7 from bright yellow (low) through orange (medium) to red (high). The network4 discriminates the patients by disease severity which results in a spectrum on the map. Note, that neither t-SNE (not shown), nor our new embedding see the spectrum or even the patient groups in the raw data. This is a important property of the method that may help support its future use in discovery of new information about the disease.
168
+
169
+ ![](images/eeeb39731b80a20709ab71582b9bc533ca1ffc2bcf1813556881823eb58f2849.jpg)
170
+ Figure 7: Patients and controls group separation map with additional unsupervised spectral decomposition of sMRI scans by disease severity. The map represents 3500 scans.
171
+
172
+ # 4 Conclusions
173
+
174
+ Our investigations show that deep learning has a high potential in neuroimaging applications. Even the shallow RBM is already competitive with the model routinely used in the field: it produces physiologically meaningful features which are (desirably) highly focal and have time course cross correlations that connect them into meaningful functional groups (Section 5). The depth of the DBN does indeed help classification and increases group separation. This is apparent on two sMRI datasets collected under varying conditions, at multiple sites each, from different disease groups, and pre-processed differently. This is a strong evidence of DBNs robustness. Furthermore, our study shows a high potential of DBNs for exploratory analysis. As Figure 7 demonstrates, DBN in conjunction with our new mapping method can reveal hidden relations in data. We did find it difficult initially to find workable parameter regions, but we hope that other researchers won’t have this difficulty starting from the baseline that we provide in this paper.
175
+
176
+ # References
177
+
178
+ [1] A. J. Bell and T. J. Sejnowski. An information-maximization approach to blind separation and blind deconvolution. Neural Computation, 7(6):1129–1159, November 1995. [2] Bharat Biswal, F Zerrin Yetkin, Victor M Haughton, and James S Hyde. Functional connectivity in the motor cortex of resting human brain using echo-planar mri. Magnetic resonance in medicine, 34(4):537–541, 1995.
179
+ [3] M.J. Brookes, M. Woolrich, H. Luckhoo, D. Price, J.R. Hale, M.C. Stephenson, G.R. Barnes, S.M. Smith, and P.G. Morris. Investigating the electrophysiological basis of resting state networks using magnetoencephalography. Proceedings of the National Academy of Sciences, 108(40):16783–16788, 2011. [4] V. D. Calhoun, K. A. Kiehl, and G. D. Pearlson. Modulation of temporally coherent brain networks estimated using ICA at rest and during cognitive tasks. Human Brain Mapping, 29(7):828–838, 2008.
180
+ [5] R. W. Cox et al. AFNI: software for analysis and visualization of functional magnetic resonance neuroimages. Computers and Biomedical Research, 29(3):162–173, 1996. [6] T. de Vries, S. Chawla, and M. E. Houle. Finding local anomalies in very high dimensional space. In Proceedings of the 10th $\{ I E E E \}$ international conference on data mining, pages 128–137. IEEE, IEEE Computer Society, 2010. [7] Nate Derbinsky, Jose Bento, Veit Elser, and Jonathan S Yedidia. An improved three-weight ´ message-passing algorithm. arXiv preprint arXiv:1305.1961, 2013. [8] V. Elser, I. Rankenburg, and P. Thibault. Searching with iterated maps. Proceedings of the National Academy of Sciences, 104(2):418, 2007. [9] Nathan Swanson et. al. Lateral differences in the default mode network in healthy controls and patients with schizophrenia. Human Brain Mapping, 32:654–664, 2011.
181
+ [10] Asja Fischer and Christian Igel. An introduction to restricted boltzmann machines. In Progress in Pattern Recognition, Image Analysis, Computer Vision, and Applications, pages 14–36. Springer, 2012.
182
+ [11] L. Freire, A. Roche, and J. F. Mangin. What is the best similarity measure for motion correction in fMRI. IEEE Transactions in Medical Imaging, 21:470–484, 2002.
183
+ [12] Karl J Friston, Andrew P Holmes, Keith J Worsley, J-P Poline, Chris D Frith, and Richard SJ Frackowiak. Statistical parametric maps in functional imaging: a general linear approach. Human brain mapping, 2(4):189–210, 1994.
184
+ [13] S. Gravel and V. Elser. Divide and concur: A general approach to constraint satisfaction. Physical Review E, 78(3):36706, 2008.
185
+ [14] Trevor. Hastie, Robert. Tibshirani, and JH (Jerome H.) Friedman. The elements of statistical learning. Springer, 2009.
186
+ [15] G. Hinton and R. Salakhutdinov. Reducing the dimensionality of data with neural networks. Science, 313(5786):504–507, 2006.
187
+ [16] G. E. Hinton, S. Osindero, and Y. W. Teh. A fast learning algorithm for deep belief nets. Neural computation, 18(7):1527–1554, 2006.
188
+ [17] Geoffrey Hinton. Training products of experts by minimizing contrastive divergence. Neural Computation, 14:2002, 2000.
189
+ [18] P. O. Hoyer. Non-negative sparse coding. In Neural Networks for Signal Processing, 2002. Proceedings of the 2002 12th IEEE Workshop on, pages 557–565, 2002.
190
+ [19] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Neural Information Processing Systems, 2012.
191
+ [20] Quoc V Le, Alexandre Karpenko, Jiquan Ngiam, and Andrew Y Ng. Ica with reconstruction cost for efficient overcomplete feature learning. In NIPS, pages 1017–1025, 2011.
192
+ [21] Quoc V. Le, Rajat Monga, Matthieu Devin, Kai Chen, Greg S. Corrado, Jeff Dean, and Andrew Y. Ng. Building high-level features using large scale unsupervised learning. In International Conference on Machine Learning. 103, 2012.
193
+ [22] N. Le Roux and Y. Bengio. Deep belief networks are compact universal approximators. Neural computation, 22(8):2192–2207, 2010.
194
+ [23] Jingyu Liu and Vince Calhoun. Parallel independent component analysis for multimodal analysis: Application to fmri and eeg data. In Biomedical Imaging: From Nano to Macro, 2007. ISBI 2007. 4th IEEE International Symposium on, pages 1028–1031. IEEE, 2007.
195
+ [24] M. J. McKeown, S. Makeig, G. G. Brown, T. P. Jung, S. S. Kindermann, A. J. Bell, and T. J. Sejnowski. Analysis of fMRI data by blind separation into independent spatial components. Human Brain Mapping, 6(3):160–188, 1998.
196
+ [25] Shashwath A Meda, Nicole R Giuliani, Vince D Calhoun, Kanchana Jagannathan, David J Schretlen, Anne Pulver, Nicola Cascella, Matcheri Keshavan, Wendy Kates, Robert Buchanan, et al. A large scale $\mathit { n } { } = 4 0 0 { }$ ) investigation of gray matter differences in schizophrenia using optimized voxel-based morphometry. Schizophrenia research, 101(1):95–105, 2008.
197
+ [26] M. Moosmann, T. Eichele, H. Nordby, K. Hugdahl, and V. D. Calhoun. Joint independent component analysis for simultaneous EEG-fMRI: principle and simulation. International Journal of Psychophysiology, 67(3):212–221, 2008.
198
+ [27] 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), pages 807–814, 2010.
199
+ [28] V. K. Potluru and V. D. Calhoun. Group learning using contrast NMF : Application to functional and structural MRI of schizophrenia. Circuits and Systems, 2008. ISCAS 2008. IEEE International Symposium on, pages 1336–1339, May 2008.
200
+ [29] Marcus E. Raichle, Ann Mary MacLeod, Abraham Z. Snyder, William J. Powers, Debra A. Gusnard, and Gordon L. Shulman. A default mode of brain function. Proceedings of the National Academy of Sciences, 98(2):676–682, 2001.
201
+ [30] Sam T Roweis and Lawrence K Saul. Nonlinear dimensionality reduction by locally linear embedding. Science, (5500):2323–2326, 2000.
202
+ [31] Mikail Rubinov and Olaf Sporns. Weight-conserving characterization of complex functional brain networks. Neuroimage, 56(4):2068–2079, 2011.
203
+ [32] John W Sammon Jr. A nonlinear mapping for data structure analysis. Computers, IEEE Transactions on, 100(5):401–409, 1969.
204
+ [33] Jing Sui, Tulay Adali, Qingbao Yu, Jiayu Chen, and Vince D. Calhoun. A review of multivariate methods for multimodal fusion of brain imaging data. Journal of Neuroscience Methods, 204(1):68–81, 2012.
205
+ [34] Joshua B Tenenbaum, Vin De Silva, and John C Langford. A global geometric framework for nonlinear dimensionality reduction. Science, 290(5500):2319–2323, 2000.
206
+ [35] M.P. van den Heuvel and H.E. Hulshoff Pol. Exploring the brain network: A review on restingstate fMRI functional connectivity. European Neuropsychopharmacology, 2010.
207
+ [36] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(2579-2605):85, 2008.
208
+ [37] Hui Zou, Trevor Hastie, and Robert Tibshirani. Sparse principal component analysis. Journal of computational and graphical statistics, 15(2):265–286, 2006.
209
+
210
+ # 5 Supplementary material
211
+
212
+ The correlation matrices for both RBM and ICA results on the fMRI dataset of Section 2.3 are provided in Figure S1, where the ordering of components is performed separately for each method. Each network is named by their physiological function but we do not go in depth explaining these in the current paper. For RBM, modularity is more apparent, both visually and quantitatively. Modularity, as defined in [31], averages $0 . 4 0 \pm 0 . 0 6 0$ across subjects for RBM, and $0 . 3 5 \pm 0 . 0 5 6$ for ICA. These values are significantly greater for RBM $( t = 7 . 1 5 , p < 1 e - 6$ per the paired t-test). Also note that the scale of correlation values for RBM and ICA is different, which highlights that RBM overestimated strong FNC values.
213
+
214
+ ![](images/ae7cce6d19fbb9d82bd5b077ad3a04815fb6c12d2a5a349b52cb5037cccb90d4.jpg)
215
+ Figure S1: Correlation matrices determined from RBM (left) and ICA (right), averaged over subjects. Note that the color scales for RBM and ICA are different (RBM shows a larger range in correlations). The correlation matrix for ICA on the same scale as RBM is also provided as an inset (upper right). Feature groupings for RBM and ICA were determined separately using the FNC matrices and known anatomical and functional properties.
216
+
217
+ ![](images/f9a151bf4c870b7e24e5b9860efde560866c036587adf63bded04a361b7f39fd.jpg)
218
+ Figure S2: Sample pairs consisting of RBM (top) and ICA (bottom) SMs thresholded at 2 standard deviations. Pairing was done with the aid of spatial correlations, temporal properties, and visual inspection. Values indicate the spatial correlation between RBM and ICA SMs.
md/train/ZUvaSolQZh3/ZUvaSolQZh3.md ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Uncertainty-Based Offline Reinforcement Learning with Diversified Q-Ensemble
2
+
3
+ Gaon $\mathbf { A } \mathbf { n } ^ { * 1 2 }$ , Seungyong Moon\*1 2, Jang-Hyun $\mathbf { K i m ^ { 1 2 } }$ , Hyun Oh Song† 1 2 3
4
+
5
+ Seoul National University1 Neural Processing Research Center2 DeepMetrics3 {white0234,symoon11,janghyun,hyunoh}@mllab.snu.ac.kr
6
+
7
+ # Abstract
8
+
9
+ Offline reinforcement learning (offline RL), which aims to find an optimal policy from a previously collected static dataset, bears algorithmic difficulties due to function approximation errors from out-of-distribution (OOD) data points. To this end, offline RL algorithms adopt either a constraint or a penalty term that explicitly guides the policy to stay close to the given dataset. However, prior methods typically require accurate estimation of the behavior policy or sampling from OOD data points, which themselves can be a non-trivial problem. Moreover, these methods under-utilize the generalization ability of deep neural networks and often fall into suboptimal solutions too close to the given dataset. In this work, we propose an uncertainty-based offline RL method that takes into account the confidence of the Q-value prediction and does not require any estimation or sampling of the data distribution. We show that the clipped Q-learning, a technique widely used in online RL, can be leveraged to successfully penalize OOD data points with high prediction uncertainties. Surprisingly, we find that it is possible to substantially outperform existing offline RL methods on various tasks by simply increasing the number of Q-networks along with the clipped Q-learning. Based on this observation, we propose an ensemble-diversified actor-critic algorithm that reduces the number of required ensemble networks down to a tenth compared to the naive ensemble while achieving state-of-the-art performance on most of the D4RL benchmarks considered.
10
+
11
+ # 1 Introduction
12
+
13
+ Over the recent years, deep reinforcement learning (deep RL) has achieved considerable success in various domains such as robotics [20], recommendation systems [6], and strategy games [26]. However, a major drawback of RL algorithms is that they adopt an active learning procedure, where training steps require active interactions with the environment. This trial-and-error procedure can be prohibitive when scaling RL to real-world applications such as autonomous driving and healthcare, as exploratory actions can cause critical damage to the agent or the environment [19]. Offline RL, also known as batch RL, aims to overcome this problem by learning policies using only previously collected data without further interactions with the environment [2, 11, 19].
14
+
15
+ Even though offline RL is a promising direction to lead a more data-driven way of solving RL problems, recent works show offline RL faces new algorithmic challenges [19]. Typically, if the coverage of the dataset is not sufficient, vanilla RL algorithms suffer severely from extrapolation error, overestimating the Q-values of out-of-distribution (OOD) state-action pairs [15]. To this end, most offline RL methods apply some constraints or penalty terms on top of the existing RL algorithms to enforce the learning process to be more conservative. For example, some prior works explicitly regularize the policy to be close to the behavior policy that was used to collect the data [11, 15]. A more recent work instead penalizes the Q-values of OOD state-action pairs to enforce the Q-values to be more pessimistic [16].
16
+
17
+ While these methods achieve significant performance gains over vanilla RL methods, they either require an estimation of the behavior policy or explicit sampling from OOD data points, which themselves can be non-trivial to solve. Furthermore, these methods do not utilize the generalization ability of the Q-function networks and prohibit the agent from approaching any OOD state-actions without any consideration on whether they are good or bad. However, if we can identify OOD data points where we can predict their Q-values with high confidence, it is more effective not to restrain the agent from choosing those data points.
18
+
19
+ From this intuition, we propose an uncertainty-based model-free offline RL method that effectively quantifies the uncertainty of the Q-value estimates by an ensemble of Q-function networks and does not require any estimation or sampling of the data distribution. To achieve this, we first show that a well-known technique from online RL, the clipped Q-learning [10], can be successfully leveraged as an uncertainty-based penalization term. Our experiments reveal that we can achieve state-of-the-art performance on various offline RL tasks by solely using this technique with increased ensemble size. To further improve the practical usability of the method, we develop an ensemble diversifying objective that significantly reduces the number of required ensemble networks. We evaluate our proposed method on D4RL benchmarks [9] and verify that the proposed method outperforms the previous state-of-the-art by a large margin on various types of environments and datasets.
20
+
21
+ # 2 Preliminaries
22
+
23
+ We consider an environment formulated as a Markov Decision Process (MDP) defined by a tuple $( S , A , T , r , d _ { 0 } , \gamma )$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $T ( \mathbf { s } ^ { \prime } \mid \mathbf { s } , \mathbf { a } )$ is the transition probability distribution, $r : S \times \mathcal { A } \mathbb { R }$ is the reward function, $d _ { 0 }$ is the initial state distribution, and $\gamma \in \mathsf { \Gamma } ( 0 , 1 ]$ is the discount factor. The goal of reinforcement learning is to find an optimal policy $\pi ( \mathbf { a } \mid \mathbf { s } )$ that maximizes the cumulative discounted reward $\begin{array} { r } { \mathbb { E } _ { { \mathbf { s } } _ { t } , { \mathbf { a } } _ { t } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( { \mathbf { s } } _ { t } , { \mathbf { a } } _ { t } ) \right] } \end{array}$ , where $\mathbf { s } _ { 0 } \sim d _ { 0 } ( \cdot )$ , $\mathbf { a } _ { t } \sim \pi ( \cdot \mid \mathbf { s } _ { t } )$ , and $\mathbf { s } _ { t + 1 } \sim T ( \cdot \mid \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ .
24
+
25
+ One of the major approaches for obtaining such a policy is Q-learning [12, 20] which learns a state-action value function $Q _ { \phi } ( \mathbf { s } , \mathbf { a } )$ parameterized by a neural network that represents the expected cumulative discounted reward when starting from state s and action a. Standard actor-critic approach [14] learns this Q-function by minimizing the Bellman residual $\big ( Q _ { \phi } ( \mathbf { s } , \mathbf { a } ) - B ^ { \pi _ { \theta } } Q _ { \phi } ( \mathbf { s } , \mathbf { a } ) \big ) ^ { 2 }$ , where $B ^ { \pi _ { \theta } } Q _ { \phi } ( \mathbf { s } , \mathbf { a } ) = \mathbb { E } _ { \mathbf { s } ^ { \prime } \sim T ( \cdot | \mathbf { s } , \mathbf { a } ) } \left[ r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { \mathbf { a } ^ { \prime } \sim \pi _ { \theta } ( \cdot | \mathbf { s } ^ { \prime } ) } Q _ { \phi } \left( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } \right) \right]$ is the Bellman operator. In the context of offline RL, where transitions are sampled from a static dataset $\mathcal { D }$ , the objective for the $\mathrm { Q }$ -network becomes minimizing
26
+
27
+ $$
28
+ J _ { q } ( Q _ { \phi } ) : = \mathbb { E } _ { ( \mathbf { s } , \mathbf { a } , \mathbf { s } ^ { \prime } ) \sim \mathcal { D } } \left[ \left( Q _ { \phi } ( \mathbf { s } , \mathbf { a } ) - \left( r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { \mathbf { a } ^ { \prime } \sim \pi _ { \theta } ( \cdot | \mathbf { s } ^ { \prime } ) } \left[ Q _ { \phi ^ { \prime } } \left( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } \right) \right] \right) \right) ^ { 2 } \right] ,
29
+ $$
30
+
31
+ where $Q _ { \phi ^ { \prime } }$ represents the target Q-network softly updated for algorithmic stability [20]. The policy, which is also parameterized by a neural network, is updated in an alternating fashion to maximize the expected $\mathrm { Q }$ -value: $J _ { p } ( \pi _ { \theta } ) : = \mathbb { E } _ { { \mathbf s } \sim \mathcal { D } , { \mathbf a } \sim \pi _ { \theta } ( \cdot | { \mathbf s } ) } \left[ Q _ { \phi } ( { \mathbf s } , { \mathbf a } ) \right] ,$ .
32
+
33
+ However, as the policy is updated to maximize the Q-values, the actions $\mathbf { a } ^ { \prime }$ sampled from the current policy in Equation (1) can be biased towards OOD actions with erroneously high Q-values. In the offline RL setting, such errors cannot be corrected by feedback from the environment as in online RL. To handle the error propagation from these OOD actions, most offline RL algorithms regularize either the policy [11, 15] or the Q-function [16] to be biased towards the given dataset. However, the policy regularization methods typically require an accurate estimation of the behavior policy. The previous state-of-the-art method CQL [16] instead learns conservative Q-values without estimating the behavior policy by penalizing the Q-values of OOD actions by
34
+
35
+ $$
36
+ \operatorname* { m i n } _ { \phi } J _ { q } ( Q _ { \phi } ) + \alpha \Big ( \mathbb { E } _ { { \mathbf { s } } \sim \mathcal { D } , { \mathbf { a } } \sim \mu ( \cdot \vert \mathbf { s } ) } \left[ Q _ { \phi } \left( \mathbf { s } , { \mathbf { a } } \right) \right] - \mathbb { E } _ { ( \mathbf { s } , { \mathbf { a } } ) \sim \mathcal { D } } \left[ Q _ { \phi } \left( \mathbf { s } , { \mathbf { a } } \right) \right] \Big ) ,
37
+ $$
38
+
39
+ where $\mu$ is an approximation of the policy that maximizes the current Q-function. While CQL does not need explicit behavior policy estimation, it requires sampling from an appropriate action distribution $\mu ( \cdot | \mathbf { \bar { s } } )$ .
40
+
41
+ # 3 Uncertainty penalization with Q-ensemble
42
+
43
+ ![](images/5ef0099c6b2f91502d99a5bd4e4ae37be48755a4861064068d4c78cfb8b708b5.jpg)
44
+ Figure 1: Performance of SAC- $N$ on halfcheetah-medium and hopper-medium datasets while varying $N$ , compared to CQL. ‘Average Return’ denotes the undiscounted return of each policies on evaluation. Results averaged over 4 seeds.
45
+
46
+ In this section, we turn our attention to a conventional technique from online RL, Clipped Double QLearning [10], which uses the minimum value of two parallel Q-networks as the Bellman target: $y =$ $\begin{array} { r } { r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { \mathbf { a } ^ { \prime } \sim \pi _ { \theta } ( \cdot | \mathbf { s } ^ { \prime } ) } \left[ \operatorname* { m i n } _ { j = 1 , 2 } Q _ { \phi _ { j } ^ { \prime } } ( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } ) \right] } \end{array}$ . Although this technique was originally proposed in online RL to mitigate the overestimation from general prediction errors, some offline RL algorithms [11, 15, 28] also utilize this technique to enforce their $\mathrm { Q }$ -value estimates to be more pessimistic. However, the isolated effect of the clipped Q-learning in offline RL was not fully analyzed in the previous works, as they use the technique only as an auxiliary term that adds up to their core methods.
47
+
48
+ To examine the ability of clipped Q-learning to prevent the overestimation in offline RL on its own, we modify SAC [12] by increasing the number of $\mathrm { Q }$ -ensembles from 2 to $N$ :
49
+
50
+ $$
51
+ \begin{array} { r l } & { \underset { \phi _ { i } } { \mathrm { n i n } } \ : \mathbb { E } _ { \mathbf { s } , \mathbf { a } , \mathbf { s } ^ { \prime } \sim \mathcal { D } } \left[ \left( Q _ { \phi _ { i } } ( \mathbf { s } , \mathbf { a } ) - \left( r ( \mathbf { s } , \mathbf { a } ) + \gamma \mathbb { E } _ { \mathbf { a } ^ { \prime } \sim \pi \theta \cdot \left( \mathbf { \cdot } \mathbf { s } ^ { \prime } \right) } \left[ \underset { j = 1 , \ldots , N } { \operatorname* { m i n } } Q _ { \phi _ { j } ^ { \prime } } \left( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } \right) - \beta \log \pi _ { \theta } \left( \mathbf { a } ^ { \prime } \mid \mathbf { s } ^ { \prime } \right) \right] \right) \right) ^ { 2 } \right] } \\ & { \underset { \theta } { \mathrm { n a x } } \ : \mathbb { E } _ { \mathbf { s } \sim \mathcal { D } , \mathbf { a } \sim \pi _ { \theta } \cdot \left( \mathbf { \cdot } \mathbf { s } \right) } \ : \left[ \underset { j = 1 , \ldots , N } { \operatorname* { m i n } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) - \beta \log \pi _ { \theta } \left( \mathbf { a } \mid \mathbf { s } \right) \right] , } \end{array}
52
+ $$
53
+
54
+ for $i = 1 , \ldots , N$ . We denote this modified algorithm as SAC- $N$ .
55
+
56
+ Figure 1 shows the preliminary experiments on D4RL halfcheetah-medium and hopper-medium datasets [9] while varying $N$ . Note that these datasets are constructed from suboptimal behavior policies. Surprisingly, as we gradually increase $N$ , we can successfully find policies that outperform the previous state-of-the-art method (CQL) by a large margin. In fact, as we will present in Section 5, SAC- $N$ outperforms CQL on various types of environments and data-collection policies.
57
+
58
+ To understand why this simple technique works so well, we can first interpret the clipping procedure (choosing the minimum value from the ensemble) as penalizing state-action pairs with high-variance Q-value estimates, which encourages the policy to favor actions that appeared in the dataset [11]. The dataset samples will naturally have lower variance compared to the OOD samples as the Bellman residual term in Equation (2) explicitly aligns the Q-value predictions for the dataset samples. More formally, we can regard this difference in variance as accounting for epistemic uncertainty [8] which refers to the uncertainty stemming from limited data and knowledge.
59
+
60
+ Utilization of the clipped Q-value relates to methods that consider the confidence bound of the Q-value estimates [24]. Online RL methods typically utilize the Q-ensemble to form an optimistic estimate of the Q-value, by adding the standard deviation to the mean of the Q-ensembles [18]. This optimistic Q-value, also known as the upper-confidence bound (UCB), can encourage the exploration of unseen actions with high uncertainty. However, in offline RL, the dataset available during training is fixed, and we have to focus on exploiting the given data. For this purpose, it is natural to utilize the lower-confidence bound (LCB) of the Q-value estimates, for example by subtracting the standard deviation from the mean, which allows us to avoid risky state-actions.
61
+
62
+ The clipped Q-learning algorithm, which chooses the worst-case Q-value instead to compute the pessimistic estimate, can also be interpreted as utilizing the LCB of the $\mathrm { Q }$ -value predictions. Suppose $Q ( \mathbf { s } , \mathbf { a } )$ follows a Gaussian distribution with mean $m ( \mathbf { s } , \mathbf { a } )$ and standard deviation $\sigma ( \mathbf { s } , \mathbf { a } )$ . Also, let $\{ Q _ { j } ( \mathbf { s } , \mathbf { \bar { a } } ) \} _ { j = 1 } ^ { N }$ be realizations of $Q ( \mathbf { s } , \mathbf { a } )$ . Then, we can approximate the expected minimum of the realizations following the work of Royston [23] as
63
+
64
+ $$
65
+ \mathbb { E } \left[ \operatorname* { m i n } _ { j = 1 , \dots , N } Q _ { j } ( \mathbf { s } , \mathbf { a } ) \right] \approx m ( \mathbf { s } , \mathbf { a } ) - \Phi ^ { - 1 } \left( \frac { N - \frac { \pi } { 8 } } { N - \frac { \pi } { 4 } + 1 } \right) \sigma ( \mathbf { s } , \mathbf { a } ) ,
66
+ $$
67
+
68
+ where $\Phi$ is the CDF of the standard Gaussian distribution. This relation indicates that using the clipped Q-value is similar to penalizing the ensemble mean of the Q-values with the standard deviation scaled by a coefficient dependent on $N$ .
69
+
70
+ ![](images/ce40e054b643c8f22be0cd242e5ba33fb71eb6ea668533184970fad707c33dc5.jpg)
71
+ Figure 2: (a) and (b) each plots the size of the clip penalty and the standard deviation of the Qvalue estimates for in-distribution (behavior) and OOD (random) actions while training SAC-10 on halfcheetah-medium dataset. (c) plots the gap of the clip penalty between the in-distribution and OOD actions while varying $N$ . Results averaged over 4 seeds.
72
+
73
+ We now move on to the empirical analysis of the clipped Q-learning. Figure 2a compares the strength of the uncertainty penalty on in-distribution and OOD actions. Specifically, we compare actions sampled from two types of policies: (1) the behavior policy which was used to collect the dataset, and (2) the random policy which samples actions uniformly from the action space. For each policy, we measure the size of the penalty from the clipping as $\begin{array} { r } { \mathbb { E } _ { { \mathbf s } \sim \mathcal { D } , { \mathbf a } \sim \pi ( \cdot | { \mathbf s } ) } [ \frac { 1 } { N } \sum _ { j = 1 } ^ { N } Q _ { \phi _ { j } } ( { \mathbf s } , { \mathbf a } ) - } \end{array}$ $\begin{array} { r } { \operatorname* { m i n } _ { j = 1 , \dots , N } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) ] } \end{array}$ . Figure 2a shows that the clipping term penalizes the random state-action pairs much stronger than the in-distribution pairs throughout the training. For comparison, we also measure the standard deviation of the $\mathrm { Q }$ -values for each policy. The results in Figure 2b show that as we conjectured, the Q-value predictions for the OOD actions have a higher variance. We also find that the size of the penalty and the standard deviation are highly correlated, as we noted in Equation (3).
74
+
75
+ As we observe that OOD actions have higher variance on Q-value estimates, the effect of increasing $N$ becomes obvious: it strengthens the penalty applied to the OOD samples compared to the dataset samples. To verify this, we measured the relative penalty applied to the OOD samples in Figure 2c and found that indeed the OOD samples are penalized relatively further as $N$ increases.
76
+
77
+ # 4 Ensemble gradient diversification
78
+
79
+ Even though SAC- $N$ outperforms existing methods on various tasks, it sometimes requires an excessively large number of ensembles to learn stably (e.g., $N = 5 0 0$ for hopper-medium). While investigating its reason, we found that the performance of SAC- $N$ is negatively correlated with the degree to which the input gradients of Q-functions $\nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } )$ are aligned, which decreases with $N$ . Figure 4 measures the minimum cosine similarity between the gradients of the Q-functions $\begin{array} { r l } & { \operatorname* { m i n } _ { i \neq j } \langle \nabla _ { \mathbf { a } } Q _ { \phi _ { i } } ( \mathbf { s } , \mathbf { a } ) , \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \rangle } \end{array}$ to examine the alignment of the gradients while varying $N$ on the D4RL hopper-medium dataset. The results imply that the performance of the learned policy degrades significantly when the Q-functions share a similar local structure.
80
+
81
+ ![](images/968b107276cad894e397102039b5ec06b011948bd1a659ae32e5bb3c98ac6b5a.jpg)
82
+ Figure 3: Illustration of the ensemble gradient diversification. The vector $\lambda _ { i } \mathbf { w } _ { i }$ represents the normalized eigenvector $\mathbf { w } _ { i }$ of $\mathrm { V a r } ( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) )$ multiplied by its eigenvalue $\lambda _ { i }$ .
83
+
84
+ We now show that the alignment of the input gradients can induce insufficient penalization of near-distribution data points, which leads to requiring a large number of ensemble networks. Let $\nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } )$ be the gradient of the $j$ -th Q-function with respect to the behavior action a and assume the gradient is normalized for simplicity. If the gradients of the Q-functions are well-aligned as illustrated in Figure 3a, then there exists a unit vector w such that the Q-values for the OOD actions along the direction of w have a low variance. To show this, we first assume the Q-value predictions for the in-distribution state-action pairs coincide, i.e., $Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) = Q ( \mathbf { s } , \mathbf { a } )$ for $j = 1 , \ldots , N$ Note that this can be optimized by minimizing the Bellman error. Then, using the first-order Taylor approximation, the sample variance of the Q-values at an OOD action along w can be represented as
85
+
86
+ ![](images/c83721bf5936ecf612e65946d04efde71ac35cf5fc4b3dcc6fa6ee753f7522c4.jpg)
87
+ Figure 4: Plot of the minimum cosine similarity between the input gradients of Q-functions and the average return while varying the number of Q-functions.
88
+
89
+ $$
90
+ \begin{array} { r l } & { \mathrm { V a r } \left( Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } + k \mathbf { w } ) \right) \approx \mathrm { V a r } \left( Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) + k \left. \mathbf { w } , \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right. \right) } \\ & { \quad \quad \quad \quad = \mathrm { V a r } \left( Q ( \mathbf { s } , \mathbf { a } ) + k \left. \mathbf { w } , \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right. \right) } \\ & { \quad \quad \quad \quad = k ^ { 2 } \mathrm { V a r } \left( \left. \mathbf { w } , \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right. \right) } \\ & { \quad \quad \quad \quad = k ^ { 2 } \mathbf { w } ^ { \top } \mathrm { V a r } \left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right) \mathbf { w } , } \end{array}
91
+ $$
92
+
93
+ where $\langle \cdot , \cdot \rangle$ denotes an inner-product, $k \in \mathbb { R }$ , and Var $\left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right)$ is the sample variance matrix for the input gradients $\nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } )$ . One interesting property of the variance matrix is that its total variance, which is equivalent to the sum of its eigenvalues, can be represented as a function of the norm of the average gradients by Lemma 1.
94
+
95
+ Lemma 1. The total variance of the matrix $\mathrm { V a r } \left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right)$ is equal to $1 - \| \bar { q } \| _ { 2 } ^ { 2 }$ , where $\bar { q } =$ $\begin{array} { r } { \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) . } \end{array}$ .
96
+
97
+ Let $\lambda _ { \mathrm { m i n } }$ be the smallest eigenvalue of $\mathrm { V a r } \left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right)$ and $\mathbf { w } _ { \mathrm { m i n } }$ be the corresponding normalized eigenvector. Also, let $\epsilon > 0$ be the value such that $\begin{array} { r } { \operatorname* { m i n } _ { i \neq j } \left. \nabla _ { \mathbf { a } } Q _ { \phi _ { i } } ( \mathbf { s } , \mathbf { a } ) , \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right. = 1 - \epsilon . } \end{array}$ Then, using Lemma 1, we can prove that the variance of the $\mathrm { Q }$ -values for an OOD action along $\mathbf { w } _ { \mathrm { m i n } }$ is upper-bounded by some constant multiple of $\epsilon$ , which is given by Proposition 1.
98
+
99
+ Proposition 1. Suppose $Q _ { \phi _ { j } } ( { \bf s } , { \bf a } ) \ = \ Q ( { \bf s } , { \bf a } )$ and $Q _ { \phi _ { j } } ( \mathbf { s } , \cdot )$ is locally linear in the neighborhood of a for all $j \in [ N ]$ . Let $\lambda _ { \mathrm { m i n } }$ and $\mathbf { w } _ { \mathrm { m i n } }$ be the smallest eigenvalue and the corresponding normalized eigenvector of the matrix Var $\left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right)$ and $\epsilon > 0$ be the value such that $\begin{array} { r } { \operatorname* { m i n } _ { i \neq j } \left. \nabla _ { \mathbf { a } } Q _ { \phi _ { i } } ( \mathbf { s } , \mathbf { a } ) , \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right. = 1 - \epsilon . } \end{array}$ . Then, the variance of the $Q$ -values for an OOD action in the neighborhood along the direction of $\mathbf { w } _ { \mathrm { m i n } }$ is upper-bounded as follows:
100
+
101
+ $$
102
+ \mathrm { V a r } \left( Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } + k \mathbf { w } _ { \mathrm { m i n } } ) \right) \leq \frac { 1 } { | \mathcal { A } | } \frac { N - 1 } { N } k ^ { 2 } \epsilon ,
103
+ $$
104
+
105
+ where $| { \cal A } |$ is the action space dimension.
106
+
107
+ We provide the proofs in Appendix A.1. Proposition 1 implies that if there exists such $\epsilon > 0$ that is small, which means the gradients of Q-function are well-aligned, then the variance of the Q-values for an OOD action along a specific direction will also be small. This in turn degrades the ability of the ensembles to penalize OOD actions, which ultimately leads to requiring a large number of ensemble networks.
108
+
109
+ To address this problem, we propose a regularizer that effectively increases the variance of the Qvalues for near-distribution OOD actions. Note that the variance is lower-bounded by some constant multiple of the smallest eigenvalue $\lambda _ { \mathrm { m i n } }$ :
110
+
111
+ $$
112
+ \begin{array} { r l } & { \mathrm { V a r } \left( Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } + k \mathbf { w } ) \right) \approx k ^ { 2 } \mathbf { w } ^ { \top } \mathrm { V a r } \left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right) \mathbf { w } } \\ & { \quad \quad \quad \quad \geq k ^ { 2 } \mathbf { w } _ { \operatorname* { m i n } } ^ { \top } \mathrm { V a r } \left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right) \mathbf { w } _ { \operatorname* { m i n } } } \\ & { \quad \quad \quad = k ^ { 2 } \lambda _ { \operatorname* { m i n } } . } \end{array}
113
+ $$
114
+
115
+ Therefore, an obvious way to increase this variance is to maximize the smallest eigenvalue of Var $\left( \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right)$ , which can be formulated as
116
+
117
+ $$
118
+ \begin{array} { r l } & { \underset { \phi } { \mathrm { m a x i m i z e } } ~ \mathbb { E } _ { { \mathbf s } , { \mathbf a } \sim \mathcal { D } } \left[ \lambda _ { \mathrm { m i n } } \left( { \mathrm { V a r } \left( { \nabla _ { { \mathbf a } } { Q _ { \phi _ { j } } } \left( { \mathbf s } , { \mathbf a } \right) } \right) } \right) \right] , } \end{array}
119
+ $$
120
+
121
+ where $\phi$ denotes the collection of the parameters $\{ \phi _ { j } \} _ { j = 1 } ^ { N }$ . There are several methods to compute the smallest eigenvalue, such as the power method or the QR algorithm [27]. However, these iterative methods require constructing huge computation graphs, which makes optimizing the eigenvalue using back-propagation inefficient. Instead, we aim to maximize the sum of all eigenvalues, which is equal to the total variance. By Lemma 1, it is equivalent to minimizing the norm of the average gradients:
122
+
123
+ $$
124
+ \underset { \phi } { \mathrm { m i n i m i z e } } \ \mathbb { E } _ { \mathbf { s } , \mathbf { a } \sim \mathcal { D } } \left[ \left. \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \nabla _ { \mathbf { a } } Q _ { \phi _ { i } } ( \mathbf { s } , \mathbf { a } ) , \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \nabla _ { \mathbf { a } } Q _ { \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right. \right] .
125
+ $$
126
+
127
+ With simple modification, we can reformulate Equation (4) as diversifying the gradients of each Q-function network for in-distribution actions:
128
+
129
+ $$
130
+ \operatorname* { m i n i m i z e } J _ { \mathrm { E S } } ( Q _ { \phi } ) : = \mathbb { E } _ { { \bf s } , { \bf a } \sim \mathcal { D } } \left[ \frac { 1 } { N - 1 } \sum _ { 1 \leq i \neq j \leq N } \underbrace { \left. \nabla _ { { \bf a } } Q _ { \phi _ { i } } ( { \bf s } , { \bf a } ) , \nabla _ { { \bf a } } Q _ { \phi _ { j } } ( { \bf s } , { \bf a } ) \right. } _ { \mathrm { E S } _ { \phi _ { i } , \phi _ { j } } ( { \bf s } , { \bf a } ) } \right] .
131
+ $$
132
+
133
+ Concretely, our final objective can be interpreted as measuring the pairwise alignment of the gradients using cosine similarity, which we denote as the Ensemble Similarity (ES) metric $\mathrm { E S } _ { \phi _ { i } , \phi _ { j } } ( \mathbf { s } , \mathbf { a } )$ , and minimizing the ES values for every pair in the Q-ensemble with regard to the dataset state-actions. The illustration of the ensemble gradient diversification is shown in Figure 3b. Note that we instead maximize the total variance to reduce the computational burden. Nevertheless, the modified objective is closely related to maximizing the smallest eigenvalue. The detailed explanation can be found in Appendix A.2.
134
+
135
+ We name the resulting actor-critic algorithm as Ensemble-Diversified Actor Critic (EDAC) and present the detailed procedure in Algorithm 1 (differences with the original SAC algorithm marked in blue). Note that Algorithm 1 reduces to SAC- $N$ when $\eta = 0$ , and further reduces to vanilla SAC when also $N = 2$ .
136
+
137
+ # 5 Experiments
138
+
139
+ We evaluate our proposed methods against the previous offline RL algorithms on the standard D4RL benchmark [9] . Concretely, we perform our evaluation on MuJoCo Gym (Section 5.1) and Adroit
140
+
141
+ 1: Initialize policy parameters $\theta$ , Q-function parameters $\{ \phi _ { j } \} _ { j = 1 } ^ { N }$ , target Q-function parameters $\{ \phi _ { j } ^ { \prime } \} _ { j = 1 } ^ { N }$ , and offline data replay buffer $\mathcal { D }$
142
+
143
+ # 2: repeat
144
+
145
+ 3: Sample a mini-batch $B = \{ ( \mathbf { s } , \mathbf { a } , r , \mathbf { s } ^ { \prime } ) \}$ from $\mathcal { D }$
146
+
147
+ 4: Compute target Q-values (shared by all Q-functions):
148
+
149
+ $$
150
+ y ( r , \mathbf { s } ^ { \prime } ) = r + \gamma \left( \operatorname* { m i n } _ { j = 1 , \dots , N } Q _ { \phi _ { j } ^ { \prime } } \left( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } \right) - \beta \log \pi _ { \theta } \left( \mathbf { a } ^ { \prime } \mid \mathbf { s } ^ { \prime } \right) \right) , \quad \mathbf { a } ^ { \prime } \sim \pi _ { \theta } \left( \cdot \mid \mathbf { s } ^ { \prime } \right)
151
+ $$
152
+
153
+ 5: Update each Q-function $Q _ { \phi _ { i } }$ with gradient descent using
154
+
155
+ $$
156
+ \nabla _ { \phi _ { i } } \frac { 1 } { \left| B \right| } \sum _ { ( \mathbf { s } , \mathbf { a } , r , \mathbf { s } ^ { \prime } ) \in B } \left( \left( Q _ { \phi _ { i } } \left( \mathbf { s } , \mathbf { a } \right) - y \left( r , \mathbf { s } ^ { \prime } \right) \right) ^ { 2 } + \frac { \eta } { N - 1 } \sum _ { 1 \leq i \neq j \leq N } \mathrm { E S } _ { \phi _ { i } , \phi _ { j } } ( \mathbf { s } , \mathbf { a } ) \right)
157
+ $$
158
+
159
+ 6: Update policy with gradient ascent using
160
+
161
+ $$
162
+ \nabla _ { \boldsymbol { \theta } } \frac { 1 } { \left| \boldsymbol { B } \right| } \sum _ { \mathbf { s } \in \boldsymbol { B } } \left( \operatorname* { m i n } _ { j = 1 , \dots , N } Q _ { \phi _ { j } } \left( \mathbf { s } , \tilde { \mathbf { a } } _ { \boldsymbol { \theta } } ( \mathbf { s } ) \right) - \beta \log \pi _ { \boldsymbol { \theta } } \left( \tilde { \mathbf { a } } _ { \boldsymbol { \theta } } ( \mathbf { s } ) \mid \mathbf { s } \right) \right) ,
163
+ $$
164
+
165
+ where $\tilde { \mathbf { a } } _ { \theta } ( \mathbf { s } )$ is a sample from $\pi _ { \boldsymbol { \theta } } ( \cdot \mid \mathbf { s } )$ which is differentiable w.r.t. $\theta$ via the reparametrization trick.
166
+
167
+ 7: Update target networks with $\phi _ { i } ^ { \prime } \rho \phi _ { i } ^ { \prime } + ( 1 - \rho ) \phi _ { i }$ (Section 5.2) domains. We consider the following baselines: SAC, the backbone algorithm of our method, CQL, the previous state-of-the-art on the D4RL benchmark, REM [2], an offline RL method which utilized Q-network ensemble on discrete control environments, and BC, the behavior cloning method. We evaluate each method under the normalized average return metric where the average return is scaled such that 0 and 100 each equals the performance of a random policy and an online expert policy. In addition to the performance evaluation, we compare the computational cost of each method (Section 5.3). For the implementation details of our algorithm and the baselines, please refer to Appendix B and C. Also, we provide more experiments such as comparison with more baselines, CQL with $N$ Q-networks, and hyperparameter sensitivity from Appendix E to H. The code is available online3.
168
+
169
+ # 5.1 Evaluation on D4RL MuJoCo Gym tasks
170
+
171
+ We first evaluate each method on D4RL MuJoCo Gym tasks which consist of three environments, halfcheetah, hopper, and walker2d, each with six datasets from different data-collecting policies. In detail, the considered policies are random: a uniform random policy, expert: a fully trained online expert, medium: a suboptimal policy with approximately 1/3 the performance of the expert, medium-expert: a mixture of medium and expert policies, medium-replay: the replay buffer of a policy trained up to the performance of the medium agent, and full-replay: the final replay buffer of the expert policy. Each dataset consists of 1M transitions except for medium-expert and medium-replay.
172
+
173
+ The experiment results in Table 1 show EDAC and SAC- $N$ both outperform or are competitive with the previous state-of-the-art on all of the tasks considered. Notably, the performance gap is especially high for random, medium, and medium-replay datasets, where the performances of the previous works are relatively low. Both the proposed methods achieve average normalized scores over 80, reducing the gap with the online expert by $40 \%$ compared to CQL. While the performance of EDAC is marginally better than the performance of SAC- $N$ , EDAC achieves this result with a much smaller Q-ensemble size. As noted in Figure 5, on hopper tasks, SAC- $N$ requires 200 to $5 0 0 \mathrm { Q }$ -networks, while EDAC requires less than 50.
174
+
175
+ Figure 6 compares the distance between the actions chosen by each method and the dataset actions. Concretely, we measure $\mathbb { E } _ { ( \mathbf { s } , \mathbf { a } ) \sim \mathcal { D } , \hat { \mathbf { a } } \sim \pi _ { \boldsymbol { \theta } } ( \cdot | \mathbf { s } ) } [ | \hat { \mathbf { a } } - \mathbf { a } | | _ { 2 } ^ { 2 } ]$ for EDAC, SAC- $N$ , CQL, SAC-2, and a random policy on $^ *$ -medium datasets. We find that our proposed methods choose from a more diverse range of actions compared to CQL. This shows the advantage of the uncertainty-based penalization which considers the prediction confidence other than penalizing all OOD actions.
176
+
177
+ Table 1: Normalized average returns on D4RL Gym tasks, averaged over 4 random seeds. CQL (Paper) denotes the results reported in the original paper.
178
+
179
+ <table><tr><td>Task Name</td><td>BC</td><td>SAC</td><td>REM</td><td>CQL (Paper)</td><td>CQL (Reproduced)</td><td>SAC-N (Ours)</td><td>EDAC (Ours)</td></tr><tr><td>halfcheetah-random</td><td>2.2±0.0</td><td>29.7±1.4</td><td>-0.8±1.1</td><td>35.4</td><td>31.3±3.5</td><td>28.0±0.9</td><td>28.4±1.0</td></tr><tr><td>halfcheetah-medium</td><td>43.2±0.6</td><td>55.2±27.8</td><td>-0.8±1.3</td><td>44.4</td><td>46.9±0.4</td><td>67.5±1.2</td><td>65.9±0.6</td></tr><tr><td>halfcheetah-expert</td><td>91.8±1.5</td><td>-0.8±1.8</td><td>4.1±5.7</td><td>104.8</td><td>97.3±1.1</td><td>105.2±2.6</td><td>106.8±3.4</td></tr><tr><td>halfcheetah-medium-expert</td><td>44.0±1.6</td><td>28.4±19.4</td><td>0.7±3.7</td><td>62.4</td><td>95.0±1.4</td><td>107.1±2.0</td><td>106.3±1.9</td></tr><tr><td>halfcheetah-medium-replay</td><td>37.6±2.1</td><td>0.8±1.0</td><td>6.6±11.0</td><td>46.2</td><td>45.3±0.3</td><td>63.9±0.8</td><td>61.3±1.9</td></tr><tr><td>halfcheetah-full-replay</td><td>62.9±0.8</td><td>86.8±1.0</td><td>27.8±35.4</td><td>-</td><td>76.9±0.9</td><td>84.5±1.2</td><td>84.6±0.9</td></tr><tr><td>hopper-random</td><td>3.7±0.6</td><td>9.9±1.5</td><td>3.4±2.2</td><td>10.8</td><td>5.3±0.6</td><td>31.3±0.0</td><td>25.3±10.4</td></tr><tr><td>hopper-medium</td><td>54.1±3.8</td><td>0.8±0.0</td><td>0.7±0.0</td><td>86.6</td><td>61.9±6.4</td><td>100.3±0.3</td><td>101.6±0.6</td></tr><tr><td>hopper-expert</td><td>107.7±9.7</td><td>0.7±0.0</td><td>0.8±0.0</td><td>109.9</td><td>106.5±9.1</td><td>110.3±0.3</td><td>110.1±0.1</td></tr><tr><td>hopper-medium-expert</td><td>53.9±4.7</td><td>0.7±0.0</td><td>0.8±0.0</td><td>111.0</td><td>96.9±15.1</td><td>110.1±0.3</td><td>110.7±0.1</td></tr><tr><td>hopper-medium-replay</td><td>16.6±4.8</td><td>7.4±0.5</td><td>27.5±15.2</td><td>48.6</td><td>86.3±7.3</td><td>101.8±0.5</td><td>101.0±0.5</td></tr><tr><td>hopper-full-replay</td><td>19.9±12.9</td><td>41.1±17.9</td><td>19.7±24.6</td><td>-</td><td>101.9±0.6</td><td>102.9±0.3</td><td>105.4±0.7</td></tr><tr><td>walker2d-random</td><td>1.3±0.1</td><td>0.9±0.8</td><td>6.9±8.3</td><td>7.0</td><td>5.4±1.7</td><td>21.7±0.0</td><td>16.6±7.0</td></tr><tr><td>walker2d-medium</td><td>70.9±11.0</td><td>-0.3±0.2</td><td>0.2±0.7</td><td>74.5</td><td>79.5±3.2</td><td>87.9±0.2</td><td>92.5±0.8</td></tr><tr><td>walker2d-expert</td><td>108.7±0.2</td><td>0.7±0.3</td><td>1.0±2.3</td><td>121.6</td><td>109.3±0.1</td><td>107.4±2.4</td><td>115.1±1.9</td></tr><tr><td>walker2d-medium-expert</td><td>90.1±13.2</td><td>1.9±3.9</td><td>-0.1±0.0</td><td>98.7</td><td>109.1±0.2</td><td>116.7±0.4</td><td>114.7±0.9</td></tr><tr><td>walker2d-medium-replay</td><td>20.3±9.8</td><td>-0.4±0.3</td><td>12.5±6.2</td><td>32.6</td><td>76.8±10.0</td><td>78.7±0.7</td><td>87.1±2.3</td></tr><tr><td>walker2d-full-replay</td><td>68.8±17.7</td><td>27.9±47.3</td><td>-0.2±0.3</td><td>-</td><td>94.2±1.9</td><td>94.6±0.5</td><td>99.8±0.7</td></tr><tr><td>Average</td><td>49.9</td><td>16.2</td><td>6.2</td><td>-</td><td>73.7</td><td>84.5</td><td>85.2</td></tr></table>
180
+
181
+ ![](images/8cc13d52b0b3edcc798dadfe4273b9dde139c1cec3b4cc0c697de114ee27b598.jpg)
182
+ Figure 5: Minimum number of Q-ensembles $( N )$ required to achieve the performance reported in Table 1. M-E denotes medium-expert. We omit the results of medium-replay and full-replay as SAC- $. N$ already works well with a small number of ensembles (less than or equal to 5). For more details of the experiment, please refer to Appendix C.
183
+
184
+ ![](images/1116de177c49343d5cd95d790cc9fd29db3d3f213b6f83a11e54c2cb38f4d694.jpg)
185
+ Figure 6: Histograms of the distances between the actions from each methods (EDAC, SAC- $N$ , CQL, SAC-2, and a random policy) and the actions from the dataset. For more details of the experiment, please refer to Appendix C.
186
+
187
+ # 5.2 Evaluation on D4RL Adroit tasks
188
+
189
+ We also experiment on the more complex D4RL Adroit tasks that require controlling a 24-DoF robotic hand to perform tasks such as aligning a pen, hammering a nail, opening a door, or relocating a ball. We use two types of datasets for each environment: human, containing 25 trajectories of human demonstrations, and cloned, a 50-50 mixture between the demonstration data and the behavioral cloned policy on the demonstrations. Note that for the Adroit tasks, we could not reproduce the CQL results from the paper completely. For the detailed procedure of reproducing the results of CQL, please refer to Appendix D.
190
+
191
+ Table 2: Normalized average returns on D4RL Adroit tasks, averaged over 4 random seeds.
192
+
193
+ <table><tr><td>Task Name</td><td>BC</td><td>SAC</td><td>REM</td><td>CQL (Paper)</td><td>CQL (Reproduced)</td><td>SAC-N (Ours)</td><td>EDAC (Ours)</td></tr><tr><td>pen-human</td><td>25.8±8.8</td><td>4.3±3.8</td><td>5.4±4.3</td><td>55.8</td><td>35.2±6.6</td><td>9.5±1.1</td><td>52.1±8.6</td></tr><tr><td>hammer-human</td><td>3.1±3.2</td><td>0.2±0.0</td><td>0.3±0.0</td><td>2.1</td><td>0.6±0.5</td><td>0.3±0.0</td><td>0.8±0.4</td></tr><tr><td>door-human</td><td>2.8±0.7</td><td>-0.3±0.0</td><td>-0.3±0.0</td><td>9.1</td><td>1.2±1.8</td><td>-0.3±0.0</td><td>10.7±6.8</td></tr><tr><td>relocate-human</td><td>0.0±0.0</td><td>-0.3±0.0</td><td>-0.3±0.0</td><td>0.35</td><td>0.0±0.0</td><td>-0.1±0.1</td><td>0.1±0.1</td></tr><tr><td>pen-cloned</td><td>38.3±11.9</td><td>-0.8±3.2</td><td>-1.0±0.1</td><td>40.3</td><td>27.2±11.3</td><td>64.1±8.7</td><td>68.2±7.3</td></tr><tr><td>hammer-cloned</td><td>0.7±0.3</td><td>0.1±0.1</td><td>-0.3±0.0</td><td>5.7</td><td>1.4±2.1</td><td>0.2±0.2</td><td>0.3±0.0</td></tr><tr><td>door-cloned</td><td>0.0±0.0</td><td>-0.3±0.1</td><td>-0.3±0.0</td><td>3.5</td><td>2.4±2.4</td><td>-0.3±0.0</td><td>9.6±8.3</td></tr><tr><td>relocate-cloned</td><td>0.1±0.0</td><td>-0.1±0.1</td><td>-0.2±0.2</td><td>-0.1</td><td>0.0±0.0</td><td>0.0±0.0</td><td>0.0±0.0</td></tr></table>
194
+
195
+ The evaluation results are summarized in Table 2. For pen- $^ { \ast }$ tasks, where the considered algorithms achieve meaningful performance, EDAC outperforms or matches with the previous state-of-the-art. Especially, for pen-cloned, both EDAC and SAC- $. N$ achieve $7 5 \%$ higher score compared to CQL. Unlike the results from the Gym tasks, we find that SAC- $N$ falls behind in some datasets, for example, pen-human, which could in part due to the size of the dataset being exceptionally small (5000 transitions). However, our method with ensemble diversification successfully overcomes this difficulty.
196
+
197
+ # 5.3 Computational cost comparison
198
+
199
+ We compared the computational cost of our methods with vanilla SAC and CQL on hopper-medium-v2, where our methods require the largest number of Q-networks. For each method, we measure the runtime per training epoch (1000 gradient steps) along with GPU memory consumption. We run our experiments on a single machine with one RTX 3090 GPU and provide the results in Table 3.
200
+
201
+ Table 3: Computational costs of each method.
202
+
203
+ <table><tr><td></td><td>Runtime (s/epoch)</td><td>GPU Mem. (GB)</td></tr><tr><td>SAC</td><td>21.4</td><td>1.3</td></tr><tr><td>CQL</td><td>38.2</td><td>1.4</td></tr><tr><td>SAC-500</td><td>44.1</td><td>5.1</td></tr><tr><td>EDAC</td><td>30.8</td><td>1.8</td></tr></table>
204
+
205
+ As the result shows, our method EDAC runs faster than CQL with comparable memory consumption. Note that CQL is about twice as slower than vanilla SAC due to the additional computations for Q-value regularization (e.g., dual update and approximate logsumexp via sampling). Meanwhile, the inference to the Q-network ensemble in SAC- $N$ and EDAC is embarrassingly parallelizable, minimizing the runtime increase with the number of Q-networks. Also, we emphasize that our gradient diversification term in Equation (4) has linear computational complexity, as we can reformulate the term using the sum of the gradients.
206
+
207
+ # 6 Related Works
208
+
209
+ Model-free offline RL A popular approach for offline RL is to regularize the learned policy to be close to the behavior policy where the offline dataset was collected. BCQ [11] uses a generative model to produce actions with high similarity to the dataset and trains a restricted policy to choose the best action from the neighborhood of the generated actions. Another line of work, such as BEAR [15] or BRAC [28], stabilizes policy learning by penalizing the divergence from the dataset measured by KL divergence or MMD. While these policy-constraint methods demonstrate high performance on datasets from expert behavior policies, they fail to find optimal policies from datasets with suboptimal policies due to the strict policy constraints [9]. Also, these methods require an accurate estimation of the behavior policy, which might be difficult in complex settings with multiple behavior sources or high-dimensional environments. To address these issues, CQL [16] directly regularizes Q-functions by introducing a term that minimizes the Q-values for out-of-distribution actions and maximizes the Q-values for in-distribution actions. Without such explicit regularizations, REM [2] proposes to use a random convex combination of Q-network ensembles on environments with discrete action spaces [4].
210
+
211
+ Estimation bias in Q-learning While Q-learning is one of the most popular algorithms in reinforcement learning, it suffers from overestimation bias due to the maximum operation $\mathrm { m a x } _ { \mathbf { a } ^ { \prime } \in \mathcal { A } } Q ( \mathbf { s } ^ { \prime } , \mathbf { a } ^ { \prime } )$ used during Q-function updates [10, 25]. This overestimation bias, together with the bootstrapping, can lead to a catastrophic build-up of errors during the Q-learning process. To resolve this issue, TD3 [10] introduces a clipped version of Double Q-learning [25] that takes the minimum value of two critics. Subsequently, Maxmin Q-learning [17] theoretically shows that the overestimation bias can be controlled by the number of ensembles in the clipped Q-learning. The overestimation problem in Q-learning can be exacerbated in the offline setting since the extrapolation error cannot be corrected with further interactions with the environment, and existing offline RL algorithms handle the bias by introducing constrained policy optimization [11, 15] or conservative Q-learning frameworks [16].
212
+
213
+ Uncertainty measures in RL Uncertainty estimates have been widely used in RL for various purposes including exploration, Q-learning, and planning. Bootstrapped DQN [21] leverages an ensemble of Q-functions to quantify the uncertainty of the Q-value, and utilizes it for efficient exploration. Following this work, the UCB exploration algorithm [5] constructs an upper confidence bound [3] of the Q-values using the empirical mean and standard deviation of Q-ensembles, which is used to promote efficient exploration by applying the principle of optimism in the face of uncertainty [7]. Osband et al. [22] proposes a randomly initialized Q-ensemble that reflects the concept of prior functions in Bayesian inference and Abbas et al. [1] introduces an uncertainty incorporated planning with imperfect models. The notion of uncertainty has also been considered in offline RL, mostly in the framework of model-based offline RL. Especially, MOPO [29] and MOReL [13] measure the uncertainty of the model’s prediction to formulate an uncertainty-penalized policy optimization problem in the offline RL setting. These methods introduce an ensemble of dynamics models for the quantification of the uncertainty, whereas our work adopts an ensemble of Q-functions for uncertainty-aware Q-learning.
214
+
215
+ # 7 Conclusion
216
+
217
+ We have shown that clipped Q-learning can be efficiently leveraged to construct an uncertaintybased offline RL method that outperforms previous methods on various datasets. Based on this observation, we proposed Ensemble-Diversifying Actor-Critic (EDAC) that effectively reduces the required number of ensemble networks for quantifying and penalizing the epistemic uncertainty. Our method does not require any explicit estimation of the data collecting policy or sampling from the out-of-distribution data and respects the epistemic uncertainty of each data point during penalization. EDAC, while requiring up to $90 \%$ less number of ensemble networks compared to the vanilla Q-ensemble, exhibits state-of-the-art performance on various datasets.
218
+
219
+ # Acknowledgements
220
+
221
+ This work was supported in part by Samsung Advanced Institute of Technology, Samsung Electronics Co., Ltd., Institute of Information & Communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 2020-0-00882, (SW STAR LAB) Development of deployable learning intelligence via self-sustainable and trustworthy machine learning and No. 2019- 0-01371, Development of brain-inspired AI with human-like intelligence), and Research Resettlement Fund for the new faculty of Seoul National University. This material is based upon work supported by the Air Force Office of Scientific Research under award number FA2386-20-1-4043. Hyun Oh Song is the corresponding author.
222
+
223
+ # References
224
+
225
+ [1] Zaheer Abbas, Samuel Sokota, Erin Talvitie, and Martha White. Selective dyna-style planning under limited model capacity. In ICML, 2020.
226
+ [2] Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In ICML, 2020.
227
+ [3] Jean-Yves Audibert, Rémi Munos, and Csaba Szepesvári. Exploration–exploitation tradeoff using variance estimates in multi-armed bandits. Theoretical Computer Science, 410(19): 1876–1902, 2009.
228
+ [4] Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013.
229
+ [5] Richard Y Chen, Szymon Sidor, Pieter Abbeel, and John Schulman. Ucb exploration via q-ensembles. arXiv preprint arXiv:1706.01502, 2017.
230
+ [6] Xinshi Chen, Shuang Li, Hui Li, Shaohua Jiang, and Le Song. Generative adversarial user model for reinforcement learning based recommendation system. In ICML, 2019.
231
+ [7] Kamil Ciosek, Quan Vuong, Robert Loftin, and Katja Hofmann. Better exploration with optimistic actor-critic. In NeurIPS, 2019.
232
+ [8] William R Clements, Bastien Van Delft, Benoît-Marie Robaglia, Reda Bahi Slaoui, and Sébastien Toth. Estimating risk and uncertainty in deep reinforcement learning. arXiv preprint arXiv:1905.09638, 2019.
233
+ [9] 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.
234
+ [10] Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actor-critic methods. In ICML, 2018.
235
+ [11] Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In ICML, 2019.
236
+ [12] Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In ICML, 2018.
237
+ [13] Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Model-based offline reinforcement learning. In NeurIPS, 2020.
238
+ [14] Vijay R Konda and John N Tsitsiklis. Actor-critic algorithms. In NeurIPS, 2000.
239
+ [15] Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In NeurIPS, 2019.
240
+ [16] Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. In NeurIPS, 2020.
241
+ [17] Qingfeng Lan, Yangchen Pan, Alona Fyshe, and Martha White. Maxmin q-learning: Controlling the estimation bias of q-learning. In ICLR, 2020.
242
+ [18] Kimin Lee, Michael Laskin, Aravind Srinivas, and Pieter Abbeel. Sunrise: A simple unified framework for ensemble learning in deep reinforcement learning. In ICML, 2021.
243
+ [19] 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.
244
+ [20] 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.
245
+ [21] Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In NeurIPS, 2016.
246
+ [22] Ian Osband, John Aslanides, and Albin Cassirer. Randomized prior functions for deep reinforcement learning. In NeurIPS, 2018.
247
+ [23] JP Royston. Expected normal order statistics(exact and approximate). Applied Statistics, 31(2): 161–5, 1982.
248
+ [24] Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. arXiv preprint arXiv:1206.2944, 2012.
249
+ [25] Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double q-learning. In AAAI, 2016.
250
+ [26] Oriol Vinyals, Igor Babuschkin, Junyoung Chung, Michael Mathieu, Max Jaderberg, Wojciech M Czarnecki, Andrew Dudzik, Aja Huang, Petko Georgiev, Richard Powell, et al. Alphastar: Mastering the real-time strategy game starcraft ii. DeepMind blog, 2, 2019.
251
+ [27] David S Watkins. Understanding the qr algorithm. SIAM review, 24(4):427–440, 1982.
252
+ [28] Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
253
+ [29] Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. Mopo: Model-based offline policy optimization. In NeurIPS, 2020.
md/train/b4YiFnQH3gN/b4YiFnQH3gN.md ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CAFE: Catastrophic Data Leakage in Vertical Federated Learning
2
+
3
+ Xiao Jin Rensselaer Polytechnic Institute jinx2@rpi.edu
4
+
5
+ Pin-Yu ChenIBM Researchpin-yu.chen@ibm.com
6
+
7
+ Chia-Yi Hsu National Yang Ming Chiao Tung University chiayihsu $8 3 1 5 @$ gmail.com
8
+
9
+ Chia-Mu Yu National Yang Ming Chiao Tung University chiamuyu@gmail.com
10
+
11
+ Tianyi Chen Rensselaer Polytechnic Institute chent18@rpi.edu
12
+
13
+ # Abstract
14
+
15
+ Recent studies show that private training data can be leaked through the gradients sharing mechanism deployed in distributed machine learning systems, such as federated learning (FL). Increasing batch size to complicate data recovery is often viewed as a promising defense strategy against data leakage. In this paper, we revisit this defense premise and propose an advanced data leakage attack with theoretical justification to efficiently recover batch data from the shared aggregated gradients. We name our proposed method as catastrophic data leakage in vertical federated learning (CAFE). Comparing to existing data leakage attacks, our extensive experimental results on vertical FL settings demonstrate the effectiveness of CAFE to perform large-batch data leakage attack with improved data recovery quality. We also propose a practical countermeasure to mitigate CAFE. Our results suggest that private data participated in standard FL, especially the vertical case, have a high risk of being leaked from the training gradients. Our analysis implies unprecedented and practical data leakage risks in those learning settings. The code of our work is available at https://github.com/DeRafael/CAFE.
16
+
17
+ # 1 Introduction
18
+
19
+ Federated learning (FL) $\mathbb { B } \mathbb { B }$ is an emerging machine learning framework where a central server and multiple workers collaboratively train a machine learning model. Some existing FL methods consider the setting where each worker has data of a different set of subjects but sharing common features. This setting is also referred to data partitioned or horizontal FL (HFL). Unlike the HFL setting, in many learning scenarios, multiple workers handle data about the same set of subjects, but each has a different set of features. This case is common in finance and healthcare applications [6]. In these examples, data owners (e.g., financial institutions and hospitals) have different records of those users in their joint user base, and so, by combining their features through FL, they can establish a more accurate model. We refer to this setting as feature-partitioned or vertical FL (VFL).
20
+
21
+ Compared with existing distributed learning paradigms, FL raises new challenges including data heterogeneity and privacy $\left[ \left[ 2 0 \right] \right]$ . To protect data privacy, only model parameters and the change of parameters (e.g., gradients) are exchanged between server and workers [19, 15]. Recent works have studied how a malicious worker can embed backdoors or replace the global model in FL [2, 3, 27]. Furthermore, as exchanging gradients is often viewed as privacy-preserving protocols, little attention has been paid to information leakage from public shared gradients and batch identities.
22
+
23
+ In the context of data security and AI ethics, the possibility of inferring private user data from the gradients in FL has received growing interests [10, 14, 21], known as the data leakage problems.
24
+
25
+ ![](images/2eb9a963a9a9a54f822632455758f7a57ec430880008974da1ed7ffe23897908.jpg)
26
+ Figure 1: Visual comparison between CAFE (our method) with the state-of-the-art data leakage attacks including DLG [32], Cosine similarity $\mathbb { \ m }$ , SAPAG $\mathbb { \left[ \left[ 2 5 \right] \right] }$ , BN regularzier $\left[ \left[ 2 9 \right] \right]$ and GC regularizer $\left[ \left[ 2 9 \right] \right]$ on Linnaeus 5 in VFL (4 workers, batch size $= 4 0$ and batch ratio $= 0 . 0 5$ ).
27
+
28
+ Previous works have made exploratory efforts on data recovery through gradients. See Section 2 and Table 1 for details. However, existing approaches often have the limitation of scaling up large-batch data recovery and are lacking in theoretical justification on the capability of data recovery, which may give a false sense of security that increasing the data batch size during training can prevent data leakage $\textcircled { \lvert 3 0 \rvert }$ . Some recent works provide sufficient conditions for guaranteed data recovery, but the assumptions are overly restrictive and can be sometimes impractical, such as requiring the number of classes to be much larger than the number of recovered data samples [29].
29
+
30
+ To enhance scalability in data recovery and gain fundamental understanding on data leakage in VFL, in this paper we propose an advanced data leakage attack with theoretical analysis on the data recovery performance, which we call catastrophic data leakage in vertical federated learning (CAFE). As an illustration, Figure 1 demonstrates the effectiveness of CAFE for large-batch data recovery compared to existing methods. The contributions of this paper are summarized as follows.
31
+
32
+ C1) We develop a new data leakage attack named CAFE to overcome the limitation of current data leakage attacks on VFL. Leveraging the novel use of data index and internal representation alignments in VFL, CAFE is able to recover large-scale data in general VFL protocols.
33
+ C2) We provide theoretical guarantees on the recovery performance of CAFE, which permeates three steps of CAFE: (I) recovering gradients of loss with respect to the outputs of the first fully connected (FC) layer; (II) recovering inputs to the first FC layer; (III) recovering the original data.
34
+ C3) To mitigate the data leakage attack by CAFE, we develop a defense strategy which leverages the fake gradients and preserves the model training performance.
35
+ C4) We conduct extensive experiments on both static and dynamic VFL training settings to validate the superior data recovery performance of CAFE over state-of-the-art methods.
36
+
37
+ # 2 Related Work
38
+
39
+ Recovering private training data from gradients has gained growing interests in FL. Recently, a popular method termed deep leakage from gradients (DLG) $\left[ \left[ 3 2 \right] \right]$ has been developed to infer training data in an efficient way without using any generative models or prior information. However, DLG lacks generalizability on model architecture and weight distribution initialization $\mathbb { \left[ \left. 2 5 \right] \right. }$ . In $\pmb { \mathbb { B } } 0 \|$ , an analytical approach has been developed to extract accurate labels from the gradients. In $\mathbb { m }$ , another analytical approach has been developed to derive the inputs before a fully connected (FC) layer. However, in $\dot { \left[ \mathrm { l i l l } \right] }$ , their method only works on a single sample input and fails to extend on a batch of data. In $\pmb { \Vert 2 2 \Vert }$ , a new approach has been developed by recovering the batch inputs before the FC layer through solving linear equations. However, strong assumptions have been made for solving the equations and cannot guarantee data recovery in more general cases. In $\bigstar \bigstar$ , it is claimed that a convolutional layer can always be converted to a FC layer. However, the gradients of the original convolutional layer are still different from the gradients of the converted FC layer, which impedes data recovery. Besides the new loss function proposed in $[ \equiv 1 ]$ , several previous works design new loss functions or regularizers based on DLG and try to make their algorithms work on more general models and weight distribution initialization. In $\bar { \| 2 5 \| }$ , a new Gaussian kernel based gradient difference is used as the distance measure. In $\textcircled { \scriptsize { 1 3 1 } }$ , a recursive method attack procedure has been developed to recover data from gradients. However, in both $\mathbb { \left. \boldsymbol { \Sigma } \boldsymbol { \bar { \Sigma } } \right. }$ and $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ , the quality of recovery on batch data is degraded. A recent work $\left[ \left[ 2 9 \right] \right]$ proposes an algorithm named GradInversion to reconstruct images from noise based on given gradients. However, their theory and algorithm are mostly built on strong assumptions and empirical observations. Although they successfully reconstruct a batch of training data, the reported batch size is still no larger than 48.
40
+
41
+ Table 1: Comparison of CAFE with state-of-the-art data leakage attack methods in FL.
42
+
43
+ <table><tr><td>Method</td><td>Optimization terms</td><td>Reported maximal batch size</td><td>Training while attacking</td><td>Theoretical guarantee</td><td>Additional information other than gradients</td></tr><tr><td>DLG B2</td><td>l2 distance between real and fake gradients</td><td>8</td><td>No</td><td>No</td><td>No</td></tr><tr><td>iDLG 目</td><td>l2 distance</td><td>8</td><td>No</td><td>Yes</td><td>No</td></tr><tr><td>Inverting Gradients 自</td><td>Cosine similarity, TV norm</td><td>8 100 (Mostly unrecognizable)</td><td>Yes</td><td>Yes</td><td>Number of local updates</td></tr><tr><td>AFramework for Evaluating Gradient Leakage 26]</td><td>l2 distance, label based regualrizer</td><td>8</td><td>No</td><td>Yes</td><td>No</td></tr><tr><td>SAPAG[ 因</td><td>Gaussian kernel based funciton</td><td>8</td><td>No</td><td>No</td><td>No</td></tr><tr><td>R-GAP 目</td><td>recursive gradient loss</td><td>5</td><td>No</td><td>Yes</td><td>The rank of matrix A defined in [31</td></tr><tr><td>Theory oriented 22]</td><td>l2 distance, l1 distances of the recovered feature map</td><td>32</td><td>No</td><td>Yes</td><td>Number of Exclusive activated neurons</td></tr><tr><td>GradInversion29]</td><td>Fidelity regularizers, Group consistency regularizers</td><td>48</td><td>No</td><td>No</td><td>Batch size &lt;number of classes &amp; Non repeating labels in a batch</td></tr><tr><td>CAFE (ours)</td><td>l2 distance, TV norm, Internal representation norm</td><td>100 (our hardware limit)</td><td>Yes</td><td>Yes</td><td>Batch indices</td></tr></table>
44
+
45
+ # 3 CAFE: Catastrophic Data Leakage in Vertical Federated Learning
46
+
47
+ In this section, we will introduce some necessary background of VFL and present our novel attack method. We consider the attack scenario where a honest-but-curious server follows the regular VFL protocols but intends to recover clients’ private data based on the aggregated gradients. Our method is termed CAFE: Catastrophic data leakage in vertical federated learning. While CAFE can be applied to any type of data, without loss of generality, we use image datasets throughout the paper.
48
+
49
+ # 3.1 Preliminaries
50
+
51
+ VFL setting. FL can be categorized into horizontal and vertical FL settings $\mathbb { \left[ \left[ 1 6 \right] \right] }$ . In this paragraph, we provide necessary background of VFL. Consider a set of $M$ clients: $\mathcal { M } = \{ 1 , 2 , \dots , M \}$ . A dataset of $N$ samples $\mathcal { D } = \{ ( \mathbf { x } _ { n } , y _ { n } ) \} _ { n = 1 } ^ { N }$ are maintained by the $M$ local clients, where $n$ is the data index. Each client $m$ in $\mathcal { M }$ is associated with a unique features set. A certain data point ${ \bf { X } } _ { n }$ in $\mathcal { D }$ can be denoted by $\mathbf { x } _ { n } = [ \mathbf { x } _ { n , 1 } ^ { \top } , \mathbf { x } _ { n , 2 } ^ { \top } , \ldots , \mathbf { x } _ { n , M } ^ { \top } ] ^ { \top }$ where ${ \bf x } _ { n , m }$ is the $m$ -th partition of the $n$ -th sample vector. The label set $\{ y _ { n } \} _ { n = 1 } ^ { N }$ can be viewed as a special feature and is kept at the server or a certain local worker. Throughout this paper, we mainly study the VFL setting. CAFE can also be applied to HFL if the data indices of each randomly selected batch are known to workers during training.
52
+
53
+ Use case of VFL. VFL is suitable for cases where multiple data owners share the same data identity but their data differ in feature space. Use cases of VFL appear in finance, e-commerce, and health. For example, in medical industry, test results of the same patient from different medical institutions are required to diagnose whether the patient has a certain disease or not, but institutions tend not to share raw data. Figure 2 gives an example of VFL in medical industry.
54
+
55
+ Batch indices in each iteration. For a given batch size $K$ , we define a set of vectors with binary entries as ${ \mathcal { S } = \{ \mathbf { s } _ { 1 } , \mathbf { s } _ { 2 } , \dots , \mathbf { s } _ { i } , \dots \} }$ with $| S | = { \binom { \bar { N } } { K } }$ . For each vector $\mathbf { s } _ { i } \in \mathbb { R } ^ { N }$ in $s$ , its $n$ -th element ${ \mathbf s } _ { i } [ n ]$ can be either 0 or 1. There are in total $K$ enires of $\cdot _ { 1 } \cdot$ in $\mathbf { s } _ { i }$ . In each iteration $t$ , the server randomly selects one element from set $s$ denoted by $\mathbf { s } ^ { t }$ , where $\mathsf { \bar { s } } ^ { t } [ n ]$ is the nth element in $\mathbf { s } ^ { t }$ . The selected batch samples in the $t$ -th iteration are denoted by $\mathcal { D } ( \mathbf { s } ^ { t } ) = \{ \bar { ( } \bar { \mathbf { x } _ { n } } , y _ { n } \mathbf { ) } \vert \mathbf { s } ^ { t } [ n ] = 1 \}$ .
56
+
57
+ ![](images/584aa44df41bf7437f10749d505ef3bf910675e011e4af438b3ef47b5a87fcb8.jpg)
58
+ Figure 2: VFL among medical institutions
59
+
60
+ Loss function and gradients. We assume that the model is a neural network parameterized by $\Theta$ , where the first FC layer is parameterized by $\Theta _ { 1 } \in \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } }$ and its bias is $\mathbf { b } _ { 1 } \in \mathbb { R } ^ { \hat { d } _ { 2 } }$ . The loss function on the batch data $\mathcal { D } \dot { ( \mathbf { s } ^ { t } ) }$ and on the entire training data $\mathcal { D }$ is, respectively, denoted by
61
+
62
+ $$
63
+ \mathcal { L } ( \boldsymbol { \Theta } , \mathcal { D } ( \mathbf { s } ^ { t } ) ) : = \frac { 1 } { K } \sum _ { n = 1 } ^ { N } \mathbf { s } ^ { t } [ n ] \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { n } , y _ { n } ) \quad \mathrm { a n d } \quad \mathcal { L } ( \boldsymbol { \Theta } , \mathcal { D } ) : = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { n } , y _ { n } ) .
64
+ $$
65
+
66
+ The gradients of losses w.r.t. $\Theta$ is denoted as
67
+
68
+ $$
69
+ \nabla _ { \Theta } \mathcal { L } ( \Theta , \mathcal { D } ( \mathbf { s } ^ { t } ) ) : = \frac { \partial \mathcal { L } ( \Theta , \mathcal { D } ( \mathbf { s } ^ { t } ) ) } { \partial \Theta } = \frac { 1 } { K } \sum _ { n = 1 } ^ { N } \mathbf { s } ^ { t } [ n ] \frac { \partial \mathcal { L } ( \Theta , \mathbf { x } _ { n } , y _ { n } ) } { \partial \Theta } .
70
+ $$
71
+
72
+ And similarly, we define $\nabla _ { \Theta } \mathcal { L } ( \Theta , \mathcal { D } )$
73
+
74
+ # 3.2 Why large-batch data leakage attack is difficult?
75
+
76
+ We motivate the design of our algorithm by providing some intuition on why performing large-batch data leakage from aggregated gradients is difficult $\mathbb { \lVert 3 2 \rVert }$ . Assume that $K$ images are selected as the inputs for a certain learning iteration. We define the selected batch data as $\mathcal { D } ^ { \prime } = \{ ( \mathbf { x } _ { n } , y _ { n } ) \}$ . Likewise, the batched ‘recovered data’ is denoted by $\hat { \mathcal { D } } ^ { \prime } = \{ ( \hat { \bf x } _ { n } , \hat { y } _ { n } ) \}$ . Then the objective function is
77
+
78
+ $$
79
+ \hat { \boldsymbol D } ^ { \prime } = \arg \operatorname* { m i n } _ { \hat { \boldsymbol D } ^ { \prime } } \left\| \frac { 1 } { K } \sum _ { ( \mathbf x _ { n } , y _ { n } ) \in \mathcal { D } } \nabla _ { \Theta } \mathcal { L } ( \boldsymbol \Theta , \mathbf x _ { n } , y _ { n } ) - \frac { 1 } { K } \sum _ { ( \hat { \mathbf x } _ { n } , \hat { y } _ { n } ) \in \hat { \mathcal { D } } ^ { \prime } } \nabla _ { \Theta } \mathcal { L } ( \boldsymbol \Theta , \hat { \mathbf x } _ { n } , \hat { y } _ { n } ) \right\| ^ { 2 } .
80
+ $$
81
+
82
+ Note that in $( 3 )$ , the dimensions of the aggregated gradients is fixed. However, as $K$ increases, the cardinality of $\hat { \mathcal { D } } ^ { \prime }$ and $\mathcal { D } ^ { \prime }$ rise. When $K$ is sufficiently large, it will be more challenging to find the “right” solution $\hat { \mathcal { D } } ^ { \prime }$ of $( 3 )$ corresponding to the ground-truth dataset $\mathcal { D } ^ { \prime }$ . On the other hand, CAFE addresses this issue of large-batch data recovery by data index alignment (defined in next subsection), which can effectively exclude undesired solutions. We discuss a specific example in Appendix B.
83
+
84
+ # 3.3 CAFE implementation
85
+
86
+ The main idea of our algorithm is that we divide the entire data leakage attack procedure into several steps. Specifically, we fully recover the inputs to the first FC layers of the model that we term the internal representation with theoretical guarantee and use the internal representation as a learnt regularizer to help improve the performance of data leakage attack. During the process, to overcome the difficulty mentioned in Section $\underline { { \boldsymbol { \mathrm { 3 . 2 } } } }$ we fully use the batch data index known by the attacker in the VFL setting so that the system equation in $\textcircled { 3 }$ can be determined instead of undetermined.
87
+
88
+ ![](images/2567c1a1c3dba78f8a84d0ec8bb570f5a31141f1c1b572c8196955596eb0f2cd.jpg)
89
+ Figure 3: Overview of CAFE. The left part (blue box) performs the regular VFL protocol and the right part (red box) illustrates the main steps of CAFE.
90
+
91
+ ![](images/a90dbb5332cdc41c29c75e188ec7368a8883cf82625affa935c6ba7a0b453297.jpg)
92
+ Figure 4: Model structure in VFL.
93
+
94
+ Prerequisite: Notably, CAFE can be readily applied to existing VFL protocols where the batch data indices is assigned or other deep learning protocols as long as the batch data indices are given. In Figure 3, the blue box represents the VFL paradigm and the red box denotes the attack paradigm.
95
+
96
+ In a typical VFL process, the server sends public key to local workers and decides the data indices in each iteration of training and evaluation $\bar { \big \vert } \bar { \big \vert } , \bar { \big \vert } \bar { \big \vert }$ . During the training process, local workers exchange their intermediate results with others to compute gradients and upload them. Therefore, the server has access to both of the model parameters and their gradients. Since data are vertically partitioned among different workers, for each batch, the server (acting as the attacker) needs to send a data index or data id list to all the local workers to ensure that data with the same id sequence have been selected by each worker $\left[ \left[ 2 8 \right] \right]$ and we name this step as data index alignment. Data index alignment turns out to be an inevitable step in the vertical training process, which provides the server (the attacker) an opportunity to control the selected batch data indices.
97
+
98
+ In the rest of this subsection, we explain our algorithm CAFE in detail, which consists of three steps.
99
+
100
+ Step I: Recover the gradients of loss w.r.t the outputs of the first FC layer. As shown in Figure $^ { 4 , }$ for a certain data point ${ \bf { X } } _ { n }$ , we denote the inputs to the first FC layer as $\mathbf { h } _ { n } = h ( \mathbf { \Theta } _ { \mathbf { } } \mathbf { e } , \mathbf { x } _ { n } ) \in \mathbf { \bar { \mathbb { R } } } ^ { d _ { 1 } }$ where $h$ is the forward function and $\Theta _ { c }$ is the parameters before the first FC layer. Let ${ \bf u } _ { n }$ denote the outputs of the first FC layer in the neural network, given by
101
+
102
+ $$
103
+ { { \mathbf { u } } } _ { n } = \Theta _ { 1 } ^ { \top } { { \mathbf { h } } } _ { n } + { { \mathbf { b } } } _ { 1 } \in \mathbb { R } ^ { d _ { 2 } } .
104
+ $$
105
+
106
+ For the training data $\mathcal { D }$ , the corresponding inputs before the first FC layer are concatenated as $\mathbf { H } =$ $[ \mathbf { h } _ { 1 } , \mathbf { h } _ { 2 } , \ldots , \mathbf { h } _ { N } ^ { - } ] ^ { \top } \in \mathbb { R } ^ { N \times d _ { 1 } }$ and the corresponding outputs of the first FC layer are concatenated as ${ \mathbf { U } } = [ { \mathbf { u } } _ { 1 } , { \mathbf { u } } _ { 2 } , \ldots , { \mathbf { u } } _ { N } ] ^ { \top } \in \mathbb { R } ^ { N \times d _ { 2 } }$ . The gradients of loss w.r.t $\mathbf { U }$ can be denoted by
107
+
108
+ $$
109
+ \begin{array} { r l r } & { } & { \nabla _ { \mathbf { U } } \mathcal { L } ( \boldsymbol { \Theta } , \mathcal { D } ) = \displaystyle \frac { 1 } { N } [ \nabla _ { \mathbf { u } _ { 1 } } \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { 1 } , y _ { 1 } ) , \nabla _ { \mathbf { u } _ { 2 } } \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { 2 } , y _ { 2 } ) , \dots , \nabla _ { \mathbf { u } _ { N } } \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { N } , y _ { N } ) ] ^ { \top } } \\ & { } & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { } & { \displaystyle \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \frac { \partial \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { 1 } , y _ { 1 } ) } { \partial \mathbf { u } _ { 1 } } , \frac { \partial \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { 2 } , y _ { 2 } ) } { \partial \mathbf { u } _ { 2 } } , \dots , \frac { \partial \mathcal { L } ( \boldsymbol { \Theta } , \mathbf { x } _ { N } , y _ { N } ) } { \partial \mathbf { u } _ { N } } \Big ] ^ { \top } \in \mathbb { R } ^ { N \times d _ { 2 } } . } \end{array}
110
+ $$
111
+
112
+ For a batch of data in the $t$ -th iteration $\mathcal { D } ( \mathbf { s } ^ { t } )$ , we have
113
+
114
+ $$
115
+ \begin{array} { l } { \displaystyle \nabla _ { { \bf b } _ { 1 } } { \mathcal L } ( { \bf \Theta } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } ^ { t } ) \left. = \frac { 1 } { K } \sum _ { n = 1 } ^ { N } { \bf s } ^ { t } [ n ] \frac { \partial { \mathcal L } ( { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } , { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } _ { n } , y _ { n } } { \partial { \bf b } _ { 1 } } = \sum _ { n = 1 } ^ { N } { \bf s } ^ { t } [ n ] \frac { 1 } { K } \sum _ { z = 1 } ^ { N } { \bf s } ^ { t } [ z ] \frac { \partial { \mathcal L } ( { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } } \\ {\right) \displaystyle \quad \quad \quad } { \quad \quad } { \quad \quad } { \quad \quad } { \quad \quad } = \sum _ { n = 1 } ^ { N } { \bf s } ^ { t } [ n ] \nabla _ { { \bf u } _ { n } } { \mathcal L } ( { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } { \bf } \bf \end{array}
116
+ $$
117
+
118
+ Although we do not have access to $\nabla _ { \mathbf { U } } \mathcal { L } ( \mathbf { \Theta } \Theta , \mathcal { D } )$ as gradients are only given w.r.t. the model parameters, we can successfully recover it through an iterative optimization process.
119
+
120
+ Algorithm 2 Recover the inputs to the first FC layer $\mathbf { H }$ ( regular VFL and attacker )
121
+
122
+ <table><tr><td rowspan=1 colspan=2>Algorithm 1 Recover the gradients VuL(0,D)(regular VFLandattacker</td></tr><tr><td rowspan=1 colspan=1>6:</td><td></td></tr><tr><td rowspan=1 colspan=1>7:</td><td></td></tr><tr><td rowspan=1 colspan=1></td><td></td></tr><tr><td rowspan=1 colspan=1>8:</td><td></td></tr><tr><td rowspan=1 colspan=1>9:10:</td><td></td></tr><tr><td rowspan=1 colspan=1>11:</td><td rowspan=2 colspan=1>Server computes F1(V; st) in (Z)Server updates V with VvF1(V; st)</td></tr><tr><td rowspan=1 colspan=1>12:</td></tr></table>
123
+
124
+ 13: end for
125
+
126
+ <table><tr><td colspan="2">1: Given @,trained V, initialize H ~UN ×d2 2: for t = 1,2,...,T do</td></tr><tr><td>3: 4: 5: 6: 7:</td><td>Server select st from S. Server broadcasts ? and st to all workers for m = 1,2,..., M do Worker m takes real batch data Worker m exchanges intermediate results with other workers and computes V@L(@, D(st))</td></tr><tr><td>9: 10: 11:</td><td>end for Server computes V@1 L(Θ,D(st)) Server computes F2(H; st) in )</td></tr><tr><td>12:</td><td>Server updates H with VHF2(H; st)</td></tr></table>
127
+
128
+ 13: end for
129
+
130
+ # Algorithm 3 CAFE (Nested-loops)
131
+
132
+ <table><tr><td colspan="2">1: Given model parameters @,initialize V~ uNxd1,H~uNxdD={,n1 2:Run Algorithmsand2each for T iterations 3: for t =1,2,...,T do</td></tr><tr><td>4: 5:</td><td>Run Step 3-10 in Algorithml1lonce Server computes V@L(Θ,D(st))</td></tr><tr><td>6:</td><td>Server computes the fake global aggregated gra- dients VL(Θ,D(t))</td></tr><tr><td>7:</td><td>Server computes CAFE loss F3(D; st) in )</td></tr><tr><td>8:</td><td>Server updates D with VbF3(D; st)</td></tr></table>
133
+
134
+ 9: end for
135
+
136
+ # Algorithm 4 CAFE (Single-loop)
137
+
138
+ <table><tr><td colspan="2">1:Given model parameters @,initialize V~ uNxd1H~uNxdD={nn1 2: for t =1,2,...,T do</td></tr><tr><td>3: 4:</td><td>Run Step 3-10 in Algorithm 1 once Server computes V@L(@,D(st)) including Vb1L(②,D(st)), Vθ1L(Θ,D(st))</td></tr><tr><td>5: 6: 7: 8:</td><td>Run Step 11 - 12 in Algorithm 1 lonce Run Step 11 - 12 in Algorithm ② Jonce Server computes CAFE loss F3(D; st) in ) Server updates D with VbF3(D; st)</td></tr></table>
139
+
140
+ 9: end for
141
+
142
+ Specifically, we randomly initialize an estimate of $\nabla _ { \mathbf { U } } \mathcal { L } ( \mathbf { \Theta } \Theta , \mathcal { D } )$ denoted as $\mathbf { V }$ , e.g., ${ \textbf { V } } =$ $\left[ \mathbf { v } _ { 1 } , \mathbf { v } _ { 2 } , \ldots , \mathbf { v } _ { n } , \ldots , \mathbf { v } _ { N } \right] ^ { \top } \ \in \ \mathbb { R } ^ { N \times d _ { 2 } }$ , where $\begin{array} { r c l } { \mathbf { v } _ { n } } & { = } & { [ v _ { n , 1 } , v _ { n , 1 } , \hdots , v _ { n , d _ { 2 } } ] ^ { \top } \mathrm { ~ ~ \in ~ \mathbb ~ R ^ { } { d } _ { 2 } ~ } } \end{array}$ . Given $\nabla _ { { \mathbf { b } } _ { 1 } } \mathcal { L } ( \Theta , \mathcal { D } ( { \mathbf { s } } ^ { t } ) )$ , we recover $\nabla _ { \mathbf { U } } \mathcal { L } ( \mathbf { \Theta } \Theta , \mathcal { D } )$ by minimizing the following objective function
143
+
144
+ $$
145
+ \mathbf { V } ^ { * } = \arg \operatorname* { m i n } _ { \mathbf { V } } \underbrace { \mathbb { E } _ { { \mathbf { s } } _ { i } \sim \mathrm { U n i f } ( { \boldsymbol { S } } ) } \left[ \mathcal { F } _ { 1 } ( { \mathbf { V } } ; { \mathbf { s } } _ { i } ) \right] } _ { : = \mathcal { F } _ { 1 } ( \mathbf { V } ) } \mathrm { w i t h } \mathcal { F } _ { 1 } ( { \mathbf { V } } ; { \mathbf { s } } _ { i } ) : = \left\| { \mathbf { V } } ^ { \top } { \mathbf { s } } _ { i } - \nabla _ { { \mathbf { b } } _ { 1 } } \mathcal { L } ( \Theta , \mathcal { D } ( { \mathbf { s } } _ { i } ) ) \right\| _ { 2 } ^ { 2 } .
146
+ $$
147
+
148
+ In each iteration $t$ , the objective function of Step I is given by $\mathcal { F } _ { 1 } ( { \mathbf { V } } ; { \mathbf { s } } ^ { t } )$ .
149
+
150
+ The first step of CAFE is summarized in Algorithm 1, which enjoys the following guarantee.
151
+
152
+ Theorem 1. If $K < N$ , the objective function $\mathcal { F } _ { 1 } ( \mathbf { V } )$ in $( 7 )$ is strongly convex in $\mathbf { V }$ . For a fixed $\Theta$ , applying SGD to $\textcircled { 7 }$ guarantees the convergence to the ground truth almost surely.
153
+
154
+ When the batch size $K$ is smaller than the number of total data samples $N$ , the Hessian matrix of $\mathcal { F } _ { 1 } ( \mathbf { V } )$ is shown to be strongly convex in Appendix $\boxed { \mathsf { C } }$ and the convergence is guaranteed according to [23]. Step I is essential in CAFE because we separate the gradients of loss w.r.t each single input to the first FC layer from the aggregated gradients in this step.
155
+
156
+ Step II: Recover inputs to the first FC layer. Using the chain rule, we have $\nabla _ { \Theta _ { 1 } } \mathcal { L } ( \Theta , \mathcal { D } ) =$ $\begin{array} { r l r } { { \bf H } ^ { \top } \nabla _ { \bf U } \mathcal { L } ( \boldsymbol { \Theta } , \mathcal { D } ) } & { { } \in } & { \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } } } \end{array}$ . We randomly initialize an estimate of $\mathbf { H }$ as $\begin{array} { r l } { \hat { \bf { H } } } & { { } = } \end{array}$ $[ \hat { \bf h } _ { 1 } , \hat { \bf h } _ { 2 } , \dots , \hat { \bf h } _ { n } , \dots , \hat { \bf h } _ { N } ] ^ { \top } \in \mathbb { R } ^ { N \times d _ { 1 } }$ , where $\hat { \bf h } _ { n } ^ { \mathrm { ~ \tiny ~ ~ ~ } } = [ \hat { h } _ { n , 1 } , \hat { h } _ { n , 1 } , \ldots , \hat { h } _ { n , d _ { 1 } } ] ^ { \top } \in \mathbb { R } ^ { d _ { 1 } }$ . Given $\mathsf { \bar { V } } _ { \Theta _ { 1 } } \mathcal { L } ( \Theta , \mathcal { D } ( \mathbf { s } ^ { t } ) )$ and $\mathbf { V } ^ { * }$ , we recover $\mathbf { H }$ by minimizing the following objective
157
+
158
+ $$
159
+ \hat { \mathbf { H } } ^ { * } = \arg \operatorname* { m i n } _ { \hat { \mathbf { H } } } \underbrace { \mathbb { E } _ { s _ { i } \sim \operatorname { U n i f } ( S ) } \mathcal { F } _ { 2 } ( \hat { \mathbf { H } } ; \mathbf { s } _ { i } ) } _ { : = \mathcal { F } _ { 2 } ( \hat { \mathbf { H } } ) } \mathrm { w i t h } \mathcal { F } _ { 2 } ( \hat { \mathbf { H } } ; \mathbf { s } _ { i } ) : = \Big \lVert \sum _ { n = 1 } ^ { N } \mathbf { s } _ { i } [ n ] \hat { \mathbf { h } } _ { n } ( \mathbf { v } _ { n } ^ { * } ) ^ { \top } - \nabla \mathbf { \Theta } _ { \Theta _ { 1 } } \mathcal { L } ( \mathbf { \Theta } , \mathcal { D } ( \mathbf { s } _ { i } ) ) \Big \rVert _ { F } ^ { 2 } .
160
+ $$
161
+
162
+ In each iteration $t$ , the objective function of Step II can be denoted by $\mathcal { F } _ { 2 } ( \hat { \mathbf { H } } ; \mathbf { s } ^ { t } )$
163
+
164
+ Through the first two steps, parts of the information about the data have already been leaked. Step II also has the following guarantee.
165
+
166
+ Theorem 2. If $N < d _ { 2 }$ and $\operatorname { R a n k } ( \mathbf { V } ^ { * } ) = N$ , the objective function $\mathcal { F } _ { 2 } ( \hat { \mathbf { H } } )$ is strongly convex. When $\Theta$ keeps unchanged, applying SGD guarantees the convergence of $\hat { \bf H }$ to $\mathbf { H }$ .
167
+
168
+ Our experiment setting satisfies the assumption, e.g., $N = 8 0 0$ and $d _ { 2 } ~ = ~ 1 0 2 4$ , and thus the convergence is guaranteed according to $\mathbb { \left| \left[ 2 3 \right] \right| }$ . The proof of Theorem 2 can be found in Appendix $\bigtriangledown ,$ In some simple models such as logistic regression or neural network models only containing $F C$ layers, the attack will recover the data only by implementing the first two steps.
169
+
170
+ Step III: Recover data. We randomly initialize the fake data and fake labels followed by uniform distribution $\hat { \mathcal { D } } = \{ \hat { \mathbf { x } } _ { n } , \hat { y } _ { n } \} _ { n = 1 } ^ { N }$ . According to equation $( 4 )$ , we have $\widetilde { \mathbf { h } } _ { n } = h ( \boldsymbol { \Theta } _ { c } , \hat { \mathbf { x } } _ { n } ) \in \mathbb { R } ^ { \dot { d } _ { 1 } }$ .
171
+
172
+ Given $\nabla _ { \Theta } \mathcal { L } ( \Theta , \mathcal { D } ( \mathbf { s } _ { i } ) )$ and $\hat { \mathbf { H } } ^ { * }$ , our objective function in the last step is
173
+
174
+ $$
175
+ \begin{array} { r l } { \displaystyle } & { \displaystyle = \arg \operatorname* { m i n } _ { \hat { \mathcal { D } } } \mathbb { E } _ { s _ { i } \sim \mathrm { U n i f } ( \mathcal { S } ) } [ \mathcal { F } _ { 3 } ( \hat { D } ; \mathbf { s } _ { i } ) ] \medskip } \\ & { \displaystyle } \\ & { \mathcal { F } _ { 3 } ( \hat { D } ; \mathbf { s } _ { i } ) : = \alpha \big \| \nabla _ { \Theta } \mathcal { L } ( \Theta , \mathcal { D } ( \mathbf { s } _ { i } ) ) - \nabla _ { \Theta } \mathcal { L } ( \Theta , \hat { \mathcal { D } } ( \mathbf { s } _ { i } ) ) \big \| _ { 2 } ^ { 2 } + \beta \underline { { \mathrm { T V } } } _ { \xi } ( \hat { \mathcal { X } } ( \mathbf { s } _ { i } ) ) + \gamma \displaystyle \sum _ { n = 1 } ^ { N } \big \| \mathbf { s } _ { i } [ n ] \big ( \hat { \mathbf { H } } _ { n } ^ { * } - \tilde { \mathbf { h } } _ { n } \big ) \big \| _ { 2 } ^ { 2 } } \end{array}
176
+ $$
177
+
178
+ where $\alpha , \beta$ and $\gamma$ are coefficients, $\underline { { \mathrm { T V } } } _ { \xi } ( \hat { \mathcal X } ( \mathbf { s } _ { i } ) )$ is the truncated total variation (TV) norm which is 0 if the TV-norm of $\hat { \mathcal { X } } ( \mathbf { s } _ { i } ) = \{ \hat { \mathbf { x } } _ { n } | \mathbf { s } _ { i } [ n ] = 1 \}$ is smaller than $\xi$ , and $\hat { \cal { D } } ( { \bf s } _ { i } ) = \{ \{ \hat { \bf x } _ { n } , \hat { y } _ { n } \} | { \bf s } _ { i } [ n ] = 1 \}$ . In each iteration $t$ , the objective function of step III is $\mathcal { F } _ { 3 } ( \hat { \mathcal { D } } ; \mathbf { s } ^ { t } )$ . The first term in $\textcircled{9}$ is the $\ell _ { 2 }$ norm in $\pmb { \Vert 3 2 \Vert }$ . The second term is the TV norm and the last term is the internal representation norm regularizer. We also define $\nabla _ { \hat { D } } \mathcal { F } _ { 3 } ( \hat { D } ; \mathbf { s } ^ { t } ) = \{ \nabla _ { \hat { \mathbf { x } } _ { n } } \mathcal { F } _ { 3 } ( \hat { D } ; \mathbf { s } ^ { t } ) , \nabla _ { \hat { y } _ { n } } \mathcal { F } _ { 3 } ( \hat { D } ; \mathbf { s } ^ { t } ) \} _ { n = 1 } ^ { N } .$ .
179
+
180
+ To ensure attacking efficiency, we consider two flexible update protocols in CAFE — Algorithm $3 \mathrm { { : } }$ CAFE (Nested-loops) and Algorithm $4 { : }$ CAFE (Single-loop). Empirically, Algorithm $\bar { 4 }$ will take fewer iterations than those of Algorithm $\textcircled { 3 }$ More details can be found in the experiment results in Section $4 . 2 .$ We also discuss the theoretical guarantee for each step and its proof in Appendix E.
181
+
182
+ # 3.4 Defense strategy: Leveraging fake gradients as a countermeasure to CAFE
183
+
184
+ Although CAFE comes with theoretical recovery guarantees, the underlying premise is that the clients will upload true (correct) gradients for aggregation. Therefore, we propose an intuitive and practical approach to mitigate CAFE by requiring each client to upload fake (but similar) gradients, resulting in incorrect data recovery via CAFE. Specifically, to solve the problem of leakage from true gradients, we design a defense called Fake Gradients and summarize it in Algorithm 5 of Appendix F. The main idea of this defense is that attackers will aim to match wrong gradients and invert incorrect inputs to the first FC layer so that attackers cannot recover the true training data. The defending strategy in Algorithm 5 (Appendix F) can be added between Line 8 and 9 in Algorithms 1 and 2.
185
+
186
+ As summarized in Algorithm $\boxed { 5 }$ (Appendix F), each local worker can randomly generate gradients with the normal distribution ${ \sqrt { ( 0 , \sigma ^ { 2 } ) } }$ and sort the elements in descending order (Line $1 , \stackrel { } { 2 } )$ . At the same time, local workers also sort their true gradients in descending order and record indexes of the sorted items (Line $^ { 7 ) }$ . Then, one computes the $L _ { 2 }$ -norm distance between a true gradient and all fake gradients to find the nearest fake gradient (Line $^ { 1 2 ) }$ . Afterwards, we pair fake gradients to match true gradients by the sorted order (Line $^ { 1 7 ) }$ . This an important step so that we can keep large/small values at the same positions of true gradients. Finally, local workers upload the fake gradients to the server.
187
+
188
+ Impact on model training. Chen et al. [5] has proved that if the distance between the actual gradients and the gradient surrogate is smaller than a decreasing threshold, using the gradient surrogate to update the model still guarantees convergence. Building upon the results in $[ \bar { | 5 | }$ , we set a sufficient threshold such that the distance between the fake gradients and the true gradients are smaller than the threshold. In this case, we can still achieve the learning performance as if true gradients are used.
189
+
190
+ Table 2: Comparison with the state-of-the-art ( $M = 4$ , $K = 4 0$ , batch ratio $= 0 . 0 5 \mathrm { , }$ )
191
+
192
+ <table><tr><td rowspan=1 colspan=1>PSNR DatasetMethod</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>Linnaeus 5</td></tr><tr><td rowspan=1 colspan=1>CAFE</td><td rowspan=1 colspan=1>31.83</td><td rowspan=1 colspan=1>43.15</td><td rowspan=1 colspan=1>33.22</td></tr><tr><td rowspan=1 colspan=1>DLG</td><td rowspan=1 colspan=1>9.29</td><td rowspan=1 colspan=1>7.96</td><td rowspan=1 colspan=1>7.14</td></tr><tr><td rowspan=1 colspan=1>Cosine Similarity</td><td rowspan=1 colspan=1>7.38</td><td rowspan=1 colspan=1>7.84</td><td rowspan=1 colspan=1>8.31</td></tr><tr><td rowspan=1 colspan=1>SAPAG</td><td rowspan=1 colspan=1>6.07</td><td rowspan=1 colspan=1>3.86</td><td rowspan=1 colspan=1>6.74</td></tr><tr><td rowspan=1 colspan=1>BN regularizer</td><td rowspan=1 colspan=1>18.94</td><td rowspan=1 colspan=1>13.38</td><td rowspan=1 colspan=1>8.09</td></tr><tr><td rowspan=1 colspan=1>GC regularizer</td><td rowspan=1 colspan=1>13.63</td><td rowspan=1 colspan=1>9.24</td><td rowspan=1 colspan=1>12.32</td></tr></table>
193
+
194
+ Table 3: PSNR vs batch size $K$ (800 data samples in total)
195
+
196
+ <table><tr><td rowspan=1 colspan=1>PSNR DatasetK</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>Linnaeus 5</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>30.83</td><td rowspan=1 colspan=1>32.60</td><td rowspan=1 colspan=1>28.00</td></tr><tr><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>35.70</td><td rowspan=1 colspan=1>39.00</td><td rowspan=1 colspan=1>30.53</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>31.83</td><td rowspan=1 colspan=1>43.15</td><td rowspan=1 colspan=1>33.22</td></tr><tr><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>36.87</td><td rowspan=1 colspan=1>47.05</td><td rowspan=1 colspan=1>30.43</td></tr><tr><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>38.94</td><td rowspan=1 colspan=1>47.50</td><td rowspan=1 colspan=1>29.18</td></tr></table>
197
+
198
+ ![](images/0e7004dce0f73e82eb5c47099291c9e1d863aafe693bc73748eeff8b470b12c5.jpg)
199
+ Figure 5: Visual comparison on the effect of auxiliary regularizers.
200
+
201
+ ![](images/631b3174ebcd9842ff09a53e80bbfef965598b958109d216f846ac3ebce4a685.jpg)
202
+ Figure 6: Visual comparison of the real and recovered data using ordinary and fake gradients.
203
+
204
+ # 4 Experiments
205
+
206
+ We conduct experiments on MNIST $ { \mathbb { I } } { \mathrm { 1 8 } } { \mathrm { ] } }$ , CIFAR-10 [17] and Linnaeus 5 [4] datasets in VFL settings. The hyper-parameter settings are shown in Appendix $\mathbf { G . l . }$ Our algorithm recovers all the data participating in VFL with a relative large batch size (more than 40). Scaling up to our hardware limits (RTX 2080 and TITAN V), CAFE can leak as many as 800 images in the VFL setting including 4 workers with a batch size as large as 100. The neural network model architecture used in the simulation is shown in Figure 4. To measure the data leakage performance, we use the peak signalto-noise ratio (PSNR) value and the mean squared error (MSE). Higher PSNR value of leaked data represents better performance of data recovery.
207
+
208
+ # 4.1 Comparison with the state-of-the-art
209
+
210
+ We compare CAFE with five state-of-the-art methods using the batch size of 40 images in each iteration. For fair comparisons, all methods were run on the the same model and iterations.
211
+
212
+ i) DLG $\pmb { \mathbb { B 2 } }$ : The deep gradients leakage method is equivalent to replacing the objective function in $\textcircled { 9 }$ with the squared $\ell _ { 2 }$ norm distance.
213
+ ii) Cosine Similarity [11]: The objective function is equivalent to replacing the objective function in $\textcircled { 9 }$ with the linear combination of cosine similarity and TV norm of the recovered images. iii) SAPAG [25]: The objective function is equivalent to replacing the objective function in $( 9 )$ with the Gaussian kernel based function.
214
+ iv) Batch normalization (BN) regularizer $[ \pmb { \big | 2 9 } ]$ : The objective function is equivalent to replacing the TV norm and internal representation norm in $\textcircled{9}$ with the batch normalization regularizer $\mathbb { \left[ \left[ 2 9 \right] \right. }$ v) Group consistency (GC) regularizer $[ \pmb { \big | 2 9 } ]$ : The objective function is equivalent to replacing the TV norm and internal representation norm in $( 9 )$ with the group consistency regularizer $\dot { \mathbb { R } } \mathfrak { Q } \mathfrak { h }$ .
215
+
216
+ In GradInversion $\mathbb { \left. 2 9 \right. }$ , several additional assumptions have been made. For example, the assumption of non-repeating labels in the batch is hard to be satisfied in datasets such as CIFAR-10, MNIST and Linnaeus 5. In those datasets, we use batch size of more than 40, which is larger than the number of classes (10 or 5). Nevertheless, we still compared our CAFE to the methods by using the batch normalization regularizer and group consistency regularizer mentioned in $\mathbb { \left[ \left[ 2 9 \right] \right. }$ in CAFE.
217
+
218
+ Theory-driven label inference methods have been proposed in $\pmb { \| } \pmb { \bigtriangledown } $ and $\left[ \left[ 2 6 \right] \right]$ . However, our attack mainly deals with training data leakage rather than labels. In $\lVert 2 2 \rVert$ , the authors proposed a sufficient requirement that "each data sample has at least two exclusively activated neurons at the last but one layer". However, in our training protocol, the batch size is too large and it is almost impossible to ensure that each selected sample has at least two exclusively activated neurons. In $\pmb { \mathbb { B } } \mathbf { \mathbb { I } }$ , it is assumed that the method will only return a linear combination of the selected training data, which is a very restricted assumption. As the results, we did not compare to those methods in Table 2.
219
+
220
+ Table 4: Effect of auxiliary regularizers $M = 4$ , $K = 4 0$ , batch ratio $= 0 . 0 5$ )
221
+
222
+ <table><tr><td rowspan=1 colspan=1>PSNR DatasetsAlgorithm</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>Linnaeus 5</td><td rowspan=1 colspan=1>MNIST</td></tr><tr><td rowspan=1 colspan=1>CAFE</td><td rowspan=1 colspan=1>31.83</td><td rowspan=1 colspan=1>33.22</td><td rowspan=1 colspan=1>43.15</td></tr><tr><td rowspan=1 colspan=1>CAFE (α = 0)</td><td rowspan=1 colspan=1>33.93</td><td rowspan=1 colspan=1>28.62</td><td rowspan=1 colspan=1>31.93</td></tr><tr><td rowspan=1 colspan=1>CAFE (g = 0)</td><td rowspan=1 colspan=1>25.57</td><td rowspan=1 colspan=1>25.29</td><td rowspan=1 colspan=1>34.51</td></tr><tr><td rowspan=1 colspan=1>CAFE (β = 0)</td><td rowspan=1 colspan=1>18.25</td><td rowspan=1 colspan=1>23.22</td><td rowspan=1 colspan=1>31.98</td></tr><tr><td rowspan=1 colspan=1>CAFE (γ = 0)</td><td rowspan=1 colspan=1>12.51</td><td rowspan=1 colspan=1>12.37</td><td rowspan=1 colspan=1>6.34</td></tr></table>
223
+
224
+ Table 5: Nested-loops vs single-loop CAFE $M = 4$ , $K = 4 0$ , batch ratio $= 0 . 0 5$ )
225
+
226
+ <table><tr><td rowspan=1 colspan=1>Iterations modeDatasets</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>Linnaues 5</td></tr><tr><td rowspan=1 colspan=1>Single loop</td><td rowspan=1 colspan=1>7300(8000)</td><td rowspan=1 colspan=1>6600(8000)</td><td rowspan=1 colspan=1>12400(20000)</td></tr><tr><td rowspan=1 colspan=1>Nested-loopsStepI</td><td rowspan=1 colspan=1>8000(8000)</td><td rowspan=1 colspan=1>8000(8000)</td><td rowspan=1 colspan=1>12428(20000)</td></tr><tr><td rowspan=1 colspan=1>Nested-loopsStep II</td><td rowspan=1 colspan=1>2404(8000)</td><td rowspan=1 colspan=1>8000(8000)</td><td rowspan=1 colspan=1>20000(20000)</td></tr><tr><td rowspan=1 colspan=1>Nested-loopsStep II</td><td rowspan=1 colspan=1>1635(8000)</td><td rowspan=1 colspan=1>2468(8000)</td><td rowspan=1 colspan=1>20000(20000)</td></tr></table>
227
+
228
+ Table 6: Effects of number of workers $M$ ( $K = 4 0$ , batch ratio $= 0 . 0 5$ )
229
+
230
+ <table><tr><td rowspan=1 colspan=1>PSNR DatasetsM</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>Linnaeus 5</td><td rowspan=1 colspan=1>MNIST</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>31.83</td><td rowspan=1 colspan=1>33.22</td><td rowspan=1 colspan=1>43.15</td></tr><tr><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>28.39</td><td rowspan=1 colspan=1>39.85</td><td rowspan=1 colspan=1>39.28</td></tr></table>
231
+
232
+ ![](images/c9a7b613b5c42b8ef154263afdb51b1b7d2b39819d2ae8e13939cab5c0d3a1a9.jpg)
233
+ Figure 7: Training loss of true gradients and fake gradients on CIFAR-10, Linnaeus 5 and MNIST.
234
+
235
+ CAFE outperforms these methods both qualitatively (Figure $^ { 1 ) }$ and quantitatively (Table $^ { 2 ) }$ . Its PSNR values are always above 30 at the end of each CAFE attacking process, suggesting high data recovery quality. However, the PSNR of other methods are below 10 on all the three datasets.
236
+
237
+ # 4.2 Ablation study
238
+
239
+ We test CAFE under different batch size, network structure and with/without auxiliary regularizers.
240
+
241
+ (i) PSNR via Batch size $K$ . Table 3 shows that the PSNR values always keep above 30 on CIFAR-10, above 32 on MNIST and above 28 on Linnaeus 5 when the batch size $K$ increases with fixed number of workers and number of total data points. The result implies that the increasing $K$ has almost no influence on data leakage performance of CAFE and it fails to be an effective defense.
242
+
243
+ (ii) PSNR via Epoch. Theoretically, given infinite number of iterations, we prove that we can recover $\nabla _ { \mathbf { U } } \mathcal { L }$ and $\mathbf { H }$ because the respective objective function in $( 7 )$ and $\textcircled{8}$ in our paper is strongly convex as long as $N < d _ { 2 }$ and $\mathbf { R a n k } ( \mathbf { V } ^ { * } ) = \bar { N }$ in Sections $\underset { . } { \mathrm { ~ { \cal { C } } ~ } }$ and D of supplementary material. The corresponding experimental results and analysis are shown in Appendix G.2.
244
+
245
+ (iii) Effect of regularizers. Table 4 demonstrates the impact of regularizers. From Figure 5, adjusting the threshold $\xi$ prevents images from being over blurred during the reconstruction process. TV norm can eliminate the noisy patterns on the recovered images and increase the PSNR. We also find that the last term in $\textcircled{9}$ , the internal representation norm regularizer, contributes most to the data recovery. In Table 4, CAFE still performs well without the first term $( \alpha = 0$ ) in $( 9 )$ . The reason is that the internal representation regularizer already allows data to be fully recovered. Notably, CAFE also performs well on MNIST even without the second term $\beta = 0$ ) in $( 9 )$ . It is mainly due to that MNIST is a simple dataset that CAFE can successfully recover even without the TV-norm regularizer.
246
+
247
+ (iv) Nested-loops vs single-loop. We compare both modes of CAFE (Algorithms $\boxed { 3 } \mathrm { a n d } \boxed { 4 }$ on all datasets. In Table $5 ,$ the number of iterations is the maximum iterations at each step. For the CAFE (single-loop), if the objective function in step I $\textcircled { 7 }$ decreases below $1 0 ^ { - 9 }$ , we switch to step II. If the objective function in step II $( 8 )$ decreases below $5 \times 1 0 ^ { - 9 }$ , we switch to step III. When the PSNR value reaches 27 on CIFAR-10, 30 on Linnaeus 5, 38 on MNIST, we stop both algorithms and record the iteration numbers. As shown in Table $5 ,$ CAFE single-loop requires fewer number of iterations. Meanwhile, it is difficult to set the loop stopping conditions in the CAFE Nested-loops mode. In particular, $\mathbf { V } ^ { * }$ and $\hat { \mathbf { H } } ^ { * }$ with low recovery precision may impact the data recovery performance.
248
+
249
+ (v) Effects of number of workers $M$ . Although data are partitioned on feature space across workers, the dimension of the entire data feature space is fixed and independent of $M$ . Therefore, increasing number of workers theoretically does not change the dimension of variables associated with data recovery in $\textcircled { 3 }$ . In practice, different from HFL, where there could be hundreds of workers, in VFL, the workers are typically financial organizations or companies. Therefore, the number of workers is usually small $\mathbb { \lVert 1 3 \rVert }$ . In Table $6 ,$ we compare the results of 4 workers with 16 workers following the same experiment setup. The CAFE performances are comparable.
250
+
251
+ Table 7: Attacking while training in VFL
252
+
253
+ <table><tr><td rowspan=1 colspan=1>PSNR(Ir) SettingDataset</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td></tr><tr><td rowspan=1 colspan=1>CIFAR10</td><td rowspan=1 colspan=1>31.24(10-4)</td><td rowspan=1 colspan=1>27.62(5×10-4)</td><td rowspan=1 colspan=1>25.22(10-3)</td></tr><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>31.82(10-4)</td><td rowspan=1 colspan=1>28.42(5×10-4)</td><td rowspan=1 colspan=1>23.60(10-3)</td></tr><tr><td rowspan=1 colspan=1>Linaeus 5</td><td rowspan=1 colspan=1>30.74(10-6)</td><td rowspan=1 colspan=1>21.45(5×10-5)</td><td rowspan=1 colspan=1>20.68(10-4)</td></tr></table>
254
+
255
+ Table 8: Training while attacking on MNIST
256
+
257
+ <table><tr><td rowspan=1 colspan=1>#of iterations</td><td rowspan=1 colspan=1>PSNR value</td><td rowspan=1 colspan=1>Training loss</td><td rowspan=1 colspan=1>Testing accuracy</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>5.07</td><td rowspan=1 colspan=1>2.36</td><td rowspan=1 colspan=1>0.11</td></tr><tr><td rowspan=1 colspan=1>2000</td><td rowspan=1 colspan=1>11.68</td><td rowspan=1 colspan=1>2.31</td><td rowspan=1 colspan=1>0.27</td></tr><tr><td rowspan=1 colspan=1>6000</td><td rowspan=1 colspan=1>18.07</td><td rowspan=1 colspan=1>1.99</td><td rowspan=1 colspan=1>0.54</td></tr><tr><td rowspan=1 colspan=1>10000</td><td rowspan=1 colspan=1>18.12</td><td rowspan=1 colspan=1>1.82</td><td rowspan=1 colspan=1>0.64</td></tr><tr><td rowspan=1 colspan=1>15000</td><td rowspan=1 colspan=1>16.86</td><td rowspan=1 colspan=1>1.63</td><td rowspan=1 colspan=1>0.65</td></tr><tr><td rowspan=1 colspan=1>20000</td><td rowspan=1 colspan=1>20.72</td><td rowspan=1 colspan=1>1.68</td><td rowspan=1 colspan=1>0.68</td></tr></table>
258
+
259
+ # 4.3 Tests for attacking while training scenarios
260
+
261
+ Previous works have shown that DLG performs better on an untrained model than a trained one $\mathbb { m }$ This is also true for CAFE. Our theoretical analysis can provide the partial reason. When the model is trained or even convergent, the real gradients of loss can be very small. It is possible that the value of the recovered $\nabla _ { \mathbf { U } } \mathcal { L } ( \hat { \textbf { \Theta } } , \mathcal { D } )$ will also be close to 0. In that case, it can be difficult to recover H.
262
+
263
+ We also implement CAFE in the ‘attacking while training’ scenario, in which we continuously run the VFL process. When the model is training, both of the selected batch data and the model parameters change every iteration, which may cause the attack loss to diverge. However, from our experimental results in Table $\bigtriangledown ,$ CAFE is able to recover training images when the learning rate (lr) is relatively small. Increasing the learning rate renders data leakage more difficult because the model is making more sizeable parameter changes in each iteration, which can be regarded as an effective defense strategy. According to our experiment in Table $\boxed { 8 }$ the model indeed converges with a relative small learning rate (e.g., Adam with learning rate $1 0 ^ { - 6 }$ , trained on 800 images, tested on 100 images, batch size $K = 4 0$ ), which indicates that we can conduct our attack successfully while a model is converging. The data indeed leaks to a certain level (PSNR above 20) while the model converges at a certain accuracy (0.68), which indicates that CAFE works in an attacking while training scenario.
264
+
265
+ # 4.4 Mitigation of CAFE data leakage attack via fake gradients
266
+
267
+ Training and defense performance. To demonstrate how fake gradients defend against CAFE (Section $\overline { { \textcircled { 3 . 4 } } }$ , we conduct CAFE with unchanged $\Theta$ , which is the strongest data leakage attack setting. We use the SGD optimizer with learning rate set as 0.1, $\sigma ^ { 2 } = 1 . 1$ , and $\nu = 1 0 0 0$ for fake gradients. Figure $\boxed { 6 }$ shows a comparison between the visual image quality of the data recovered by CAFE on CIFAR-10 when the ordinary gradients and fake gradients are used, respectively. The PSNR of recovered data in CAFE on ordinary and fake gradients is 28.68 and 7.67, respectively. Moreover, Figure $^ { 7 }$ shows that the training process with fakes gradients behaves in a similar way to the one with true gradients, confirming that the use of fake gradients does not lose the training efficacy. We have also added the experiment to discuss the difference of our fake gradients method to differential privacy (DP). The results and analysis are shown in Appendix G.3.
268
+
269
+ # 4.5 Recover human face data
270
+
271
+ We also implement CAFE on Yale $3 2 \times 3 2$ human face dataset $\pmb { \mathbb { L 2 } }$ , which achieves the PSNR above 42. The recovered data are shown in Appendix $\mathbf { G . } 4 .$ It implies that CAFE can fully recover data that requires privacy protection such as facial images.
272
+
273
+ # 5 Conclusions
274
+
275
+ In this paper, we uncover the risk of catastrophic data leakage in vertical federated learning (CAFE) through a novel algorithm that can perform large-batch data leakage with high data recovery quality and theoretical guarantees. Extensive experimental results demonstrate that CAFE can recover large-scale private data from the shared aggregated gradients on vertical FL settings, overcoming the batch limitation problem in current data leakage attacks. We also propose an effective countermeasure using fake gradients to mitigate the potential risks of CAFE.
276
+
277
+ # Acknowledgments
278
+
279
+ This work was supported by National Science Foundation CAREER Award 2047177, and the Rensselaer-IBM AI Research Collaboration (http://airc.rpi.edu), part of the IBM AI Horizons Network (http://ibm.biz/AIHorizons). C-Y Hsu and C-M Yu were supported by MOST 110- 2636-E-009-018, and we also thank National Center for High-performance Computing (NCHC) of National Applied Research Laboratories (NARLabs) in Taiwan for providing computational and storage resources.
280
+
281
+ # References
282
+
283
+ [1] M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, and L Zhang. "Deep learning with differential privacy". In Proc. the 2016 ACM SIGSAC Conference on Computer and Communications Security, pages 308–318, Vienna, Austria, Oct, 2016.
284
+ [2] E. Bagdasaryan, A. Veit, Y. Hua, D. Estrin, and V. Shmatikov. "How to backdoor federated learning". In Proc. the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 2938–2948. PMLR, 26–28 Aug 2020.
285
+ [3] A. N. Bhagoji, S. Chakraborty, P. Mittal, and S. Calo. "Analyzing federated learning through an adversarial lens". In Proc. International Conference on Machine Learning, pages 634–643, Long Beach, California, 2019.
286
+ [4] G. Chaladze and L. Kalatozishvili. Linnaeus 5 dataset for machine learning, 2017.
287
+ [5] T. Chen, G. Giannakis, T. Sun, and W. Yin. "LAG: lazily aggregated gradient for communicationefficient distributed learning". In Proc. Advances in Neural Information Processing Systems, volume 31, Montréal, CANADA, 2018.
288
+ [6] T. Chen, X. Jin, Y. Sun, and W. Yin. "VAFL: a method of vertical asynchronous federated learning". arXiv preprint:2007.06081, Jul, 2020.
289
+ [7] K. Cheng, T. Fan, Y. Jin, Y. Liu, T. Chen, and Q. Yang. "Secureboost: A lossless federated learning framework". In Proc. The 1st International Workshop on Federated Machine Learning for User Privacy and Data Confidentiality (FML’19) in conjunction with IJCAI, 2019.
290
+ [8] T. Chilimbi, Y. Suzue, J. Apacible, and K. Kalyanaraman. "Project adam: Building an efficient and scalable deep learning training system". In 11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14), pages 571–582, Broomfield, CO, October 2014.
291
+ [9] L. Fan, K. Ng, C. Ju, T. Zhang, C. Liu, C. S. Chan, and Q. Yang. "Rethinking privacy preserving deep learning: How to evaluate and thwart privacy attacks". In Federated Learning - Privacy and Incentive, volume 12500 of Lecture Notes in Computer Science, pages 32–50. Springer, 2020.
292
+ [10] M. Fredrikson, S. Jha, and T. Ristenpart. "Model inversion attacks that exploit confidence information and basic countermeasures". In Proc. the 22nd ACM SIGSAC Conference on Computer and Communications Security, pages 1322–1333, New York, NY, USA, 10 2015.
293
+ [11] J. Geiping, H. Bauermeister, H. Dröge, and M. Moeller. "Inverting gradients - how easy is it to break privacy in federated learning?". In Proc. Advances in Neural Information Processing Systems, 2020.
294
+ [12] A.S. Georghiades, P.N. Belhumeur, and D.J. Kriegman. "From few to many: Illumination cone models for face recognition under variable lighting and pose". IEEE Trans. Pattern Anal. Mach. Intelligence, 23(6):643–660, 2001.
295
+ [13] C. He, S. Li, J. So, M. Zhang, H. Wang, X. Wang, P. Vepakomma, A. Singh, H. Qiu, L. Shen, P. Zhao, Y. Kang, Y. Liu, R. Raskar, Q. Yang, M. Annavaram, and S. Avestimehr. "Fedml: A research library and benchmark for federated machine learning". In Proc. Advances in Neural Information Processing Systems Workshop: SpicyFL 2020, 2020.
296
+ [14] B. Hitaj, G. Ateniese, and F. Pérez-Cruz. Deep models under the GAN: information leakage from collaborative deep learning. In Proc. the 2017 ACM SIGSAC Conference on Computer and Communications Security, New York, NY, USA, 2017.
297
+ [15] F.N. Iandola, K. Ashraf, M.W. Moskewicz, and K. Keutzer. Firecaffe: near-linear acceleration of deep neural network training on compute clusters. In Proc. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2592–2600, Los Alamitos, CA, USA, Jun 2016.
298
+ [16] P. Kairouz, H. B. McMahan, B. Avent, A. Bellet, M. Bennis, A. N. Bhagoji, K. Bonawit, Z. Charles, G. Cormode, R. Cummings, R. G. L. D’Oliveira, H. Eichner, S. El Rouayheb, D. Evans, J. Gardner, Z. Garrett, A. Gascón, B. Ghazi, P. B. Gibbons, M. Gruteser, Z. Harchaoui, C. He, L. He, Z. Huo, B. Hutchinson, J. Hsu, M. Jaggi, T. Javidi, G. Joshi, M. Khodak, J. Konecný, A. Korolova, F. Koushanfar, S. Koyejo, T. Lepoint, Y. Liu, P. Mittal, M. Mohri, R. Nock, A. Özgür, R. Pagh, H. Qi, D. Ramage, R. Raskar, M. Raykova, D. Song, W. Song, S. U. Stich, Z. Sun, A. Theertha Suresh, F. Tramèr, P. Vepakomma, J. Wang, L. Xiong, Z. Xu, Q. Yang, F. X. Yu, H. Yu, and S. Zhao. "Advances and open problems in federated learning". arXiv preprint:1912.04977, December 2019.
299
+ [17] A. Krizhevsky and G. Hinton. "Learning multiple layers of features from tiny images". Master’s thesis, Department of Computer Science, University of Toronto, 2009.
300
+ [18] Y. LeCun and C. Cortes. MNIST handwritten digit database. 2010.
301
+ [19] M. Li. "Scaling distributed machine learning with the parameter server". In Proc. the 11th USENIX Conference on Operating Systems Design and Implementation, pages 1–1, Broomfield, CO, USA, 08 2014.
302
+ [20] H. McMahan, E. Moore, D. Ramage, S. Hampson, and B. A. Arcas. "Communication-efficient learning of deep networks from decentralized data". In AISTATS, Ft. Lauderdale, FL, USA, 2017.
303
+ [21] L. Melis, C. Song, E. D. Cristofaro, and V. Shmatikov. "Inference attacks against collaborative learning". In Proc. the 35th Annual Computer Security Applications Conference, page 148–162, New York, NY, USA, 2018.
304
+ [22] X. Pan, M. Zhang, Y. Yan, J. Zhu, and M. Yang. "Theory-oriented deep leakage from gradients via linear equation solver". In arXiv eprint 2010.13356, 2020.
305
+ [23] A. Rakhlin, O. Shamir, and K. Sridharan. "Making gradient descent optimal for strongly convex stochastic optimization". In Proc. International Conference on Learning Representations, Edinburgh, Scotland, 2012.
306
+ [24] R. Shokri and V. Shmatikov. "Privacy-preserving deep learning". In Proc. the 22nd ACM SIGSAC Conference on Computer and Communications Security, page 1310–1321, Denver, Colorado, USA, 2015.
307
+ [25] Y. Wang, J. Deng, D. Guo, C. Wang, X. Meng, H. Liu, C. Ding, and S. Rajasekaran. Sapag: A self-adaptive privacy attack from gradients. arXiv, eprint:2009.06228, 2020.
308
+ [26] W. Wei, L. Liu, M. Loper, K. H. Chow, M. E. Gursoy, S. Truex, and Y. Wu. "A framework for evaluating gradient leakage attacks in federated learning". arXiv, eprint 2004.10397, 2020.
309
+ [27] C. Xie, K. Huang, P. Chen, and B. Li. "DBA: Distributed backdoor attacks against federated learning". In International Conference on Learning Representations, Addis Ababa, Ethiopia, 2020.
310
+ [28] Q. Yang, Y. Liu, T. Chen, and Yongxin Tong. Federated machine learning: Concept and applications. ACM Trans. Intell. Syst. Technol., 10(2), January 2019.
311
+ [29] H. Yin, A. Mallya, A. Vahdat, J. M. Alvarez, J. Kautz, and P. Molchanov. "See through gradients: Image batch recovery via gradinversion". In Proc. Conference on Computer Vision and Pattern Recognition, 2021.
312
+ [30] B. Zhao, K. R. Mopuri, and H. Bilen. idlg: Improved deep leakage from gradients. arXiv, eprint:2001.02610, 2020.
313
+ [31] J. Zhu and M. B. Blaschko. "R-GAP: Recursive gradient attack on privacy". In International Conference on Learning Representations, 2021.
314
+ [32] L. Zhu, Z. Liu, and S. Han. "Deep leakage from gradients". In Advances in Neural Information Processing Systems 32, pages 14774–14784, Vancouver, Canada, 2019.
md/train/hbHkvGBZB9/hbHkvGBZB9.md ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Are Transformers More Robust Than CNNs?
2
+
3
+ Yutong Bai1 Jieru Mei1 Alan Yuille1 Cihang Xie2 1Johns Hopkins University 2 University of California, Santa Cruz {ytongbai, meijieru, alan.l.yuille, cihangxie306}@gmail.com
4
+
5
+ # Abstract
6
+
7
+ Transformer emerges as a powerful tool for visual recognition. In addition to demonstrating competitive performance on a broad range of visual benchmarks, recent works also argue that Transformers are much more robust than Convolutions Neural Networks (CNNs). Nonetheless, surprisingly, we find these conclusions are drawn from unfair experimental settings, where Transformers and CNNs are compared at different scales and are applied with distinct training frameworks. In this paper, we aim to provide the first fair & in-depth comparisons between Transformers and CNNs, focusing on robustness evaluations.
8
+
9
+ With our unified training setup, we first challenge the previous belief that Transformers outshine CNNs when measuring adversarial robustness. More surprisingly, we find CNNs can easily be as robust as Transformers on defending against adversarial attacks, if they properly adopt Transformers’ training recipes. While regarding generalization on out-of-distribution samples, we show pretraining on (external) large-scale datasets is not a fundamental request for enabling Transformers to achieve better performance than CNNs. Moreover, our ablations suggest such stronger generalization is largely benefited by the Transformer’s self-attention-like architectures per se, rather than by other training setups. We hope this work can help the community better understand and benchmark the robustness of Transformers and CNNs. The code and models are publicly available at https://github.com/ytongbai/ViTs-vs-CNNs.
10
+
11
+ # 1 Introduction
12
+
13
+ Convolutional Neural Networks (CNNs) have been the widely-used architecture for visual recognition in recent years [22, 38, 40, 16, 21]. It is commonly believed the key to such success is the usage of the convolutional operation, as it introduces several useful inductive biases (e.g., translation equivalence) to models for benefiting object recognition. Interestingly, recent works alternatively suggest that it is also possible to build successful recognition models without convolutions [34, 60, 3]. The most representative work in this direction is Vision Transformer (ViT) [12], which applies the pure self-attention-based architecture to sequences of images patches and attains competitive performance on the challenging ImageNet classification task [35] compared to CNNs. Later works [26, 47] further expand Transformers with compelling performance on other visual benchmarks, including COCO detection and instance segmentation [23], ADE20K semantic segmentation [61].
14
+
15
+ The dominion of CNNs on visual recognition is further challenged by the recent findings that Transformers appear to be much more robust than CNNs. For example, Shao et al. [37] observe that the usage of convolutions may introduce a negative effect on models’ adversarial robustness, while migrating to Transformer-like architectures (e.g., the Conv-Transformer hybrid model or the pure Transformer) can help secure models’ adversarial robustness. Similarly, Bhojanapalli et al. [4] report that, if pre-trained on sufficiently large datasets, Transformers exhibit considerably stronger robustness than CNNs on a spectrum of out-of-distribution tests (e.g., common image corruptions [17], texture-shape cue conflicting stimuli [13]).
16
+
17
+ Though both [4] and [37] claim that Transformers are preferable to CNNs in terms of robustness, we find that such conclusion cannot be strongly drawn based on their existing experiments. Firstly, Transformers and CNNs are not compared at the same model scale, e.g., a small CNN, ResNet50 ${ \sim } 2 5$ million parameters), by default is compared to a much larger Transformer, ViT-B ( $\mathord { \sim } 8 6$ million parameters), for these robustness evaluations. Secondly, the training frameworks applied to Transformers and CNNs are distinct from each other (e.g., training datasets, number of epochs, and augmentation strategies are all different), while little efforts are devoted on ablating the corresponding effects. In a nutshell, due to these inconsistent and unfair experiment settings, it remains an open question whether Transformers are truly more robust than CNNs.
18
+
19
+ To answer it, in this paper, we aim to provide the first benchmark to fairly compare Transformers to CNNs in robustness evaluations. We particularly focus on the comparisons between Small Data-efficient image Transformer (DeiT-S) [43] and ResNet-50 [16], as they have similar model capacity (i.e., ${ \sim } 2 2$ million parameters vs. ${ \sim } 2 5$ million parameters) and achieve similar performance on ImageNet (i.e., $7 6 . 8 \%$ top-1 accuracy vs. $7 6 . 9 \%$ top-1 accuracy1). Our evaluation suite accesses model robustness in two ways: 1) adversarial robustness, where the attackers can actively and aggressively manipulate inputs to approximate the worst-case scenario; 2) generalization on out-of-distribution samples, including common image corruptions (ImageNet-C [17]), texture-shape cue conflicting stimuli (Stylized-ImageNet [13]) and natural adversarial examples (ImageNet-A [19]).
20
+
21
+ With this unified training setup, we present a completely different picture from previous ones [37, 4]. Regarding adversarial robustness, we find that Transformers actually are no more robust than CNNs— if CNNs are allowed to properly adopt Transformers’ training recipes, then these two types of models will attain similar robustness on defending against both perturbation-based adversarial attacks and patch-based adversarial attacks. While for generalization on out-of-distribution samples, we find Transformers can still substantially outperform CNNs even without the needs of pre-training on sufficiently large (external) datasets. Additionally, our ablations show that adopting Transformer’s self-attention-like architecture is the key for achieving strong robustness on these out-of-distribution samples, while tuning other training setups will only yield subtle effects here. We hope this work can serve as a useful benchmark for future explorations on robustness, using different network architectures, like CNNs, Transformers, and beyond [42, 24].
22
+
23
+ # 2 Related Works
24
+
25
+ Vision Transformer. Transformers, invented by Vaswani et al. in 2017 [46], have largely advanced the field of natural language processing (NLP). With the introduction of self-attention module, Transformer can effectively capture the non-local relationships between all input sequence elements, achieving the state-of-the-art performance on numerous NLP tasks [54, 10, 5, 11, 31, 32].
26
+
27
+ The success of Transformer on NLP also starts to get witnessed in computer vision. The pioneering work, ViT [12], demonstrates that the pure Transformer architectures are able to achieve exciting results on several visual benchmarks, especially when extremely large datasets (e.g., JFT-300M [39]) are available for pre-training. This work is then subsequently improved by carefully curating the training pipeline and the distillation strategy to Transformers [43], enhancing the Transformers’ tokenization module [55], building multi-resolution feature maps on Transformers [26, 47], designing parameter-efficient Transformers for scaling [57, 45, 52], etc. In this work, rather than focusing on furthering Transformers on standard visual benchmarks, we aim to provide a fair and comprehensive study of their performance when testing out of the box.
28
+
29
+ Robustness Evaluations. Conventional learning paradigm assumes training data and testing data are drawn from the same distribution. This assumption generally does not hold, especially in the real-world case where the underlying distribution is too complicated to be covered in a (limitedsized) dataset. To properly access model performance in the wild, a set of robustness generalization benchmarks have been built, e.g., ImageNet-C [17], Stylized-ImageNet [13], ImageNet-A [19], etc. Another standard surrogate for testing model robustness is via adversarial attacks, where the attackers deliberately add small perturbations or patches to input images, for approximating the worst-case evaluation scenario [41, 14]. In this work, both robustness generalization and adversarial robustness are considered in our robustness evaluation suite.
30
+
31
+ Concurrent to ours, both Bhojanapalli et al. [4] and Shao et al. [37] conduct robustness comparisons between Transformers and CNNs. Nonetheless, we find their experimental settings are unfair, e.g., models are compared at different capacity [4, 37] or are trained under distinct frameworks [37]. In this work, our comparison carefully align the model capacity and the training setups, which draws completely different conclusions from the previous ones.
32
+
33
+ # 3 Settings
34
+
35
+ # 3.1 Training CNNs and Transformers
36
+
37
+ Convolutional Neural Networks. ResNet [16] is a milestone architecture in the history of CNN. We choose its most popular instantiation, ResNet-50 (with ${ \sim } 2 5 $ million parameters), as the default CNN architecture. To train CNNs on ImageNet, we follow the standard recipe of [15, 33]. Specifically, we train all CNNs for a total of 100 epochs, using momentum-SGD optimizer; we set the initial learning rate to 0.1, and decrease the learning rate by $1 0 \times$ at the 30-th, 60-th, and 90-th epoch; no regularization except weight decay is applied.
38
+
39
+ Vision Transformer. ViT [12] successfully introduces Transformers from natural language processing to computer vision, achieving excellent performance on several visual benchmarks compared to CNNs. In this paper, we follow the training recipe of DeiT [43], which successfully trains ViT on ImageNet without any external data, and set DeiT-S (with ${ \sim } 2 2$ million parameters) as the default Transformer architecture. Specifically, we train all Transformers using AdamW optimizer [27]; we set the initial learning rate to 5e-4, and apply the cosine learning rate scheduler to decrease it; besides weight decay, we additionally adopt three data augmentation strategies (i.e., RandAug [9], MixUp [59] and CutMix [56]) to regularize training (otherwise DeiT-S will attain significantly lower ImageNet accuracy due to overfitting [6]).
40
+
41
+ Note that different from the standard recipe of DeiT (which applies 300 training epochs by default), we hereby train Transformers only for a total of 100 epochs, i.e., same as the setup in ResNet. We also remove {Erasing, Stochastic Depth, Repeated Augmentation}, which were applied in the original DeiT framework, in this basic 100 epoch schedule, for preventing over-regularization in training. Such trained DeiT-S yields $7 6 . 8 \%$ top-1 ImageNet accuracy, which is similar to the ResNet-50’s performance $7 6 . 9 \%$ top-1 ImageNet accuracy).
42
+
43
+ # 3.2 Robustness Evaluations
44
+
45
+ Our experiments mainly consider two types of robustness here, i.e., robustness on adversarial examples and robustness on out-of-distribution samples.
46
+
47
+ Adversarial Examples, which are crafted by adding human-imperceptible perturbations or smallsized patches to images, can lead deep neural networks to make wrong predictions. In addition to the very popular PGD attack [28], our robustness evaluation suite also contains: A) AutoAttack [8], which is an ensemble of diverse attacks (i.e., two variants of PGD attack, FAB attack [7] and Square Attack [1]) and is parameter-free; and B) Texture Patch Attack (TPA) [53], which uses a predefined texture dictionary of patches to fool deep neural networks.
48
+
49
+ Recently, several benchmarks of out-of-distribution samples have been proposed to evaluate how deep neural networks perform when testing out of the box. Particularly, our robustness evaluation suite contains three such benchmarks: A) ImageNet-A [19], which are real-world images but are collected from challenging recognition scenarios (e.g., occlusion, fog scene); B) ImageNet-C [17], which is designed for measuring model robustness against 75 distinct common image corruptions; and C) Stylized-ImageNet [13], which creates texture-shape cue conflicting stimuli by removing local texture cues from images while retaining their global shape information.
50
+
51
+ # 4 Adversarial Robustness
52
+
53
+ In this section, we investigate the robustness of Transformers and CNNs on defending against adversarial attacks, using ImageNet validation set (with 50,000 images). We consider both perturbation-based attacks (i.e., PGD and AutoAttack) and patch-based attacks (i.e., TPA) for robustness evaluations.
54
+
55
+ # 4.1 Robustness to Perturbation-Based Attacks
56
+
57
+ Following [37], we first report the robustness of ResNet-50 and DeiT-S on defending against AutoAttack. We verify that, when applying with a small perturbation radius $\epsilon = 0 . 0 0 1$ , DeiT-S indeed achieves higher robustness than ResNet-50, i.e., $2 2 . 1 \%$ vs. $1 7 . 8 \%$ as shown in Table 1.
58
+
59
+ However, when increasing the perturbation radius to 4/255, a more challenging but standard case studied in previous works [36, 48, 49], both models will be circumvented completely, i.e., $0 \%$ robustness on defending against AutoAttack. This is mainly due to that both models are not adversarially trained [14, 28], which is an effective way to secure model robustness against adversarial attacks, and we will study it next.
60
+
61
+ Table 1: Performance of ResNet-50 and DeiT-S on defending against AutoAttack, using ImageNet validation set. We note both models are completely broken when setting perturbation radius to 4/255.
62
+
63
+ <table><tr><td rowspan="2"></td><td rowspan="2">Clean</td><td colspan="2">Perturbation Radius</td></tr><tr><td>0.001</td><td>4/255</td></tr><tr><td>ResNet-50</td><td>76.9</td><td>17.8</td><td>0.0</td></tr><tr><td>DeiT-S</td><td>76.8</td><td>22.1</td><td>0.0</td></tr></table>
64
+
65
+ # 4.1.1 Adversarial Training
66
+
67
+ Adversarial training [14, 28], which trains models with adversarial examples that are generated on-the-fly, aims to optimize the following min-max framework:
68
+
69
+ $$
70
+ \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { ( x , y ) \sim \mathbb { D } } \Big [ \underset { \epsilon \in \mathbb { S } } { \operatorname* { m a x } } L ( \theta , x + \epsilon , y ) \Big ] ,
71
+ $$
72
+
73
+ where $\mathbb { D }$ is the underlying data distribution, $L ( \cdot , \cdot , \cdot )$ is the loss function, $\theta$ is the network parameter, $x$ is a training sample with the ground-truth label $y , \epsilon$ is the added adversarial perturbation, and $\mathbb { S }$ is the allowed perturbation range. Following [51, 48], the adversarial training here applies single-step PGD (PGD-1) to generate adversarial examples (for lowering training cost), with the constrain that maximum per-pixel change $\epsilon = 4 / 2 5 5$ .
74
+
75
+ Adversarial Training on Transformers. We apply the setup above to adversarially train both ResNet-50 and DeiT-S. However, surprisingly, this default setup works for ResNet-50 but will collapse the training with DeiT-S, i.e., the robustness of such trained DeiT-S is merely ${ \sim } 4 \%$ when evaluating against PGD-5. We identify the issue is over-regularization—when combining strong data augmentation strategies (i.e., RangAug, Mixup and CutMix) with adversarial attacks, the yielded training samples are too hard to be learnt by DeiT-S.
76
+
77
+ ![](images/a2f799125ca6f7dbb0833cd607301c9f054edae0c4dd865ac2a4577d18566455.jpg)
78
+ Figure 1: The illustration of the proposed augmentation warm-up strategy. At the beginning of adversarial training (from epoch ${ } = 0$ to epoch $^ { - 9 }$ ), we progressively increase the augmentation strength.
79
+
80
+ To ease this observed training difficulty, we design a curriculum of the applied augmentation strategies. Specifically, as shown in Figure 1, at the first 10 epoch, we progressively enhance the augmentation strength (e.g., gradually changing the distortion magnitudes in RandAug from 1 to 9) to warmup the training process. Our experiment verifies this curriculum enables a successful adversarial training—DeiT-S now attains ${ \sim } 4 4 \%$ robustness (boosted from ${ \sim } 4 \%$ ) on defending against PGD-5.
81
+
82
+ Transformers with CNNs’ Training Recipes. Interestingly, an alternative way to address the observed training difficulty is directly adopting CNN’s recipes to train Transformers [37], i.e., applying M-SGD with step decay learning rate scheduler and removing strong data augmentation strategies (like Mixup). Though this setup can stabilize the adversarial training process, it significantly hurts the overall performance of DeiT-S—the clean accuracy drops to $5 9 . 9 \%$ $( \mathbf { - 6 . 6 \% } )$ , and the robustness on defending against PGD-100 drops to $3 1 . 9 \%$ $( - 8 . 4 \% )$ .
83
+
84
+ One reason for this degenerated performance is that strong data augmentation strategies are not included in CNNs’ recipes, therefore Transformers will be easily overfitted during training [6]. Another key factor here is the incompatibility between the SGD optimizer and Transformers. As explained in [25], compared to SGD, adaptive optimizers (like AdamW) are capable of assigning different learning rates to different parameters, resulting in consistent update magnitudes even with unbalanced gradients. This property is crucial for enabling successful training of Transformers, given the gradients of attention modules are highly unbalanced.
85
+
86
+ CNNs with Transformers’ Training Recipes. As shown in Table 2, adversarially trained ResNet50 is less robust than adversarially trained DeiT-S, i.e., $3 2 . 2 6 \%$ vs. $4 0 . 3 2 \%$ on defending against PGD-100. It motivates us to explore whether adopting Transformers’ training recipes to CNNs can enhance CNNs’ adversarial training. Interestingly, if we directly apply AdamW to ResNet-50, the adversarial training will collapses. We also explore the possibility of adversarially training ResNet-50 with strong data augmentation strategies (i.e., RandAug, Mixup and CutMix). However, we find ResNet-50 will be overly regularized in adversarial training, leading to very unstable training process, sometimes may even collapse completely.
87
+
88
+ Though Transformers’ optimizer and augmentation strategies cannot improve CNNs’ adversarial training, we find Transformers’ choice of activation functions matters. Unlike the widely-used activation function in CNNs is ReLU, Transformers by default use GELU [18]. As suggested in [49], ReLU significantly weakens adversarial training due to its non-smooth nature; replacing ReLU with its smooth approximations (e.g., GELU, SoftPlus) can strengthen adversarial training. We verify that by replacing ReLU with Transformers’ activation function (i.e., GELU) in ResNet-50. As shown in Table 2, adversarial training now can be significantly enhanced, i.e., ResNet- $5 0 +$ GELU substantially outperforms its ReLU counterpart by $8 . 0 1 \%$ on defending against PGD-100. Moreover, we note the usage of GELU enables ResNet-50 to match DeiT-S in adversarial robustness, i.e., $4 0 . 2 7 \%$ vs. $4 0 . 3 2 \%$ for defending against PGD-100, and $3 5 . 5 1 \%$ vs. $3 5 . 5 0 \%$ for defending against AutoAttack, challenging the previous conclusions [4, 37] that Transformers are more robust than CNNs on defending against adversarial attacks.
89
+
90
+ Table 2: The performance of ResNet-50 and DeiT-S on defending against adversarial attacks (with $\epsilon = 4$ ). After replacing ReLU with DeiT’s activation function GELU in ResNet-50, its robustness can match the robustness of DeiT-S.
91
+
92
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Activation</td><td rowspan=1 colspan=1>Clean Acc</td><td rowspan=1 colspan=1>PGD-5</td><td rowspan=1 colspan=1>PGD-10</td><td rowspan=1 colspan=1>PGD-50</td><td rowspan=1 colspan=1>PGD-100</td><td rowspan=1 colspan=1>AutoAttack</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>ReLUGELU</td><td rowspan=1 colspan=1>66.7767.38</td><td rowspan=1 colspan=1>38.7044.01</td><td rowspan=1 colspan=1>34.1940.98</td><td rowspan=1 colspan=1>32.4740.28</td><td rowspan=1 colspan=1>32.2640.27</td><td rowspan=1 colspan=1>26.4135.51</td></tr><tr><td rowspan=1 colspan=1>DeiT-S</td><td rowspan=1 colspan=1>GELU</td><td rowspan=1 colspan=1>66.50</td><td rowspan=1 colspan=1>43.95</td><td rowspan=1 colspan=1>41.03</td><td rowspan=1 colspan=1>40.34</td><td rowspan=1 colspan=1>40.32</td><td rowspan=1 colspan=1>35.50</td></tr></table>
93
+
94
+ # 4.2 Robustness to Patch-Based Attacks
95
+
96
+ We next study the robustness of CNNs and Transformers on defending against patch-based attacks. We choose Texture Patch Attack (TPA) [53] as the attacker. Note that different from typical patchbased attacks which apply monochrome patches, TPA additionally optimizes the pattern of the patches to enhance attack strength. By default, we set the number of attacking patches to 4, limit the largest manipulated area to $10 \%$ of the whole image area, and set the attack mode as the non-targeted attack. For ResNet-50 and DeiT-S, we do not consider adversarial training here as their vanilla counterparts already demonstrate non-trivial performance on defending against TPA.
97
+
98
+ Table 3: Performance of ResNet-50 and DeiT-S on defending against Texture Patch Attack.
99
+
100
+ <table><tr><td>Architecture</td><td>Clean Acc</td><td>TexturePatchAttack</td></tr><tr><td>ResNet-50</td><td>76.9</td><td>19.7</td></tr><tr><td>DeiT-S</td><td>76.8</td><td>47.7</td></tr></table>
101
+
102
+ Interestingly, as shown in Table 3, though both models attain similar clean image accuracy, DeiT-S substantially outperforms ResNet-50 by $28 \%$ on defending against TPA. We conjecture such huge performance gap is originated from the differences in training setups; more specifically, it may be resulted by the fact DeiT-S by default use strong data augmentation strategies while ResNet-50 use none of them. The augmentation strategies like CutMix already naïvely introduce occlusion or image/patch mixing during training, therefore are potentially helpful for securing model robustness against patch-based adversarial attacks.
103
+
104
+ To verify the hypothesis above, we next ablate how strong augmentation strategies in DeiT-S (i.e., RandAug, Mixup and CutMix) affect ResNet-50’s robustness. We report the results in Table 4. Firstly, we note all augmentation strategies can help ResNet-50 achieve stronger TPA robustness, with improvements ranging from $+ 4 . 6 \%$ to $+ 3 2 . 7 \%$ . Among all these augmentation strategies, CutMix stands as the most effective one to secure model’s TPA robustness, i.e., CutMix alone can improve TPA robustness by $2 9 . 4 \%$ . Our best model is obtained by using both CutMix and RandAug, reporting $5 2 . 4 \%$ TPA robustness, which is even stronger than DeiT-S ( $4 7 . 7 \%$ TPA robustness). This observation still holds by using stronger TPA with 10 patches (increased from 4), i.e., ResNet-50 now attains $3 4 . 5 \%$ TPA robustness, outperforming DeiT-S by $5 . 6 \%$ . These results suggest that Transformers are also no more robust than CNNs on defending against patch-based adversarial attacks.
105
+
106
+ Table 4: Performance of ResNet-50 trained with different augmentation strategies on defending against Texture Patch Attack. We note 1) all augmentation strategies can improve model robustness, and 2) CutMix is the most effective augmentation strategy to secure model robustness.
107
+
108
+ <table><tr><td colspan="3">Augmentations</td><td rowspan="2">Clean Acc</td><td rowspan="2">Texture Patch Attack</td></tr><tr><td>RandAug</td><td>MixUp</td><td>CutMix</td></tr><tr><td>X</td><td>×</td><td>×</td><td>76.9</td><td>19.7</td></tr><tr><td>√</td><td>X</td><td>×</td><td>77.5</td><td>24.3 (+4.6)</td></tr><tr><td>X</td><td>√</td><td>X</td><td>75.9</td><td>31.5 (+11.8)</td></tr><tr><td>X</td><td>X</td><td>√</td><td>77.2</td><td>49.1 (+29.4)</td></tr><tr><td>√</td><td>√</td><td>X</td><td>75.7</td><td>31.7 (+12.0)</td></tr><tr><td>√</td><td>×</td><td>√</td><td>76.7</td><td>52.4 (+32.7)</td></tr><tr><td>X</td><td>√</td><td>!</td><td>77.1</td><td>39.8 (+20.1)</td></tr><tr><td>√</td><td>√</td><td>√</td><td>76.4</td><td>48.6 (+28.9)</td></tr></table>
109
+
110
+ # 5 Robustness on Out-of-distribution Samples
111
+
112
+ In addition to adversarial robustness, we are also interested in comparing the robustness of CNNs and Transformers on out-of-distribution samples. We hereby select three datasets, i.e., ImageNet-A, ImageNet-C and Stylized ImageNet, to capture the different aspects of out-of-distribution robustness.
113
+
114
+ # 5.1 Aligning Training Recipes
115
+
116
+ We first provide a direct comparison between ResNet-50 and DeiT-S with their default training setup. As shown in Table 5, we observe that, even without pretraining on (external) large scale datasets, DeiT-S still significantly outperforms ResNet-50 on ImageNet-A $( + 9 . 0 \% )$ , ImageNet-C $( + 9 . 9 )$ and Stylized-ImageNet $( + 4 . 7 \% )$ . It is possible that such performance gap is caused by the differences in training recipes (similar to the situation we observed in Section 4), which we plan to ablate next.
117
+
118
+ Table 5: DeiT-S shows stronger robustness generalization than ResNet-50 on ImageNet-C, ImageNetA and Stylized-ImageNet. Note the results on ImageNet-C is measured by mCE (lower is better).
119
+
120
+ <table><tr><td>Architecture</td><td>ImageNet个</td><td>ImageNet-A↑</td><td>ImageNet-C</td><td>Stylized-ImageNet↑</td></tr><tr><td>ResNet-50</td><td>76.9</td><td>3.2</td><td>57.9</td><td>8.3</td></tr><tr><td>ResNet-50*</td><td>76.3</td><td>4.5</td><td>55.6</td><td>8.2</td></tr><tr><td>DeiT-S</td><td>76.8</td><td>12.2</td><td>48.0</td><td>13.0</td></tr></table>
121
+
122
+ A fully aligned version. A simple baseline here is that we completely adopt the recipes of DeiT-S to train ResNet-50, denoted as ResNet- $5 0 ^ { \ast }$ . Specifically, this ResNet- ${ } . 5 0 ^ { * }$ will be trained with AdamW optimizer, cosine learning rate scheduler and strong data augmentation strategies. Nonetheless, as reported in Table 5, ResNet- ${ } . 5 0 ^ { * }$ only marginally improves ResNet-50 on ImageNet-A $( + 1 . 3 \% )$ and ImageNet-C $( + 2 . 3 )$ , which is still much worse than DeiT-S on robustness generalization.
123
+
124
+ It is possible that completely adopting the recipes of DeiT-S overly regularizes the training of ResNet50, leading to suboptimal performance. To this end, we next seek to discover the “best” setups to train ResNet-50, by ablating learning rate scheduler (step decay vs. cosine decay), optimizer (M-SGD vs. AdamW) and augmentation strategies (RandAug, Mixup and CutMix) progressively.
125
+
126
+ Step 1: aligning learning rate scheduler. It is known that switching learning rate scheduler from step decay to cosine decay improves model accuracy on clean images [2]. We additionally verify that such trained ResNet-50 (second row in Table 6) attains slightly better performance on ImageNet-A $( + 0 . 1 \% )$ , ImageNet-C $( + 1 . 0 )$ and Stylized-ImageNet $( + 0 . 1 \% )$ . Given the improvements here, we will use cosine decay by default for later ResNet training.
127
+
128
+ Step 2: aligning optimizer. We next ablate the effects of optimizers. As shown in the third row in Table 6, switching optimizer from M-SGD to AdamW weakens ResNet training, i.e., it not only decreases ResNet-50’s accuracy on ImageNet $( - 1 . 0 \% )$ , but also hurts ResNet-50’s robustness generalization on ImageNet-A $( - 0 . 2 \% )$ , ImageNet-C (-2.4) and Stylized-ImageNet $( - 0 . 3 \% )$ . Given this degenerated performance, we stick to M-SGD for later ResNet-training.
129
+
130
+ Table 6: The robustness generalization of ResNet-50 trained with different learning rate schedulers and optimizers. Nonetheless, compared to DeiT-S, all the resulted ResNet-50 show worse generalization on out-of-distribution samples.
131
+
132
+ <table><tr><td></td><td>Optimizer-LR Scheduler</td><td>ImageNet 个</td><td>ImageNet-A↑</td><td>ImageNet-C</td><td>Stylized-ImageNet↑</td></tr><tr><td rowspan="2">ResNet-50</td><td>SGD-Step</td><td>76.9</td><td>3.2</td><td>57.9</td><td>8.3</td></tr><tr><td>SGD-Cosine</td><td>77.4</td><td>3.3</td><td>56.9</td><td>8.4</td></tr><tr><td>DeiT-S</td><td>AdamW-Cosine</td><td>76.4</td><td>3.1</td><td>59.3</td><td>8.1</td></tr><tr><td></td><td>AdamW-Cosine</td><td>76.8</td><td>12.2</td><td>48.0</td><td>13.0</td></tr></table>
133
+
134
+ Step 3: aligning augmentation strategies. Compared to ResNet-50, DeiT-S additionally applied RandAug, Mixup and CutMix to augment training data. We hereby examine whether these augmentation strategies affect robustness generalization. The performance of ResNet-50 trained with different combinations of augmentation strategies is reported in Table 7. Compared to the vanilla counterpart, nearly all the combinations of augmentation strategies can improve ResNet-50’s generalization on out-of-distribution samples. The best performance is achieved by using RandAug $^ +$ Mixup, outperforming the vanilla ResNet-50 by $3 . 0 \%$ on ImageNet-A, 4.6 on ImageNet-C and $2 . 4 \%$ on Stylized-ImageNet.
135
+
136
+ Table 7: The robustness generalization of ResNet-50 trained with different combinations of augmentation strategies. We note applying RandAug $^ +$ Mixup yields the best ResNet-50 on out-ofdistribution samples; nonetheless, DeiT-S still significantly outperforms such trained ResNet-50.
137
+
138
+ <table><tr><td rowspan="2">Architecture</td><td colspan="2">Augmentation Strategies</td><td rowspan="2">ImageNet ↑</td><td rowspan="2">ImageNet-A ↑</td><td rowspan="2">ImageNet-C</td><td rowspan="2">Stylized-ImageNet↑</td></tr><tr><td>RandAug MixUp</td><td>CutMix</td></tr><tr><td rowspan="4">ResNet-50</td><td>X X</td><td>X</td><td>77.4</td><td>3.3</td><td>56.9</td><td>8.4</td></tr><tr><td>√ √</td><td>X</td><td>75.7</td><td>6.3</td><td>52.3</td><td>10.8</td></tr><tr><td>√</td><td>X 公</td><td>76.7</td><td>6.3</td><td>56.3</td><td>7.1</td></tr><tr><td>×</td><td>√</td><td>77.1</td><td>6.1</td><td>55.1</td><td>8.8</td></tr><tr><td></td><td>√</td><td>√ √</td><td>76.4</td><td>5.5</td><td>54.0</td><td>9.1</td></tr><tr><td>DeiT-S</td><td>√</td><td>√ √</td><td>76.8</td><td>12.2</td><td>48.0</td><td>13.0</td></tr></table>
139
+
140
+ Comparing ResNet with the “best” training recipes to DeiT-S. With the ablations above, we can conclude that the “best” training recipes for ResNet-50 (denoted as ResNet-50-Best) is by applying M-SGD optimizer, scheduling learning rate using cosine decay, and augmenting training data using RandAug and Mixup. As shown in the second row of Table 7, ResNet-50-Best attains $6 . 3 \%$ accuracy on ImageNet-A, $5 2 . 3 \mathrm { m C E }$ on ImageNet-C and $1 0 . 8 \%$ accuracy on Stylized-ImageNet.
141
+
142
+ Nonetheless, interestingly, we note DeiT-S still shows much stronger robustness generalization on out-of-distribution samples than our “best” ResNet-50, i.e., $+ 5 . 9 \%$ on ImageNet-A, $+ 4 . 3$ on ImageNet-C and $+ 2 . 2 \%$ on Stylized-ImageNet. These results suggest that the differences in training recipes (including the choice of optimizer, learning rate scheduler and augmentation strategies) is not the key for leading the observed huge performance gap between CNNs and Transformers on out-of-distribution samples.
143
+
144
+ Model size. To further validate that Transformers are indeed more robust than CNNs on out-ofdistribution samples, we hereby extend the comparisons above to other model sizes. Specifically, we consider the comparison at a smaller scale, i.e. ResNet-18 ( ${ \sim } 1 2$ million parameters) vs. DeiTMini ${ \sim } 1 0$ million parameters, with embedding dimension $= 2 5 6$ and number of head $= 4$ ). For ResNet training, we consider both the fully aligned recipe version (denoted as ResNet\*) and the “best” recipe version (denoted as ResNet-Best). Figure 2 shows the main results. Similar to the comparison between ResNet-50 and DeiT-S, DeiT-Mini also demonstrates much stronger robustness generalization than ResNet- $. 1 8 ^ { * }$ and ResNet-18-Best.
145
+
146
+ We next study DeiT and ResNet at a more challenging setting—comparing DeiT to a much larger ResNet on robustness generalization. Surprisingly, we note in both cases, DeiT-Mini vs. ResNet-50 and DeiT-S vs. ResNet-101, DeiTs are able to show similar, sometimes even superior, performance than ResNets. For example, DeiT-S beats the nearly $2 \times$ larger ResNet- $1 0 1 ^ { \ast }$ ${ \sim } 2 2$ million parameters vs. ${ \sim } 4 5$ million parameters) by $3 . 3 7 \%$ on ImageNet-A, 1.20 on ImageNet-C and $1 . 3 8 \%$ on StylizedImageNet. All these results further corroborate that Transformers are much more robust than CNNs on out-of-distribution samples.
147
+
148
+ ![](images/bf4d39032ccfa302941ff1a4cbed3b351becccb56bcd88acbc853ff679346427.jpg)
149
+ Figure 2: By comparing models at different scales, DeiT consistently outperforms ResNet\* and ResNet-Best by a large margin on ImageNet-A, ImageNet-C and Stylized-ImageNet.
150
+
151
+ # 5.2 Distillation
152
+
153
+ In this section, we make another attempt to bridge the robustness generalization gap between CNNs and Transformers—we apply knowledge distillation to let ResNet-50 (student model) directly learn from DeiT-S (teacher model). Specifically, we perform soft distillation [20], which minimizes the Kullback-Leibler divergence between the softmax of the teacher model and the softmax of the student model; we adopt the training recipe of DeiT during distillation.
154
+
155
+ Main results. We report the distillation results in Table 8. Though both models attain similar clean image accuracy, the student model ResNet-50 shows much worse robustness generalization than the teacher model DeiT-S, i.e., the performance is decreased by $7 . 0 \%$ on ImageNet-A, 6.2 on ImageNet-C and $3 . 2 \%$ on Stylized-ImageNet. This observation is counter-intuitive as student models typically achieve higher performance than teacher models in knowledge distillation.
156
+
157
+ However, interestingly, if we switch the roles of DeiT-S and ResNet-50, the student model DeiT-S is able to significantly outperforms the teacher model ResNet-50 on out-of-distribution samples. As shown in the third row and the fourth row in Table 8, the improvements are $6 . 4 \%$ on ImageNet-A, 6.3 on ImageNet-C and $3 . 7 \%$ on Stylized-ImageNet. These results arguably suggest that the strong generalization robustness of DeiT is rooted in the architecture design of Transformer that cannot be transferred to ResNet via neither training setups or knowledge distillation.
158
+
159
+ Table 8: The robustness generalization of ResNet-50, DeiT-S and their distilled models.
160
+
161
+ <table><tr><td>Distillation</td><td>Architecture</td><td>ImageNet</td><td>ImageNet-A 个</td><td>ImageNet-C</td><td>Stylized-ImageNet个</td></tr><tr><td>Teacher</td><td>DeiT-S</td><td>76.8</td><td>12.2</td><td>48.0</td><td>13.0</td></tr><tr><td>Student Teacher</td><td>ResNet-50*-Distill ResNet-50*</td><td>76.7 76.3</td><td>5.2 (-7.0) 4.5</td><td>54.2 (+6.2) 55.6</td><td>9.8 (-3.2) 8.2</td></tr><tr><td>Student</td><td>DeiT-S-Distill</td><td>76.2</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>10.9 (+6.4)</td><td>49.3 (-6.3)</td><td>11.9 (+3.7)</td></tr></table>
162
+
163
+ # 5.3 Hybrid Architecture
164
+
165
+ Following the discussion in Section 5.2, we hereby ablate whether incorporating Transformer’s self-attention-like architecture into model design can help robustness generalization. Specifically, we create a hybrid architecture (named Hybrid-DeiT) by directly feeding the output of res_4 block in ResNet-18 into DeiT-Mini, and compare its robustness generalization to ResNet-50 and DeiT-Small. Note that under this setting, these three models are at the same scale, i.e., hybrid-DeiT ( ${ \sim } 2 1$ million parameters) vs. ResNet-50 ( ${ \sim } 2 5$ million parameters) vs. DeiT-S ${ \sim } 2 2$ million parameters). We apply the recipe of DeiT to train these three models.
166
+
167
+ Main results. We report the robustness generalization of these three models in Figure 3. Interestingly, with the introduction of Transformer blocks, Hybrid-DeiT is able to achieve better robustness generalization than ResNet-50, i.e., $+ 1 . 1 \%$ on ImageNet-A and $+ 2 . 5 \%$ on Stylized-ImageNet, suggesting Transformer’s self-attention-like architectures is essential for boosting performance on out-of-distribution samples. We additionally compare this hybrid architecture to the pure Transformer architecture. As expected, Hybrid-DeiT attains lower robustness generalization than DeiT-S, as shown in Figure 3.
168
+
169
+ ![](images/47be14ef538bca69f32ca448f05e8b70af8abee7ace8f7a694c64624869f6146.jpg)
170
+ Figure 3: The robustness generalization of ResNet-50, DeiT-S and Hybrid-DeiT. We note introducing Transformer blocks into model design benefits generalization on out-of-distribution samples.
171
+
172
+ # 5.4 300-Epoch Training
173
+
174
+ As mentioned in Section 3.1, we by default train all models for only 100 epochs. This is a standard setup in training CNNs [15, 33], but not typical in training Transformers [44, 26]. To rule out the possibility of introducing negative effects in shortening training length, we lastly ablate the 300-epoch setup, i.e., we directly borrow the default setup in [44] to train both ResNet and DeiT.
175
+
176
+ As reported in Table 9, DeiT-S substantially outperforms ResNet-50 by $1 0 . 4 \%$ on ImageNet-A, 7.5 on ImageNet-C and 5.6 on Stylized-ImageNet. Nonetheless, we argue that such comparison is less interesting and even unfair—DeiT-S already beats ResNet-50 by $1 . 8 \%$ on ImageNet classification, therefore it is expected that DeiT-S will also show stronger performance than ResNet-50 on ImageNetA, ImageNet-C and Stylized-ImageNet.
177
+
178
+ Table 9: The robustness generalization of ResNet-50 and DeiT-S under the 300-epoch training setup. We note DeiT-S shows stronger performance than ResNet-50 on both clean images and out-of-distribution samples.
179
+
180
+ <table><tr><td>Architecture</td><td>ImageNet↑</td><td>ImageNet-A↑</td><td>ImageNet-C</td><td>Stylized-ImageNet↑</td></tr><tr><td>ResNet-50</td><td>78.1</td><td>8.8</td><td>50.3</td><td>9.5</td></tr><tr><td>DeiT-S</td><td>79.9</td><td>19.2</td><td>42.8</td><td>15.1</td></tr></table>
181
+
182
+ To make the setup fairer (i.e., comparing the robustness of models that have similar accuracy), we now compare DeiT-S to the much larger ResNet-101 (i.e., ${ \sim } 2 2$ million parameters vs. ${ \sim } 4 5$ million parameters). The results are shown in Table 10. We observer that though both models achieve similar accuracy on ImageNet, DeiT-S demonstrates much stronger robustness generalization than ResNet-101. This observation can also holds for bigger Transformers and CNNs, e.g., DeiT-B can consistently outperforms ResNet-200 on ImageNet-A, ImageNet-C and Stylized- ImageNet, despite they attain similar clean image accuracy (i.e., $8 1 . 8 \%$ vs. $8 2 . 1 \%$ ).
183
+
184
+ Table 10: The robustness generalization of ResNet and DeiT under the 300-epoch training setup. Though both models attain similar clean image accuracy, DeiTs show much stronger robustness generalization than ResNets.
185
+
186
+ <table><tr><td rowspan=1 colspan=1>Architecture</td><td rowspan=1 colspan=1>ImageNet个</td><td rowspan=1 colspan=1>ImageNet-A↑</td><td rowspan=1 colspan=1>ImageNet-C↓</td><td rowspan=1 colspan=1>Stylized-ImageNet个</td></tr><tr><td rowspan=1 colspan=1>ResNet-101DeiT-S</td><td rowspan=1 colspan=1>80.279.9</td><td rowspan=1 colspan=1>17.619.2</td><td rowspan=1 colspan=1>45.842.8</td><td rowspan=1 colspan=1>11.915.1</td></tr><tr><td rowspan=1 colspan=1>ResNet-200DeiT-B</td><td rowspan=1 colspan=1>82.181.8</td><td rowspan=1 colspan=1>23.827.9</td><td rowspan=1 colspan=1>40.838.0</td><td rowspan=1 colspan=1>13.617.9</td></tr></table>
187
+
188
+ In summary, in this 300-epoch training setup, we can draw the same conclusion as the one in the 100-epoch training setup, i.e., Transformers are truly much more robust than CNNs on out-ofdistribution samples. In addition, we note this conclusion is further corroborated in concurrent works [58, 30, 50, 62, 29], where a range of additional out-of-distribution tasks/datasets are tested. We refer interested readers to their papers for details.
189
+
190
+ # 6 Conclusion
191
+
192
+ With the recent success of Transformer in visual recognition, researchers begin to study its robustness compared with CNNs. While recent works suggest that Transformers are much more robust than CNNs, their comparisons are not fair in many aspects, e.g., training datasets, model scales, training strategies, etc. This motivates us to provide a fair and in-depth comparisons between CNNs and Transformers, focusing on adversarial robustness and robustness on out-of-distribution samples. With our unified training setup, we found that Transformers are no more robust than CNNs on adversarial robustness. By properly adopting Transformer’s training recipes, CNNs can achieve similar robustness as Transformers on defending against both perturbation-based adversarial attacks and patch-based adversarial attacks. While regarding generalization on out-of-distribution samples (e.g., ImageNet-A, ImageNet-C and Stylized ImageNet), we find Transformer’s self-attention-like architectures is the key. We hope this work would shed lights on the understanding of Transformer, and help the community to fairly compare robustness between Transformers and CNNs.
193
+
194
+ # Acknowledgements
195
+
196
+ This work was partially supported by the ONR N00014-20-1-2206, ONR N00014-18-1-2119 and Institute for Assured Autonomy at JHU with Grant IAA 80052272. Cihang Xie was supported by a gift grant from Open Philanthropy.
197
+
198
+ # References
199
+
200
+ [1] Maksym Andriushchenko, Francesco Croce, Nicolas Flammarion, and Matthias Hein. Square attack: a query-efficient black-box adversarial attack via random search. In ECCV, 2020.
201
+ [2] Irwan Bello, William Fedus, Xianzhi Du, Ekin D Cubuk, Aravind Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret Zoph. Revisiting resnets: Improved training and scaling strategies. In NeurIPS, 2021.
202
+ [3] Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V Le. Attention augmented convolutional networks. In ICCV, 2019.
203
+ [4] Srinadh Bhojanapalli, Ayan Chakrabarti, Daniel Glasner, Daliang Li, Thomas Unterthiner, and Andreas Veit. Understanding robustness of transformers for image classification. arXiv preprint arXiv:2103.14586, 2021.
204
+ [5] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. In NeurIPS, 2020.
205
+ [6] Xiangning Chen, Cho-Jui Hsieh, and Boqing Gong. When vision transformers outperform resnets without pretraining or strong data augmentations. arXiv preprint arXiv:2106.01548, 2021.
206
+ [7] Francesco Croce and Matthias Hein. Minimally distorted adversarial examples with a fast adaptive boundary attack. In ICML, 2020.
207
+ [8] Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In ICML, 2020.
208
+ [9] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical data augmentation with no separate search. In NeurIPS, 2020.
209
+ [10] Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL, 2019.
210
+ [11] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
211
+ [12] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2020.
212
+ [13] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. In ICLR, 2018.
213
+ [14] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015.
214
+ [15] 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.
215
+ [16] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
216
+ [17] Dan Hendrycks and Thomas G Dietterich. Benchmarking neural network robustness to common corruptions and surface variations. In ICLR, 2018.
217
+ [18] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
218
+ [19] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. CVPR, 2021.
219
+ [20] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. In NeurIPS Workshop, 2015.
220
+ [21] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, 2017.
221
+ [22] Alex Krizhevsky, Ilya Sutskever, and Geoff Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012.
222
+ [23] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
223
+ [24] Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021.
224
+ [25] Liyuan Liu, Xiaodong Liu, Jianfeng Gao, Weizhu Chen, and Jiawei Han. Understanding the difficulty of training transformers. In EMNLP, 2020.
225
+ [26] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, 2021.
226
+ [27] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019.
227
+ [28] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018.
228
+ [29] Muzammal Naseer, Kanchana Ranasinghe, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang. Intriguing properties of vision transformers. In NeurIPS, 2021.
229
+ [30] Sayak Paul and Pin-Yu Chen. Vision transformers are robust learners. In AAAI, 2022.
230
+ [31] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. https://s3-us-west-2.amazonaws.com/openai-assets/ research-covers/language-unsupervised/language_understanding_paper.pdf, 2018.
231
+ [32] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 2019.
232
+ [33] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In CVPR, 2020.
233
+ [34] Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. In NeurIPS, 2019.
234
+ [35] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. IJCV, 2015.
235
+ [36] Ali Shafahi, Mahyar Najibi, Amin Ghiasi, Zheng Xu, John P. Dickerson, Christoph Studer, Larry S. Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In NeurIPS, 2019.
236
+ [37] Rulin Shao, Zhouxing Shi, Jinfeng Yi, Pin-Yu Chen, and Cho-Jui Hsieh. On the adversarial robustness of visual transformers. arXiv preprint arXiv:2103.15670, 2021.
237
+ [38] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
238
+ [39] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
239
+ [40] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015.
240
+ [41] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014.
241
+ [42] Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
242
+ [43] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In ICML, 2021.
243
+ [44] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve Jegou. Training data-efficient image transformers &amp; distillation through attention. In International Conference on Machine Learning, volume 139, pages 10347–10357, July 2021.
244
+ [45] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. In ICCV, 2021.
245
+ [46] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
246
+ [47] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, 2021.
247
+ [48] Eric Wong, Leslie Rice, and J Zico Kolter. Fast is better than free: Revisiting adversarial training. In ICLR, 2020.
248
+ [49] Cihang Xie, Mingxing Tan, Boqing Gong, Alan Yuille, and Quoc V Le. Smooth adversarial training. arXiv preprint arXiv:2006.14536, 2020.
249
+ [50] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. In NeurIPS, 2021.
250
+ [51] Qizhe Xie, Eduard Hovy, Minh-Thang Luong, and Quoc Le. Self-training with noisy student improves imagenet classification. In CVPR, 2020.
251
+ [52] Fuzhao Xue, Ziji Shi, Yuxuan Lou, Yong Liu, and Yang You. Go wider instead of deeper. arXiv preprint arXiv:2107.11817, 2021.
252
+ [53] Chenglin Yang, Adam Kortylewski, Cihang Xie, Yinzhi Cao, and Alan Yuille. Patchattack: A black-box texture-based attack with reinforcement learning. In ECCV, 2020.
253
+ [54] Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In NeurIPS, 2019.
254
+ [55] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In ICCV, 2021.
255
+ [56] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In ICCV, 2019.
256
+ [57] Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers. arXiv preprint arXiv:2106.04560, 2021.
257
+ [58] Chongzhi Zhang, Mingyuan Zhang, Shanghang Zhang, Daisheng Jin, Qiang Zhou, Zhongang Cai, Haiyu Zhao, Shuai Yi, Xianglong Liu, and Ziwei Liu. Delving deep into the generalization of vision transformers under distribution shifts. arXiv preprint arXiv:2106.07617, 2021.
258
+ [59] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018.
259
+ [60] Hengshuang Zhao, Jiaya Jia, and Vladlen Koltun. Exploring self-attention for image recognition. In CVPR, 2020.
260
+ [61] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In CVPR, 2017.
261
+ [62] Chen Zhu, Wei Ping, Chaowei Xiao, Mohammad Shoeybi, Tom Goldstein, Anima Anandkumar, and Bryan Catanzaro. Long-short transformer: Efficient transformers for language and vision. In NeurIPS, 2021.
md/train/jCxDyge46t2/jCxDyge46t2.md ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Neural Contextual Bandits with Deep Representation and Shallow Exploration
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 We study neural contextual bandits, a general class of contextual bandits, where
11
+ 2 each context-action pair is associated with a raw feature vector, but the specific
12
+ 3 reward generating function is unknown. We propose a novel learning algorithm
13
+ 4 that transforms the raw feature vector using the last hidden layer of a deep ReLU
14
+ 5 neural network (deep representation learning), and uses an upper confidence bound
15
+ 6 (UCB) approach to explore in the last linear layer (shallow exploration). We prove
16
+ 7 that under standard assumptions, our proposed algorithm achieves $\widetilde { O } ( \sqrt { T } )$ finite
17
+ 8 time regret, where $T$ is the learning time horizon. Compared with existing neural
18
+ 9 contextual bandit algorithms, our approach is computationally much more efficient
19
+ 10 since it only needs to explore in the last layer of the deep neural network.
20
+
21
+ # 11 1 Introduction
22
+
23
+ 12 Multi-armed bandits (MAB) [9, 8, 30] are a class of online decision-making problems where an
24
+ 13 agent needs to learn to maximize its expected cumulative reward while repeatedly interacting with a
25
+ 14 partially known environment. Based on a bandit algorithm (also called a strategy or policy), in each
26
+ 15 round, the agent adaptively chooses an arm, and then observes and receives a reward associated with
27
+ 16 that arm. Since only the reward of the chosen arm will be observed (bandit information feedback),
28
+ 17 a good bandit algorithm has to deal with the exploration-exploitation dilemma: trade-off between
29
+ 18 pulling the best arm based on existing knowledge/history data (exploitation) and trying the arms that
30
+ 19 have not been fully explored (exploration).
31
+ 20 In many real-world applications, the agent will also be able to access detailed contexts associated
32
+ 21 with the arms. For example, when a company wants to choose an advertisement to present to a user,
33
+ 22 the recommendation will be much more accurate if the company takes into consideration the contents,
34
+ 23 specifications, and other features of the advertisements in the arm set as well as the profile of the user.
35
+ 24 To encode the contextual information, contextual bandit models and algorithms have been developed,
36
+ 25 and widely studied both in theory and in practice [19, 39, 34, 16, 1]. Most existing contextual bandit
37
+ 26 algorithms assume that the expected reward of an arm at a context is a linear function in a known
38
+ 27 context-action feature vector, which leads to many useful algorithms such as LinUCB [16], OFUL [1],
39
+ 28 etc. The representation power of the linear model can be limited in applications such as marketing,
40
+ 29 social networking, clinical studies, etc., where the rewards are usually counts or binary variables. The
41
+ 30 linear contextual bandit problem has also been extended to richer classes of parametric bandits such
42
+ 31 as the generalized linear bandits [24, 35] and kernelised bandits [44, 15].
43
+ 32 With the prevalence of deep neural networks (DNNs) and their phenomenal performances in many
44
+ 33 machine learning tasks [32, 25], there has emerged a line of work that employs DNNs to increase the
45
+ 34 representation power of contextual bandit algorithms [5, 38, 17, 49, 52, 20, 51]. The problems they
46
+ 35 solve are usually referred to as neural contextual bandits. For example, Zhou et al. [52] developed
47
+ 36 the NeuralUCB algorithm, which can be viewed as a natural extension of LinUCB [16, 1], where they
48
+ 37 use the output of a deep neural network with the feature vector as input to approximate the reward.
49
+ 38 Zhang et al. [51] adapted neural networks in Thompson Sampling [43, 14, 40] for both exploration
50
+ 39 and exploitation and proposed NeuralTS . For a fixed time horizon $T$ , it has been proved that both
51
+ 40 NeuralUCB and NeuralTS achieve a $O ( \widetilde { d } \sqrt { T } )$ regret bound, where $\hat { d }$ is the effective dimension of a
52
+ 41 neural tangent kernel matrix which can potentially scale with $O ( T K )$ for $K$ -armed bandits. This
53
+ 42 high complexity is mainly due to that the exploration is performed over the entire huge neural network
54
+ 43 parameter space, which is inefficient and even infeasible when the number of neurons is large. A more
55
+ 44 realistic and efficient way of learning neural contextual bandits may be to just explore different arms
56
+ 45 using the last layer as the exploration parameter. More specifically, Riquelme et al. [38] provided
57
+ 46 an extensive empirical study of benchmark algorithms for contextual-bandits through the lens of
58
+ 47 Thompson Sampling, which suggests decoupling representation learning and uncertainty estimation
59
+ 48 improves performance.
60
+ 49 In this paper, we show that the decoupling of representation learning and the exploration can be
61
+ 50 theoretically validated. We study a new neural contextual bandit algorithm, which learns a mapping
62
+ 51 to transform the raw features associated with each context-action pair using a deep neural network
63
+ 52 (deep representation), and then performs an upper confidence bound (UCB)-type exploration over the
64
+ 53 linear output layer of the network (shallow exploration). We prove a sublinear regret of the proposed
65
+ 54 algorithm by exploiting the UCB exploration techniques in linear contextual bandits [1] and the
66
+ 55 analysis of deep overparameterized neural networks using neural tangent kernels [27]. Our theory
67
+ 56 confirms the empirically observed effectiveness of decoupling the deep representation learning and
68
+ 57 the UCB exploration in contextual bandits [38, 49].
69
+
70
+ 58 Contributions we summarize the main contributions of this paper as follows.
71
+
72
+ • We propose a contextual bandit algorithm, Neural-LinUCB, for solving a general class of contextual bandit problems without knowing the specific reward generating function. The proposed algorithm learns a deep representation to transform the raw feature vectors and performs UCB-type exploration in the last layer of the neural network, which we refer to as deep representation and shallow exploration. Compared with LinUCB [34, 16] and neural bandits such as NeuralUCB [52] and NeuralTS [51], our algorithm enjoys the best of two worlds: strong expressiveness due to the deep representation and computational efficiency due to the shallow exploration.
73
+
74
+ 66 • Despite the usage of a DNN as the feature mapping, we prove a $\widetilde { O } ( \sqrt { T } )$ regret for the proposed
75
+ 67 Neural-LinUCB algorithm, which matches the regret bound of linear contextual bandits [16, 1].
76
+ 68 To the best of our knowledge, this is the first work that theoretically shows the convergence of
77
+ 69 bandits algorithms under the scheme of deep representation and shallow exploration. It is notable
78
+ 70 that a similar scheme called Neural-Linear was proposed by Riquelme et al. [38] for Thompson
79
+ 71 sampling algorithms, and they empirically showed that decoupling representation learning and
80
+ 72 uncertainty estimation improves the performance. Our work confirms this observation from a
81
+ 73 theoretical perspective.
82
+
83
+ • We conduct experiments on contextual bandit problems based on real-world datasets, demonstrating a better performance and computational efficiency of Neural-LinUCB over LinUCB and NeuralUCB, which well aligns with our theory.
84
+
85
+ # 77 1.1 Additional related work
86
+
87
+ 78 There is a line of related work to ours on the recent advance in the optimization and generalization
88
+ 79 analysis of deep neural networks. In particular, Jacot et al. [27] first introduced the neural tangent
89
+ 80 kernel (NTK) to characterize the training dynamics of network outputs in the infinite width limit.
90
+ 81 From the notion of NTK, a fruitful line of research emerged and showed that loss functions of
91
+ 82 deep neural networks trained by (stochastic) gradient descent can converge to the global minimum
92
+ 83 [22, 4, 21, 54, 53]. The generalization bounds for overparameterized deep neural networks are also
93
+ 84 established in Arora et al. [6, 7], Allen-Zhu et al. [3], Cao and Gu [12, 13]. Recently, the NTK based
94
+ 85 analysis is also extended to the study of sequential decision problems including bandits [52, 51], and
95
+ 86 reinforcement learning algorithms [11, 36, 45, 47].
96
+ 87 Our algorithm is also different from Langford and Zhang [29], Agarwal et al. [2] which reduce the
97
+ 88 bandit problem to supervised learning. Moreover, their algorithms need to access an oracle that
98
+ 89 returns the optimal policy in a policy class given a sequence of context and reward vectors, whose
99
+ 90 regret depends on the VC-dimension of the policy class.
100
+ 91 Notation We use $[ k ]$ to denote a set $\{ 1 , \ldots , k \}$ , $k \in \mathbb { N } ^ { + }$ . $\| \mathbf { x } \| _ { 2 } = \sqrt { \mathbf { x } ^ { \top } \mathbf { x } }$ is the Euclidean norm of
101
+ 92 a vector $\mathbf { x } \in \mathbb { R } ^ { d }$ . For a matrix $\mathbf { W } \in \mathbb { R } ^ { m \times n }$ , we denote by $\lVert \mathbf { W } \rVert _ { 2 }$ and $\| \mathbf { W } \| _ { F }$ its operator norm
102
+ 93 and Frobenius norm respectively. For a semi-definite matrix $\mathbf { A } \in \mathbb { R } ^ { d \times d }$ and a vector $\mathbf { x } \in \mathbb { R } ^ { d }$ , we
103
+ 94 denote the Mahalanobis norm as $\| \mathbf { x } \| _ { \mathbf { A } } = \sqrt { \mathbf { x } ^ { \top } \mathbf { A } \mathbf { x } }$ . Throughout this paper, we reserve the notations
104
+ 95 $\{ C _ { i } \} _ { i = 0 , 1 , \ldots }$ to represent absolute positive constants that are independent of problem parameters such
105
+ 96 as dimension, sample size, iteration number, step size, network length and so on. The specific values
106
+ 97 of $\{ C _ { i } \} _ { i = 0 , 1 , \ldots }$ . can be different in different context. For a parameter of interest $T$ and a function
107
+ 98 $f ( T )$ , we use notations such as $O ( f ( T ) )$ and $\Omega ( f ( T ) )$ to hide constant factors and ${ \widetilde { O } } ( f ( T ) )$ to hide
108
+ 99 constant and logarithmic dependence of $T$ .
109
+
110
+ # 2 Preliminaries
111
+
112
+ In this section, we provide the background of contextual bandits and deep neural networks.
113
+
114
+ # 2.1 Linear contextual bandits
115
+
116
+ 103 A contextual bandit is characterized by a tuple $( S , A , r )$ , where $s$ is the context (state) space, $\mathcal { A }$ is the
117
+ 104 arm (action) space, and $r$ encodes the unknown reward generating function at all context-arm pairs.
118
+ 105 A learning agent, who knows $s$ and $\mathcal { A }$ but does not know the true reward $r$ (values bounded in $( 0 , 1 )$
119
+ 106 for simplicity), needs to interact with the contextual bandit for $T$ rounds. At each round $t = 1 , \dots , T$ ,
120
+ 107 the agent first observes a context $s _ { t } \in S$ chosen by the environment; then it needs to adaptively select
121
+ 108 an arm $a _ { t } \in \mathcal A$ based on its past observations; finally it receives a reward $\widehat { r } _ { t } ( \mathbf { x } _ { s , a _ { t } } ) = r ( \mathbf { x } _ { s , a _ { t } } ) + \xi _ { t }$ ,
122
+ 109 where $\mathbf { x } _ { s , a } \in \mathbb { R } ^ { d }$ is a known feature vector for context-arm pair $( s , a ) \in S \times A$ , and $\xi _ { t }$ is a random
123
+ 110 noise with zero mean. The agent’s objective is to maximize its expected total reward over these $T$
124
+ 111 rounds, which is equivalent to minimizing the pseudo regret [8]:
125
+
126
+ $$
127
+ R _ { T } = \mathbb { E } \bigg [ \sum _ { t = 1 } ^ { T } \big ( \widehat { r } ( \mathbf { x } _ { s _ { t } , a _ { t } ^ { * } } ) - \widehat { r } ( \mathbf { x } _ { s _ { t } , a _ { t } } ) \big ) \bigg ] ,
128
+ $$
129
+
130
+ where 112 $a _ { t } ^ { * } \in \operatorname { a r g m a x } _ { a \in \mathcal { A } } \{ r ( \mathbf { x } _ { s _ { t } , a } ) = \mathbb { E } [ \widehat { r } ( \mathbf { x } _ { s _ { t } , a } ) ] \}$ . To simplify the exposition, we use $\mathbf { x } _ { t , a }$ to denote 113 $\mathbf { x } _ { s _ { t } , a }$ bsince it only depends on the round index $t$ in most bandit problems, and we assume $A = [ K ]$ .
131
+
132
+ 114 In some practical problems, the agent has a prior knowledge that the reward-generating function
133
+ 115 $r$ has some specific parametric form. For instance, in linear contextual bandits, the agent knows
134
+ 116 that $r ( \mathbf { x } _ { s , a } ) \stackrel { * } { = } \mathbf { x } _ { s , a } ^ { \top } \pmb { \theta } ^ { * }$ for some unknown weight vector $\pmb { \theta } ^ { * } \in \mathbb { R } ^ { d }$ . One provably sample efficient
135
+ 117 algorithm for linear contextual bandits is Linear Upper Confidence Bound (LinUCB) [1]. Specifically,
136
+ 118 at each round $t$ , LinUCB chooses action by the following strategy
137
+
138
+ $$
139
+ a _ { t } = \underset { a \in [ K ] } { \operatorname { a r g m a x } } \left. \mathbf { x } _ { t , a } ^ { \top } \pmb { \theta } _ { t } + \alpha _ { t } \Vert \mathbf { x } _ { t , a } \Vert _ { \mathbf { A } _ { t } ^ { - 1 } } \right. ,
140
+ $$
141
+
142
+ 119 where θt is a point estimate of θ∗, At = λI + Pti=1 xi,ai x> i,ai with some λ > 0 is a matrix
143
+ 120 defined based on the historical context-arm pairs, and $\alpha _ { t } > 0$ is a tuning parameter that controls the
144
+ 121 exploration rate in LinUCB.
145
+
146
+ # 2.2 Deep neural networks
147
+
148
+ In this paper, we use 123 $f ( \mathbf { x } )$ to denote a neural network with input data $\mathbf { x } \in \mathbb { R } ^ { d }$ . Let $L$ be the number 124 of hidden layers and $\mathbf { W } _ { l } \in \mathbb { R } ^ { m _ { l } \times m _ { l - 1 } }$ be the weight matrices in the $l$ -th layer, where $l = 1 , \ldots , L$ 125 $m _ { 1 } = . . . = m _ { L - 1 } = m$ and $m _ { 0 } = m _ { L } = d$ . Then a $L$ -hidden layer neural network is defined as
149
+
150
+ $$
151
+ f ( \mathbf { x } ) = \sqrt { m } \pmb { \theta } ^ { \ast \top } \sigma _ { L } ( \mathbf { W } _ { L } \sigma _ { L - 1 } ( \mathbf { W } _ { L - 1 } \cdot \cdot \cdot \sigma _ { 1 } ( \mathbf { W } _ { 1 } \mathbf { x } ) \cdot \cdot \cdot ) ) ,
152
+ $$
153
+
154
+ 126 where $\sigma _ { l }$ is an activation function and $\pmb { \theta } ^ { * } \in \mathbb { R } ^ { d }$ is the weight of the output layer. To simplify the
155
+ 127 presentation, we will assume $\sigma _ { 1 } = \sigma _ { 2 } = . . . = \sigma _ { L } = \sigma$ is the ReLU activation function, i.e.,
156
+ 128 ${ \bar { \sigma } } ( x ) = \operatorname* { m a x } \{ 0 , x \}$ for $x \in \mathbb { R }$ . We denote $\mathbf { w } = ( \mathrm { v e c } ( \mathbf { W } _ { 1 } ) ^ { \top } , \ldots , \mathrm { v e c } ( \mathbf { W } _ { L } ) ^ { \top } ) ^ { \top }$ , which is the
157
+ 129 concatenation of the vectorized weight parameters of all hidden layers of the neural network. We also
158
+ 130 write $f ( \mathbf { x } ; \pmb { \theta } ^ { * } , \mathbf { w } ) = f ( \mathbf { x } )$ in order to explicitly specify the weight parameters of neural network $f$ . It
159
+ 131 is easy to show that the dimension $p$ of vector w satisfies $p = ( L - 2 ) m ^ { 2 } + 2 m d .$ . To simplify the
160
+ 132 notation, we define $\phi ( \mathbf { x } ; \mathbf { w } )$ as the output of the $L$ -th hidden layer of neural network $f$ .
161
+
162
+ $$
163
+ \boldsymbol { \phi } ( \mathbf { x } ; \mathbf { w } ) = \sqrt { m } \sigma ( \mathbf { W } _ { L } \sigma ( \mathbf { W } _ { L - 1 } \cdot \cdot \cdot \sigma ( \mathbf { W } _ { 1 } \mathbf { x } ) \cdot \cdot \cdot \cdot ) ) .
164
+ $$
165
+
166
+ 33 Note that $\phi ( \mathbf { x } ; \mathbf { w } )$ itself can also be viewed as a neural network with vector-valued outputs.
167
+
168
+ # 134 3 Deep Representation and Shallow Exploration
169
+
170
+ 135 The linear parametric form in linear contextual bandits might produce biased estimates of the reward
171
+ 136 due to the lack of representation power [42, 38]. In contrast, it is well known that deep neural networks
172
+ 137 are powerful enough to approximate an arbitrary function [18]. Therefore, a natural extension of
173
+ 138 linear contextual bandits is to use a deep neural network to approximate the reward generating
174
+ 139 function $r ( \cdot )$ . Nonetheless, DNNs usually have a prohibitively large dimension for weight parameters,
175
+ 140 which makes the exploration in neural networks based UCB algorithm inefficient [28, 52].
176
+ 141 In this work, we study a neural contextual bandit algorithm, where the hidden layers of a deep neural
177
+ 142 network are used to represent the features and the exploration is only performed in the last layer of the
178
+ 143 neural network. In particular, we assume that the reward generating function $r ( \cdot )$ can be expressed as
179
+ 144 the inner product between a deep represented feature vector and an exploration weight parameter,
180
+ 145 namely, $\bar { r ( \cdot ) } = \langle \theta ^ { * } , \psi ( \cdot ) \rangle$ , where $\pmb { \theta } ^ { * } \in \mathbb { R } ^ { d }$ is some weight parameter and $\psi ( \cdot )$ is an unknown feature
181
+ 146 mapping. This decoupling of the representation and the exploration will achieve the best of both
182
+ 147 worlds: efficient exploration in shallow (linear) models and high expressive power of deep models.
183
+ 148 To learn the unknown feature mapping, we propose to use a neural network to approximate it. In
184
+ 149 what follows, we will describe a neural contextual bandit algorithm that uses the output of the last
185
+ 150 hidden layer of a neural network to transform the raw feature vectors (deep representation) and
186
+ 151 performs UCB-type exploration in the last layer of the neural network (shallow exploration). Since
187
+ 152 the exploration is performed only in the last linear layer, we call this procedure Neural-LinUCB,
188
+ 153 which is displayed in Algorithm 1.
189
+ 154 Specifically, in round $t$ , the agent receives an action set with raw features $\mathcal { X } _ { t } = \{ \mathbf { x } _ { t , 1 } , . . . , \mathbf { x } _ { t , K } \}$ .
190
+ 155 Then the agent chooses an arm $a _ { t }$ that maximizes the following upper confidence bound:
191
+
192
+ $$
193
+ a _ { t } = \underset { k \in [ K ] } { \operatorname { a r g m a x } } \Big \{ \langle \phi ( \mathbf { x } _ { t , k } ; \mathbf { w } _ { t - 1 } ) , \theta _ { t - 1 } \rangle + \alpha _ { t } \| \phi ( \mathbf { x } _ { t , k } ; \mathbf { w } _ { t - 1 } ) \| _ { \mathbf { A } _ { t - 1 } ^ { - 1 } } \Big \} ,
194
+ $$
195
+
196
+ 156 where $\pmb { \theta } _ { t - 1 }$ is a point estimate of the unknown weight in the last layer, $\phi ( \mathbf { x } ; \mathbf { w } )$ is defined as in (2.3),
197
+ 157 $\mathbf { w } _ { t - 1 }$ is an estimate of all the weight parameters in the hidden layers of the neural network, $\alpha _ { t } > 0$ is
198
+ 158 the algorithmic parameter controlling the exploration, and ${ \bf A } _ { t }$ is a matrix defined based on historical
199
+ 159 transformed features:
200
+
201
+ $$
202
+ \mathbf { A } _ { t } = \lambda \mathbf { I } + \sum _ { i = 1 } ^ { t } \phi ( \mathbf { x } _ { i , a _ { i } } ; \mathbf { w } _ { i - 1 } ) \phi ( \mathbf { x } _ { i , a _ { i } } ; \mathbf { w } _ { i - 1 } ) ^ { \top } ,
203
+ $$
204
+
205
+ and 160 $\lambda > 0$ . After pulling arm $a _ { t }$ , the agent will observe a noisy reward $\widehat { r } _ { t } : = \widehat { r } ( \mathbf { x } _ { t , a _ { t } } )$ defined as
206
+
207
+ $$
208
+ \widehat { r } ( \mathbf { x } _ { t , k } ) = r ( \mathbf { x } _ { t , k } ) + \xi _ { t } ,
209
+ $$
210
+
211
+ 161 where $\xi _ { t }$ is an independent $\nu$ -subGaussian random noise for some $\nu > 0$ and $r ( \cdot )$ is an unknown
212
+ 162 reward function. In this paper, we will interchangeably use notation $\widehat { r _ { t } }$ to denote the reward received
213
+ 163 at the $t$ -th step and an equivalent notation $\widehat { r } ( \mathbf { x } )$ b to express its dependence on the feature vector $\mathbf { x }$ .
214
+
215
+ 164 Upon receiving the reward $\widehat { r _ { t } }$ , the agent updates its estimate $\theta _ { t }$ of the output layer weight by using the same 165 $\ell ^ { 2 }$ b-regularized least-squares estimate in linear contextual bandits [1]. In particular, we have
216
+
217
+ $$
218
+ \pmb { \theta } _ { t } = \mathbf { A } _ { t } ^ { - 1 } \mathbf { b } _ { t } ,
219
+ $$
220
+
221
+ where 166 $\begin{array} { r } { \mathbf { b } _ { t } = \sum _ { i = 1 } ^ { t } \widehat { r } _ { i } \phi ( \mathbf { x } _ { i , a _ { i } } ; \mathbf { w } _ { i - 1 } ) } \end{array}$ .
222
+
223
+ 167 To save the computation, the neural network $\phi ( \cdot ; { \mathbf w } _ { t } )$ will be updated once every $H$ steps. Therefore,
224
+ 168 we have $\mathbf { w } _ { ( q - 1 ) H + 1 } = . . . = \mathbf { w } _ { q H }$ for $q = 1 , 2 , \ldots$ We call the time steps $\{ ( q - 1 ) H + 1 , \ldots , q H \}$
225
+ 169 an epoch with length $H$ . At time step $t = H q$ , for any $q = 1 , 2 , \ldots$ , Algorithm 1 will retrain the
226
+ 170 neural network based on all the historical data. In Algorithm 2, our goal is to minimize the following
227
+ 171 empirical loss function:
228
+
229
+ $$
230
+ \mathcal { L } _ { q } ( \mathbf { w } ) = \sum _ { i = 1 } ^ { q H } \big ( \pmb { \theta } _ { i } ^ { \top } \phi ( \mathbf { x } _ { i , a _ { i } } ; \mathbf { w } ) - \widehat { r } _ { i } \big ) ^ { 2 } .
231
+ $$
232
+
233
+ In practi172 i=1e, one can further save computational cost by onl eding data $\{ \mathbf { x } _ { i , a _ { i } } , \widehat { r } _ { i } , \pmb { \theta } _ { i } \} _ { i = ( q - 1 ) H + 1 } ^ { q H }$ $q$ $\mathbf { w } _ { t }$ b, which does not hurt the performance 174 since the historical information has been encoded into the estimate of $\theta _ { i }$ . In this paper, we will 175 perform the following gradient descent step
234
+
235
+ $$
236
+ \mathbf { w } _ { q } ^ { ( s ) } = \mathbf { w } _ { q } ^ { ( s - 1 ) } - \eta _ { q } \nabla _ { \mathbf { w } } \mathcal { L } _ { q } \big ( \mathbf { w } ^ { ( s - 1 ) } \big ) .
237
+ $$
238
+
239
+ 176 for $s = 1 , \ldots , n$ , where $\mathbf { w } _ { q } ^ { ( 0 ) } = \mathbf { w } ^ { ( 0 ) }$ is chosen as the same random initialization point. We will
240
+ 177 discuss more about the initial point $\mathbf { w } ^ { ( 0 ) }$ in the next paragraph. Then Algorithm 2 outputs $\mathbf { w } _ { q } ^ { ( n ) }$ and
241
+ 178 we set it as the updated weight parameter $\mathbf { w } _ { H q + 1 }$ in Algorithm 1. In the next round, the agent will
242
+ 179 receive another action set $\mathcal { X } _ { t + 1 }$ with raw feature vectors and repeat the above steps to choose the
243
+ 180 sub-optimal arm and update estimation for contextual parameters.
244
+ 181 Initialization: Recall that w is the collection of all hidden layer weight parameters of the neural
245
+ 182 network. We will follow the same initialization scheme as used in Zhou et al. [52], where each entry
246
+ 183 of the weight matrices follows some Gaussian distribution. Specifically, for any $l \in \{ 1 , \ldots , L - 1 \}$ ,
247
+ 184 we set $\mathbf { W } _ { l } = \left[ \begin{array} { c c } { \mathbf { W } } & { \mathbf { 0 } } \\ { \mathbf { 0 } } & { \mathbf { W } } \end{array} \right]$ , where each entry of $\mathbf { W }$ follows distribution $N ( 0 , 4 / m )$ independently; for
248
+ 185 $\mathbf { W } _ { L }$ , we set it as $\begin{array} { r l } { [ \mathbf { V } } & { { } - \mathbf { V } ] } \end{array}$ , where each entry of $\mathbf { V }$ follows distribution $N ( 0 , 2 / m )$ independently.
249
+
250
+ Comparison with LinUCB and NeuralUCB: Compared with linear contextual bandits in Section 2.1, Algorithm 1 has a distinct feature that it learns a deep neural network to obtain a deep representation of the raw data vectors and then performs UCB exploration. This deep representation allows our algorithm to characterize more intrinsic and latent information about the raw data $\left\{ \mathbf { x } _ { t , k } \right\} _ { t \in [ T ] , k \in [ K ] } \subset \mathbb { R } ^ { d }$ . However, the increased complexity of the feature mapping $\phi ( \cdot ; { \mathbf { w } } )$ also introduces great hardness in training. For instance, a recent work by Zhou et al. [52] also studied the neural contextual bandit problem, but different from (3.1), their algorithm (NeuralUCB) performs the UCB exploration on the entire network parameter space, which is $\dot { \mathbb { R } } ^ { \widetilde { p } + d }$ , where $\ddot { \tilde { p } } = m + m d + ( L \dot { \bar { \mathbf { \alpha } } } 1 ) m ^ { 2 }$ . Note that in Zhou et al. [52], they need to compute the inverse eof a matrix $\mathbf { Z } _ { t } \in \mathbb { R } ^ { ( \widetilde { p } + d ) \times ( \widetilde { p } + d ) }$ , which is defined in a similar way to the matrix ${ \bf A } _ { t }$ in our paper except that $\mathbf { Z } _ { t }$ is defined based on the gradient of the network instead of the output of the last hidden layer as in (3.2). In sharp contrast, ${ \bf A } _ { t }$ in our paper is only of size $d \times d$ and thus is much more efficient and practical in implementation, which will be seen from our experiments in later sections.
251
+
252
+ 199 We note that there is also a similar algorithm to our Neural-LinUCB presented in Deshmukh et al.
253
+ 200 [20], where they studied the self-supervised learning loss in contextual bandits with neural network
254
+ 201 representation for computer vision problems. However, no regret analysis has been provided. When
255
+ 202 the feature mapping $\phi ( \cdot ; { \mathbf { w } } )$ is an identity function, the problem reduces to linear contextual bandits
256
+ 203 where we directly use $\mathbf { x } _ { t }$ as the feature vector. In this case, it is easy to see that Algorithm 1 reduces
257
+ 204 to LinUCB [16] since we do not need to learn the representation parameter w anymore.
258
+ 205 Comparison with Neural-Linear: The high-level idea of decoupling the representation and explo
259
+ 206 ration in our algorithm is also similar to that of the Neural-Linear algorithm [38, 49], which trains a
260
+ 207 deep neural network to learn a representation of the raw feature vectors, and then uses a Bayesian
261
+ 208 linear regression to estimate the uncertainty in the bandit problem. However, these two algorithms
262
+ 209 are significantly different since Neural-Linear [38] is a Thompson sampling based algorithm that
263
+ 210 uses posterior sampling to estimate the weight parameter $\pmb { \theta } ^ { * }$ via Bayesian linear regression, whereas
264
+ 211 Neural-LinUCB adopts upper confidence bound based techniques to estimate the weight $\pmb { \theta } ^ { * }$ . Never
265
+ 212 theless, both algorithms share the same idea of deep representation and shallow exploration, and we
266
+ 213 view our Neural-LinUCB algorithm as one instantiation of the Neural-Linear scheme.
267
+
268
+ # 214 4 Main Results
269
+
270
+ 215 To analyze the regret bound of Algorithm 1, we first lay down some important assumptions on the
271
+ 216 neural contextual bandit model.
272
+
273
+ # Algorithm 1 Deep Representation and Shallow Exploration (Neural-LinUCB)
274
+
275
+ 1: Input: regularization parameter $\lambda > 0$ , number of total steps $T$ , episode length $H$ , exploration parameters $\{ \alpha _ { t } > 0 \} _ { t \in [ T ] }$
276
+ 2: Initialization: $\mathbf { A } _ { 0 } = \lambda \mathbf { I }$ , $\mathbf { b } _ { 0 } = \mathbf { 0 }$ ; entries of $\pmb { \theta } _ { 0 }$ follow $N ( 0 , 1 / d )$ , and $\mathbf { w } ^ { ( 0 ) }$ is initialized as described in Section 3; $q = 1$ ; $\mathbf { w } _ { 0 } = \mathbf { w } ^ { ( 0 ) }$
277
+ 3: for $t = 1 , \dots , T$ do
278
+ 4: receive feature vectors $\left\{ \mathbf { x } _ { t , 1 } , \ldots , \mathbf { x } _ { t , K } \right\}$
279
+ 5: choose arm $\begin{array} { r } { a _ { t } \ = \ \mathrm { a r g m a x } _ { k \in [ K ] } \pmb { \theta } _ { t - 1 } ^ { \top } \phi ( \mathbf { x } _ { t , k } ; \mathbf { w } _ { t - 1 } ) \ + \alpha _ { t } \| \phi ( \mathbf { x } _ { t , k } ; \mathbf { w } _ { t - 1 } ) \| _ { \mathbf { A } _ { t - 1 } ^ { - 1 } } } \end{array}$ , and obtain reward $\widehat { r } _ { t }$
280
+ 6: update ${ \bf A } _ { t }$ and $\mathbf { b } _ { t }$ as follows: $\begin{array} { r l } & { \mathbf { \Phi } ^ { \mathbf { A } } t = \tilde { \mathbf { A } } _ { t - 1 } + \tilde { \phi } ( \mathbf { x } _ { t , a _ { t } } ; \mathbf { w } _ { t - 1 } ) \phi ( \mathbf { x } _ { t , a _ { t } } ; \mathbf { w } _ { t - 1 } ) ^ { \top } } \\ & { \mathbf { b } _ { t } = \mathbf { b } _ { t - 1 } + \hat { r } _ { t } \phi ( \mathbf { x } _ { t , a _ { t } } ; \mathbf { w } _ { t - 1 } ) , } \end{array}$ ,
281
+ 7: update $\pmb { \theta } _ { t } = \mathbf { A } _ { t } ^ { - 1 } \mathbf { b } _ { t }$
282
+ 8: if $\mathrm { n o d } ( t , H ) = 0$ then
283
+ 9: $\mathbf { w } _ { t } \gets$ output of Algorithm 2
284
+ 10: $q = q + 1$
285
+ 11: else
286
+ 12: $\mathbf { w } _ { t } = \mathbf { w } _ { t - 1 }$
287
+ 13: end if
288
+ 14: end for
289
+ 15: Output $\mathbf { w } _ { T }$
290
+
291
+ # Algorithm 2 Update Weight Parameters with Gradient Descent
292
+
293
+ 1: Input: initial point $\mathbf { w } _ { q } ^ { ( 0 ) } = \mathbf { w } ^ { ( 0 ) }$ , maximum iteration number $n$ , step size $\eta _ { q }$ , and loss function
294
+ defined in (3.5).
295
+ 2: for $s = 1 , \ldots , n$ do
296
+ 3: $\begin{array} { r } { \mathbf { w } _ { q } ^ { ( s ) } = \mathbf { w } _ { q } ^ { ( s - 1 ) } - \eta _ { q } \nabla _ { \mathbf { w } } \mathcal { L } _ { q } ( \mathbf { w } _ { q } ^ { ( s - 1 ) } ) . } \end{array}$
297
+ 4: end for
298
+ 5: Output w(n)q
299
+ 7 Assumption 4.1. For all $i \geq 1$ and $k \in [ K ]$ , we assume that $\| \mathbf { x } _ { i , k } \| _ { 2 } = 1$ and its entries satisfy
300
+ 8 $[ { \bf { x } } _ { i , k } ] _ { j } \stackrel { - } { = } [ { \bf { x } } _ { j , k } ] _ { j + d / 2 }$ .
301
+
302
+ 19 The assumption that $\| \mathbf { x } _ { i , k } \| _ { 2 } = 1$ is not essential and is only imposed for simplicity, which is also 20 used in Zou and $\mathrm { G u }$ [53], Zhou et al. [52]. Finally, the condition on the entries of $\mathbf { x } _ { i , k }$ is also mild since otherwise we could always construct 21 $\mathbf { x } _ { i , k } ^ { \prime } = [ \mathbf { x } _ { i , k } ^ { \top } , \mathbf { x } _ { i , k } ^ { \top } ] ^ { \top } / \sqrt { 2 }$ to replace it. An implication of
303
+
304
+ Assumption 4.1 is that the initialization scheme in Algorithm 1 results in $\phi ( \mathbf { x } _ { i , k } ; \mathbf { w } ^ { ( 0 ) } ) = \mathbf { 0 }$ for all $i \in [ T ]$ and $k \in [ K ]$ .
305
+
306
+ 24 We assume the following stability condition on the spectral norm of the neural network gradient:
307
+
308
+ 225 Assumption 4.2. There is a constant $\ell _ { \mathrm { L i p } } > 0$ such that it holds
309
+
310
+ $$
311
+ \left\| \frac { \partial \phi } { \partial \mathbf { w } } ( \mathbf { x } ; \mathbf { w } _ { 0 } ) - \frac { \partial \phi } { \partial \mathbf { w } } ( \mathbf { x } ^ { \prime } ; \mathbf { w } _ { 0 } ) \right\| _ { 2 } \leq \ell _ { \mathrm { L i p } } \| \mathbf { x } - \mathbf { x } ^ { \prime } \| _ { 2 } ,
312
+ $$
313
+
314
+ for all 226 $\mathbf { x } , \mathbf { x } ^ { \prime } \in \{ \mathbf { x } _ { i , k } \} _ { i \in [ T ] , k \in [ K ] }$
315
+
316
+ 227 The inequality in Assumption 4.2 resembles the Lipschitz condition on the gradient of the neural
317
+ 228 network. However, it is essentially different from the smoothness condition since here the gradient
318
+ 229 is taken with respect to the neural network weights while the Lipschitz condition is imposed on the
319
+ 230 feature parameter x. Similar conditions are widely made in nonconvex optimization [46, 10, 48], in
320
+ 231 the name of first-order stability, which is essential to derive the convergence of alternating optimization
321
+ 232 algorithms. Furthermore, Assumption 4.2 is only required on the $T K$ training data points and a
322
+ 233 specific weight parameter $\mathbf { w } _ { 0 }$ . Therefore, the condition will hold if the raw feature data lie in a
323
+ 234 certain subspace of $\mathbb { R } ^ { d }$ . We provided some further discussions in the supplementary material about
324
+ 235 this assumption for interested readers.
325
+ 236 In order to analyze the regret bound of Algorithm 1, we need to characterize the properties of the
326
+ 237 deep neural network in (2.2) that is used to represent the feature vectors. Following a recent line of
327
+ 238 research [27, 12, 7, 52], we define the covariance between two data point $\mathbf { x } , \mathbf { y } \in \mathbb { R } ^ { \bar { d } }$ as follows.
328
+
329
+ $$
330
+ \begin{array} { r l } & { \widetilde { \pmb { \Sigma } } ^ { ( 0 ) } ( \mathbf x , \mathbf y ) = \pmb { \Sigma } ^ { ( 0 ) } ( \mathbf x , \mathbf y ) = \mathbf x ^ { \top } \mathbf y , } \\ & { \pmb { \Lambda } ^ { ( l ) } ( \mathbf x , \mathbf y ) = \left[ \pmb { \Sigma } ^ { l - 1 } ( \mathbf x , \mathbf x ) \quad \pmb { \Sigma } ^ { l - 1 } ( \mathbf x , \mathbf y ) \right] , } \\ & { \pmb { \Sigma } ^ { ( l ) } ( \mathbf x , \mathbf y ) = 2 \mathbb { E } _ { ( u , v ) \sim N ( \mathbf 0 , \mathbf { A } ^ { ( l - 1 ) } ( \mathbf x , \mathbf y ) ) } [ \sigma ( u ) \sigma ( v ) ] , } \\ & { \widetilde { \pmb { \Sigma } } ^ { ( l ) } ( \mathbf x , \mathbf y ) = 2 \widetilde { \pmb { \Sigma } } ^ { ( l - 1 ) } ( \mathbf x , \mathbf y ) \mathbb { E } _ { u , v } [ \dot { \sigma } ( u ) \dot { \sigma } ( v ) ] + \pmb { \Sigma } ^ { ( l ) } ( \mathbf x , \mathbf y ) , } \end{array}
331
+ $$
332
+
333
+ where 239 the ne240 $( u , v ) \sim N ( \mathbf { 0 } , \mathbf { \Lambda } \Lambda ^ { ( l - 1 ) } ( \mathbf { x } , \mathbf { y } ) )$ , arix $\dot { \sigma } ( \cdot )$ rivative of activation functiobased on all feature vectors $\sigma ( \cdot )$ $\mathbf { H } \in \mathbb { R } ^ { T K \times T K }$ $\{ \mathbf { x } _ { t , k } \} _ { t \in [ T ] , k \in [ K ] }$ 241 Renumbering $\{ \mathbf { x } _ { t , k } \} _ { t \in [ T ] , k \in [ K ] }$ as $\{ \mathbf { x } _ { i } \} _ { i = 1 , \dots , T K }$ , then each entry $\mathbf { H } _ { i j }$ is defined as
334
+
335
+ $$
336
+ \mathbf { H } _ { i j } = \frac { 1 } { 2 } \big ( \widetilde { \boldsymbol { \Sigma } } ^ { ( L ) } ( \mathbf { x } _ { i } , \mathbf { x } _ { j } ) + \boldsymbol { \Sigma } ^ { ( L ) } ( \mathbf { x } _ { i } , \mathbf { x } _ { j } ) \big ) ,
337
+ $$
338
+
339
+ 42 for all $i , j \in [ T K ]$ . Based on the above definition, we impose the following assumption on $\mathbf { H }$
340
+
341
+ 43 Assumption 4.3. The neural tangent kernel defined in (4.2) is positive definite, i.e., $\lambda _ { \operatorname* { m i n } } ( \mathbf { H } ) \geq \lambda _ { 0 }$
342
+ 244 for some constant $\lambda _ { 0 } > 0$ .
343
+ 245 Assumption 4.3 essentially requires the neural tangent kernel matrix $\mathbf { H }$ to be non-singular, which is
344
+ 246 a mild condition and also imposed in other related work [21, 7, 12, 52]. Moreover, it is shown that
345
+ 247 Assumption 4.3 can be easily derived from Assumption 4.1 for two-layer ReLU networks [37, 53].
346
+ 248 Therefore, Assumption 4.3 is mild or even negligible given the non-degeneration assumption on the
347
+ 249 feature vectors. Also note that matrix $\mathbf { H }$ is only defined based on layers $l = 1 , \ldots , L$ of the neural
348
+ 250 network, and does not depend on the output layer $\pmb \theta$ . It is easy to extend the definition of $\mathbf { H }$ to the
349
+ 251 NTK matrix defined on all layers including the output layer $\pmb \theta$ , which would also be positive definite
350
+ 252 by Assumption 4.3 and the recursion in (4.2).
351
+ 253 Before we present the regret analysis of the neural contextual bandit, we need to modify the regret
352
+ 254 defined in (2.1) to account for the randomness of the neural network initialization. For a fixed time
353
+ 255 horizon $T$ , we define the regret of Algorithm 1 as follows.
354
+
355
+ $$
356
+ R _ { T } = \mathbb { E } \bigg [ \sum _ { t = 1 } ^ { T } \big ( \widehat { r } ( \mathbf { x } _ { t , a _ { t } ^ { * } } ) - \widehat { r } ( \mathbf { x } _ { t , a _ { t } } ) \big ) \big | \mathbf { w } ^ { ( 0 ) } \bigg ] ,
357
+ $$
358
+
359
+ 256 where the expectation is taken over the randomness of the reward noise. Note that $R _ { T }$ defined in (4.3)
360
+ 257 is still a random variable since the initialization of Algorithm 2 is randomly generated.
361
+
362
+ 258 Now we are going to present the regret bound of the proposed algorithm.
363
+
364
+ 59 Theorem 4.4. Suppose Assumptions 4.1, 4.2 and 4.3 hold. Assume that $\lVert \pmb { \theta } ^ { * } \rVert _ { 2 } \leq M$ for some
365
+ 0 positive constant $M > 0$ . For any $\delta \in ( 0 , 1 )$ , let us choose $\alpha _ { t }$ in Neural-LinUCB as
366
+
367
+ $$
368
+ \alpha _ { t } = \nu \sqrt { 2 \big ( d \log ( 1 + t \log ( H K ) / \lambda ) + \log ( 1 / \delta ) \big ) } + \lambda ^ { 1 / 2 } M .
369
+ $$
370
+
371
+ 261 We choose the step size $\eta _ { q }$ of Algorithm 2 as
372
+
373
+ $$
374
+ \eta _ { q } \leq C _ { 0 } \big ( d ^ { 2 } m n T ^ { 5 . 5 } L ^ { 6 } \log ( T K / \delta ) \big ) ^ { - 1 } ,
375
+ $$
376
+
377
+ 262 and the width of the neural network satisfies $m = \mathrm { p o l y } ( L , d , 1 / \delta , H , \log ( T K / \delta ) )$ . With probability
378
+ 263 at least $1 - \delta$ over the randomness of the initialization of the neural network, it holds that
379
+
380
+ $$
381
+ R _ { T } \leq C _ { 1 } \alpha _ { T } \sqrt { T d \log \left( 1 + \frac { T G ^ { 2 } } { \lambda d } \right) } + \frac { C _ { 2 } \ell _ { \mathrm { L i p } } L ^ { 3 } d ^ { 5 / 2 } T \sqrt { \log m \log ( \frac { 1 } { \delta } ) \log ( \frac { T K } { \delta } ) } \| \mathbf { r } - \widetilde { \mathbf { r } } \| _ { \mathbf { H } ^ { - 1 } } } { m ^ { 1 / 6 } } ,
382
+ $$
383
+
384
+ 264 where $\{ C _ { i } \} _ { i = 0 , 1 , 2 }$ are absolute constants independent of the problem parameters, $\begin{array} { r l } { \mathbf { r } } & { { } = } \end{array}$
385
+ 265 $( r ( \mathbf { x } _ { 1 } ) , r ( \mathbf { x } _ { 2 } ) , \ldots , r ( \mathbf { x } _ { T K } ) ) ^ { \top } \ \in \ \mathbb { R } ^ { T K }$ and $\widetilde { \textbf { r } } = ( f ( \mathbf { x } _ { 1 } ; \pmb { \theta } _ { 0 } , \mathbf { w } _ { 0 } ) , \dots , f ( \mathbf { x } _ { T K } ; \pmb { \theta } _ { T - 1 } , \mathbf { w } _ { T - 1 } ) ) ^ { \top } \ \in$
386
+ 266 $\mathbb { R } ^ { T K }$ , and $\| \mathbf { r } \| _ { \mathbf { A } } = \sqrt { \mathbf { r } ^ { \top } \mathbf { A } \mathbf { r } }$ .
387
+ 267 Remark 4.5. Theorem 4.4 shows that the regret of Algorithm 1 can be bounded by two parts: the
388
+ 268 first part is of order $\widetilde { O } ( \sqrt { T } )$ , which resembles the regret bound of linear contextual bandits [1]; the
389
+ 269 second part is of order $\widetilde { O } ( m ^ { - 1 / 6 } T \sqrt { ( \mathbf { r } - \widetilde { \mathbf { r } } ) ^ { \top } \mathbf { H } ^ { - 1 } ( \mathbf { r } - \widetilde { \mathbf { r } } ) } )$ , which depends on the estimation error
390
+ 270 of the neural network $f$ e efor the reward generating function $r$ and the neural tangent kernel $\mathbf { H }$ .
391
+
392
+ It is worth noting that our theoretical analysis depends on the reward structure assumption that $r ( \cdot ) = \langle \theta \ast , \psi ( \cdot ) \rangle$ . However, the linear structure between $\pmb { \theta } \ast$ and $\psi ( \cdot )$ is not essential. As long as the deep representation of the feature vector and the uncertainty weight parameter can be decoupled, Algorithm 1 can be easily extended to settings with milder assumptions on the reward structure such as generalized linear models [41, 24, 35, 28]. For more general bandit models where no assumption is imposed to the reward generating function, it is still unclear whether the decoupled deep representation and shallow exploration would work especially in cases a thorough exploration may be needed.
393
+
394
+ Based on the result in Theorem 4.4, we can easily verify the following conclusion:
395
+
396
+ Corollary 4.6. Under the same conditions of Theorem 4.4, if we choose a sufficiently overparameterized neural network mapping $\phi ( \cdot )$ such that $m \geq T ^ { 3 }$ , then the regret of Algorithm 1 is $R _ { T } = { \widetilde { O } } ( { \sqrt { T } } { \sqrt { ( \mathbf { r } - { \widetilde { \mathbf { r } } } ) ^ { \top } \mathbf { H } ^ { - 1 } ( \mathbf { r } - { \widetilde { \mathbf { r } } } ) } } )$ .
397
+
398
+ Remark 4.7. For the ease of presentation, let us denote $\mathcal { E } : = \| \mathbf { r } - \widetilde { \mathbf { r } } \| _ { \mathbf { H } ^ { - 1 } }$ . If we have $\mathcal { E } = O ( 1 )$ , the total regret in Theorem 4.4 becomes $\widetilde { O } ( \sqrt { T } )$ which matches the regret of linear contextual bandits [1]. We remark that there is a similar assumption in [52] where they assume that $\mathbf { r } ^ { \top } \mathbf { H } ^ { - 1 } \mathbf { r }$ can be upper bounded by a constant. They show that this term can be bounded by the RKHS norm of $\mathbf { r }$ if it belongs to the RKHS induced by the neural tangent kernel [6, 7, 33]. In addition, $\mathcal { E }$ here is the difference between the true reward function and the neural network function, which can also be small if the deep neural network function well approximates the reward generating function $r ( \cdot )$ .
399
+
400
+ # 290 5 Experiments
401
+
402
+ 291
403
+ 292
404
+ 293
405
+ 294
406
+ 295
407
+ 296
408
+ 297
409
+ 298
410
+ 299
411
+ 300
412
+ 301
413
+ 302
414
+ 303
415
+ 304
416
+ 305
417
+
418
+ In this section, we provide empirical evaluations of Neural-LinUCB on real-world datasets. As we have discussed in Section 3, Neural-LinUCB could be viewed as an instantiation of the NeuralLinear scheme studied in Riquelme et al. [38] except that we use the UCB exploration instead of the posterior sampling exploration therein. Note that there has been an extensive comparison [38] of the Neural-Linear methods with many other baselines such as greedy algorithms, Variational Inference, Expectation-Propagation, Bayesian Non-parametrics and so on. Therefore, we do not seek a thorough empirical comparison of Neural-LinUCB with all existing bandits algorithms. We refer readers who are interested in the performance of Neural-Linear methods with deep representation and shallow exploration compared with a vast of baselines in the literature to the benchmark study by Riquelme et al. [38]. In this experiment, we only aim to show the advantages of our algorithm over the following baselines: (1) Neural-Linear [38]; (2) LinUCB [16], which does not have a deep representation of the feature vectors; and (3) NeuralUCB [52], which performs UCB exploration on all the parameters of the neural network instead of the shallow exploration used in our paper. All numerical experiments were run on a workstation with Intel(R) Xeon(R) CPU E5-2637 v4 $@$ 3.50GHz.
419
+
420
+ Datasets: we evaluate the performances of all algorithms on bandit problems created from real-world data. Specifically, following the experimental setting in Zhou et al. [52],we use datasets (Shuttle) Statlog, Magic and Covertype from UCI machine learning repository [23], and the MINST dataset from LeCun et al. [31]. The details of these datasets are presented in Table 1. In Table 1, each instance represents a feature vector $\mathbf { x } \in \mathbb { R } ^ { d }$ that is associated with one of the $K$ arms, and dimension $d$ is the number of attributes in each instance.
421
+
422
+ Table 1: Specifications of datasets from the UCI machine learning repository used in this paper.
423
+
424
+ <table><tr><td></td><td>Statlog</td><td>Magic</td><td>Covertype</td><td>MNIST</td></tr><tr><td>Number of attributes</td><td>9</td><td>11</td><td>54</td><td>784</td></tr><tr><td>Number of arms</td><td>7</td><td>2</td><td>7</td><td>10</td></tr><tr><td>Number of instances</td><td>58,000</td><td>19,020</td><td>581,012</td><td>60,000</td></tr></table>
425
+
426
+ ![](images/943bd96058f4439657901f76b8c00684d91994e2afa724f14d33961644a23aaf.jpg)
427
+ Figure 1: The cumulative regrets of LinUCB, NeuralUCB, Neural-Linear and Neural-LinUCB over 15, 000 rounds. Experiments are averaged over 10 repetitions.
428
+
429
+ 311 Implementations: for LinUCB, we follow the setting in Li et al. [34] to use disjoint models
430
+ 312 for different arms. For neural network based algorithms such as NeuralUCB, Neural-Linear and
431
+ 313 Neural-LinUCB, we use a ReLU neural network defined as in (2.2) with $L = 2$ and 2000 for the
432
+ 314 UCI datasets (Statlog, Magic, Covertype). Thus the neural network weights are $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { m \times d }$
433
+ 315 $\mathbf { W } _ { 2 } \in \mathbb { R } ^ { k \times m }$ , and $\pmb { \theta } \in \mathbb { R } ^ { \widetilde { k } }$ respectively, where $k = 1 0 0$ , $m = 2 0 0 0$ , and $d$ is the dimension of
434
+ 316 features in the corresponding task. Since the problem size of the MNIST dataset is larger, inspired
435
+ 317 by Hinton and Salakhutdinov [26], we use a deeper NN and set $L = 3$ , $k = 1 0 0$ and $m = 1 0 0$ ,
436
+ 318 with weights $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { m \times d }$ , $\mathbf { W } _ { 2 } \in \mathbb { R } ^ { m \times m }$ , $\mathbf { W _ { 3 } } \in \mathbb { R } ^ { k \times m }$ , and $\pmb \theta \in \mathbb { R } ^ { k }$ . We set the time horizon
437
+ 319 $T = 1 5 , 0 0 0$ , which is the total number of rounds for each algorithm on each dataset. We use
438
+ 320 gradient decent to optimize the network weights, with a step size $\eta _ { q } = 1 \mathrm { e } { - 5 }$ and maximum iteration
439
+ 321 number $n = 1 , 0 0 0$ . To speed up the training process, the network parameter w is updated every
440
+ 322 $H = 1 0 0$ rounds starting from round 2000. We also apply early stopping when the loss difference
441
+ 323 of two consecutive iterations is smaller than a threshold of 1e-6. We set $\lambda = 1$ and $\alpha _ { t } = 0 . 0 2$
442
+ 324 for all algorithms, $t \in [ T ]$ . Following the setting in Riquelme et al. [38], we use round-robin to
443
+ 325 independently select each arm for 3 times at the beginning of each algorithm. For NeuralUCB, since
444
+ 326 it is computationally unaffordable to perform the original UCB exploration as displayed in Zhou et al.
445
+ 327 [52], we follow their experimental setting to replace the matrix $\mathbf { Z } _ { t } \in \mathbb { R } ^ { ( d + \widetilde { p } ) \times \widetilde { ( } d + \widetilde { p } ) }$ in Zhou et al.
446
+ 328 [52] with its diagonal matrix.
447
+
448
+ Results: we plot the cumulative regret of all algorithms versus round in Figures 1(a), 1(b) and 1(c) for UCI datasets and in Figure 1(d) for MNIST. The results are reported based on the average of 10 repetitions over different random shuffles of the datasets. It can be seen that algorithms based on neural network representations (NeuralUCB, Neural-Linear and Neural-LinUCB) consistently outperform the linear contextual bandit method LinUCB, which shows that linear models may lack representation power and find biased estimates for the underlying reward generating function. Furthermore, our proposed Neural-LinUCB achieves a comparable regret with NeuralUCB in all experiments despite the fact that our algorithm only explores in the output layer of the neural network, which is more computationally efficient as we will show in the sequel.The results in our experiment are well aligned with our theory that deep representation and shallow exploration are sufficient to guarantee a good performance of neural contextual bandit algorithms, which is also consistent with the findings in existing literature [38] that decoupling the representation learning and uncertainty estimation improves the performance.
449
+
450
+ We also conducted experiments to study the effects of different widths of deep neural networks on the regret performance and to show the computational efficiency of Neural-LinUCB compared with existing neural bandit algorithms. Due to the space limit, we defer the results to Appendix A.
451
+
452
+ # 6 Conclusions
453
+
454
+ In this paper, we propose a new neural contextual bandit algorithm called Neural-LinUCB, which uses the hidden layers of a ReLU neural network as a deep representation of the raw feature vectors and performs UCB type exploration on the last layer of the neural network. By incorporating techniques in liner contextual bandits and neural tangent kernels, we prove that the proposed algorithm achieves a sublinear regret when the width of the network is sufficiently large. This is the first regret analysis of neural contextual bandit algorithms with deep representation and shallow exploration, which have been observed in practice to work well on many benchmark bandit problems [38]. We also conducted experiments on real-world datasets to demonstrate the advantage of the proposed algorithm over LinUCB and existing neural contextual bandit algorithms.
455
+
456
+ 355 References [1] Yasin Abbasi-Yadkori, Dávid Pál, and Csaba Szepesvári. Improved algorithms for linear stochastic bandits. In Advances in Neural Information Processing Systems, pages 2312–2320, 2011. [2] Alekh Agarwal, Daniel Hsu, Satyen Kale, John Langford, Lihong Li, and Robert Schapire. Taming the monster: A fast and simple algorithm for contextual bandits. In International Conference on Machine Learning, pages 1638–1646, 2014. [3] Zeyuan Allen-Zhu, Yuanzhi Li, and Yingyu Liang. Learning and generalization in overparameterized neural networks, going beyond two layers. In Advances in neural information processing systems, pages 6155–6166, 2019. [4] Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via over-parameterization. In International Conference on Machine Learning, pages 242–252, 2019. [5] Robin Allesiardo, Raphaël Féraud, and Djallel Bouneffouf. A neural networks committee for the contextual bandit problem. In International Conference on Neural Information Processing, pages 374–381. Springer, 2014. [6] Sanjeev Arora, Simon Du, Wei Hu, Zhiyuan Li, and Ruosong Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In International Conference on Machine Learning, pages 322–332, 2019. [7] Sanjeev Arora, Simon S Du, Wei Hu, Zhiyuan Li, Russ R Salakhutdinov, and Ruosong Wang. On exact computation with an infinitely wide neural net. In Advances in Neural Information Processing Systems, pages 8139–8148, 2019. [8] Jean-Yves Audibert, Rémi Munos, and Csaba Szepesvári. Exploration–exploitation tradeoff using variance estimates in multi-armed bandits. Theoretical Computer Science, 410(19): 1876–1902, 2009. [9] Peter Auer, Nicolo Cesa-Bianchi, and Paul Fischer. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2-3):235–256, 2002.
457
+ 382 [10] Sivaraman Balakrishnan, Martin J Wainwright, Bin Yu, et al. Statistical guarantees for the em algorithm: From population to sample-based analysis. The Annals of Statistics, 45(1):77–120, 2017. [11] Qi Cai, Zhuoran Yang, Jason D Lee, and Zhaoran Wang. Neural temporal-difference learning converges to global optima. In Advances in Neural Information Processing Systems, 2019.
458
+ 387 [12] Yuan Cao and Quanquan Gu. A generalization theory of gradient descent for learning overparameterized deep relu networks. arXiv preprint arXiv:1902.01384, 2019. [13] Yuan Cao and Quanquan Gu. Generalization bounds of stochastic gradient descent for wide and deep neural networks. In Advances in Neural Information Processing Systems, pages 10835–10845, 2019. [14] Olivier Chapelle and Lihong Li. An empirical evaluation of thompson sampling. In Advances in neural information processing systems, pages 2249–2257, 2011. [15] Sayak Ray Chowdhury and Aditya Gopalan. On kernelized multi-armed bandits. In International Conference on Machine Learning, pages 844–853, 2017. [16] Wei Chu, Lihong Li, Lev Reyzin, and Robert Schapire. Contextual bandits with linear payoff functions. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pages 208–214, 2011. [17] Mark Collier and Hector Urdiales Llorens. Deep contextual multi-armed bandits. arXiv preprint arXiv:1807.09809, 2018.
459
+ [18] George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303–314, 1989.
460
+ [19] Varsha Dani, Thomas P Hayes, and Sham M Kakade. Stochastic linear optimization under bandit feedback. In Conference on Learning Theory, 2008.
461
+ [20] Aniket Anand Deshmukh, Abhimanu Kumar, Levi Boyles, Denis Charles, Eren Manavoglu, and Urun Dogan. Self-supervised contextual bandits in computer vision. arXiv preprint arXiv:2003.08485, 2020.
462
+ [21] Simon Du, Jason Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning, pages 1675–1685, 2019.
463
+ [22] Simon S. Du, Xiyu Zhai, Barnabas Poczos, and Aarti Singh. Gradient descent provably optimizes over-parameterized neural networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=S1eK3i09YQ.
464
+ [23] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
465
+ [24] Sarah Filippi, Olivier Cappe, Aurélien Garivier, and Csaba Szepesvári. Parametric bandits: The generalized linear case. In Advances in Neural Information Processing Systems, pages 586–594, 2010.
466
+ [25] Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016.
467
+ [26] Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006.
468
+ [27] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in neural information processing systems, pages 8571–8580, 2018.
469
+ [28] Branislav Kveton, Manzil Zaheer, Csaba Szepesvari, Lihong Li, Mohammad Ghavamzadeh, and Craig Boutilier. Randomized exploration in generalized linear bandits. In International Conference on Artificial Intelligence and Statistics, pages 2066–2076, 2020.
470
+ [29] John Langford and Tong Zhang. The epoch-greedy algorithm for multi-armed bandits with side information. In Advances in neural information processing systems, pages 817–824, 2008.
471
+ [30] Tor Lattimore and Csaba Szepesvári. Bandit algorithms. Cambridge University Press, 2020.
472
+ [31] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
473
+ [32] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436–444, 2015.
474
+ [33] Jaehoon Lee, Lechao Xiao, Samuel Schoenholz, Yasaman Bahri, Roman Novak, Jascha SohlDickstein, and Jeffrey Pennington. Wide neural networks of any depth evolve as linear models under gradient descent. In Advances in neural information processing systems, pages 8570–8581, 2019.
475
+ [34] Lihong Li, Wei Chu, John Langford, and Robert E Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international conference on World wide web, pages 661–670, 2010.
476
+ [35] Lihong Li, Yu Lu, and Dengyong Zhou. Provably optimal algorithms for generalized linear contextual bandits. In International Conference on Machine Learning, pages 2071–2080, 2017.
477
+ [36] Boyi Liu, Qi Cai, Zhuoran Yang, and Zhaoran Wang. Neural trust region/proximal policy optimization attains globally optimal policy. In Advances in Neural Information Processing Systems, pages 10564–10575, 2019.
478
+ [37] Samet Oymak and Mahdi Soltanolkotabi. Towards moderate overparameterization: global convergence guarantees for training shallow neural networks. IEEE Journal on Selected Areas in Information Theory, 2020.
479
+ [38] Carlos Riquelme, George Tucker, and Jasper Snoek. Deep bayesian bandits showdown: An empirical comparison of bayesian deep networks for thompson sampling. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum? id=SyYe6k-CW.
480
+ [39] Paat Rusmevichientong and John N Tsitsiklis. Linearly parameterized bandits. Mathematics of Operations Research, 35(2):395–411, 2010.
481
+ [40] Daniel J. Russo, Benjamin Van Roy, Abbas Kazerouni, Ian Osband, and Zheng Wen. A tutorial on thompson sampling. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 11(1):1–96, 2018. ISSN 1935-8237.
482
+ [41] Jyotirmoy Sarkar. One-armed bandit problems with covariates. The Annals of Statistics, pages 1978–2002, 1991.
483
+ [42] Jasper Snoek, Oren Rippel, Kevin Swersky, Ryan Kiros, Nadathur Satish, Narayanan Sundaram, Mostofa Patwary, Mr Prabhat, and Ryan Adams. Scalable bayesian optimization using deep neural networks. In International conference on machine learning, pages 2171–2180, 2015.
484
+ [43] 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.
485
+ [44] Michal Valko, Nathan Korda, Rémi Munos, Ilias Flaounas, and Nello Cristianini. Finite-time analysis of kernelised contextual bandits. In Proceedings of the Twenty-Ninth Conference on Uncertainty in Artificial Intelligence, pages 654–663, 2013.
486
+ [45] Lingxiao Wang, Qi Cai, Zhuoran Yang, and Zhaoran Wang. Neural policy gradient methods: Global optimality and rates of convergence. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=BJgQfkSYDS.
487
+ [46] Zhaoran Wang, Han Liu, and Tong Zhang. Optimal computational and statistical rates of convergence for sparse nonconvex learning problems. Annals of statistics, 42(6):2164, 2014.
488
+ [47] Pan Xu and Quanquan Gu. A finite-time analysis of q-learning with neural network function approximation. In International Conference on Machine Learning, 2020.
489
+ [48] Pan Xu, Jian Ma, and Quanquan Gu. Speeding up latent variable gaussian graphical model estimation via nonconvex optimization. In Advances in Neural Information Processing Systems, pages 1933–1944, 2017.
490
+ [49] Tom Zahavy and Shie Mannor. Deep neural linear bandits: Overcoming catastrophic forgetting through likelihood matching. arXiv preprint arXiv:1901.08612, 2019.
491
+ [50] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=Sy8gdB9xx.
492
+ [51] Weitong Zhang, Dongruo Zhou, Lihong Li, and Quanquan Gu. Neural thompson sampling. arXiv preprint arXiv:2010.00827, 2020.
493
+ [52] Dongruo Zhou, Lihong Li, and Quanquan Gu. Neural contextual bandits with ucb-based exploration. In International Conference on Machine Learning, 2020.
494
+ [53] Difan Zou and Quanquan Gu. An improved analysis of training over-parameterized deep neural networks. In Advances in Neural Information Processing Systems, pages 2053–2062, 2019.
495
+ [54] Difan Zou, Yuan Cao, Dongruo Zhou, and Quanquan Gu. Stochastic gradient descent optimizes over-parameterized deep relu networks. arXiv preprint arXiv:1811.08888, 2018.
496
+
497
+ 1. For all authors...
498
+
499
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
500
+ (b) Did you describe the limitations of your work? [Yes] We discussed the limitation of the assumptions made in this paper. We also admit in the experiment that the theory maybe conservative since our experiment does not require a very wide neural network to achieve good performance.
501
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] This work focuses on a general methodology in bandit problems and its theoretical analysis. It does not cause any negative social impact.
502
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
503
+
504
+ 2. If you are including theoretical results...
505
+
506
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See the assumptions listed in Section 4
507
+ (b) Did you include complete proofs of all theoretical results? [Yes] Proofs are provided in the appendix.
508
+
509
+ 3. If you ran experiments...
510
+
511
+ (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 provide them in the supplementary material.
512
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We specify all the details in the Implementations paragraph of Section 5.
513
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] All the figures are plotted with the standard error with respect to random repetitions.
514
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We stated the type of workstation at the end of the first paragraph of Section 5.
515
+
516
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
517
+
518
+ (a) If your work uses existing assets, did you cite the creators? [Yes] As we mentioned in Section 5, we used codes from baseline algorithms and public available datasets. All the assets were properly cited.
519
+ (b) Did you mention the license of the assets? [N/A] All the codes and datasets are open-source.
520
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include our code in the supplementary for reproduction.
521
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
522
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] The data does not contain any personally identifiable information or offensive content.
523
+
524
+ 5. If you used crowdsourcing or conducted research with human subjects...
525
+
526
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
527
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
528
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/r1gIdySFPH/r1gIdySFPH.md ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SKEW-FIT: STATE-COVERING SELF-SUPERVISED REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Autonomous agents that must exhibit flexible and broad capabilities will need to be equipped with large repertoires of skills. Defining each skill with a manuallydesigned reward function limits this repertoire and imposes a manual engineering burden. Self-supervised agents that set their own goals can automate this process, but designing appropriate goal setting objectives can be difficult, and often involves heuristic design decisions. In this paper, we propose a formal exploration objective for goal-reaching policies that maximizes state coverage. We show that this objective is equivalent to maximizing the entropy of the goal distribution together with goal reaching performance, where goals correspond to full state observations. To instantiate this principle, we present an algorithm called Skew-Fit for learning a maximum-entropy goal distributions. Skew-Fit enables self-supervised agents to autonomously choose and practice reaching diverse goals. We show that, under certain regularity conditions, our method converges to a uniform distribution over the set of valid states, even when we do not know this set beforehand. Our experiments show that it can learn a variety of manipulation tasks from images, including opening a door with a real robot, entirely from scratch and without any manually-designed reward function.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Reinforcement learning (RL) provides an appealing formalism for automated learning of behavioral skills, but separately learning every potentially useful skill becomes prohibitively time consuming, both in terms of the experience required for the agent and the effort required for the user to design reward functions for each behavior. What if we could instead design an unsupervised RL algorithm that automatically explores the environment and iteratively distills this experience into general-purpose policies that can accomplish new user-specified tasks at test time?
12
+
13
+ ![](images/e63694dfee063113410dee749ee6eadb4238e7f49cedfcc7d0705d23188a8a5b.jpg)
14
+ Figure 1: Left: Robot learning to open a door with Skew-Fit, without any task reward. Right: Samples from a goal distribution when using (a) Skew-Fit and (b) unweighted (ie. uniform) sampling. When used as goals, the diverse samples from Skew-Fit encourage the robot to practice opening the door more frequently.
15
+
16
+ For an agent to learn autonomously, it needs an exploration objective. In the absence of any prior knowledge about which states are more useful, an effective exploration scheme is one that visits as many states as possible, allowing a policy to autonomously prepare for user-specified task that it might see at test time. This objective has been formalized as maximizing the entropy of the learned policy’s visited state distribution 1 $\mathcal { H } ( \mathbf { S } )$ (Hazan et al., 2018a), since a policy that maximizes this objective should approach a uniform distribution over valid states. Unfortunately, directly optimizing $\mathcal { H } ( \mathbf { S } )$ requires an accurate model of the policy and environment (Hazan et al., 2018a). Moreover, even if this optimization were tractable, another short-coming of this objective is that the resulting policy cannot be used to solve new tasks: it only knows how to maximize state entropy. In other words, to develop principled unsupervised RL algorithms that result in useful policies, maximizing $\mathcal { H } ( \mathbf { S } )$ is not enough. We need a mechanism that allows us to control the resulting policy to achieve new tasks at test-time.
17
+
18
+ We argue that this can be accomplished by performing goal-directed exploration. In addition to maximizing the state entropy, we should be able to control where the policy goes by giving it a goal $\mathbf { G }$ that corresponds to a state that it must reach. Mathematically, a goal-conditioned policy should minimize the conditional entropy over the states given a goal, $\mathcal { H } ( \mathbf { S } \mid \mathbf { G } )$ . This objective provides us with a principled way for training a policy to explore all states, by maximizing $\mathcal { H } ( \mathbf { S } )$ , such that the state that is reached can be controlled by commanding goals, which means minimizing $\mathcal { H } ( \mathbf { S } \mid \mathbf { G } )$ .
19
+
20
+ Directly using this objective is often intractable, since it requires optimizing the entropy of the marginal state distribution of the policy, $\mathcal { H } ( \mathbf { S } )$ . However, we can sidestep this issue by noting that the objective is the mutual information between the state and the goal, $I ( \mathbf { S } ; \mathbf { G } )$ , which can be written as:
21
+
22
+ $$
23
+ \begin{array} { r } { \mathbf { \mathcal { H } } ( \mathbf { S } ) - \mathbf { \mathcal { H } } ( \mathbf { S } | \mathbf { G } ) = I ( \mathbf { S } ; \mathbf { G } ) = \mathbf { \mathcal { H } } ( \mathbf { G } ) - \mathbf { \mathcal { H } } ( \mathbf { G } | \mathbf { S } ) . } \end{array}
24
+ $$
25
+
26
+ Equation 1 thus gives an equivalent objective for an unsupervised RL algorithm: the agent should set diverse goals, maximizing $\mathcal { H } ( \mathbf { G } )$ , and learn how to reach them, minimizing $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ .
27
+
28
+ While the second term is the typical objective studied in goal-conditioned RL (Kaelbling, 1993; Andrychowicz et al., 2017), maximizing the diversity of goals is crucial for effectively learning to reach all possible states. In a new environment, acquiring such a maximum-entropy goal distribution is challenging: how can an agent set diverse goals when it does not even know what states exist?
29
+
30
+ In this paper, we address this question via a new algorithm, Skew-Fit, which learns to model the uniform distribution over states, given only access to data collected by an autonomous goalconditioned policy. Our paper makes the following contributions. First, we propose a principled objective for unsupervised RL, based on Equation 1. While a number of prior works ignore the $\mathcal { H } ( \mathbf { G } )$ term, we argue that jointly optimizing the entire quantity is needed to develop effective and useful exploration. Second, we propose a method called Skew-Fit and prove that, under some regularity conditions, it learns a generative model that converges to a uniform distribution over the goal space, even when the set of valid states is unknown (e.g., as in the case of images). Third, we empirically demonstrate that, when combined with goal-conditioned RL, Skew-Fit allows us to autonomously train goal-conditioned policies that reach diverse states. We test this method on a variety of simulated vision-based robot tasks without any task-specific reward function. In these experiments, Skew-Fit reaches substantially better final performance than prior methods, and learns much more quickly. We also demonstrate that our approach solves a real-world manipulation task, which requires a robot to learn to open a door from scratch in about five hours, directly from images, and without any manually-designed reward function.
31
+
32
+ # 2 PROBLEM FORMULATION
33
+
34
+ To ensure that an unsupervised reinforcement learning agent learns to reach all possible states in a controllable way, we maximize the mutual information between the state S and the goal $\mathbf { G }$ , $I ( \mathbf { S } ; \mathbf { G } )$ , as stated in Equation 1. This section discusses how to optimize Equation 1 by splitting the optimization into two parts: minimizing $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ and maximizing $\mathcal { H } ( \mathbf { G } )$ .
35
+
36
+ # 2.1 MINIMIZING $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ : GOAL-CONDITIONED REINFORCEMENT LEARNING
37
+
38
+ Standard RL considers a Markov decision process (MDP), which has a state space $s$ , action space $\mathcal { A }$ , and unknown dynamics $\rho ( \mathbf { s } _ { t + 1 } \mid \mathbf { s } _ { t } , \mathbf { a } _ { t } ) : \mathcal { S } \times \mathcal { S } \times \mathcal { A } \mapsto [ 0 , + \infty )$ . Goal-conditioned RL also includes a goal space $\mathcal { G }$ . For simplicity, we will assume in our derivation that the goal space matches the state space, such that $\mathcal { G } = \mathcal { S }$ , though the approach extends trivially to the case where $\mathcal { G }$ is a hand-specified subset of $s$ , such as the global x-y position of a robot. A goal-conditioned policy $\pi ( \mathbf { a } \mid \mathbf { s } , \mathbf { g } )$ maps a state $\mathbf { s } \in { \mathcal { S } }$ and goal $\mathbf { g } \in { \mathcal { S } }$ to a distribution over actions $\mathbf { a } \in { \mathcal { A } }$ , and its objective is to reach the goal, i.e., to make the current state equal to the goal.
39
+
40
+ Goal-reaching can be formulated as minimizing $\mathcal { H } ( \textbf { G } | \textbf { S } )$ , and many practical goal-reaching algorithms (Kaelbling, 1993; Lillicrap et al., 2016; Schaul et al., 2015; Andrychowicz et al., 2017; Nair et al., 2018; Pong et al., 2018; Florensa et al., 2018a) can be viewed as approximations to this objective by observing that the optimal goal-conditioned policy will deterministically reach the goal, resulting in a conditional entropy of zero: $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } ) = 0$ . See Appendix E for more details. Our method may thus be used in conjunction with any of these prior goal-conditioned RL methods in order to jointly minimize $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ and maximize $\mathcal { H } ( \mathbf { G } )$ .
41
+
42
+ # 2.2 MAXIMIZING $\mathcal { H } ( \mathbf { G } )$ : SETTING DIVERSE GOALS
43
+
44
+ We now turn to the problem of setting diverse goals or, mathematically, maximizing the entropy of the goal distribution $\mathcal { H } ( \mathbf { G } )$ . Let $U _ { S }$ be the uniform distribution over $s$ , where we assume $s$ has finite volume so that the uniform distribution is well-defined. Let $p _ { \phi }$ be the goal distribution from which goals $\mathbf { G }$ are sampled. Our goal is to maximize the entropy of $p _ { \phi }$ , which we write as $\mathcal { H } ( \mathbf { G } )$ . Since the maximum entropy distribution over $s$ is the uniform distribution $U _ { S }$ , maximizing $\mathcal { H } ( \mathbf { G } )$ may seem as simple as choosing the uniform distribution to be our goal distribution: $p _ { \phi } = U _ { S }$ . However, this requires knowing the uniform distribution over valid states, which may be difficult to obtain when $s$ is a subset of $\mathbb { R } ^ { n }$ , for some $n$ . For example, if the states correspond to images viewed through a robot’s camera, $s$ corresponds to the (unknown) set of valid images of the robot’s environment, while $\mathbb { R } ^ { n }$ corresponds to all possible arrays of pixel values of a particular size. In such environments, sampling from the uniform distribution $\mathbb { R } ^ { n }$ is unlikely to correspond to a valid image of the real world. Sampling uniformly from $s$ would require knowing the set of all possible valid images, which we assume the agent does not know when starting to explore the environment.
45
+
46
+ While we cannot sample arbitrary states from $s$ , we can sample states by performing goal-directed exploration. To derive and analyze our method, we introduce a simple model of this process: a goal ${ \bf G } \sim p _ { \phi }$ is sampled from the goal distribution $p _ { \phi }$ , and then the agent attempts to achieve this goal, which results in a distribution of states $\mathbf { S } \in S$ seen along the trajectory. We abstract this entire process by writing the resulting marginal distribution over $\mathbf { S }$ as $p ( \mathbf { S } \mid p _ { \phi } )$ . We assume that $p ( \mathbf { S } \mid p _ { \phi } )$ has full support, which can be accomplished with an epsilon-greedy goal reaching policy in a communicating MDP. We also assume that the entropy of the resulting state distribution $\mathcal { H } ( p ( \mathbf { S } \mid p _ { \phi } ) )$ is no less than the entropy of the goal distribution $\mathcal { H } ( p _ { \phi } ( \mathbf { S } ) )$ . Without this assumption, a policy could ignore the goal and stay in a single state, no matter how diverse and realistic the goals are. Note that this assumption does not require that the entropy of $p ( \mathbf { S } \mid p _ { \phi } )$ is strictly larger than the entropy of the goal distribution, $p _ { \phi }$ . This simplified model allows us to analyze the behavior of our goal-setting scheme separately from any specific goal-reaching algorithm. We will however show in Section 6 that we can instantiate this approach into a practical algorithm that jointly learns the goal-reaching policy. In summary, our goal is to acquire a maximum-entropy goal distribution $p _ { \phi }$ over valid states $s$ , while only having access to state samples from $p ( \mathbf { S } \mid p _ { \phi } )$ .
47
+
48
+ # 3 SKEW-FIT: LEARNING A MAXIMUM ENTROPY GOAL DISTRIBUTION
49
+
50
+ Our method, Skew-Fit, learns a maximum entropy goal distribution $p _ { \phi }$ using samples collected from a goal-conditioned policy. We analyze the algorithm and show that Skew-Fit maximizes the entropy of the goal distribution, and present a practical instantiation for unsupervised deep RL.
51
+
52
+ # 3.1 SKEW-FIT ALGORITHM
53
+
54
+ To learn a uniform distribution over valid goal states, we present a method that iteratively increases the entropy of a generative model $p _ { \phi }$ . In particular, given a generative model $p _ { \phi _ { t } }$ at iteration $t$ , we would like to train a new generative model $p _ { \phi _ { t + 1 } }$ such that $p _ { \phi _ { t + 1 } }$ has higher entropy than $p _ { \phi _ { t } }$ over the set of valid states. While we do not know the set of valid states $s$ , we can sample states from $p ( \mathbf { S } \mid p _ { \phi _ { t } } )$ , resulting in an empirical distribution $p _ { \mathrm { e m p } _ { t } }$ over the states
55
+
56
+ $$
57
+ p _ { \mathrm { e m p } _ { t } } ( \mathbf { s } ) \triangleq \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathbf { 1 } \{ \mathbf { s } = \mathbf { S } _ { n } \} , \quad \mathbf { S } _ { n } \sim p ( \mathbf { S } \mid p _ { \phi _ { t } } ) ,
58
+ $$
59
+
60
+ and use this empirical distribution to train the next generative model $p _ { \phi _ { t + 1 } }$ . However, if we simply train $p _ { \phi _ { t + 1 } }$ to model this empirical distribution, it may not necessarily have higher entropy than $p _ { \phi _ { t } }$
61
+
62
+ The intuition behind our method is quite simple: rather than fitting a generative model to our empirical distribution, we skew the empirical distribution so that rarely visited states are given more weight. See Figure 2 for a visualization of this process. How should we skew the empirical distribution if we want to maximize the entropy of $p _ { \phi _ { t + 1 } }$ ? If we had access to the density of each state, $p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } )$ , then we could simply weight each state by $1 / p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } )$ . We could then perform maximum likelihood estimation (MLE) for the uniform distribution by using the following loss to train $\phi _ { t + 1 }$
63
+
64
+ ![](images/894da00b480142f481d085047763b172e7496ac38d3b0d0c99e57bba975f2991.jpg)
65
+ Figure 2: Our method, Skew-Fit, samples goals for goal-conditioned RL in order to induce a uniform state visitation distribution. We start by sampling from our replay buffer, and weighting the states such that rare states are given more weight. We then train a generative model $p _ { \phi _ { t + 1 } }$ with the weighted samples. By sampling new states with goals proposed from this new generative model, we obtain a higher entropy distribution of states in our replay buffer at the next iteration.
66
+
67
+ $$
68
+ \mathcal { L } ( \phi ) = \mathbb { E } _ { \mathbf { S } \sim U _ { S } } \left[ \log p _ { \phi } ( \mathbf { S } ) \right] = \mathbb { E } _ { \mathbf { S } \sim p _ { \mathrm { r o u p } _ { t } } } \left[ \frac { U _ { S } ( \mathbf { S } ) } { p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } ) } \log p _ { \phi } ( \mathbf { S } ) \right] \propto \mathbb { E } _ { \mathbf { S } \sim p _ { \mathrm { r o u p } _ { t } } } \left[ \frac { 1 } { p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } ) } \log p _ { \phi } ( \mathbf { S } ) \right]
69
+ $$
70
+
71
+ where we use the fact that the uniform distribution $U _ { S } ( \mathbf { S } )$ has constant density for all states in $s$ . However, computing this density $p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } )$ requires marginalizing out the MDP dynamics, which requires an accurate model of both the dynamics and the goal-conditioned policy.
72
+
73
+ We avoid needing to model the entire MDP process by approximating $p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } )$ with our previous learned generative model: $p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } ) \approx p ( \mathbf { S } \mid p _ { \phi _ { t } } ) \approx p _ { \phi _ { t } } ( \mathbf { S } )$ . We therefore weight each state by the following weight function
74
+
75
+ $$
76
+ \begin{array} { r } { w _ { t , \alpha } ( \mathbf { S } ) \triangleq p _ { \phi _ { t } } ( \mathbf { S } ) ^ { \alpha } , \quad \alpha < 0 . } \end{array}
77
+ $$
78
+
79
+ where $\alpha$ is a hyperparameter that controls how heavily we weight each state. If our approximation $p _ { \phi _ { t } }$ was exact, we could choose $\alpha = - 1$ and recover the exact importance sampling procedure described above. If $\alpha = 0$ , then this skew step has no effect. By choosing intermediate values of $\alpha$ , we can trade off the reliability of our estimate $p _ { \phi _ { t } } ( \mathbf { S } )$ with the speed at which we want to increase the entropy of the goal distribution.
80
+
81
+ Variance Reduction As described, this procedure relies on importance sampling (IS), which can have high variance, particularly if $p _ { \phi _ { t } } ( \mathbf { S } ) \approx 0$ . We therefore choose a class of generative models where the probabilities are prevented from collapsing to zero, as we will describe in Section 4. To further reduce the variance, we train $p _ { \phi _ { t + 1 } }$ with sampling importance resampling (SIR) (Rubin, 1988). Rather than sampling from $p _ { \mathrm { e m p } _ { t } }$ and weighting the update from each sample by $w _ { t , \alpha }$ , SIR explicitly defines a skewed distribution as
82
+
83
+ $$
84
+ p _ { \mathrm { s k e w e d } _ { t } } ( \mathbf { s } ) \triangleq \frac { 1 } { Z _ { \alpha } } p _ { \mathrm { e m p } _ { t } } ( \mathbf { s } ) w _ { t , \alpha } ( \mathbf { s } ) , \quad Z _ { \alpha } = \sum _ { n = 1 } ^ { N } p _ { \mathrm { e m p } _ { t } } ( \mathbf { S } _ { n } ) w _ { t , \alpha } ( \mathbf { S } _ { n } ) ,
85
+ $$
86
+
87
+ where $Z _ { \alpha }$ is the normalizing coefficient and $p _ { \mathrm { e m p } _ { t } }$ is given by Equation 2. We note that computing $Z _ { \alpha }$ adds little computational overhead, since all of the weights already need to be computed. We then fit the generative model at the next iteration $p _ { \phi _ { t + 1 } }$ to $p _ { \mathrm { s k e w e d } _ { t } }$ using standard MLE. We found that using SIR resulted in significantly lower variance than IS. See Appendix B.3 for this comparision.
88
+
89
+ Goal Sampling Alternative Because $p _ { \phi _ { t + 1 } } \approx p _ { \mathrm { s k e w e d } _ { t } }$ , at iteration $t + 1$ , one can sample goals from either $p _ { \phi _ { t + 1 } }$ or $p _ { \mathrm { s k e w e d } _ { t } }$ . Sampling goals from $p _ { \mathrm { s k e w e d } _ { t } }$ may be preferred if sampling from the learned generative model $p _ { \phi _ { t + 1 } }$ is computationally or otherwise challenging. In either case, one still needs to train the generative model $p _ { \phi _ { t } }$ to create $p _ { \mathrm { s k e w e d } _ { t } }$ . In our experiments, we found that both methods perform well.
90
+
91
+ Summary Overall, Skew-Fit samples data from the environment and weights different samples by their density under the generative model $p _ { \phi _ { t } }$ . We prove in the next section conditions under which this weighting makes the generative model at the next iteration $p _ { \phi _ { t + 1 } }$ have higher entropy. With higher entropy, the $p _ { \phi _ { t + 1 } }$ is more likely to generate goals at the frontier of unseen states, which results in more uniform state coverage. Skew-Fit is shown in Figure 2 and summarized in Algorithm 1.
92
+
93
+ # Algorithm 1 Skew-Fit
94
+
95
+ 1: for Iteration $t = 1 , 2 , \dots \mathbf { d o }$
96
+ 2: Collect $N$ states $\{ \mathbf { S } _ { i } \} _ { i = 1 } ^ { N }$ by sampling goals from $p _ { \phi _ { t } }$ (or $p _ { \mathrm { s k e w e d } _ { t } } )$ ) and running goal
97
+ conditioned policy.
98
+ 3: Construct skewed distribution $p _ { \mathrm { s k e w e d } _ { t } }$ (Equation 3 and Equation 4).
99
+ 4: Fit $p _ { \phi _ { t + 1 } }$ to skewed distribution $p _ { \mathrm { s k e w e d } _ { t } }$ using MLE.
100
+ 5: end for
101
+
102
+ # 3.2 SKEW-FIT ANALYSIS
103
+
104
+ In this section, we provide conditions under which $p _ { \phi _ { t } }$ converges in distribution to the uniform distribution over the state space $s$ . To make this analysis possible, we consider the case where $N \infty$ , which allows us to study the limit behavior of the goal distribution $p _ { \mathrm { s k e w e d } _ { t } }$ . Our most general result is stated as follows:
105
+
106
+ Lemma 3.1. Let $s$ be a compact set. Define the set of distributions $\mathcal { Q } = \{ p : s u p p o r t o f p i s \mathcal { S } \}$ . Let $\mathcal { F } : \mathcal { Q } \mapsto \mathcal { Q }$ be a continuous function and such that $\mathcal { H } ( \mathcal { F } ( p ) ) \geq \mathcal { H } ( p )$ with equality if and only if $p$ is the uniform probability distribution on $s$ , $U _ { S }$ . Define the sequence of distributions $P = ( p _ { 1 } , p _ { 2 } , . . . )$ by starting with any $p _ { 1 } \in \mathcal { Q }$ and recursively defining $p _ { t + 1 } = \mathcal { F } ( p _ { t } )$ .
107
+
108
+ The sequence $P$ converges to $U _ { S }$
109
+
110
+ Proof. See Appendix Section E.
111
+
112
+ We will apply Lemma 3.1 to be the map from $p _ { \mathrm { s k e w e d } _ { t } }$ to $p _ { \mathrm { s k e w e d } _ { t + 1 } }$ to show that $p _ { \mathrm { s k e w e d } _ { t } }$ converges to $U _ { S }$ . If we assume that the goal-conditioned policy and generative model learning procedure are well behaved ( i.e., the maps from $p _ { \phi _ { t } } ( \mathbf { S } )$ to $p _ { \mathrm { e m p } _ { t } }$ and from $p _ { \mathrm { s k e w e d } _ { t } }$ to $p _ { \phi _ { t + 1 } }$ are continuous ), then to apply Lemma 3.1, we only need to show that $\mathcal { H } ( p _ { \mathrm { s k e w e d } _ { t } } ) \geq \mathcal { H } ( p _ { \mathrm { e m p } _ { t } } )$ with equality if and only if $p _ { \mathrm { e m p } _ { t } } = U _ { S }$ . For the simple case when $p _ { \phi _ { t } } = p _ { \mathrm { e m p } _ { t } }$ identically at each iteration, we prove the convergence of Skew-Fit true for any value of $\alpha \in [ - 1 , 0 )$ in Appendix A.3. However, in practice, $p _ { \phi _ { t } }$ only approximates $p _ { \mathrm { e m p } _ { t } }$ . To address this more realistic situation, we prove the following result:
113
+
114
+ Lemma 3.2. Given two distribution $p _ { e m p _ { t } }$ and $p _ { \phi _ { t } }$ where $p _ { e m p _ { t } } \ll { p _ { \phi _ { t } } } ^ { 2 }$ and
115
+
116
+ $$
117
+ \mathrm { C o v } _ { \mathbf { S } \sim p _ { e m p _ { t } } } \left[ \log p _ { e m p _ { t } } ( \mathbf { S } ) , \log p _ { \phi _ { t } } ( \mathbf { S } ) \right] > 0 ,
118
+ $$
119
+
120
+ define the distribution $p _ { s k e w e d _ { t } }$ as in Equation $^ { 4 . }$ . Let ${ \mathcal { H } } _ { \alpha } ( \alpha )$ be the entropy of $p _ { s k e w e d _ { t } }$ for a fixed $\alpha$ . Then there exists a constant $a < 0$ such that for all $\alpha \in [ a , 0 )$ ,
121
+
122
+ $$
123
+ \mathcal { H } ( p _ { s k e w e d _ { t } } ) = \mathcal { H } _ { \alpha } ( \alpha ) > \mathcal { H } ( p _ { e m p _ { t } } ) .
124
+ $$
125
+
126
+ Proof. See Appendix Section E.
127
+
128
+ Thus, our generative model $p _ { \phi _ { t } }$ does not need to exactly fit the empirical distribution. We merely need for the log densities of $p _ { \phi _ { t } }$ and $p _ { \mathrm { e m p } _ { t } }$ to be correlated, which we expect to happen frequently with an accurate goal-conditioned policy, since $p _ { \mathrm { e m p } _ { t } }$ is the set of states seen when trying to reach goals from $p _ { \phi _ { t } }$ . In this case, if we choose negative values of $\alpha$ that are small enough, then the entropy of $p _ { \mathrm { s k e w e d } _ { t } }$ will be higher than that of $p _ { \mathrm { e m p } _ { t } }$ . Empirically, we found that $\alpha$ values as low as $\alpha = - 1$ performed well.
129
+
130
+ In summary, we see that under certain assumptions, $p _ { \mathrm { s k e w e d } _ { t } }$ converges to $U _ { S }$ . Since we train each generative model $p _ { \phi _ { t + 1 } }$ by fitting it to $p _ { \mathrm { s k e w e d } _ { t } }$ , we expect $p _ { \phi _ { t } }$ to also converge to $U _ { S }$ .
131
+
132
+ # 4 TRAINING GOAL-CONDITIONED POLICIES WITH SKEW-FIT
133
+
134
+ Thus far, we have presented and derived Skew-Fit assuming that we have access to a goal-reaching policy, allowing us to separately analyze how we can maximize $\mathcal { H } ( \mathbf { G } )$ . However, in practice we do not have access to such a policy, and in this section we discuss how we concurrently train a goal-reaching policy.
135
+
136
+ Maximizing $I ( \mathbf { S } ; \mathbf { G } )$ can be done by simultaneously performing Skew-Fit and training a goal conditioned policy to minimize $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ , or, equivalently, maximize $- \mathcal { H } ( \textbf G | \textbf { S } )$ . Maximizing $- \mathcal { H } ( \textbf { G } | \textbf { S } )$ requires computing the density $\log p ( \textbf { G } | \textbf { S } )$ , which may be difficult to compute without strong modeling assumptions. However, for any distribution $q$ , the following lower bound for $- \mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ holds:
137
+
138
+ $$
139
+ \begin{array} { r } { - \mathcal { H } ( \mathbf { G } \mid \mathbf { S } ) = \mathbb { E } _ { ( \mathbf { G } , \mathbf { S } ) \sim p _ { \phi _ { t } } , \pi } \left[ \log q ( \mathbf { G } \mid \mathbf { S } ) \right] + D _ { \mathrm { K L } } ( p \mid q ) \ge \mathbb { E } _ { ( \mathbf { G } , \mathbf { S } ) \sim p _ { \phi _ { t } } , \pi } \left[ \log q ( \mathbf { G } \mid \mathbf { S } ) \right] , } \end{array}
140
+ $$
141
+
142
+ where $D _ { \mathrm { K L } }$ denotes Kullback–Leibler divergence as discussed by Barber & Agakov (2004). Thus, to minimize $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ , we train a policy to maximize the following reward:
143
+
144
+ $$
145
+ r ( \mathbf { S } , \mathbf { G } ) = \log q ( \mathbf { G } \mid \mathbf { S } ) .
146
+ $$
147
+
148
+ For the RL algorithm, we use reinforcement learning with imagined goals (RIG) (Nair et al., 2018), though in principle any goal-conditioned method could be used. RIG is an efficient off-policy goalconditioned method that solves the vision-based RL problem in a learned latent space. In particular, RIG fits a $\beta$ -VAE and uses it to encode all observations and goals into a latent space, which it uses as the state representation. RIG also uses the $\beta$ -VAE to compute rewards, $\log q ( \mathbf { G } \mid \mathbf { S } )$ . Unlike RIG, we use the goal distribution from Skew-Fit to sample goals, both for exploration and for relabeling goals during training (Andrychowicz et al., 2017). Since RIG already trains a generative model over states, we reuse this $\beta$ -VAE for the generative model $p _ { \phi }$ of Skew-Fit. To make the most use of the data, $p _ { \phi }$ is trained on all visited state rather than only the terminal states, which we found to work well in practice. In other words, our method uses the likelihood estimates from the $\beta$ -VAE to choose the probability of sampling each state in Equation 3. To prevent these probabilities from collapsing to zero, we model the posterior of the $\beta$ -VAE as a multivariate Gaussian distribution with a fixed variance and only learn the mean. We include a detailed summary of RIG and description our how we combine Skew-Fit and RIG in Appendix C.1.
149
+
150
+ # 5 RELATED WORK
151
+
152
+ Many prior methods for training goal-conditioned policies assume that a goal distribution is available to sample from during exploration (Kaelbling, 1993; Schaul et al., 2015; Andrychowicz et al., 2017; Pong et al., 2018). Other methods use data collected from a randomly initialized policy or heuristics based on data collected online to design a non-parametric (Colas et al., 2018b; Warde-Farley et al., 2018; Florensa et al., 2018a; Zhao & Tresp, 2019) or parametric (Péré et al., 2018; Nair et al., 2018) goal distribution. We remark that Warde-Farley et al. (2018) also motivate their work in terms of minimizing a lower bound for $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ . Our work is complementary to these goal-reaching methods: rather than focusing on how to train goal-reaching policies, we propose a principled method for maximizing the entropy of a goal sampling distribution, $\mathcal { H } ( \mathbf { G } )$ .
153
+
154
+ Our method learns without any task rewards, directly acquiring a policy that can be reused to reach user-specified goals. This stands in contrast to exploration methods that give bonus rewards based on state visitation frequency (Bellemare et al., 2016; Ostrovski et al., 2017; Tang et al., 2017; Savinov et al., 2018; Chentanez et al., 2005; Lopes et al., 2012; Stadie et al., 2016; Pathak et al., 2017; Burda et al., 2018; 2019; Mohamed & Rezende, 2015; Tang et al., 2017; Fu et al., 2017). While these methods can also be used without a task reward, they provide no mechanism for distilling the knowledge gained from visiting diverse states into flexible policies that can be applied to accomplish new goals at test-time: their policies visit novel states, and they quickly forget about them as other states become more novel.
155
+
156
+ Other prior methods extract reusable skills in the form of latent-variable-conditioned policies, where latent variables can be interpreted as options (Sutton et al., 1999) or abstract skills (Hausman et al., 2018; Gupta et al., 2018b; Eysenbach et al., 2019; Gupta et al., 2018a; Florensa et al., 2017). The resulting skills may be diverse, but they have no grounded interpretation, while our method can be used immediately after unsupervised training to reach diverse user-specified goals.
157
+
158
+ Some prior methods propose to choose goals based on heuristics such as learning progress (Baranes & Oudeyer, 2012; Veeriah et al., 2018; Colas et al., 2018a), how off-policy the goal is (Nachum et al., 2018), level of difficulty (Florensa et al., 2018b) or likelihood ranking (Zhao & Tresp, 2019). In contrast, our approach provides a principled framework for optimizing a concrete and well-motivated exploration objective, and can be shown to maximize this objective under regularity assumptions. The work of Hazan et al. (2018b) also provably optimizes a well-motivated exploration objective, but is limited to tabular MDPs, while Skew-Fit is able to handle high dimensional settings such as vision-based continuous control.
159
+
160
+ # 6 EXPERIMENTS
161
+
162
+ Our experiments study the following questions: (1) Does Skew-Fit empirically result in a goal distribution with increasing entropy? (2) In image-based domains, how does Skew-Fit compare to prior work on choosing goals for goal-conditioned RL? (3) Can Skew-Fit be applied to a real-world, vision-based robot task?
163
+
164
+ Does Skew-Fit Maximize Entropy? To see the effects of Skew-Fit on goal distribution entropy in isolation of learning a goal-reaching policy, we begin by studying an idealized example where the policy is a near-perfect goal-reaching policy. The MDP is defined on a 2-by-2 unit square-shaped corridor (see Figure 3). At the beginning of an episode, the agent begins in the bottom-left corner and samples a goal from the goal distribution $p _ { \phi _ { t } }$ . To simulate the stochasticity of the policy and environment, we add a Gaussian noise with standard deviation of 0.05 to this goal. The policy reaches the state that is closest to this noisy goal and inside the corridor, giving us a state S to add to our empirical distribution. We compare Skew-Fit to sampling uniformly from the replay buffer (labeled MLE). The $\beta$ -VAE hyperparameters used to train $p _ { \phi _ { t } }$ are given in Appendix C.5. As seen in Figure 3, naively using previous experience to set goals results in a policy that primarily sets goal near the initial state distribution and only relies on the stochasticity of the policy and environment to explore. In contrast, Skew-Fit results in quickly learning a high entropy, near-uniform distribution over the state space.
165
+
166
+ ![](images/a7efccfb2d480e2ee3ded9740d1ac703f88743c90286a6da7fb0d3f4d67fc854.jpg)
167
+ Figure 3: (Left) The set of final states visited by our agent and MLE over the course of training. In contrast to MLE, our method quickly approaches a uniform distribution over the set of valid states. (Right) The entropy of the sample data distribution, which quickly reaches its maximum for Skew-Fit. The entropy was calculated via discretization onto a 60 by 60 grid.
168
+
169
+ Vision-Based Continuous Control Tasks We now evaluate Skew-Fit on a variety of continuous control tasks, where the policy must control a robot arm using only image observations, without access to any ground truth reward signal. We test our method on three different simulated continuous control tasks released by the authors of RIG (Nair et al., 2018): Visual Door, Visual Pusher, and Visual Pickup. To our knowledge, these are the only goal-conditioned, vision-based continuous control environments that are publicly available and used in experimental evaluations in prior work, making them a good point of comparison. See Figure 4 for visuals and Appendix C for details of these environments. The policies are trained in a completely unsupervised manner, without access to any prior information about the state-space or any pre-defined goal-sampling distribution. To evaluate their performance, we sample goal images from a uniform distribution over valid states and report the agent’s final distance to the corresponding simulator states (e.g., distance of the object to the target object location), but the agent never has access to this true uniform distribution nor the ground-truth state information during training. While this evaluation method and metric is only practical in simulation, it provides us with a quantitative measure of a policy’s ability to reach a broad coverage of goals in a vision-based setting.
170
+
171
+ ![](images/609f4b69c4699ff46c91c0eb13f2ac3b037b7837df7dc55eb94e4d73fcd0a057.jpg)
172
+ Figure 4: We evaluate on these continuous control environments. From left to right: Visual Pusher, a simulated pushing task; Visual Door, a door opening task; Visual Pickup, a picking task; and Real World Visual Door, a real world door opening task. All tasks are solved from images and without any task-specific reward. See Appendix D for details.
173
+
174
+ ![](images/6804bd20ac047d2e426986cc88b5535a2a71d82eb57336a96817a814247fae7d.jpg)
175
+ Figure 5: (Left) Learning curves for simulated continuous control experiments. Lower is better. For each environment and method, we show the mean and standard deviation of 6 seeds and smooth temporally across 25 epochs within each seed. Skew-Fit consistently outperforms RIG and various baselines. See the text for description of each method. (Right) The first column displays example test goal images for each environment. In the next two columns, we display final images reached by Skew-Fit and RIG respectively. Under each image is the final distance in state space to provide a notion of the behavior of each method in the plots.
176
+
177
+ We use these domains to compare Skew-Fit to a number of existing methods on goal-sampling. We compare to Warde-Farley et al. (2018), a vision-based method which uses a non-parametric approach based on clustering to sample goals and an image discriminator to compute rewards. We denote this method as DISCERN. The other methods that we compare to were developed in non-vision, statebased environments. To ensure a fair comparison across methods, we combine these prior methods with a policy trained using RIG. First, we compare to RIG without Skew-Fit. We also compared to RIG using the relabeling scheme described in the hindsight experience replay (labeled HER). We compare to curiosity-driven prioritization (Ranked-Based Priority) (Zhao & Tresp, 2019), a variant of HER that samples goals for relabeling based on their ranked likelihoods. Florensa et al. (2018b) samples goals from a GAN based on the difficulty of reaching the goal. We compare against this method by replacing $p _ { \phi }$ with the GAN and label it AutoGoal GAN. We also separately compare to the goal proposal mechanism proposed by Warde-Farley et al. (2018) and otherwise train the policy with RIG, which we label DISCERN- $\mathbf { g }$ . Lastly, to demonstrate the difficulty of the exploration challenge in these domains, we compare to # Exploration (Tang et al., 2017), an exploration method that assigns bonus rewards based on the novelty of new states. Implementation details of the prior methods is given in Appendix C.3.
178
+
179
+ We see in Figure 5 that Skew-Fit significantly outperforms prior methods both in terms of task performance and sample complexity. The most common failure mode for prior methods is that the goal distributions collapse, resulting in the agent learning to reach only a fraction of the state space, as shown in Figure 1. For comparison, additional samples of $p _ { \phi }$ when trained with and without Skew-Fit are shown in Appendix B.4. Those images show that without $S k e w - F i t$ , $p _ { \phi }$ produces a small, non-diverse distribution for each environment: the object is in the same place for pickup, the puck is often in the starting position for pushing, and the door is always closed. In contrast, Skew-Fit proposes goals where the object is in the air and on the ground, where the puck positions are varied, and the door angle changes.
180
+
181
+ The direct effect of these goal choices can be seen by visualizing more example rollouts for RIG and Skew-Fit. Due to space constraints, these visuals are in Figure 16 in Appendix B.4. The figure shows that standard RIG only learns to reach states close to the initial position, while Skew-Fit learns to reach the entire state space. A quantitative comparison of the various methods on the pickup task can be seen in Figure 6, which gives the cumulative total exploration pickups for each method. From the graph, we can see that only Skew-Fit learns to pay attention to the object and therefore consistently increases the rate at which the policy picks up the object during exploration. In contrast, the other methods have near constant slopes past $4 0 \mathrm { k }$ steps, meaning that they do not continue to learning, and many methods have a near-constant rate of object lifts throughout all of training.
182
+
183
+ ![](images/c9e4d5facae1d025fe7c393bd49a4852d6c62eac706c06b099385758e883dd58.jpg)
184
+ Figure 6: Cumulative total pickups during exploration for each method. The prior methods fail to pay attention to the object and only pick it up at the same rate as the initial policy. In contrast, after seeing the object picked up a few times, Skew-Fit practices picking up the object more often by sampling the appriopriate exploration goals.
185
+
186
+ Real-World Vision-Based Robotic Manipulation We also demonstrate that Skew-Fit scales well to the real world with a door opening task, Real World Visual Door. See Figure 4 for a picture of this environment. While a number of prior works have studied RL-based learning of door opening Kalakrishnan et al. (2011); Chebotar et al. (2017), we demonstrate the first method for autonomous learning of door opening without a user-provided, task-specific reward function. As in simulation, we do not provide any goals to the agent and simply let it interact with the door to solve the door opening task from scratch, without any human guidance or reward signal. We train two agents using Skew-Fit with RIG and RIG alone. Unlike in simulation, we cannot measure the difference between the policy’s achieved and desired door angle since we do not have access to the true state of the world. Instead, we simply visually denote a binary success/failure for each goal based on whether the last state in the trajectory achieves the target angle. Every seven and a half minutes of interaction time we evaluate on 5 goals and plot the cumulative successes for each method. As Figure 7 shows, standard RIG only starts to open the door after five hours of training. In contrast, Skew-Fit learns to occasionally open the door after three hours of training and achieves a near-perfect success rate after five and a half hours of interaction time, demonstrating that Skew-Fit is a promising technique for solving real world tasks without any human-provided reward function. Videos of Skew-Fit solving this task and the simulated tasks can be viewed on our website.3
187
+
188
+ ![](images/e2c4e8720ca6f6aceb3fbf839042dce61934c8cccc44d522be0ff43c1d0eb560.jpg)
189
+ Figure 7: Learning curve for Real World Visual Door environment. We visually label a success if the policy opens the door to the target angle by the last state of the trajectory. Skew-Fit results in considerable sample efficiency gains over prior work on this realworld task.
190
+
191
+ Additional Experiments To study the sensitivity of our method to the hyperparameter $\alpha$ , we sweep $\alpha$ across the values $[ - 1 , - 0 . 7 5 , - 0 . 5 , - 0 . 2 5 , 0 ]$ on the simulated image-based tasks. Due to space constraints, the sensitivity analysis over the hyperparameter $\alpha$ is in Appendix B, and the results demonstrate that Skew-Fit works across a large range of values for $\alpha$ , and $\alpha = - 1$ consistently outperform $\alpha = 0$ , where the empirical distribution is not skewed. Additionally, Appendix C provides a complete description our method hyper-parameters, including network architecture and RL algorithm hyperparameters.
192
+
193
+ # 7 CONCLUSION
194
+
195
+ We presented a formal objective for self-supervised goal-directed exploration, allowing researchers to quantify progress and compare progress when designing algorithms that enable agents to autonomously learn. We also presented Skew-Fit, an algorithm for training a generative model to approximate a uniform distribution over valid states, using data obtained via goal-conditioned reinforcement learning, and our theoretical analysis gives conditions under which Skew-Fit converges to the uniform distribution. When such a model is used to choose goals for exploration and to relabeling goals for training, the resulting method results in much better coverage of the state space, enabling our method to explore effectively. Our experiments show that when we concurrently train a goal-reaching policy using self-generated goals, Skew-Fit produces quantifiable improvements on simulated robotic manipulation tasks, and can be used to learn a door opening skill to reach a $9 5 \%$ success rate directly on a real-world robot, without any human-provided reward supervision.
196
+
197
+ # REFERENCES
198
+
199
+ Andrychowicz, M., Wolski, F., Ray, A., Schneider, J., Fong, R., Welinder, P., Mcgrew, B., Tobin, J., Abbeel, P., and Zaremba, W. Hindsight Experience Replay. In Advances in Neural Information Processing Systems (NIPS), 2017.
200
+ Baranes, A. and Oudeyer, P.-Y. Active Learning of Inverse Models with Intrinsically Motivated Goal Exploration in Robots. Robotics and Autonomous Systems, 61(1):49–73, 2012. doi: 10.1016/j.robot.2012.05.008.
201
+ Barber, D. and Agakov, F. V. Information maximization in noisy channels: A variational approach. In Advances in Neural Information Processing Systems, pp. 201–208, 2004.
202
+ Bellemare, M., Srinivasan, S., Ostrovski, G., Schaul, T., Saxton, D., and Munos, R. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems (NIPS), pp. 1471–1479, 2016.
203
+ Billingsley, P. Convergence of probability measures. John Wiley & Sons, 2013.
204
+ Burda, Y., Edwards, H., Storkey, A., and Klimov, O. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018.
205
+ Burda, Y., Edwards, H., Pathak, D., Storkey, A., Darrell, T., and Efros, A. A. Large-scale study of curiosity-driven learning. In International Conference on Learning Representations (ICLR), 2019.
206
+ Chebotar, Y., Kalakrishnan, M., Yahya, A., Li, A., Schaal, S., and Levine, S. Path integral guided policy search. In 2017 IEEE International Conference on Robotics and Automation (ICRA), pp. 3381–3388. IEEE, 2017.
207
+ Chentanez, N., Barto, A. G., and Singh, S. P. Intrinsically motivated reinforcement learning. In Advances in neural information processing systems, pp. 1281–1288, 2005.
208
+ Colas, C., Fournier, P., Sigaud, O., and Oudeyer, P. CURIOUS: intrinsically motivated multi-task, multi-goal reinforcement learning. CoRR, abs/1810.06284, 2018a.
209
+ Colas, C., Sigaud, O., and Oudeyer, P.-Y. Gep-pg: Decoupling exploration and exploitation in deep reinforcement learning algorithms. International Conference on Machine Learning (ICML), 2018b.
210
+ Eysenbach, B., Gupta, A., Ibarz, J., and Levine, S. Diversity is All You Need: Learning Skills without a Reward Function. In International Conference on Learning Representations (ICLR), 2019.
211
+ Florensa, C., Duan, Y., and Abbeel, P. Stochastic neural networks for hierarchical reinforcement learning. In International Conference on Learning Representations (ICLR), 2017.
212
+ Florensa, C., Degrave, J., Heess, N., Springenberg, J. T., and Riedmiller, M. Self-supervised Learning of Image Embedding for Continuous Control. In Workshop on Inference to Control at NeurIPS, 2018a.
213
+ Florensa, C., Held, D., Geng, X., and Abbeel, P. Automatic Goal Generation for Reinforcement Learning Agents. In International Conference on Machine Learning (ICML), 2018b.
214
+ Fu, J., Co-Reyes, J. D., and Levine, S. EX 2 : Exploration with Exemplar Models for Deep Reinforcement Learning. In Advances in Neural Information Processing Systems (NIPS), 2017.
215
+ Fujimoto, S., van Hoof, H., and Meger, D. Addressing Function Approximation Error in Actor-Critic Methods. In International Conference on Machine Learning (ICML), 2018.
216
+ Gupta, A., Eysenbach, B., Finn, C., and Levine, S. Unsupervised meta-learning for reinforcement learning. CoRR, abs:1806.04640, 2018a.
217
+ Gupta, A., Mendonca, R., Liu, Y., Abbeel, P., and Levine, S. Meta-Reinforcement Learning of Structured Exploration Strategies. In Advances in Neural Information Processing Systems (NIPS), 2018b.
218
+ Haarnoja, T., Zhou, A., Hartikainen, K., Tucker, G., Ha, S., Tan, J., Kumar, V., Zhu, H., Gupta, A., Abbeel, P., and Levine, S. Soft actor-critic algorithms and applications. CoRR, abs/1812.05905, 2018.
219
+ Hausman, K., Springenberg, J. T., Wang, Z., Heess, N., and Riedmiller, M. Learning an Embedding Space for Transferable Robot Skills. In International Conference on Learning Representations (ICLR), pp. 1–16, 2018.
220
+ Hazan, E., Kakade, S. M., Singh, K., and Soest, A. V. Provably efficient maximum entropy exploration. CoRR, abs/1812.02690, 2018a.
221
+ Hazan, E., Kakade, S. M., Singh, K., and Soest, A. V. Provably efficient maximum entropy exploration. CoRR, abs/1812.02690, 2018b.
222
+ Kaelbling, L. P. Learning to achieve goals. In International Joint Conference on Artificial Intelligence (IJCAI), volume vol.2, pp. 1094 – 8, 1993.
223
+ Kalakrishnan, M., Righetti, L., Pastor, P., and Schaal, S. Learning force control policies for compliant manipulation. In 2011 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 4639–4644. IEEE, 2011.
224
+ 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. In International Conference on Learning Representations (ICLR), 2016. ISBN 0-7803-3213-X. doi: 10.1613/jair.301.
225
+ Lopes, M., Lang, T., Toussaint, M., and Oudeyer, P.-Y. Exploration in model-based reinforcement learning by empirically estimating learning progress. In Advances in Neural Information Processing Systems, pp. 206–214, 2012.
226
+ Mohamed, S. and Rezende, D. J. Variational information maximisation for intrinsically motivated reinforcement learning. In Advances in neural information processing systems, pp. 2125–2133, 2015.
227
+ Nachum, O., Brain, G., Gu, S., Lee, H., and Levine, S. Data-Efficient Hierarchical Reinforcement Learning. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
228
+ Nair, A., Pong, V., Dalal, M., Bahl, S., Lin, S., and Levine, S. Visual Reinforcement Learning with Imagined Goals. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
229
+ Nielsen, F. and Nock, R. Entropies and cross-entropies of exponential families. In Image Processing (ICIP), 2010 17th IEEE International Conference on, pp. 3621–3624. IEEE, 2010.
230
+ Ostrovski, G., Bellemare, M. G., Oord, A., and Munos, R. Count-based exploration with neural density models. In International Conference on Machine Learning, pp. 2721–2730, 2017.
231
+ Pathak, D., Agrawal, P., Efros, A. A., and Darrell, T. Curiosity-Driven Exploration by Self-Supervised Prediction. In International Conference on Machine Learning (ICML), pp. 488–489. IEEE, 2017.
232
+ Péré, A., Forestier, S., Sigaud, O., and Oudeyer, P.-Y. Unsupervised Learning of Goal Spaces for Intrinsically Motivated Goal Exploration. In International Conference on Learning Representations (ICLR), 2018.
233
+ Pong, V., Gu, S., Dalal, M., and Levine, S. Temporal Difference Models: Model-Free Deep RL For Model-Based Control. In International Conference on Learning Representations (ICLR), 2018.
234
+ Rubin, D. B. Using the sir algorithm to simulate posterior distributions. Bayesian statistics, 3:395–402, 1988.
235
+ Savinov, N., Raichuk, A., Marinier, R., Vincent, D., Pollefeys, M., Lillicrap, T., and Gelly, S. Episodic curiosity through reachability. arXiv preprint arXiv:1810.02274, 2018.
236
+ Schaul, T., Horgan, D., Gregor, K., and Silver, D. Universal Value Function Approximators. In International Conference on Machine Learning (ICML), pp. 1312–1320, 2015. ISBN 9781510810587.
237
+ Stadie, B. C., Levine, S., and Abbeel, P. Incentivizing Exploration In Reinforcement Learning With Deep Predictive Models. In International Conference on Learning Representations (ICLR), 2016.
238
+ Sutton, R. S., Precup, D., and Singh, S. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 112(1-2):181–211, 1999.
239
+ Tang, H., Houthooft, R., Foote, D., Stooke, A., Chen, X., Duan, Y., Schulman, J., De Turck, F., and Abbeel, P. #Exploration: A Study of Count-Based Exploration for Deep Reinforcement Learning. In Neural Information Processing Systems (NIPS), 2017.
240
+ Veeriah, V., Oh, J., and Singh, S. Many-goals reinforcement learning. arXiv preprint arXiv:1806.09605, 2018.
241
+ Warde-Farley, D., de Wiele, T. V., Kulkarni, T., Ionescu, C., Hansen, S., and Mnih, V. Unsupervised control through non-parametric discriminative rewards. CoRR, abs/1811.11359, 2018.
242
+ Zhao, R. and Tresp, V. Curiosity-driven experience prioritization via density estimation. CoRR, abs/1902.08039, 2019.
243
+
244
+ # A PROOFS
245
+
246
+ A.1 PROOF OF LEMMA 3.1
247
+
248
+ Lemma A.1. Let $s$ be a compact set. Define the set of distributions $\mathcal { Q } = \{ p : s u p p o r t o f p i s \ : S \}$ . Let $\mathcal { F } : \mathcal { Q } \mapsto \mathcal { Q }$ be a continuous function and such that $\mathcal { H } ( \mathcal { F } ( p ) ) \geq \mathcal { H } ( { \bar { p } } )$ with equality if and only if $p$ is the uniform probability distribution on $s$ , $U _ { S }$ . Define the sequence of distributions $P = ( p _ { 1 } , p _ { 2 } , . . . )$ by starting with any $p _ { 1 } \in \mathcal { Q }$ and recursively defining $p _ { t + 1 } = \mathcal { F } ( p _ { t } )$ .
249
+
250
+ The sequence $P$ converges to $U _ { S }$
251
+
252
+ Proof. The uniform distribution $U _ { S }$ is well defined since $s$ is compact. Because $s$ is a compact set, by Prokhorov’s Theorem Billingsley (2013), the set $\mathcal { Q }$ is sequentially compact. Thus, $P$ has a convergent subsequence $P ^ { \prime } = ( p _ { k _ { 1 } } , p _ { k _ { 2 } } , \dots ) \subset P$ for $k _ { 1 } < k _ { 2 } < . . .$ that converges to a distribution $p ^ { * } \in \mathcal { Q }$ . Because $\mathcal { F }$ is continuous, $p ^ { * }$ must be a fixed point of $\mathcal { F }$ since by the convergence mapping theorem, we have that
253
+
254
+ $$
255
+ \operatorname* { l i m } _ { i \to \infty } p _ { k _ { i } } = p ^ { * } \implies \operatorname* { l i m } _ { i \to \infty } \mathcal { F } ( p _ { k _ { i } } ) = \mathcal { H } ( p ^ { * } )
256
+ $$
257
+
258
+ and so
259
+
260
+ $$
261
+ \begin{array} { r c l } { p ^ { * } = \displaystyle \operatorname* { l i m } _ { i \to \infty } p _ { k _ { i } } } \\ { = \displaystyle \operatorname* { l i m } _ { i \to \infty } \mathcal { F } ( p _ { k _ { i - 1 } } ) } \\ { = \mathcal { H } ( p ^ { * } ) . } \end{array}
262
+ $$
263
+
264
+ The only fixed point of $\mathcal { F }$ is $U _ { S }$ since for any distribution $p$ that is not the uniform distribution, $U _ { S }$ , we have that $\mathcal { H } ( \mathcal { F } ( p ) ) > \mathcal { H } ( p )$ which implies that $\mathcal { F } ( p ) \neq p$ . Thus, $P ^ { \prime }$ converges to the only fixed point, $U _ { S }$ . Since the entropy cannot decrease, then entropy of the distributions in $P$ must also converge to the entropy of $U _ { S }$ . Lastly, since entropy is a continuous function of distribution, $P$ must converge to $U _ { S }$ . □
265
+
266
+ # A.2 PROOF OF LEMMA 3.2
267
+
268
+ Lemma A.2. Given two distribution $p ( x )$ and $q ( x )$ where $p \ll q$ and
269
+
270
+ $$
271
+ 0 < \operatorname { C o v } _ { p } [ \log p ( X ) , \log q ( X ) ]
272
+ $$
273
+
274
+ define the distribution $p _ { \alpha }$ as
275
+
276
+ $$
277
+ p _ { \alpha } ( x ) = \frac { 1 } { Z _ { \alpha } } p ( x ) q ( x ) ^ { \alpha }
278
+ $$
279
+
280
+ where $\alpha \in \mathbb { R }$ and $Z _ { \alpha }$ is the normalizing factor. Let ${ \mathcal { H } } _ { \alpha } ( \alpha )$ be the entropy of $p _ { \alpha }$ . Then there exists $a$ constant $a > 0$ such that for all $\alpha \in [ - a , 0 )$ ,
281
+
282
+ $$
283
+ \begin{array} { r } { \mathcal { H } _ { \alpha } ( \alpha ) > \mathcal { H } _ { \alpha } ( 0 ) = \mathcal { H } ( p ) . } \end{array}
284
+ $$
285
+
286
+ Proof. Observe that $\{ p _ { \alpha } : \alpha \in [ - 1 , 0 ] \}$ is a one-dimensional exponential family
287
+
288
+ $$
289
+ p _ { \alpha } ( x ) = e ^ { \alpha T ( x ) - A ( \alpha ) + k ( x ) }
290
+ $$
291
+
292
+ with log carrier density $k ( x ) = \log p ( x )$ , natural parameter $\alpha$ , sufficient statistic $T ( x ) = \log q ( x )$ , and log-normalizer $\begin{array} { r } { A ( \alpha ) = \int _ { \mathcal { X } } e ^ { \alpha T ( x ) + k ( x ) } d x } \end{array}$ . As shown in Nielsen & Nock (2010), the entropy of a distribution from a one-dimensional exponential family with parameter $\alpha$ is given by:
293
+
294
+ $$
295
+ \begin{array} { r } { \mathcal { H } _ { \alpha } ( \alpha ) \triangleq \mathcal { H } ( p _ { \alpha } ) = A ( \alpha ) - \alpha A ^ { \prime } ( \alpha ) - \mathbb { E } _ { p _ { \alpha } } [ k ( X ) ] } \end{array}
296
+ $$
297
+
298
+ The derivative with respect to $\alpha$ is then
299
+
300
+ $$
301
+ \begin{array} { c l } { \displaystyle \frac { d } { d \alpha } \mathcal { H } _ { \alpha } ( \alpha ) = - \alpha A ^ { \prime \prime } ( \alpha ) - \frac { d } { d \alpha } \mathbb { E } _ { p _ { \alpha } } [ k ( x ) ] } \\ { = - \alpha A ^ { \prime \prime } ( \alpha ) - \mathbb { E } _ { \alpha } [ k ( x ) ( T ( x ) - A ^ { \prime } ( \alpha ) ] } \\ { = - \alpha \mathrm { V a r } _ { p _ { \alpha } } [ T ( x ) ] - \mathrm { C o v } _ { p _ { \alpha } } [ k ( x ) , T ( x ) ] } \end{array}
302
+ $$
303
+
304
+ where we use the fact that the $n$ th derivative of $A ( \alpha )$ give the $n$ central moment, i.e. $A ^ { \prime } ( \alpha ) =$ $\mathbb { E } _ { p _ { \alpha } } [ T ( x ) ]$ and $A ^ { \prime \prime } ( \alpha ) = \mathrm { V a r } _ { p _ { \alpha } } [ T ( x ) ]$ . The derivative of $\alpha = 0$ is
305
+
306
+ $$
307
+ \begin{array} { c } { { { \displaystyle \frac { d } { d \alpha } } { \mathcal { H } } _ { \alpha } ( 0 ) = - \mathrm { C o v } _ { p _ { 0 } } [ k ( x ) , T ( x ) ] \ } } \\ { { = - \mathrm { C o v } _ { p } [ \log p ( x ) , \log q ( x ) ] } } \end{array}
308
+ $$
309
+
310
+ which is negative by assumption. Because the derivative at $\alpha = 0$ is negative, then there exists a constant $a > 0$ such that for all $\alpha \in [ - a , 0 ]$ , $\mathcal { H } _ { \alpha } ( \alpha ) > \mathcal { H } _ { \alpha } ( 0 ) = \mathcal { H } ( p )$ . □
311
+
312
+ # A.3 SIMPLE CASE PROOF
313
+
314
+ We prove the convergence directly for the (even more) simplified case when $p _ { \theta } = p ( \mathbf { S } \mid p _ { \phi _ { t } } )$ using a similar technique:
315
+
316
+ Lemma A.3. Assume the set $s$ has finite volume so that its uniform distribution $U _ { S }$ is well defined and has finite entropy. Given any distribution $p ( \mathbf { s } )$ whose support is $s$ , recursively define $p _ { t }$ with $p _ { 1 } = p$ and
317
+
318
+ $$
319
+ p _ { t + 1 } ( \mathbf { s } ) = \frac { 1 } { Z _ { \alpha } ^ { t } } p _ { t } ( \mathbf { s } ) ^ { \alpha } , \quad \forall \mathbf { s } \in \mathcal { S }
320
+ $$
321
+
322
+ where $Z _ { \alpha } ^ { t }$ is the normalizing constant and $\alpha \in [ 0 , 1 )$ .
323
+
324
+ The sequence $( p _ { 1 } , p _ { 2 } , \dots )$ converges to $U _ { S }$ , the uniform distribution $s$ .
325
+
326
+ Proof. If $\alpha = 0$ , then $p _ { 2 }$ (and all subsequent distributions) will clearly be the uniform distribution.
327
+ We now study the case where $\alpha \in ( 0 , 1 )$ .
328
+
329
+ At each iteration $t$ , define the one-dimensional exponential family $\{ p _ { \theta } ^ { t } : \theta \in [ 0 , 1 ] \}$ where $p _ { \theta } ^ { t }$ is
330
+
331
+ $$
332
+ p _ { \theta } ^ { t } ( \mathbf { s } ) = e ^ { \theta T ( \mathbf { s } ) - A ( \theta ) + k ( \mathbf { s } ) }
333
+ $$
334
+
335
+ with log carrier density $k ( \mathbf { s } ) = 0$ , natural parameter $\theta$ , sufficient statistic $T ( \mathbf { s } ) = \log p _ { t } ( \mathbf { s } )$ , and lognormalizer $\begin{array} { r } { A ( \theta ) = \int _ { \mathcal { S } } e ^ { \theta T ( \mathbf { s } ) } d \mathbf { s } } \end{array}$ . As shown in Nielsen & Nock (2010), the entropy of a distribution from a one-dimensional exponential family with parameter $\theta$ is given by:
336
+
337
+ $$
338
+ \mathcal { H } _ { \theta } ^ { t } ( \theta ) \triangleq \mathcal { H } ( p _ { \theta } ^ { t } ) = A ( \theta ) - \theta A ^ { \prime } ( \theta )
339
+ $$
340
+
341
+ The derivative with respect to $\theta$ is then
342
+
343
+ $$
344
+ \begin{array} { r l } & { \frac { d } { d \theta } d \mathcal { H } _ { \theta } ^ { t } ( \theta ) = - \theta A ^ { \prime \prime } ( \theta ) } \\ & { \quad \quad \quad = - \theta \mathrm { V a r } _ { \mathbf { s } \sim p _ { \theta } ^ { t } } [ T ( \mathbf { s } ) ] } \\ & { \quad \quad \quad = - \theta \mathrm { V a r } _ { \mathbf { s } \sim p _ { \theta } ^ { t } } [ \log p _ { t } ( \mathbf { s } ) ] } \\ & { \quad \quad \quad \quad \leq 0 } \end{array}
345
+ $$
346
+
347
+ where we use the fact that the $n$ th derivative of $A ( \theta )$ is the $n$ central moment, i.e. $A ^ { \prime \prime } ( \theta ) =$ $\operatorname { V a r } _ { \mathbf { s } \sim p _ { \theta } ^ { t } } [ T ( \mathbf { s } ) ]$ . Since variance is always non-negative, this means the entropy is monotonically decreasing with $\theta$ . Note that $p _ { t + 1 }$ is a member of this exponential family, with parameter $\theta = \alpha \in$ $( 0 , 1 )$ . So
348
+
349
+ $$
350
+ \mathcal { H } ( p _ { t + 1 } ) = \mathcal { H } _ { \boldsymbol { \theta } } ^ { t } ( \alpha ) \geq \mathcal { H } _ { \boldsymbol { \theta } } ^ { t } ( 1 ) = \mathcal { H } ( p _ { t } )
351
+ $$
352
+
353
+ which implies
354
+
355
+ $$
356
+ { \mathcal { H } } ( p _ { 1 } ) \leq { \mathcal { H } } ( p _ { 2 } ) \leq \dots .
357
+ $$
358
+
359
+ This monotonically increasing sequence is upper bounded by the entropy of the uniform distribution, and so this sequence must converge.
360
+
361
+ The sequence can only converge if $\begin{array} { r } { \frac { d } { d \theta } \mathcal { H } _ { \theta } ^ { t } ( \theta ) } \end{array}$ converges to zero. However, because $\alpha$ is bounded away from 0, Equation 8 states that this can only happen if
362
+
363
+ $$
364
+ \begin{array} { r } { \mathrm { V a r } _ { { \bf s } \sim p _ { \theta } ^ { t } } [ \log p _ { t } ( { \bf s } ) ] 0 . } \end{array}
365
+ $$
366
+
367
+ Because $p _ { t }$ has full support, then so does $p _ { \theta } ^ { t }$ . Thus, Equation 9 is only true if $\log p _ { t } ( \mathbf { s } )$ converges to a constant, i.e. $p _ { t }$ converges to the uniform distribution. □
368
+
369
+ ![](images/7157a6d5e573ea20ef91644a3e31387f89e670199a503eefb1e228a7b14f477c.jpg)
370
+ Figure 8: (Top) Coverage over time on the classic 4-room domain, shown on the right. (Bottom) Coverage over time on a more challenging maze domain, shown on the right. In both cases, we see that not using Skew-Fit $\alpha = 0$ ) results in significantly slower learning that primarily stays near the start (yellow star).
371
+
372
+ B ADDITIONAL EXPERIMENTS
373
+
374
+ # B.1 SKEW-FIT FOR EXPLORING LOW-DIMENSIONAL SPACES
375
+
376
+ Skew-Fit is a general method that enables exploration when it is infeasible to sample goal states uniformly across the entire state space. While the experiments in Section 6 focused on image-based state spaces, there exists many low-dimensional domains in which we know that the goal space is a subset of $\mathbb { R } ^ { d }$ for some $d < n$ , but the exact goal space is still unknown. This scenario is quite common in domains such as robotics: we know that we want an agent to move the position of its center of mass (CoM), but we do not know the set of valid CoM positions, as this requires knowing the geometry of all potential obstacles a priori. We conduct a series of experiments that study whether Skew-Fit enable effectively exploration in these state spaces containing unknown obstacles.
377
+
378
+ 2D Maze Navigation with Oracle Policy To study the impact of Skew-Fit on exploration in isolation of learning a goal-reaching policy, our first set of experiments use a near-perfect policy that reaches the goal state and then takes a step in a random direction (while taking wall-collisions into account). The random step size is Gaussian with a standard deviation of 0.1 units, and the size of each square shown in Figure 8 is 1.8 units. Due to the relatively small step size, the agent cannot rely on random actions to explore the environment and must instead learn to set goals that are progressively farther and farther from the initial state. The first environment is the Four Rooms environment (Sutton et al., 1999), shown in Figure 8 (top). This environment requires a policy to explore four different rooms, each of which requires passing through a narrow doorway. The maze environment (Figure 8, bottom) presents a more challenging exploration problem and consists of various long corridors that require setting goals progressively deeper into the maze. In both domains, setting goals near the state state (represented by the yellow star) and taking small actions will result in minimal exploration. To measure exploration, we discretize the space into squares (see Figure 8 for square sizes) and measure what fraction of the squares the agent has ever visited during exploration. We see in Figure 8 that using Skew-Fit significantly improves exploration, whereas training $p _ { \phi }$ on samples drawn uniformly from the replay buffer ( $\alpha = 0$ ) results in little exploration.
379
+
380
+ 2D Navigation with Learned Policy Next, we reproduce the 2D navigation environment experiment from Section 6, and replace the oracle goal-reacher with a goal-reaching policy that is simultaneously trained with the goal setter. The policy outputs velocities with maximum speed of one. Evaluation goals are chosen uniformly over the valid states. The hyperparameters for this experiment are given in Table 2. In Figure 9a, we can see that a policy trained with a goal distribution trained by Skew-Fit consistently learns to reach all goals, whereas a goal distribution trained with uniform sampling, labeled MLE, results in a policy that fails to reach states far from the starting position (the bottom left corner).
381
+
382
+ ![](images/2aba6465194be867e1f3ff649ce48cd9610ef27d1f243e647d0c627b34946876.jpg)
383
+ Figure 9: (a) Comparison of Skew-Fit vs MLE goal sampling on final distance to goal on RL version of the pointmass environment. Skew-Fit consistently learns to solve the task, while MLE often fails. (b) Heatmaps of final distance to each possible goal location for Skew-Fit and MLE. Skew-Fit learns a good policy over the entire state space, but MLE performs poorly for states far away from the starting position (the bottom left corner).
384
+
385
+ ![](images/78d05fe11fa53cd4baf34907979561a1486a9c0a9d0f3e27fb7641f15a6cfb4d.jpg)
386
+ Figure 10: (Left) Ant navigation environment. (Right) Evaluation on reaching joint and XY position. Policies are trained from state. Reward is L2-norm between the current and target joint angle and XY position concatenated together. We use Skew-Fit to sample goals for relabeling and exploration, and compare to other goal sampling methods. See main paper for description of baselines.
387
+
388
+ Quadruped “Ant” Locomotion with Learned Policy Lastly, we test Skew-Fit in an exploration task that requires training a simulated quadruped “ant” robot to navigate to random XY positions in a plane, as shown in Figure 10. The input to the policy is the joint and velocity of each angle and the reward is the distance to the goal XY-position. While the goal space is known to reside in the XY-plane, the agent does not know about the location of the center obstacle, and so it must still learn about the set of valid goals by controlling its 8 joint actuators. More details of the environment are in Appendix D. We see in Figure 10 that Skew-Fit outperforms prior methods both in terms of learning speed and final performance, demonstrating that Skew-Fit accelerates exploration in non-vision domains that contains unknown goal spaces.
389
+
390
+ # B.2 SENSITIVITY ANALYSIS
391
+
392
+ Sensitivity to RL Algorithm In our experiments, we combined Skew-Fit with soft actor critic (SAC) (Haarnoja et al., 2018). We conduct a set of experiments to test whether Skew-Fit may be used with other RL algorithms for training the goal-conditioned policy. To that end, we replaced SAC with twin delayed deep deterministic policy gradient (TD3) (Fujimoto et al., 2018) and ran the same Skew-Fit experiments on Visual Door, Visual Pusher, and Visual Pickup. In Figure 11, we see that Skew-Fit performs consistently well with both SAC and TD3, demonstrating that Skew-Fit is beneficial across multiple RL algorithms.
393
+
394
+ Sensitivity to $\alpha$ Hyperparameter We study the sensitivity of the $\alpha$ hyperparameter by testing values of $\alpha \in [ - 1 , - 0 . 7 5 , - 0 . 5 , - 0 . 2 5 , 0 ]$ on the Visual Door and Visual Pusher task. The results are included in Figure 12 and shows that our method is robust to different parameters of $\alpha$ , particularly for the more challenging Visual Pusher task. Also, the method consistently outperform $\alpha = 0$ , which is equivalent to sampling uniformly from the replay buffer.
395
+
396
+ ![](images/ec6c2ddb13f510e3e12d6cee49a539f01fac4d0f7cae3d20f726c29bcd9c7786.jpg)
397
+ Figure 11: We compare using SAC (Haarnoja et al., 2018) and TD3 (Fujimoto et al., 2018) as the underlying RL algorithm on Visual Door, Visual Pusher and Visual Pickup. We see that Skew-Fit works consistently well with both SAC and TD3, demonstrating that Skew-Fit may be used with various RL algorithms.
398
+
399
+ ![](images/d52b0fd2c45f7e80b2ef123b8a56fece84a8eff300427780018461fbb380cc11.jpg)
400
+ Figure 12: We sweep different values of $\alpha$ on Visual Door, Visual Pusher and Visual Pickup. Skew-Fit helps the final performance on the Visual Door task, and outperforms No Skew-Fit (alpha ${ = } 0$ ) as seen in the zoomed in version of the plot. In the more challenging Visual Pusher task, we see that Skew-Fit consistently helps and halves the final distance. Similarly, in we observe that Skew-Fit consistently outperforms No Skew-fit on Visual Pickup. Note that alpha $= - 1$ is not always the optimal setting for each environment, but performs strongly in each case in terms of final performance.
401
+
402
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>NLL</td></tr><tr><td rowspan=1 colspan=1>MLE on uniform (oracle)</td><td rowspan=1 colspan=1>20175.4</td></tr><tr><td rowspan=1 colspan=1>Skew-Fit onunbalanced</td><td rowspan=1 colspan=1>20175.9</td></tr><tr><td rowspan=1 colspan=1>MLEon unbalanced</td><td rowspan=1 colspan=1>20178.03</td></tr></table>
403
+
404
+ Table 1: Despite training on a unbalanced Visual Door dataset (see Figure 7 of paper), the negative log-likelihood (NLL) of Skew-Fit evaluated on a uniform dataset matches that of a VAE trained on a uniform dataset.
405
+
406
+ # B.3 VARIANCE ABLATION
407
+
408
+ ![](images/e7fa99743716fc7f318350d1987c686e5d4cecc44c03f194f71473ca29ac5d3f.jpg)
409
+ Figure 13: Gradient variance averaged across parameters in last epoch of training VAEs. Values of $\alpha$ less than $^ { - 1 }$ are numerically unstable for importance sampling (IS), but not for Skew-Fit.
410
+
411
+ We measure the gradient variance of training a VAE on an unbalanced Visual Door image dataset with Skew-Fit vs Skew-Fit with importance sampling (IS) vs no Skew-Fit (labeled MLE). We construct the imbalanced dataset by rolling out a random policy in the environment and collecting the visual observations. Most of the images contained the door in a closed position; in a few, the door was opened. In Figure 13, we see that the gradient variance for Skew-Fit with IS is catastrophically large for large values of $\alpha$ . In contrast, for Skew-Fit with SIR, which is what we use in practice, the variance is relatively similar to that of MLE. Additionally we trained three VAE’s, one with MLE on a uniform dataset of valid door opening images, one with Skew-Fit on the unbalanced dataset from above, and one with MLE on the same unbalanced dataset. As expected, the VAE that has access to the uniform dataset gets the lowest negative log likelihood score. This is the oracle method, since in practice we would only have access to imbalanced data. As shown in Table 1, Skew-Fit considerably outperforms MLE, getting a much closer to oracle log likelihood score.
412
+
413
+ # B.4 GOAL AND PERFORMANCE VISUALIZATION
414
+
415
+ We visualize the goals sampled from Skew-Fit as well as those sampled when using the prior method, RIG (Nair et al., 2018). As shown in Figure 14 and Figure 15, the generative model $p _ { \phi }$ results in much more diverse samples when trained with Skew-Fit. We we see in Figure 16, this results in a policy that more consistently reaches the goal image.
416
+
417
+ # C IMPLEMENTATION DETAILS
418
+
419
+ # C.1 RIG WITH SKEW-FIT SUMMARY
420
+
421
+ Algorithm 2 provides detailed pseudo-code for how we combined our method with RIG. Steps that were removed from the base RIG algorithm are highlighted in blue and steps that were added are highlighted in red. The main differences between the two are (1) sampling exploration goals from the buffer using $p _ { \mathrm { s k e w e d } }$ instead of the VAE prior, (2) relabeling with replay buffer goals sampled using $p _ { \mathrm { s k e w e d } }$ instead of from the VAE prior, and (3) training the VAE on replay buffer data data sampled using $p _ { \mathrm { s k e w e d } }$ instead of uniformly.
422
+
423
+ ![](images/eee40151bd44d1d02e1708cee24b74b73b609448fb16acd199fd73e40a79f99d.jpg)
424
+ Figure 14: Proposed goals from the VAE for RIG and with Skew-Fit on the Visual Pickup, Visual Pusher, and Visual Door environments. Standard RIG produces goals where the door is closed and the object and puck is in the same position, while ${ \mathrm { R I G } } +$ Skew-Fit proposes goals with varied puck positions, occasional object goals in the air, and both open and closed door angles.
425
+
426
+ ![](images/ad0be2668649871d7c884809f45bd4f227c67c6e587e848bc7ebd605a9918cca.jpg)
427
+ Figure 15: Proposed goals from the VAE for RIG (left) and with RIG $^ +$ Skew-Fit (right) on the Real World Visual Door environment. Standard RIG produces goals where the door is closed while RIG $^ +$ Skew-Fit proposes goals with both open and closed door angles.
428
+
429
+ ![](images/011af52d760f48a1c08a253a58d51a40f944f066da3bbe985e23d2cdac20ba29.jpg)
430
+ Figure 16: Example reached goals by Skew-Fit and RIG. The first column of each environment section specifies the target goal while the second and third columns show reached goals by Skew-Fit and RIG. Both methods learn how to reach goals close to the initial position, but only Skew-Fit learns to reach the more difficult goals.
431
+
432
+ # C.2 LIKELIHOOD ESTIMATION USING $\beta$ -VAE
433
+
434
+ We estimate the density under the VAE by using a sample-wise approximation to the marginal over $x$ estimated using importance sampling:
435
+
436
+ $$
437
+ \begin{array} { l } { { \displaystyle p _ { \phi _ { t } } ( x ) = \mathbb { E } _ { z \sim q _ { \theta _ { t } } ( z \mid x ) } \left[ \frac { p ( z ) } { q _ { \theta _ { t } } ( z \mid x ) } p _ { \psi _ { t } } ( x \mid z ) \right] } } \\ { { \displaystyle ~ \approx \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left[ \frac { p ( z ) } { q _ { \theta _ { t } } ( z \mid x ) } p _ { \psi _ { t } } ( x \mid z ) \right] . } } \end{array}
438
+ $$
439
+
440
+ where $q _ { \theta }$ is the encoder, $p _ { \psi }$ is the decoder, and $p ( z )$ is the prior, which in this case is unit Gaussian.
441
+ We found that sampling $N = 1 0$ latents for estimating the density worked well in practice.
442
+
443
+ # C.3 IMPLEMENTATION OF PRIOR WORK
444
+
445
+ We replaced TD3 (Fujimoto et al., 2018) with soft actor critic (SAC) from Haarnoja et al. (2018) for all the methods that use RIG, including Skew-Fit.. This is in contrast to the original RIG Nair et al. (2018) paper which used TD3 Fujimoto et al. (2018). We found that maximum entropy policies in general improved the performance of RIG, and that we did not need to add noise on top of the stochastic policy’s noise. For our RL network architectures and training scheme, we use fully connected networks for the policy, Q-function and value networks with two hidden layers of size 400 and 300 each. We also delay training any of these networks for 10000 time steps in order to collect sufficient data for the replay buffer as well as to ensure the latent space of the VAE is relatively stable (since we train the VAE online in this setting). As in RIG, we train a goal-conditioned value functions Schaul et al. (2015) using hindsight experience replay Andrychowicz et al. (2017), relabelling $5 0 \%$ of exploration goals as goals sampled from the VAE prior $\mathcal { N } ( 0 , 1 )$ and $3 0 \%$ from future goals in the trajectory. In the prior RIG method, the VAE was pre-trained on a uniform sampling of images from the state space of each environment. In order to ensure a fair comparison to Skew-Fit, we forego pre-training and instead train the VAE alongside RL, using the variant described in the RIG paper.
446
+
447
+ # C.4 VISION-BASED CONTINUOUS CONTROL EXPERIMENTS
448
+
449
+ In our experiments, we use an image size of $4 8 \mathbf { x } 4 8$ . For our VAE architecture, we use a modified version of the architecture used in the original RIG paper Nair et al. (2018). Our VAE has three convolutional layers with kernel sizes: 5x5, 3x3, and 3x3, number of output filters: 16, 32, and 64 and strides: 3, 2, and 2. We then have a fully connected layer with the latent dimension number of units, and then reverse the architecture with de-convolution layers. We vary the latent dimension of the VAE, the $\beta$ term of the VAE and the $\alpha$ term for Skew-Fit based on the environment. Additionally, we vary the training schedule of the VAE based on the environment. See the table at the end of the appendix for more details. Our VAE has a Gaussian decoder with identity variance, meaning that we train the decoder with a mean-squared error loss.
450
+
451
+ When training the VAE alongside RL, we found the following two schedules to be effective for different environments:
452
+
453
+ 1. For first $5 K$ steps: Train VAE using standard MLE training every 500 time steps for 1000 batches. After that, train VAE using Skew-Fit every 500 time steps for 200 batches. 2. For first $5 K$ steps: Train VAE using standard MLE training every 500 time steps for 1000 batches. For the next $4 5 K$ steps, train VAE using Skew-Fit every 500 steps for 200 batches. After that, train VAE using Skew-Fit every 1000 time steps for 200 batches.
454
+
455
+ We found that initially training the VAE without Skew-Fit improved the stability of the algorithm. This is due to the fact that density estimates under the VAE are constantly changing and inaccurate during the early phases of training. Therefore, it made little sense to use those estimates to prioritize goals early on in training. Instead, we simply train using MLE training for the first $5 K$ timesteps, and after that we perform Skew-Fit according to the VAE schedules above. Table 3 lists the hyperparameters that were shared across the continuous control experiments. Table 4 lists hyper-parameters specific to each environment. Additionally, Appendix C.1 shows the combined RIG $^ +$ Skew-Fit algorithm.
456
+
457
+ Table 2: Hyper-parameters used for 2D RL experiment (Figure 9a).
458
+
459
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Algorithm</td><td>TD3 Fujimoto et al. (2018)a</td></tr><tr><td># training batches per time step</td><td>1</td></tr><tr><td>Q network hidden sizes</td><td>400,300</td></tr><tr><td>Policy network hidden sizes</td><td>400,300</td></tr><tr><td>Q network and policy activation</td><td>ReLU</td></tr><tr><td>Exploration Noise</td><td>None</td></tr><tr><td>RL Batch Size</td><td>1024</td></tr><tr><td>Discount Factor</td><td>0.99</td></tr><tr><td>Path length</td><td>25</td></tr><tr><td>Reward Scaling</td><td>100</td></tr><tr><td>Number of steps per epoch</td><td>5000</td></tr></table>
460
+
461
+ Table 3: General hyper-parameters used for all continuous control experiments.
462
+
463
+ <table><tr><td>Hyper-parameter</td><td>Value</td><td>Comments</td></tr><tr><td># training batches per time step</td><td>2</td><td>Marginal improvementsafter2</td></tr><tr><td>Exploration Noise</td><td>None (SAC policy is stochastic)</td><td>Did not tune</td></tr><tr><td>RL Batch Size</td><td>1024</td><td>smaller batch sizes work as well</td></tr><tr><td>VAE Batch Size</td><td>64</td><td>Did not tune</td></tr><tr><td>Discount Factor</td><td>0.99</td><td>Did not tune</td></tr><tr><td>Reward Scaling</td><td>1</td><td>Did not tune</td></tr><tr><td>Path length</td><td>100</td><td>Did not tune</td></tr><tr><td>Replay Buffer Size</td><td>100000</td><td>Did not tune</td></tr><tr><td>Number of Latents for Estimating Density(N)</td><td>10</td><td>Marginal improvements beyond 10</td></tr></table>
464
+
465
+ Table 4: Environment specific hyper-parameters
466
+
467
+ <table><tr><td>Hyper-parameter</td><td>VisualPusher</td><td>Visual Door</td><td>Visual Pickup</td><td>Real World Visual Door</td></tr><tr><td>Path Length</td><td>50</td><td>100</td><td>50</td><td>100</td></tr><tr><td>β for β-VAE</td><td>20</td><td>20</td><td>30</td><td>60</td></tr><tr><td>Latent Dimension Size</td><td>4</td><td>16</td><td>16</td><td>16</td></tr><tr><td>α for Skew-Fit</td><td>-1</td><td>-1/2</td><td>-1</td><td>-1/2</td></tr><tr><td>VAE Training Schedule</td><td>2</td><td>1</td><td>2</td><td>1</td></tr><tr><td>Sample Goals From</td><td>P</td><td>Pskewed</td><td>Pskewed</td><td>Pskewed</td></tr></table>
468
+
469
+ Algorithm 2 RIG and RIG $^ +$ Skew-Fit. Blue text denotes RIG specific steps and red text denotes $\mathrm { R I G } +$ Skew-Fit specific steps
470
+
471
+ Require: VAE encoder $q _ { \phi }$ , VAE decoder $p _ { \psi }$ , policy $\pi _ { \theta }$ , goal-conditioned value function $Q _ { w }$ , $\alpha$ , VAE Training Schedule.
472
+ 1: Collect $\mathcal { D } = \{ s ^ { ( i ) } \}$ using exploration policy.
473
+ 2: Train $\beta$ -VAE on data uniformly sampled from $\mathcal { D }$ .
474
+ 3: Fit prior $p ( z )$ to latent encodings $\{ \hat { \mu _ { \phi } } ( s ^ { ( i ) } ) \}$ .
475
+ 4: for $n = 0 , . . . , N - 1$ episodes do
476
+ 5: Sample latent goal from prior $z _ { g } \sim p ( z )$ .
477
+ 6: Sample latent goal $e ( s ^ { \prime } )$ from $( s , a , s ^ { \prime } , z _ { g } ) \sim$ $\mathcal { R }$ using $\cdot$ if $\cdot$ not empty. Otherwise, use $\cdot$ .
478
+ 7: Sample initial state $s _ { 0 } \sim E$ .
479
+ 8: for $t = 0 , . . . , H - 1$ steps do
480
+ 9: Get action $a _ { t } \sim \pi _ { \theta } ( e ( s _ { t } ) , z _ { g } )$ .
481
+ 10: Get next state $s _ { t + 1 } \sim p ( \cdot \mid s _ { t } , a _ { t } )$ .
482
+ 11: Store $( s _ { t } , a _ { t } , s _ { t + 1 } , z _ { g } )$ into replay buffer $\mathcal { R }$ .
483
+ 12: Sample transition $( s , a , s ^ { \prime } , z _ { g } ) \sim \mathcal { R }$ .
484
+ 13: Encode $z = e ( s ) , z ^ { \prime } = e ( s ^ { \prime } )$ .
485
+ 14: (Probability 0.5) replace $z _ { g }$ with $z _ { g } ^ { \prime } \sim p ( z )$ .
486
+ 15: (Probability 0.5) replace $\cdot$ with $\cdot$ where $\cdot$ using $p _ { \phi }$
487
+ 16: Compute new reward $r = - | | \boldsymbol { z } ^ { \prime } - \boldsymbol { z } _ { g } | |$ .
488
+ 17: Minimize Bellman Error using $( z , a , z ^ { \prime } , z _ { g } , r )$ .
489
+ 18: end for
490
+ 19: for $t = 0 , . . . , H - 1$ steps do
491
+ 20: for $i = 0 , . . . , k - 1$ steps do
492
+ 21: Sample future state $s _ { h _ { i } }$ , $t < h _ { i } \leq H - 1$ .
493
+ 22: Store $\left( s _ { t } , a _ { t } , s _ { t + 1 } , e \left( s _ { h _ { i } } \right) \right)$ into $\mathcal { R }$ .
494
+ 23: end for
495
+ 24: end for
496
+ 25: Construct skewed replay buffer distribution $\cdot$ using data from $\mathcal { R }$ with Equation 4
497
+ 26: if total_steps $< 5 0 0 0$ then
498
+ 27: Fine-tune $\beta$ -VAE on data uniformly sampled from $\mathcal { R }$ according to VAE Training Schedule.
499
+ 28: else
500
+ 29: Fine-tune $\beta$ -VAE on data uniformly sampled from $\mathcal { R }$ according to VAE Training Schedule.
501
+ 30: Fine-tune $\beta$ -VAE on data sampled from $\mathcal { R }$ using $p _ { \phi }$ according to VAE Training Schedule.
502
+ 31: end if
503
+ 32: end for
504
+
505
+ # C.5 ORACLE 2D NAVIGATION EXPERIMENTS
506
+
507
+ We initialize the VAE to the middle of the environment for Maze, and the bottom left corner of the environment for Four Rooms. Both the encoder and decoder have 2 hidden layers with [400, 300] units, ReLU hidden activations, and no output activations. The VAE has a latent dimension of 8 and a Gaussian decoder trained with mean-squared error loss, batch size of 256, and 1000 batches at each iteration. The VAE is trained on the exploration data buffer every 1000 rollouts.
508
+
509
+ # D ENVIRONMENT DETAILS
510
+
511
+ Point-Mass: In this environment, an agent must learn to navigate a square-shaped corridor (see Figure 3). The observation is the 2D position, and the agent must specify a velocity as the 2D action. The reward at each time step is the negative distance between the achieved position and desired position.
512
+
513
+ Maze: A $2 0 \times 2 0 \ : 2 \mathrm { D }$ pointmass environment in the shape of a maze. The observation is the 2D position of the agent, and the agent must specify a target 2D position as the action. The dynamics of the environment are the following: first, the agent is teleported to the target position, specified by the action. Then a gaussian change in position with mean 0 and standard deviation 0.1 is then applied. If the action would result in the agent moving through or into a wall, then the agent will be stopped at the wall instead.
514
+
515
+ Four Rooms: A $2 0 \mathrm { ~ x ~ } 2 0 \ 2 \mathrm { D }$ pointmass environment in the shape of four rooms (Sutton et al., 1999). The observation space, actions space, and environment dynamics are the same as the Maze environment above.
516
+
517
+ Ant: A MuJoCo ant environment with the same corridor as the Point-Mass environment. The observation is a 2D position, orientation, joint angles, and velocity of the joint angles of the ant. The observation space is 29 dimensions. The agent controls the ant through the joints, which is 8 dimensions. The goal is a target 2D position, and the reward is the negative Euclidean distance between the achieved 2D position and target 2D position.
518
+
519
+ Visual Pusher: A MuJoCo environment with a 7-DoF Sawyer arm and a small puck on a table that the arm must push to a target position. The agent controls the arm by commanding $x , y$ position for the end effector (EE). The underlying state is the EE position, $e$ and puck position $p$ . The evaluation metric is the distance between the goal and final puck positions. The hand goal/state space is a $1 0 \mathrm { x } 1 0$ $\mathrm { c m ^ { 2 } }$ box and the puck goal/state space is a $3 0 { \mathrm { x } } 2 0 ~ \mathrm { c m } ^ { 2 }$ box. Both the hand and puck spaces are centered around the origin. The action space ranges in the interval $[ - 1 , 1 ]$ in the $\mathbf { X }$ and y dimensions.
520
+
521
+ Visual Door: A MuJoCo environment with a 7-DoF Sawyer arm and a door on a table that the arm must pull open to a target angle. Control is the same as in Visual Pusher. The evaluation metric is the distance between the goal and final door angle, measured in radians. In this environment, we do not reset the position of the hand or door at the end of each trajectory. The state/goal space is a $5 \mathrm { x } 2 0 \mathrm { x } 1 5$ $\mathrm { c m ^ { 3 } }$ box in the $x , y , z$ dimension respectively for the arm and an angle between [0, .83] radians. The action space ranges in the interval $[ - 1 , 1 ]$ in the $\mathbf { X }$ , y and z dimensions.
522
+
523
+ Visual Pickup: A MuJoCo environment with the same robot as Visual Pusher, but now with a different object. The object is cube-shaped, but a larger intangible sphere is overlaid on top so that it is easier for the agent to see. Moreover, the robot is constrained to move in 2 dimension: it only controls the $y , z$ arm positions. The $x$ position of both the arm and the object is fixed. The evaluation metric is the distance between the goal and final object position. For the purpose of evaluation, $7 5 \%$ of the goals have the object in the air and $2 5 \%$ have the object on the ground. The state/goal space for both the object and the arm is $1 0 \mathrm { c m }$ in the $y$ dimension and $1 3 \mathrm { c m }$ in the $z$ dimension. The action space ranges in the interval $[ - 1 , 1 ]$ in the $y$ and $z$ dimensions.
524
+
525
+ Real World Visual Door: A Rethink Sawyer Robot with a door on a table. The arm must pull the door open to a target angle. The agent controls the arm by commanding the $x , y , z$ velocity of the EE. Our controller commands actions at a rate of up to $1 0 \mathrm { H z }$ with the scale of actions ranging up to 1cm in magnitude. The underlying state and goal is the same as in Visual Door. Again we do not reset the position of the hand or door at the end of each trajectory. We obtain images using a Kinect Sensor. The state/goal space for the environment is a $1 0 \mathrm { { \dot { x } } 1 0 \mathrm { { x } 1 \mathrm { { \dot { 0 } } \mathrm { { c m } ^ { 3 } } } } }$ box. The action space ranges in the interval $[ - 1 , 1 ]$ (in cm) in the $\mathbf { X }$ , y and $\mathbf { Z }$ dimensions. The door angle lies in the range $[ 0 , 4 5 ]$ degrees.
526
+
527
+ # E GOAL-CONDITIONED REINFORCEMENT LEARNING MINIMIZES $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$
528
+
529
+ Some goal-conditioned RL methods such as Warde-Farley et al. (2018); Nair et al. (2018) present methods for minimizing a lower bound for $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ , by approximating $\log p ( \mathbf { G } \mid \mathbf { S } )$ and using it as the reward. Other goal-conditioned RL methods (Kaelbling, 1993; Lillicrap et al., 2016; Schaul et al., 2015; Andrychowicz et al., 2017; Pong et al., 2018; Florensa et al., 2018a) are not developed with the intention of minimizing the conditional entropy $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ . Nevertheless, one can see that goal-conditioned RL generally minimizes $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ by noting that the optimal goal-conditioned policy will deterministically reach the goal. The corresponding conditional entropy of the goal given the state, $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ , would be zero, since given the current state, there would be no uncertainty over the goal (the goal must have been the current state since the policy is optimal). So, the objective of goal-conditioned RL can be interpreted as finding a policy such that $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } ) = 0$ . Since zero is the minimum value of $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ , then goal-conditioned RL can be interpreted as minimizing $\mathcal { H } ( \mathbf { G } \mid \mathbf { S } )$ .
md/train/r1gzoaNtvr/r1gzoaNtvr.md ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENCE OF COMPOSITIONAL LANGUAGE WITH DEEP GENERATIONAL TRANSMISSION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Recent work has studied the emergence of language among deep reinforcement learning agents that must collaborate to solve a task. Of particular interest are the factors that cause language to be compositional—i.e. express meaning by combining words which themselves have meaning. Evolutionary linguists have found that in addition to structural priors like those already studied in deep learning, the dynamics of transmitting language from generation to generation contribute significantly to the emergence of compositionality. In this paper, we introduce these cultural evolutionary dynamics into language emergence by periodically replacing agents in a population to create a knowledge gap, implicitly inducing cultural transmission of language. We show that this implicit cultural transmission encourages the resulting languages to exhibit better compositional generalization.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Compositionality is an important structure of language that reflects a disentangled understanding of the world – enabling the expression of infinitely many concepts using finitely many elements. Agents that have compositional understandings of the world generalize in obviously correct ways even in the face of limited training examples (Lake & Baroni, 2018). For example, an agent with a compositional understanding of blue squares and purple triangles should also understand purple squares without directly observing any of them. Developing artificial agents that can ground, understand, and produce compositional (and therefore more interpretable) language could greatly improve generalization to new instances and ease human-AI interactions.
12
+
13
+ In building theories of how compositionality emerges in human languages, work in evolutionary linguistics looks to the process of cultural transmission (Kirby, 2001; Kirby et al., 2008). Cultural transmission of language occurs when a group of agents pass their language on to a new group of agents, e.g. parents who teach their children to speak as they do. Because this education is incomplete and biased, it allows the language itself to change over time via a process known as cultural evolution. This paradigm (Kirby et al., 2014) explains the emergence of compositionality as a result of expressivity and compressibility – i.e. to be most effective, a language should be expressive enough to differentiate between all possible meanings (e.g., objects) and compressible enough to be learned easily. Work in the evolutionary linguistics community has shown that over multiple ‘generations’ these competing pressures result in the emergence of compositional languages both in simulation (Kirby, 2001) and with human subjects (Kirby et al., 2008). These studies aim to understand humans whereas we want to understand and design artificial neural networks.
14
+
15
+ Approaching the problem from another direction, recent work in AI has studied language emergence in such multi-agent, goal-driven tasks. These works have demonstrated that agent languages will emerge to enable coordination-centric tasks to be solved without direct or even indirect language supervision (Foerster et al., 2016; Sukhbaatar et al., 2016; Lazaridou et al., 2017; Das et al., 2017). However, the resulting languages are usually not compositional (Kottur et al., 2017) and are difficult to interpret, even by other machines (Andreas et al., 2017). Some existing work has studied means to encourage compositional language formation (Mordatch & Abbeel, 2018; Kottur et al., 2017), but these settings study fixed populations of agents – i.e. examining language within a single generation.
16
+
17
+ In this work we bridge these two areas – examining the effect of generational cultural transmission on the compositionality of emergent languages in a multi-agent, goal-driven setting.
18
+
19
+ ![](images/d64c3dc18b10c42f786b8344e8cfe36b77969264468818f9ca45bddd10bb08bf.jpg)
20
+ (b) Implicit cultural transmission
21
+ Figure 1: We introduce cultural transmission into language emergence between neural agents. The starting point of our study is a goal-oriented dialog task (similar to that of Kottur et al. (2017)), summarized in Fig. 1a. During learning we periodically replace some agents with new ones (gray agents). These new agents do not know any language, but instead of creating one they learn it from older agents. This creates generations of language that become more compositional over time.
22
+
23
+ We study this in the context of a cooperative dialog-based reference game involving two agents communicating in discrete symbols (Kottur et al., 2017); an example dialog is shown in Fig. 1a. To examine cultural transmission, we extend this setting to a population of agents (Fig. 1b) and introduce a simple mechanism to induce the expressivity and compressibility pressures inherent in cultural transmission. Specifically, we periodically re-initialize some subset of the agents in the population. In order to perform well at the task, the population’s emergent language must be sufficiently expressive to reference all the objects (expressivity) and must be easily learnable by these ‘new’ agents (compressibility). The new agents have a randomized language whereas the surviving agents already know a grounded language. This “knowledge gap” creates an implicit ‘teaching’ setting that is analogous to the explicit transmission stage in models of iterative learning (Kirby, 2001).
24
+
25
+ Through our experiments and analysis, we show that periodic agent replacement is an effective way to induce cultural transmission and yields more compositionally generalizable language in our setting. To summarize, our contributions are:
26
+
27
+ – We propose a method for inducing implicit cultural transmission in neural language models. – We introduce new metrics to measure the similarity between agent languages and verify cultural transmission has occurred as a result of our periodic agent replacement protocol. We show our cultural transmission procedure induces compositionality in neural language models, going from $13 \%$ accuracy on a compositionally novel test set to $46 \%$ in the best configuration. Further, we show this is complementary with previous priors which encourage compositionality.
28
+
29
+ # 2 TASK & TALK: A TESTBED FOR COMPOSITIONAL LANGUAGE EMERGENCE
30
+
31
+ We consider the cooperative Task & Talk reference game introduced in Kottur et al. (2017). Shown in Fig. 1a, the game is played by two agents – one who observes an attributed object – e.g. (purple, solid, square) – and another who is given a task to retrieve a subset of these attributes over the course of the dialog – e.g. (color,shape). The dialog itself consists of two rounds of agents exchanging single-token utterances from fixed vocabularies. At the end of the dialog, the task-aware agent must report the requested attributes and both agents are rewarded for correct predictions. This causes a language grounded in the objects to emerge because there is no other way to solve the task.
32
+
33
+ A compositional solution to this task can look like a question-answer style dialog where the taskaware agent queries the other for specific attributes (Fig. 1a) – e.g. uttering “X” requesting the color to which the other agent replies “1” indicating purple. Importantly, this pattern would persist regardless of the other attribute values of the object (e.g. for all $( \mathtt { p u r p l e } , \star , \star )$ objects). However, as there is no grounding supervision provided, agents must learn to associate specific meanings to specific words and it is unlikely for compositional languages to emerge purely by chance. Given a color task, an agent might use “1” for (purple, solid, square) and then “2” for (purple, solid, circle). It is impossible for other agents to know that “2” means purple without having seen (purple, solid, circle), so compositional language is essential for generalization to compositionally novel instances.
34
+
35
+ Models. To formalize this setting, let Q-bot and A-bot be agent policies parameterized by neural networks $Q$ and $A$ respectively. At each round $t$ , Q-bot observes the task $x _ { Q }$ and it’s memory of the dialog so far $h _ { Q } ^ { t - 1 }$ and produces a single-token utterance $m _ { Q } ^ { t } \in \mathcal { V }$ from the vocabulary $\nu$ . Functionally, $m _ { Q } ^ { t } , h _ { Q } ^ { t } \stackrel { \cdot } { = } Q ( m _ { A } ^ { t - 1 } , x _ { Q } , h _ { Q } ^ { t - 1 } )$ where $m _ { A } ^ { t - 1 }$ is A-bot’s reply in the previous round. Likewise, A-bot responds by computing $\quad \quad m _ { A ; } ^ { t } , h _ { A _ { . } } ^ { t } = A ( m _ { Q } ^ { t } , x _ { A } , h _ { A } ^ { t - 1 } )$ where $x _ { A }$ is the object instance represented symbolically by concatenating 3 one-hot vectors, one per attribute. After two rounds, Q-bot must respond to the task, predicting the requested attribute pair $\hat { u } = U ( x _ { Q } , h _ { Q } ^ { T } )$ as a function of the task and Q-bot’s final memory state. Both agents are rewarded if both attributes are correct (no partial credit). We follow the neural network architectures of $Q , A$ , and $U$ from Kottur et al. (2017).
36
+
37
+ Measuring Compositional Generalization. Kottur et al. (2017) generated a synthetic dataset consisting of three attribute types (color, shape, style) each with four values (e.g. red, blue, square, star, dotted, solid, ...) and six tasks, one task for each ordered pair of different attribute types. In total, this results in 64 unique instances and 384 task-instance pairs. To evaluate compositionality, Kottur et al. (2017) held out 12 random instances for testing. Given the closed-world set of instances, these 12 are guaranteed to be never-before-seen triplets of attribute values; however, each individual value has been seen in training in other triplets. As such, accuracy on this set is a measure of compositional generalization.
38
+
39
+ Shortcomings of Kottur et al. (2017) Evaluation. In our investigations, we found some shortcomings in the evaluation protocol of Kottur et al. (2017). First, the authors do not report variance over multiple runs or different random test-sets which we found to be significant. Second, the strategy of randomly selecting the test set can still reward some only partially compositional strategies. For instance, suppose agents develop a language that uses single words to refer to attribute pairs like (red, $\star$ , triangle) and (red, filled, $\star$ ). Such agents might generalize to an unseen instance (red, filled, triangle) by composing the ‘paired’ words above instead of disentangling individual attributes.
40
+
41
+ We make two modifications to address these issues. Our results are reported as means and variances estimated from multiple training runs with different random seeds evaluated with 4-way crossvalidation. We also introduce a harder dataset where instead of withholding random individual instances (e.g., (green,dotted,triangle),. . . ) as in Kottur et al. (2017), we withhold all instances for a set of attribute pairs (e.g., (green,dotted, $\star$ ), $( \mathtt { r e d } , \mathtt { s o l i d } , \star ) , \dots )$ . We will refer to datasets generated in this fashion as novel pair and the original dataset as novel instance. We report on both settings for comparison, but find our new setting to be significantly more challenging in practice – requiring a stricter notion of compositionality that is more closely aligned with human intuitions about these attributes.
42
+
43
+ # 3 COMPOSITIONAL LANGUAGE EMERGENCE WITH CULTURAL TRANSMISSION
44
+
45
+ In iterative learning models of cultural transmission from evolutionary linguistics, competing pressures towards expressivity and compressibility have been shown to induce compositionality over multiple ‘generations’ of language transfer (Kirby, 2001; Kirby et al., 2008). The goal-driven nature of our reference game already encourages expressivity – agents must be able to refer to the objects in order to succeed. To introduce compressibility pressure and parallel literature in evolutionary linguistics, we introduce a population of agents which regularly has members replaced by new agents that lack any understanding of the remaining population’s language. As this paradigm lacks explicit teaching steps where new agents are trained to ground existing words, we consider this approach as a means of implicit cultural transmission.
46
+
47
+ Populations of Agents. We consider a population of Q-bots $\{ Q ^ { 1 } , \ldots , Q ^ { N _ { Q } } \}$ and a population of Abots $\{ A ^ { 1 } , \ldots , A ^ { \tilde { N _ { A } } } \}$ with each agent having a different set of parameters. At each iteration during learning, we sample a random Q-bot-A-bot pair to interact and receive updates $\mathrm { ~ - ~ } i . e .$ . the red line (2) in Alg. 1. As any Q-bot may be made to communicate with any A-bot, there is pressure for the population to adopt a unified language. Likewise, when an agent is reinitialized it will receive positive reward much more quickly when it happens to use language that its conversational partners understand. Furthermore, ‘compressible’ languages that are easier to learn will result in greater reward for the population in the face of periodic re-initialization of agents.
48
+
49
+ # Algorithm 1: Training with Replacement and Multiple Agents
50
+
51
+ ![](images/d9fb159b8995993138efdc0355babbc22213c082cff6da9b1e4522e7205d2628.jpg)
52
+
53
+ 11 return all Q-bots and A-bots.
54
+
55
+ Introducing multiple agents may in itself add compressibility pressure and improve generalizations even without replacement (Raviv et al., 2018). Agents in a population have to model minor linguistic differences between conversational partners given the same memory capacity. Further, each agent provides another potential language variation that can be mimicked and perpetuated–increasing language diversity early in training. We examine these effects through no-replacement baselines, but find that generational pressure where some agents know less than others can also be important for compositionality in our setting.
56
+
57
+ Replacement. In order to create a notion of ‘generations’ we replace agents periodically. Let $\pi$ be some replacement strategy that returns a subset of the population. Every $E$ epochs, we call $\pi$ and reinitialize the parameters and optimizers for the corresponding agents (blue lines 9-10 in Alg. 1). We investigate three settings of $\pi$ (appendix A.2 for more details):
58
+
59
+ Uniform Random. Sample an A-bot and Q-bot from uniform random distributions. – Epsilon Greedy. With probability $1 - \varepsilon$ replace the A-bot and Q-bot with the lowest validation accuracy. We use $\varepsilon = 0 . 2$ in our experiments. – Oldest. Replace the oldest A-bot and Q-bot, breaking ties with uniform random sampling.
60
+
61
+ # 4 EXPERIMENTAL SETTING
62
+
63
+ Experimental Setting. We evaluate on both our modified Task & Talk dataset and the original from Kottur et al. (2017), as described in Section 2. All results are reported as means and variances computed from a total of 16 trials (four random seeds each with 4-way cross-validation). We report accuracy based on Q-bot getting both elements of the task correct – corresponding to the more restrictive “Both” setting from Kottur et al. (2017).
64
+
65
+ Kottur et al. (2017) examined a series of increasingly restrictive settings in order to study conditions under which compositionality emerges. The primary variables are whether A-bot has memory (ablated by setting ${ h _ { A } ^ { \bar { t } } } { = } 0$ ) and the vocabulary sizes $\gamma _ { Q }$ and $\nu _ { A }$ for Q-bot and A-bot respectively. For comparison we also evaluate in these settings: Minimal Vocab ( $V _ { Q } { = } 3$ , $V _ { A } { = } 4$ ). Memoryless $^ +$ Minimal Vocab $V _ { Q } { = } 3$ , $V _ { A } { = } 4$ , ${ h _ { A } ^ { t } } \mathrm { { = } } 0 $ ), Overcomplete $V _ { Q } = V _ { A } = 6 \dot { 4 }$ ). We also introduce Memoryless $^ +$ Overcomplete $V _ { Q } = V _ { A } = 6 4$ , $h _ { A } ^ { t } { = } 0$ ) to complete the cross product of settings and examine the role of memory restriction in overcomplete vocabularies.
66
+
67
+ The Memoryless $^ +$ Minimal Vocabulary setting results in the best compositional generalization; however, this is an extreme setting – requiring not only that the minimum number of groundable symbols be known but also that A-bot not be able to remember it’s previous utterance. While we do report these settings and see quite large performance gains due to cultural transmission, we are mainly interested in the more realistic Overcomplete setting where a large pool of possible tokens is provided and both dialog agents remember the conversation.
68
+
69
+ Model and Training Details. Our A-bots and Q-bots have the same architectur as in Kottur et al. (2017). All agents are trained with $E = 2 5 0 0 0$ , a batch size of 1000, 1 and the Adam (Kingma & Ba, 2015) optimizer (one per bot) with learning rate 0.01. In the Multi Agent setting we use
70
+
71
+ ![](images/ca67aa287b00528c7c8e3eefeb9c5020788b825d6be972a2216a637b8e32a2a7.jpg)
72
+ Figure 2: Test set accuracies (with standard deviations) are reported against our new harder dataset using models similar to those in Kottur et al. (2017). Our variations on cultural transmission (darker blue bars) outperform the baselines where language does not change over generations.
73
+
74
+ $N _ { A } = N _ { Q } = 5$ . We stop training after 8 generations (199000 epochs Multi Agent; 39000 epochs Single Agent). This differs from Kottur et al. (2017), which stopped once train accuracy reached $100 \%$ . Further, we do not perform negative mining.
75
+
76
+ Baselines. We consider a set of baseline setting to isolate the effect of our approach.
77
+
78
+ – Single Agent Populations. We ablate the effect of multi-agent populations by training individual A-bot-Q-bot pairs (i.e. populations with $N _ { A } = N _ { Q } = 1 _ { , }$ ). We apply the uniform random (either A-bot or Q-bot at random) and oldest (alternating between A-bot and Q-bot) replacement strategies to these agents; however, the epsilon greedy strategy is not well-defined here. In this setting we decrease $E$ from 25000 to 5000 to keep the average number of gradient updates for each agent constant with respect to the multi-agent experiments.
79
+
80
+ – No Replacement. We also consider the effect of replacing no agents at all, but still allowing the agents to train for the full 199,000 (39,000) epochs. Improvement over this baseline shows the gains from our replacement strategy under identical computational budgets.
81
+
82
+ # 5 RESULTS AND ANALYSIS
83
+
84
+ # 5.1 IMPACT OF CULTURAL TRANSMISSION ON COMPOSITIONAL GENERALIZATION
85
+
86
+ Results with standard deviations against our harder dataset are reported in Fig. 2. We compared methods and models using dependent paired t-tests and reported the resulting p-values in Section A.3. Result on the original Task & Talk dataset are in Section A.1.
87
+
88
+ Cultural transmission induces compositionality. Our main result is that cultural transmission approaches outperform baselines without cultural transmission. This can be seen by noting that for each model type in Fig. 2, the 3 darker blue bars (Multi Agent Replacement approaches) are largest. After running a dependent paired t-test against all pairs of baselines and cultural transmission approaches we find a meaningful difference in all cases $( p \leq 0 . 0 5 )$ . This is strong support for our claim that our version of cultural transmission encourages compositional language because it causes better generalization to novel compositions of attributes.
89
+
90
+ Next we go on to discuss some additional trends we hope the community will find useful.
91
+
92
+ Population dynamics without replacement usually lead to some compositionality. The Multi Agent No Replacement policies usually outperform than the Single Agent No Replacement policies, though the difference isn’t very significant in the except in the Overcomplete and Minimal Vocab settings. This agrees with recent work from evolutionary linguistics, where multiple agents can lead to compositionality without generational transmission Raviv et al. (2018).
93
+
94
+ Variations in replacement strategy tend to not affect performance. The Multi Agent Uniform Random/Epsilon Greedy/Oldest replacement strategies are not largely or consistently different from one another across model variations. This suggests that while some agent replacement needs to occur, it is not critical whether agents with worse language are replaced or whether there is a pool of similarly typed agents to remember knowledge lost from older generations. The main factor is that new agents learn in the presence of others who already know a language.
95
+
96
+ Cultural transmission is complementary with other factors that encourage compositionality. As in Kottur et al. (2017), we find the Memoryless $^ +$ Small Vocab model is clearly the best. This agrees with factors noted elsewhere Kottur et al. (2017); Mordatch & Abbeel (2018); Nowak et al. (2000) and shows how many different factors can affect the emergence of compositionality.
97
+
98
+ Removing memory makes only minor differences. Removing memory makes no difference (negative or positive) in Single Agent settings, but it can have a relatively small effect in Multi Agent settings, helping Small Vocab models and hurting Overcomplete models. While our approach is complementary with minimizing vocab size to increase compositionality, its makes memory removal less useful. As the Memoryless $^ +$ Overcomplete setting has not been reported before, these results suggest that the relationship between inter-round memory and compositionality is not clear.
99
+
100
+ Overall, these results show that adding cultural transmission to neural dialog agents improves the compositional generalization of the languages learned by those agents in a way complementary to other priors. It thereby shows how to transfer the cultural transmission principle from evolutionary linguistics to deep learning.
101
+
102
+ # 5.2 IS GENERATIONAL TRANSMISSION OCCURRING?
103
+
104
+ Because it is implicit, cultural transmission may not actually be occurring; improvements may be from other sources. How can we measure cultural transmission? We focus on A-bots and take a simple approach. We assume that if two A-bots ‘speak the same language’ then that language was culturally transmitted. There is a combinatorial explosion of possible languages that could refer to all the objects of interest, so if the words that refer to the same object for two agents are the same then they were very likely transmitted from the other agents, rather than similar languages emerging from scratch just by chance. This leads to a simple approach: consider pairs of bots and see if they say similar things in the same context. If they do, then their language was likely transmitted.
105
+
106
+ More formally, consider the distribution of tokens A-bot $A ^ { i }$ might use to describe its object $x _ { A }$ when talking to Q-bot $Q ^ { k }$ : $p _ { k , i } ( m _ { A } ^ { t } | x _ { A } )$ or $p _ { k , i }$ for short. We want to know how similar $\bar { A } ^ { i }$ ’s language is to that of another A-bot $A ^ { j }$ . We’ll start by comparing those two distributions by computing the KL divergence between them and then taking an average over context (objects, Q-bots, and dialog rounds) to get our pairwise agent language similarity metric $D _ { i j }$ :
107
+
108
+ $$
109
+ D _ { i j } = \hat { E } _ { x _ { A } , k , t } \left[ D _ { K L } \left( p _ { k , i } ( m _ { A } ^ { t } | x _ { A } ) , p _ { k , j } ( m _ { A } ^ { t } | x _ { A } ) \right) \right]
110
+ $$
111
+
112
+ Taking another average, this time over all pairs of bots (and also random seeds and cross-val folds), gives our final measure of language similarity reported in Fig. 3.
113
+
114
+ $$
115
+ D = \hat { E } _ { i , j \mathrm { ~ s . t . ~ } i \neq j } \left[ D _ { i j } \right]
116
+ $$
117
+
118
+ $D$ is smaller the more similar language is between bots. Note that even though $D _ { i j }$ is not symmetric (because KL divergence is not), $D$ is symmetric because it averages over both directions of pairs.
119
+
120
+ We compute $D$ by sampling an empirical distribution over all messages and observations, taking 10 sample dialogues in each possible test state $( x _ { A } , x _ { Q } )$ of the world using the final populations of agents as in Fig. 2. Note that this metric applies to a group of agents, so we measure it for only the Multi Agent settings, including two new baselines colored red in Fig. 3. The Single Agents Combined baseline trains 4 Single Agent No Replacement models independently then puts them together and computes $D$ for that group. These agents only speak similar languages by chance, so $D$ is high. The Random Initialization baseline evaluates language similarity using newly initialized models. These agents have about a uniform distribution over words at every utterance, so their languages are both very similar and useless. For each model these baselines act like practical (not strict) upper and lower bounds on $D$ , respectively.
121
+
122
+ Fig. 3 shows this language dissimilarity metric for all our settings. As we expect, the paired Single Agents are highly dissimilar compared to agents from Multi Agent populations. Further, all the replacement strategies result in increased language similarity—although the degree of this effect seems dependent on vocabulary setting. This provides some evidence that cultural transmission is occurring in Multi Agent settings and is encouraged by the replacement strategy in our approach. While all Multi Agent settings resulted in language transmission, our replacement strategies results in more compositional languages due to repeated teaching of new generations of agents.
123
+
124
+ # 5.3 VISUALIZING EMERGENT LANGUAGES
125
+
126
+ In this section we visualize the language learned by agents at various stages of training to reinforce our previous conclusions and build intuition. Each of the three sub-figures in Fig. 4 summarizes all of the conversations between a particular pair of bots for the (shape, color) task. To see how these summaries work, consider Fig. 4a. That sub-figure is divided into a $4 \times 4$ grid with 4 elements in each cell, so there is one element for each of the 64 possible objects. For this task, objects in each row of the $4 \times 4$ grid have the same shape and objects in each column have the same color. To the right of each object are the two tokens A-bot used to respond to Q-bot in the two dialog rounds. Ideally they should indicate the color and shape of the object. Finally, the check-marks or Xs to the right of A-bot’s utterances indicate whether Q-bot guessed correctly.
127
+
128
+ ![](images/e68419c7891d177e2ae37f512fe3dc70e24b66bef8877d8103b4dc83fed0b9e0.jpg)
129
+ Model Figure 3: Do bots in a population learn similar languages? On the y-axis (eq. (2)) lower values indicate similar language. Populations evolved with our method speak similar languages, but independently evolved agents do not. Thus our implicit procedure induces cultural transmission.
130
+
131
+ ![](images/383e1a2eec5bbbd3805c1ab8f39b1a203f63370349f09eb5189cc2d11b8bb83f.jpg)
132
+ Figure 4: Each sub-figure summarizes an A-bot’s language, as described in Section 5.3. By comparing the baseline of Fig. 4a to a similar pair of bots from our approach Section 4b we can see that our approach encourages compositional language to emerge. Furthermore, the similarity between Fig. 4b and Fig. 4c suggests language is indeed transmitted in our approach.
133
+
134
+ From left to right: Fig. 4a summarizes the single pair from a Single Agent No Replacement run (3000 iterations old); Fig. 4b summarizes dialogs between an old Q-bot (about 23000 iterations) and a recently re-initialized A-bot (about 3000 iterations) at the 8th and final generation of a Multi Oldest run; Fig. 4c summarizes dialogs between the same old Q-bot as in Fig. 4b and an old A-bot (13000 iterations) from the same Multi Oldest experiment. Even though the A-bots in Fig. 4a and Fig. 4b have trained for about2 the same number of iterations, the A-bot trained in the presence of other bots which already know a functional language has already learned a somewhat compositional language whereas the Single Agent A-bot has not. Furthermore, by comparing the old A-bot’s language Fig. 4c with the new one Fig. 4b we can see that they are extremely similar. They even lead to the same mistakes. This again suggests that language is transmitted between bots, in agreement with our previous experiments.
135
+
136
+ # 6 RELATED WORK
137
+
138
+ Language Evolution Causes Structure. Researchers have spent decades studying how unique properties of human language like compositionality could have emerged. There is general agreement that people acquire language using a combination of innate cognitive capacity and learning from other language speakers (cultural transmission), with the degree of each being widely disputed Perfors (2002); Pinker & Bloom (1990). Both innate cognitive capacity and specific modern human languages like English co-evolved Briscoe (2000) via biological Pinker & Bloom (1990) and cultural Tomasello (1999); Smith (2006) evolution, respectively.
139
+
140
+ In particular, explanations of how the cultural evolution of languages could cause structure like compositionality are in abundance Nowak & Krakauer (1999); Nowak et al. (2000); Smith et al. (2003); Brighton (2002); Vogt (2005); Kirby et al. (2014); Spike et al. (2017). An important piece of the explanation of linguistic structure is the iterated learning model Kirby et al. (2014); Kirby (2001); Kirby et al. (2008) used to motivate our approach. Indeed it shows that cultural transmission causes structure in computational Kirby (2001; 2002); Christiansen & Kirby (2003); Smith et al. (2003) and human Kirby et al. (2008); Cornish et al. (2009); Scott-Phillips & Kirby (2010) experiments. Even though cultural transmission may aid the emergence of compositionality, recent results in evolutionary linguistics Raviv et al. (2018) and deep learning Kottur et al. (2017); Mordatch & Abbeel (2018) also emphasize other factors.
141
+
142
+ While existing work in deep learning has focused on biases that encourage compositionality, it has not considered settings where language is permitted to evolve over generations of agents. We have shown such an approach is viable and even complementary with other approaches.
143
+
144
+ Language Emergence in Deep Learning. Recent work in deep learning has increasingly focused on multi-agent environments where deep agents learn to accomplish goals (possibly cooperative or competitive) by interacting appropriately with the environment and each other. Some of this work has shown that deep agents will develop their own language where none exists initially if driven by a task which requires communication Foerster et al. (2016); Sukhbaatar et al. (2016); Lazaridou et al. (2017). Most relevant is work which focuses on conditions under which compositional language emerges as deep agents learn to cooperate Mordatch & Abbeel (2018); Kottur et al. (2017). Both Mordatch & Abbeel (2018) and Kottur et al. (2017) find that limiting the vocabulary size so that there aren’t too many more words than there are objects to refer to encourages compositionality, which follows earlier results in evolutionary linguistics Nowak et al. (2000). Follow up work has continued to investigate the emergence of compositional language among neural agents, mainly focusing on perceptual as opposed to symbolic input and how the structure of the input relates to the tendency for compositional language to emerge Choi et al. (2018); Havrylov & Titov (2017); Lazaridou et al. (2018). Other work has shown that Multi Agent interaction leads to better emergent translation Lee et al. (2018), but it does not measure compositionality.
145
+
146
+ Cultural Evolution and Neural Nets. Somewhat recently, Bengio (2012) suggested that culturally transmitted ideas may help in escaping from local minima. Experiments in Gulc¸ehre & Bengio ¨ (2016) support this idea by showing that supervision of intermediate representations allows a more complex toy task to be learned. Unlike our work, these experiments use direct supervision provided by the designed environment rather than indirect and implicit supervision provided by other agents.
147
+
148
+ Two concurrent works examine the role of periodic agent replacement on language emergence – albeit in different environments. In Li & Bowling (2019) replacement is used to encourage languages to be easy to teach, and this in turn causes compositionality. In Dagan et al. (2019) neural language is transmitted through a bottleneck caused by replacement. The resulting language has increased efficiency and effectiveness, with further results showing that co-evolving the agents themselves with the language amplifies the effect. Both of these works support our central observations.
149
+
150
+ # 7 CONCLUSION
151
+
152
+ In this work we investigated cultural transmission in deep neural dialog agents, applying it to language emergence. The evolutionary linguistics community has long used cultural transmission to explain how compositional languages could have emerged. The deep learning community, having recently become interested in language emergence, has not investigated that link until now. Instead of explicit models of cultural transmission familiar in evolutionary linguistics, we favor an implicit model where language is transmitted from generation to generation only because it helps agents achieve their goals. We show that this does indeed cause cultural transmission and compositionality.
153
+
154
+ Future work. While our work used an implicit version of cultural transmission, we are interested in investigating the effect of explicit versions of cultural transmission on language structure. In another direction, cultural transmission may also provide an appropriate prior for neural representations of non-language information.
155
+
156
+ # REFERENCES
157
+
158
+ Jacob Andreas, Anca D. Dragan, and Dan Klein. Translating neuralese. In ACL, 2017.
159
+
160
+ Yoshua Bengio. Evolving culture vs local minima. CoRR, abs/1203.2990, 2012.
161
+
162
+ Henry Brighton. Compositional syntax from cultural transmission. Artificial Life, 8:25–54, 2002.
163
+
164
+ Ted Briscoe. Grammatical acquisition: Inductive bias and coevolution of language and the language acquisition device. In Language, volume 76. Linguistic Society of America, 2000.
165
+
166
+ Edward Choi, Angeliki Lazaridou, and Nando de Freitas. Compositional obverter communication learning from raw visual input. In International Conference on Learning Representations (ICLR), 2018.
167
+
168
+ Morten H. Christiansen and Simon Kirby. Language evolution: consensus and controversies. Trends in cognitive sciences, 7 7:300–307, 2003.
169
+
170
+ Hannah Cornish, Monica Tamariz, and Simon Kirby. Complex adaptive systems and the origins of adaptive structure: What experiments can tell us. Language Learning, 59(s1):187–205, 2009. doi: 10.1111/j.1467-9922.2009.00540.x. URL https://onlinelibrary.wiley.com/doi/ abs/10.1111/j.1467-9922.2009.00540.x.
171
+
172
+ Gautier Dagan, Dieuwke Hupkes, and Elia Bruni. Co-evolution of language and agents in referential games. pre-print, 2019. URL https://eliabruni.github.io/publications/ dagan2019coevolution.pdf.
173
+
174
+ Abhishek Das, Satwik Kottur, Jose M.F. Moura, Stefan Lee, and Dhruv Batra. Learning cooperative ´ visual dialog agents with deep reinforcement learning. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2017.
175
+
176
+ Jakob Foerster, Ioannis Alexandros Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate with deep multi-agent reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2137–2145, 2016.
177
+
178
+ C¸ aglar G ˘ ulc¸ehre and Yoshua Bengio. Knowledge matters: Importance of prior information for ¨ optimization. Journal of Machine Learning Research, 17:8:1–8:32, 2016.
179
+
180
+ Serhii Havrylov and Ivan Titov. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. In NIPS, 2017.
181
+
182
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
183
+
184
+ Simon Kirby. Spontaneous evolution of linguistic structure-an iterated learning model of the emergence of regularity and irregularity. IEEE Trans. Evolutionary Computation, 5:102–110, 2001.
185
+
186
+ Simon Kirby. Natural language from artificial life. In Artificial Life, 2002.
187
+
188
+ Simon Kirby, Hannah Cornish, and Kenny Smith. Cumulative cultural evolution in the laboratory: An experimental approach to the origins of structure in human language. Proceedings of the National Academy of Sciences, 2008. ISSN 0027-8424. doi: 10.1073/pnas.0707835105. URL https://www.pnas.org/content/early/2008/07/29/0707835105.
189
+
190
+ Simon Kirby, Tom Griffiths, and Kenny Smith. Iterated learning and the evolution of language. Current Opinion in Neurobiology, 28:108–114, 2014.
191
+
192
+ Satwik Kottur, Jose M. F. Moura, Stefan Lee, and Dhruv Batra. Natural language does not emerge ´ ’naturally’ in multi-agent dialog. In EMNLP, 2017.
193
+
194
+ Brenden M. Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In ICML, 2018.
195
+
196
+ Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In International Conference on Learning Representations (ICLR), 2017.
197
+
198
+ Angeliki Lazaridou, Karl Moritz Hermann, Karl Tuyls, and Stephen Clark. Emergence of linguistic communication from referential games with symbolic and pixel input. In International Conference on Learning Representations (ICLR), 2018.
199
+
200
+ Jason D. Lee, Kyunghyun Cho, Jason Weston, and Douwe Kiela. Emergent translation in multiagent communication. CoRR, abs/1710.06922, 2018.
201
+
202
+ Fushan Li and Michael Bowling. Ease-of-teaching and language structure from emergent communication. CoRR, abs/1906.02403, 2019. URL http://arxiv.org/abs/1906.02403.
203
+
204
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. In AAAI, 2018.
205
+
206
+ Martin A. Nowak and David C. Krakauer. The evolution of language. Proceedings of the National Academy of Sciences of the United States of America, 96 14:8028–33, 1999.
207
+
208
+ Martin A. Nowak, Joshua B. Plotkin, and Vincent A A Jansen. The evolution of syntactic communication. Nature, 404:495–498, 2000.
209
+
210
+ Amy Perfors. Simulated evolution of language: a review of the field. J. Artificial Societies and Social Simulation, 5, 2002.
211
+
212
+ Steven Pinker and Paul Bloom. Natural language and natural selection. Behavioral and brain sciences, 13(4):707–727, 1990.
213
+
214
+ Limor Raviv, Antje Meyer, and Shiri Lev-Ari. Compositional structure can emerge without generational transmission. Cognition, 182:151–164, 2018.
215
+
216
+ Thomas C. Scott-Phillips and Simon Kirby. Language evolution in the laboratory. Trends in cognitive sciences, 14 9:411–7, 2010.
217
+
218
+ Kenny Smith. Cultural evolution of language. Encyclopedia of Language and Linguistics 2 Edition, 2:315–322, 2006.
219
+
220
+ Kenny Smith, Simon Kirby, and Henry Brighton. Iterated learning: A framework for the emergence of language. Artificial Life, 9:371–386, 2003.
221
+
222
+ Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. In Cognitive Science, 2017.
223
+
224
+ Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. In NIPS, 2016.
225
+
226
+ Michael Tomasello. The cultural origins of human cognition. Harvard university press, 1999.
227
+
228
+ Paul Vogt. The emergence of compositional structures in perceptually grounded language games. Artificial intelligence, 167(1-2):206–242, 2005.
229
+
230
+ # A APPENDIX
231
+
232
+ # A.1 RESULTS ON SINGLE HELD OUT ATTRIBUTE DATASET OF KOTTUR ET AL. (2017)
233
+
234
+ In Section 4 we proposed a new harder compositional dataset different from the one in Kottur et al. (2017). For comparison, in this section we train and evaluate our models on the original dataset from Kottur et al. (2017) to show that our approach also improves still improves compositionality in this setting and to show that our new dataset is indeed harder.
235
+
236
+ ![](images/3c1f5868d98f9e916b1c8cf1e9e36eb91faa16b49dcc985ae245616a9c280394.jpg)
237
+ Figure 5: Test set accuracies (with standard deviations) are reported by training and evaluating the same models as in our main results Fig. 2 against the dataset from Kottur et al. (2017). These results do not perform cross-validation, following Kottur et al. (2017). They only vary across 4 different random seeds. This dataset is significantly easier than our new dataset, as indicated by the Our proposed approach still outperforms models without replacement or multiple agents.
238
+
239
+ # A.2 REPLACEMENT STRATEGIES
240
+
241
+ Our approach to cultural transmission periodically replaces agents by re-initializing them. The approach section outlines various replacement strategies (policy $\pi$ ), but does not detail their implementation. We do so here.
242
+
243
+ These strategies depend on a number of possible inputs:
244
+
245
+ • $e$ the current epoch
246
+ • $E$ the period of agent replacement
247
+ • $v _ { i } ^ { Q } / v _ { i } ^ { A }$ the validation accuracy of agent $i$ for Q-bots/A-bots. For Q-bots this is averaged over all potential A-bot partners, and vice-versa for A-bots.
248
+ • $a _ { i } ^ { Q } / a _ { i } ^ { A }$ the age in epochs of agent $i$ for Q-bots/A-bots
249
+
250
+ Single Agent strategies are given in Alg. 2 and Alg. 3. Multi Agent strategies are given in Alg. 4, Alg. 5, and Alg. 6. Note that Single Agent strategies always replace one agent while Multi Agent strategies always replace one Q-bot and one A-bot. An additional Replace All baseline strategy is given in Alg. ?? and generalizes to both Single and Multi Agent cases.
251
+
252
+ # Algorithm 2: Single Agent - Random Replacement
253
+
254
+ <table><tr><td>1 d~U{0,1}</td></tr><tr><td></td></tr><tr><td>2 if d=O then return {A-bot }</td></tr><tr><td></td></tr><tr><td>4 else return {Q-bot}</td></tr></table>
255
+
256
+ # A.3 DETAILED RESULTS
257
+
258
+ In our experiments we compare models and we compare replacement strategies. We ran dependent paired t-tests across random seeds, cross-val folds, and replacement strategies to compare models. We ran dependent paired t-tests across random seeds, cross-val folds, and models to compare replacement strategies. The p-values for all of these t-tests are reported here.
259
+
260
+ Replacement strategy comparisons are in Fig. 7 (Single Agent) and Fig. 8 (Multi Agent). Model comparisons are in Fig. 6.
261
+
262
+ ![](images/fc000857cd1616211d7de8541016d7cbd9c818d97401baf12896a1033c618806.jpg)
263
+ Figure 6: Replacement strategy comparison p-values.
264
+
265
+ ![](images/3765b7e01ed3a5a0cfbba49a0af8fadc84510f5b295801cd24b995b74c104a2a.jpg)
266
+ Figure 7: Single Agent model comparison p-values.
267
+
268
+ ![](images/7ef9b3e377968b1755836c0ed298545d627e2ebf38fcd55e8c7a107744b84db2.jpg)
269
+ Figure 8: Multi Agent model comparison p-values.
270
+
271
+ # Algorithm 3: Single Agent - Alternate Replacement
272
+
273
+ 1 Input: e
274
+ 2 if $\lfloor e / E \rfloor = 0$ then
275
+ 3 return { A-bot }
276
+ 4 else
277
+ 5 return { Q-bot }
278
+
279
+ # Algorithm 4: Multi Agent - Uniform Random Replacement
280
+
281
+ 1 iA ∼ U{1, NA}
282
+ 2 iQ ∼ U{1, NQ}
283
+ 3 return { A-bot $i _ { A }$ , Q-bot iQ }
284
+
285
+ # Algorithm 5: Multi Agent - Epsilon Greedy Replacement
286
+
287
+ 1 Input: $v _ { i } ^ { Q } \forall i$ , $v _ { i } ^ { A } \forall i$ , ε ∈ [0, 1) (usually 0.2)
288
+ 2 $d \sim \mathcal { U } [ 0 , \overset { \cdot } { 1 } )$
289
+ 3 if $d < \varepsilon$ then
290
+ 4 $i _ { A } \sim \mathcal { U } \{ 1 , N _ { A } \}$
291
+ 5 $i _ { Q } \sim \mathcal { U } \{ 1 , N _ { Q } \}$
292
+ $\mathbf { 6 }$ else
293
+ 7 $i _ { A } = \mathrm { a r g m i n } _ { i } v _ { i } ^ { A }$ (unique in our experiments)
294
+ 8 $i _ { Q } = \mathrm { a r g m i n } _ { i } v _ { i } ^ { Q }$ (unique in our experiments)
295
+ 9 return { A-bot iA, Q-bot iQ }
296
+
297
+ # Algorithm 6: Multi Agent - Oldest Replacement
298
+
299
+ 1 Input: $a _ { i } ^ { Q } \forall i$ , $a _ { i } ^ { V } \forall i$
300
+ 2 $i _ { A } = \mathcal { U } \{ \mathrm { a r g m a x } _ { i } a _ { i } ^ { A } \}$
301
+ 3 $i _ { Q } = \mathcal { U } \{ \mathrm { a r g m a x } _ { i } a _ { i } ^ { Q } \}$
302
+ 4 return { A-bot $i _ { A }$ , Q-bot iQ }
md/train/r1lZ7AEKvB/r1lZ7AEKvB.md ADDED
@@ -0,0 +1,581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE LOGICAL EXPRESSIVENESS OF GRAPH NEURAL NETWORKS
2
+
3
+ Pablo Barcelo´ IMC, PUC & IMFD Chile
4
+
5
+ Egor V. Kostylev University of Oxford
6
+
7
+ Mikael Monet¨ IMFD Chile
8
+
9
+ Jorge Perez ´ DCC, UChile & IMFD Chile
10
+
11
+ Juan Reutter DCC, PUC & IMFD Chile
12
+
13
+ Juan-Pablo Silva DCC, UChile
14
+
15
+ # ABSTRACT
16
+
17
+ The ability of graph neural networks (GNNs) for distinguishing nodes in graphs has been recently characterized in terms of the Weisfeiler-Lehman (WL) test for checking graph isomorphism. This characterization, however, does not settle the issue of which Boolean node classifiers (i.e., functions classifying nodes in graphs as true or false) can be expressed by GNNs. We tackle this problem by focusing on Boolean classifiers expressible as formulas in the logic $\mathrm { F O C _ { 2 } }$ , a well-studied fragment of first order logic. $\mathrm { F O C _ { 2 } }$ is tightly related to the WL test, and hence to GNNs. We start by studying a popular class of GNNs, which we call AC-GNNs, in which the features of each node in the graph are updated, in successive layers, only in terms of the features of its neighbors. We show that this class of GNNs is too weak to capture all $\mathrm { F O C _ { 2 } }$ classifiers, and provide a syntactic characterization of the largest subclass of $\mathrm { F O C _ { 2 } }$ classifiers that can be captured by AC-GNNs. This subclass coincides with a logic heavily used by the knowledge representation community. We then look at what needs to be added to AC-GNNs for capturing all $\mathrm { F O C _ { 2 } }$ classifiers. We show that it suffices to add readout functions, which allow to update the features of a node not only in terms of its neighbors, but also in terms of a global attribute vector. We call GNNs of this kind ACR-GNNs. We experimentally validate our findings showing that, on synthetic data conforming to $\mathrm { F O C _ { 2 } }$ formulas, AC-GNNs struggle to fit the training data while ACR-GNNs can generalize even to graphs of sizes not seen during training.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Graph neural networks (GNNs) (Merkwirth & Lengauer, 2005; Scarselli et al., 2009) are a class of neural network architectures that has recently become popular for a wide range of applications dealing with structured data, e.g., molecule classification, knowledge graph completion, and Web page ranking (Battaglia et al., 2018; Gilmer et al., 2017; Kipf & Welling, 2017; Schlichtkrull et al., 2018). The main idea behind GNNs is that the connections between neurons are not arbitrary but reflect the structure of the input data. This approach is motivated by convolutional and recurrent neural networks and generalize both of them (Battaglia et al., 2018). Despite the fact that GNNs have recently been proven very efficient in many applications, their theoretical properties are not yet well-understood. In this paper we make a step towards understanding their expressive power by establishing connections between GNNs and well-known logical formalisms. We believe these connections to be conceptually important, as they permit us to understand the inherently procedural behavior of some fragments of GNNs in terms of the more declarative flavor of logical languages.
22
+
23
+ Two recent papers (Morris et al., 2019; Xu et al., 2019) have started exploring the theoretical properties of GNNs by establishing a close connection between GNNs and the Weisfeiler-Lehman (WL) test for checking graph isomorphism. The WL test works by constructing a labeling of the nodes of the graph, in an incremental fashion, and then decides whether two graphs are isomorphic by comparing the labeling of each graph. To state the connection between GNNs and this test, consider the simple GNN architecture that updates the feature vector of each graph node by combining it with the aggregation of the feature vectors of its neighbors. We call such GNNs aggregate-combine GNNs, or AC-GNNs. The authors of these papers independently observe that the node labeling produced by the WL test always refines the labeling produced by any GNN. More precisely, if two nodes are labeled the same by the algorithm underlying the WL test, then the feature vectors of these nodes produced by any AC-GNN will always be the same. Moreover, there are AC-GNNs that can reproduce the WL labeling, and hence AC-GNNs can be as powerful as the WL test for distinguishing nodes. This does not imply, however, that AC-GNNs can capture every node classifier—that is, a function assigning true or false to every node—that is refined by the WL test. In fact, it is not difficult to see that there are many such classifiers that cannot be captured by AC-GNNs; one simple example is a classifier assigning true to every node if and only if the graph has an isolated node. Our work aims to answer the question of what are the node classifiers that can be captured by GNN architectures such as AC-GNNs.
24
+
25
+ To start answering this question, we propose to focus on logical classifiers—that is, on unary formulas expressible in first order predicate logic (FO): such a formula classifies each node $v$ according to whether the formula holds for $v$ or not. This focus gives us an opportunity to link GNNs with declarative and well understood formalisms, and to establish conclusions about GNNs drawing upon the vast amount of work on logic. For example, if one proves that two GNN architectures are captured with two logics, then one can immediately transfer all the knowledge about the relationships between those logics, such as equivalence or incomparability of expressiveness, to the GNN setting.
26
+
27
+ For AC-GNNs, a meaningful starting point to measure their expressive power is the logic $\mathrm { F O C _ { 2 } }$ , the two variable fragment of first order predicate logic extended with counting quantifiers of the form $\exists ^ { \geq N } \varphi$ , which state that there are at least $N$ nodes satisfying formula $\varphi$ (Cai et al., 1992). Indeed, this choice of $\mathrm { F O C _ { 2 } }$ is justified by a classical result due to Cai et al. (1992) establishing a tight connection between $\mathrm { F O C _ { 2 } }$ and WL: two nodes in a graph are classified the same by the WL test if and only if they satisfy exactly the same unary $\mathrm { F O C _ { 2 } }$ formulas. Moreover, the counting capabilities of $\mathrm { F O C _ { 2 } }$ can be mimicked in FO (albeit with more than just two variables), hence $\mathrm { F O C _ { 2 } }$ classifiers are in fact logical classifiers according to our definition.
28
+
29
+ Given the connection between AC-GNNs and WL on the one hand, and that between WL and $\mathrm { F O C _ { 2 } }$ on the other hand, one may be tempted to think that the expressivity of AC-GNNs coincides with that of $\mathrm { F O C _ { 2 } }$ . However, the reality is not as simple, and there are many $\mathrm { F O C _ { 2 } }$ node classifiers (e.g., the trivial one above) that cannot be expressed by AC-GNNs. This leaves us with the following natural questions. First, what is the largest fragment of $\mathrm { F O C _ { 2 } }$ classifiers that can be captured by AC-GNNs? Second, is there an extension of AC-GNNs that allows to express all $\mathrm { F O C _ { 2 } }$ classifiers? In this paper we provide answers to these two questions. The following are our main contributions.
30
+
31
+ • We characterize exactly the fragment of $\mathrm { F O C _ { 2 } }$ formulas that can be expressed as ACGNNs. This fragment corresponds to graded modal logic (de Rijke, 2000), or, equivalently, to the description logic $\mathcal { A L C Q }$ , which has received considerable attention in the knowledge representation community (Baader et al., 2003; Baader & Lutz, 2007). • Next we extend the AC-GNN architecture in a very simple way by allowing global readouts, where in each layer we also compute a feature vector for the whole graph and combine it with local aggregations; we call these aggregate-combine-readout GNNs (ACR-GNNs). These networks are a special case of the ones proposed by Battaglia et al. (2018) for relational reasoning over graph representations. In this setting, we prove that each $\mathrm { F O C _ { 2 } }$ formula can be captured by an ACR-GNN.
32
+
33
+ We experimentally validate our findings showing that the theoretical expressiveness of ACR-GNNs, as well as the differences between AC-GNNs and ACR-GNNs, can be observed when we learn from examples. In particular, we show that on synthetic graph data conforming to $\mathrm { F O C _ { 2 } }$ formulas, ACGNNs struggle to fit the training data while ACR-GNNs can generalize even to graphs of sizes not seen during training.
34
+
35
+ # 2 GRAPH NEURAL NETWORKS
36
+
37
+ In this section we describe the architecture of AC-GNNs and introduce other related notions. We concentrate on the problem of Boolean node classification: given a (simple, undirected) graph $G = ( V , E )$ in which each vertex $v \in V$ has an associated feature vector $\mathbf { \boldsymbol { x } } _ { v }$ , we wish to classify each graph node as true or false; in this paper, we assume that these feature vectors are one-hot encodings of node colors in the graph, from a finite set of colors. The neighborhood $\mathcal { N } _ { G } ( v )$ of a node $v \in V$ is the set $\{ u \mid \{ v , u \} \in E \}$ .
38
+
39
+ The basic architecture for GNNs, and the one studied in recent studies on GNN expressibility (Morris et al., 2019; $\mathrm { X u }$ et al., 2019), consists of a sequence of layers that combine the feature vectors of every node with the multiset of feature vectors of its neighbors. Formally, let $\{ \mathrm { A G G } ^ { ( i ) } \} _ { i = 1 } ^ { L }$ and $\{ \mathrm { C O M } ^ { ( i ) } \} _ { i = 1 } ^ { L }$ be two sets of aggregation and combination functions. An aggregate-combine GNN (AC-GNN) computes vectors $\pmb { x } _ { v } ^ { ( i ) }$ for every node $v$ of the graph $G$ , via the recursive formula
40
+
41
+ $$
42
+ \pmb { x } _ { v } ^ { ( i ) } = \mathrm { C O M } ^ { ( i ) } \left( \pmb { x } _ { v } ^ { ( i - 1 ) } , \mathrm { A G G } ^ { ( i ) } \left( \{ \pmb { x } _ { u } ^ { ( i - 1 ) } \mid u \in \mathcal { N } _ { G } ( v ) \} \right) \right) , \quad \mathrm { f o r } i = 1 , \ldots , L
43
+ $$
44
+
45
+ where each $\pmb { x } _ { v } ^ { ( 0 ) }$ is the initial feature vector $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathit { v } }$ of $v$ . Finally, each node $v$ of $G$ is classified according to a Boolean classification function CLS applied to x(L)v . Thus, an AC-GNN with L layers is defined as a tuple $\mathcal { A } = \left( \{ \mathrm { A G G } ^ { ( i ) } \} _ { i = 1 } ^ { L } , \{ \mathrm { C O M } ^ { ( i ) } \} _ { i = 1 } ^ { \bar { L } } \right.$ , CLS , and we denote by ${ \mathcal { A } } ( G , v )$ the class (i.e., true or false) assigned by $\mathcal { A }$ to each node $v$ in $G$ . 1
46
+
47
+ There are many possible aggregation, combination, and classification functions, which produce different classes of GNNs (Hamilton et al., 2017; Kipf & Welling, 2017; Morris et al., 2019; $\mathrm { X u }$ et al., 2019). A simple, yet common choice is to consider the sum of the feature vectors as the aggregation function, and a combination function as
48
+
49
+ $$
50
+ \mathrm { C O M } ^ { ( i ) } ( { \pmb x } _ { 1 } , { \pmb x } _ { 2 } ) = f \big ( { \pmb x } _ { 1 } { \pmb C } ^ { ( i ) } + { \pmb x } _ { 2 } { \pmb A } ^ { ( i ) } + { \pmb b } ^ { ( i ) } \big ) ,
51
+ $$
52
+
53
+ where $C ^ { ( i ) }$ and $A ^ { ( i ) }$ are matrices of parameters, $\mathbf { \delta } _ { b } ( i )$ is a bias vector, and $f$ is a non-linearity function, such as relu or sigmoid. We call simple an AC-GNN using these functions. Furthermore, we say that an AC-GNN is homogeneous if all $\mathrm { A G G } ^ { ( i ) }$ are the same and all $\mathrm { C O M } ^ { ( i ) }$ are the same (share the same parameters across layers). In most of our positive results we construct simple and homogeneous GNNs, while our negative results hold in general (i.e., for GNNs with arbitrary aggregation, combining, and classification functions).
54
+
55
+ The Weisfeiler-Lehman (WL) test is a powerful heuristic used to solve the graph isomorphism problem (Weisfeiler & Leman, 1968), or, for our purposes, to determine whether the neighborhoods of two nodes in a graph are structurally close or not. Due to space limitations, we refer to (Cai et al., 1992) for a formal definition of the underlying algorithm, giving only its informal description: starting from a colored graph, the algorithm iteratively assigns, for a certain number of rounds, a new color to every node in the graph; this is done in such a way that the color of a node in each round has a one to one correspondence with its own color and the multiset of colors of its neighbors in the previous round. An important observation is that the rounds of the WL algorithm can be seen as the layers of an AC-GNN whose aggregation and combination functions are all injective (Morris et al., 2019; Xu et al., 2019). Furthermore, as the following proposition states, an AC-GNN classification can never contradict the WL test.
56
+
57
+ Proposition 2.1 (Morris et al., 2019; Xu et al., 2019). If the WL test assigns the same color to two nodes in a graph, then every AC-GNN classifies either both nodes as true or both nodes as false.
58
+
59
+ # 3 CONNECTION BETWEEN GNNS AND LOGIC
60
+
61
+ # 3.1 LOGICAL NODE CLASSIFIERS
62
+
63
+ Our study relates the power of GNNs to that of classifiers expressed in first order (FO) predicate logic over (undirected) graphs where each vertex has a unique color (recall that we call these classifiers logical classifiers). To illustrate the idea of logical node classifiers, consider the formula
64
+
65
+ $$
66
+ \alpha ( x ) : = \operatorname { R e d } ( x ) \wedge \exists y { \big ( } E ( x , y ) \wedge \operatorname { B l u e } ( y ) { \big ) } \wedge \exists z { \big ( } E ( x , z ) \wedge \operatorname { G r e e n } ( z ) { \big ) } .
67
+ $$
68
+
69
+ This formula has one free variable, $x$ , which is not bounded by any quantifier of the form $\exists$ or $\forall .$ , and two quantified variables $y$ and $z$ . In general, formulas with one free variable are evaluated over nodes of a given graph. For example, the above formula evaluates to true exactly in those nodes $v$ whose color is Red and that have both a Blue and a Green neighbor. In this case, we say that node $v$ of $G$ satisfies $\alpha$ , and denote this by $( G , v ) \not = \alpha$ .
70
+
71
+ Formally, a logical (node) classifier is given by a formula $\varphi ( x )$ in FO logic with exactly one free variable. This formula classifies as true those nodes $v$ in $G$ such that $( G , v ) \models \varphi$ , while all other nodes (i.e., those with $( G , v ) \not \ = \varphi )$ are classified as false. We say that a GNN classifier captures a logical classifier when both classifiers coincide over every node in every possible input graph.
72
+
73
+ Definition 3.1. A GNN classifier $\mathcal { A }$ captures a logical classifier $\varphi ( x )$ if for every graph $G$ and node $v$ in $G$ , it holds that ${ \mathcal { A } } ( G , v ) =$ true if and only $i f ( G , v ) \models \varphi$ .
74
+
75
+ # 3.2 LOGIC $\mathrm { F O C _ { 2 } }$
76
+
77
+ Logical classifiers are useful as a declarative formalism, but as we will see, they are too powerful to compare them to AC-GNNs. Instead, for reasons we explain later we focus on classifiers given by formulas in $\mathrm { F O C _ { 2 } }$ , the fragment of FO logic that only allows formulas with two variables, but in turn permits to use counting quantifiers.
78
+
79
+ Let us briefly introduce $\mathrm { F O C _ { 2 } }$ and explain why it is a restriction of FO logic. The first remark is that reducing the number of variables used in formulas drastically reduces their expressive power. Consider for example the following FO formula expressing that $x$ is a red node, and there is another node, $y$ , that is not connected to $x$ and that has at least two blue neighbors, $z _ { 1 }$ and $z _ { 2 }$ :
80
+
81
+ $$
82
+ \begin{array} { r } { \mathfrak { z } ( x ) : = \mathrm { R e d } ( x ) \wedge \exists y \bigl ( \neg E ( x , y ) \wedge \exists z _ { 1 } \exists z _ { 2 } \bigl [ E ( y , z _ { 1 } ) \wedge E ( y , z _ { 2 } ) \wedge z _ { 1 } \neq z _ { 2 } \wedge \mathrm { B l u e } ( z _ { 1 } ) \wedge \mathrm { B l u e } ( z _ { 2 } ) \bigr ] \bigr ) . } \end{array}
83
+ $$
84
+
85
+ The formula $\beta ( x )$ uses four variables, but it is possible to find an equivalent one with just three: the trick is to reuse variable $x$ and replace every occurrence of $z _ { 2 }$ in $\beta ( x )$ by $x$ . However, this is as far as we can go with this trick: $\beta ( x )$ does not have an equivalent formula with less than three variables. In the same way, the formula $\alpha ( x )$ given in Equation (3) can be expressed using only two variables, $x$ and $y$ , simply by reusing $y$ in place of $z$ .
86
+
87
+ That being said, it is possible to extend the logic so that some node properties, such as the one defined by $\beta ( x )$ , can be expressed with even less variables. To this end, consider the counting quantifier $\exists \geq N$ for every positive integer $N$ . Analogously to how the quantifier $\exists$ expresses the existence of a node satisfying a property, the quantifier $\exists \geq N$ expresses the existence of at least $N$ different nodes satisfying a property. For example, with $\exists ^ { \geq 2 }$ we can express $\beta ( x )$ by using only two variables by means of the classifier
88
+
89
+ $$
90
+ \gamma ( x ) : = { \mathrm { R e d } } ( x ) \wedge \exists y \bigl ( \neg E ( x , y ) \wedge \exists ^ { \geq 2 } x \bigl [ E ( y , x ) \wedge \mathbf { B l u e } ( x ) \bigr ] \bigr ) .
91
+ $$
92
+
93
+ Based on this idea, the logic $\mathrm { F O C _ { 2 } }$ allows for formulas using all FO constructs and counting quantifiers, but restricted to only two variables. Note that, in terms of their logical expressiveness, we have that $\mathrm { F O C _ { 2 } }$ is strictly less expressive than FO (as counting quantifiers can always be mimicked in FO by using more variables and disequalities), but is strictly more expressive than $\mathrm { F O _ { 2 } }$ , the fragment of FO that allows formulas to use only two variables (as $\beta ( x )$ belongs to $\mathrm { F O C _ { 2 } }$ but not to $\mathrm { F O _ { 2 } }$ ).
94
+
95
+ The following result establishes a classical connection between $\mathrm { F O C _ { 2 } }$ and the WL test. Together with Proposition 2.1, this provides a justification for our choice of logic $\mathrm { F O C _ { 2 } }$ for measuring the expressiveness of AC-GNNs.
96
+
97
+ Proposition 3.2 (Cai et al., 1992). For any graph $G$ and nodes $u , v$ in $G$ , the WL test colors v and u the same after any number of rounds iff u and $v$ are classified the same by all $F O C _ { 2 }$ classifiers.
98
+
99
+ # 3.3 $\mathrm { F O C _ { 2 } }$ AND AC-GNN CLASSIFIERS
100
+
101
+ Having Propositions 2.1 and 3.2, one may be tempted to combine them and claim that every $\mathrm { F O C _ { 2 } }$ classifier can be captured by an AC-GNN. Yet, this is not the case as shown in Proposition 3.3 below. In fact, while it is true that two nodes are declared indistinguishable by the WL test if and only if they are indistinguishable by all $\mathrm { F O C _ { 2 } }$ classifiers (Proposition 3.2), and if the former holds then such nodes cannot be distinguished by AC-GNNs (Proposition 2.1), this by no means tells us that every $\mathrm { F O C _ { 2 } }$ classifier can be expressed as an AC-GNN.
102
+
103
+ Proposition 3.3. There is an $F O C _ { 2 }$ classifier that is not captured by any AC-GNN.
104
+
105
+ One such $\mathrm { F O C _ { 2 } }$ classifier is $\gamma ( x )$ in Equation (4), but there are infinitely many and even simpler $\mathrm { F O C _ { 2 } }$ formulas that cannot be captured by AC-GNNs. Intuitively, the main problem is that an ACGNN has only a fixed number $L$ of layers and hence the information of local aggregations cannot travel further than at distance $L$ of every node along edges in the graph. For instance, the red node in $\gamma ( x )$ may be farther away than the node with the blue neighbours, which means that AC-GNNs would never be able to connect this information. Actually, both nodes may even be in different connected components of a graph, in which case no number of layers would suffice.
106
+
107
+ The negative result of Proposition 3.3 opens up the following important questions.
108
+
109
+ 1. What kind of $\mathrm { F O C _ { 2 } }$ classifiers can be captured by AC-GNNs?
110
+ 2. Can we capture $\mathrm { F O C _ { 2 } }$ classifiers with GNNs using a simple extension of AC-GNNs?
111
+
112
+ We provide answers to these questions in the next two sections.
113
+
114
+ # 4 THE EXPRESSIVE POWER OF AC-GNNS
115
+
116
+ Towards answering our first question, we recall that the problem with AC-GNN classifiers is that they are local, in the sense that they cannot see across a distance greater than their number of layers. Thus, if we want to understand which logical classifiers this architecture is capable of expressing, we must consider logics built with similar limitations in mind. And indeed, in this section we show that AC-GNNs capture any $\mathrm { F O C _ { 2 } }$ classifier as long as we further restrict the formulas so that they satisfy such a locality property. This happens to be a well-known restriction of $\mathrm { F O C _ { 2 } }$ , and corresponds to graded modal logic (de Rijke, 2000) or, equivalently, to description logic $\mathcal { A L C Q }$ (Baader et al., 2003), which is fundamental for knowledge representation: for instance, the OWL 2 Web Ontology Language (Motik et al., 2012; W3C OWL Working Group, 2012) relies on $\mathcal { A L C Q }$ .
117
+
118
+ The idea of graded modal logic is to force all subformulas to be guarded by the edge predicate $E$ . This means that one cannot express in graded modal logic arbitrary formulas of the form $\exists y \varphi ( y )$ , i.e., whether there is some node that satisfies property $\varphi$ . Instead, one is allowed to check whether some neighbor $y$ of the node $x$ where the formula is being evaluated satisfies $\varphi$ . That is, we are allowed to express the formula $\exists y ( E ( x , y ) \land \varphi ( y ) )$ in the logic as in this case $\varphi ( y )$ is guarded by $E ( x , y )$ . We can define this fragment of FO logic using FO syntax as follows. A graded modal logic formula is either $\operatorname { C o l } ( x )$ , for $\mathrm { C o l }$ a node color, or one of the following, where $\varphi$ and $\psi$ are graded modal logic formulas and $N$ is a positive integer:
119
+
120
+ $$
121
+ \neg \varphi ( x ) , \quad \varphi ( x ) \wedge \psi ( x ) , \quad \exists ^ { \geq N } y ( E ( x , y ) \wedge \varphi ( y ) ) .
122
+ $$
123
+
124
+ Notice then that the formula $\delta ( x ) : = \operatorname { R e d } ( x ) \wedge \exists y \left( E ( x , y ) \wedge \operatorname { B l u e } ( y ) \right)$ is in graded modal logic, but the logical classifier $\gamma ( x )$ in Equation (4) is not, because the use of $\neg E ( x , y )$ as a guard is disallowed. As required, we can now show that AC-GNNs can indeed capture all graded modal logic classifiers.
125
+
126
+ Proposition 4.1. Each graded modal logic classifier is captured by a simple homogeneous AC-GNN.
127
+
128
+ The key idea of the construction is that the vectors’ dimensions used by the AC-GNN to label nodes, represent the sub-formulas of the captured classifier. Thus, if a feature in a node is 1 then the node satisfies the corresponding sub-formula, and the opposite holds after evaluating $L$ layers, where $L$ is the “quantifier depth” of the classifier (which does not depend on the graph). The construction uses simple, homogeneous AC-GNNs with the truncated relu non-linearity $\operatorname* { m a x } ( 0 , \operatorname* { m i n } ( x , 1 ) )$ . The formal proof of Proposition 4.1, as well as other formal statements, can be found in the Appendix. An interesting question that we leave as future work is to investigate whether the same kind of construction can be done with AC-GNNs using different aggregate and combine operators than the ones we consider here; for instance, using max instead of sum to aggregate the feature vectors of the neighbors, or using other non-linearity such as sigmoid, etc.
129
+
130
+ The relationship between AC-GNNs and graded modal logic goes further: we can show that graded modal logic is the “largest” class of logical classifiers captured by AC-GNNs. This means that the only FO formulas that AC-GNNs are able to learn accurately are those in graded modal logic.
131
+
132
+ Theorem 4.2. A logical classifier is captured by AC-GNNs if and only if it can be expressed in graded modal logic.
133
+
134
+ The backward direction of this theorem is Proposition 4.1, while the proof of the forward direction is based on a recently communicated extension of deep results in finite model theory (Otto, 2019). We point out that the forward direction holds no matter which aggregate and combine operators are considered, i.e., this is a limitation of the architecture for AC-GNNs, not of the specific functions that one chooses to update the features.
135
+
136
+ # 5 GNNS FOR CAPTURING $\mathrm { F O C _ { 2 } }$
137
+
138
+ # 5.1 GNNS WITH GLOBAL READOUTS
139
+
140
+ In this section we tackle our second question: which kind of GNN architecture we need to capture all $\mathrm { F O C _ { 2 } }$ classifiers? Recall that the main shortcoming of AC-GNNs for expressing such classifiers is their local behavior. A natural way to break such a behavior is to allow for a global feature computation on each layer of the GNN. This is called a global attribute computation in the framework of Battaglia et al. (2018). Following the recent GNN literature (Gilmer et al., 2017; Morris et al., 2019; Xu et al., 2019), we refer to this global operation as a readout.
141
+
142
+ Formally, an aggregate-combine-readout GNN (ACR-GNN) extends AC-GNNs by specifying readout functions {READ(i)}L , which aggregate the current feature vectors of all the nodes in a graph. Then, the vector $\pmb { x } _ { v } ^ { ( i ) }$ of each node $v$ in $G$ on each layer $i$ , is computed by the following formula, generalizing Equation (1):
143
+
144
+ $$
145
+ \begin{array} { r } { \pmb { x } _ { v } ^ { ( i ) } = \mathrm { C O M } ^ { ( i ) } \left( \pmb { x } _ { v } ^ { ( i - 1 ) } , \mathbf { A G G } ^ { ( i ) } \left( \ P \pmb { x } _ { u } ^ { ( i - 1 ) } \mid u \in \mathcal { N } _ { G } ( v ) \ P \right) , \mathrm { R E A D } ^ { ( i ) } \left( \ P \pmb { x } _ { u } ^ { ( i - 1 ) } \mid u \in G \ P \right) \right) . } \end{array}
146
+ $$
147
+
148
+ Intuitively, every layer in an ACR-GNN first computes (i.e., “reads out”) the aggregation over all the nodes in $G$ ; then, for every node $v$ , it computes the aggregation over the neighbors of $v$ ; and finally it combines the features of $v$ with the two aggregation vectors. All the notions about ACGNNs extend to ACR-GNNs in a straightforward way; for example, a simple ACR-GNN uses the sum as the function $\mathrm { R E A D } ^ { ( i ) }$ in each layer, and the combination function $\mathrm { { C O M } } ^ { ( i ) } ( { \pmb x } _ { 1 } , { \pmb x } _ { 2 } , { \pmb x } _ { 3 } ) =$ $f \big ( \boldsymbol { x } _ { 1 } \boldsymbol { C } ^ { ( i ) } + \boldsymbol { x } _ { 2 } \boldsymbol { A } ^ { ( i ) } + \boldsymbol { x } _ { 3 } \boldsymbol { R } ^ { ( i ) } + \boldsymbol { b } ^ { ( i ) } \big )$ with a matrix $\pmb { R } ^ { ( i ) }$ , generalizing Equation (2).
149
+
150
+ # 5.2 ACR-GNNS AND $\mathrm { F O C _ { 2 } }$
151
+
152
+ To see how a readout function could help in capturing non-local properties, consider again the logical classifier $\gamma ( x )$ in Equation (4), that assigns true to every red node $v$ as long as there is another node not connected with $v$ having two blue neighbors. We have seen that AC-GNNs cannot capture this classifier. However, using a single readout plus local aggregations one can implement this classifier as follows. First, define by $B$ the property “having at least 2 blue neighbors”. Then an ACR-GNN that implements $\gamma ( x )$ can (1) use one aggregation to store in the local feature of every node if the node satisfies $B$ , then (2) use a readout function to count how many nodes satisfying $B$ exist in the whole graph, and (3) use another local aggregation to count how many neighbors of every node satisfiy $B$ . Then $\gamma$ is obtained by classifying as true every red node having less neighbors satisfying $B$ than the total number of nodes satisfying $B$ in the whole graph. It turns out that the usage of readout functions is enough to capture all non-local properties of $\mathrm { F O C _ { 2 } }$ classifiers.
153
+
154
+ Theorem 5.1. Each $F O C _ { 2 }$ classifier can be captured by a simple homogeneous ACR-GNN.
155
+
156
+ The construction is similar to that of Proposition 4.1 and uses simple, homogeneous ACR-GNNs— that is, the readout function is just the sum of all the local node feature vectors. Moreover, the readout functions are only used to deal with subformulas asserting the existence of a node that is not connected to the current node in the graph, just as we have done for classifier $\gamma ( x )$ . As an intermediate step in the proof, we use a characterization of $\mathrm { F O C _ { 2 } }$ using an extended version of graded modal logic, which was obtained by Lutz et al. (2001). We leave as a challenging open problem whether $\mathrm { F O C _ { 2 } }$ classifiers are exactly the logical classifiers captured by ACR-GNNs.
157
+
158
+ # 5.3 COMPARING THE NUMBER OF READOUT LAYERS
159
+
160
+ The proof of Theorem 5.1 constructs GNNs whose number of layers depends on the formula being captured—that is, readout functions are used unboundedly many times in ACR-GNNs for capturing different $\mathrm { F O C _ { 2 } }$ classifiers. Given that a global computation can be costly, one might wonder whether this is really needed, or if it is possible to cope with all the complexity of such classifiers by performing only few readouts. We next show that actually just one readout is enough. However, this reduction in the number of readouts comes at the cost of severely complicating the resulting GNN.
161
+
162
+ Formally, an aggregate-combine GNN with final readout (AC-FR-GNN) results out of using any number of layers as in the AC-GNN definition, together with a final layer that uses a readout function, according to Equation (5).
163
+
164
+ # Theorem 5.2. Each $F O C _ { 2 }$ classifier is captured by an AC-FR-GNN.
165
+
166
+ The AC-FR-GNN in the proof of this theorem is not based on the idea of evaluating the formula incrementally along layers, as in the proofs of Proposition 4.1 and Theorem 5.1, and it is not simple (note that AC-FR-GNNs are never homogeneous). Instead, it is based on a refinement of the GIN architecture proposed by $\mathrm { X u }$ et al. (2019) to obtain as much information as possible about the local neighborhood in graphs, followed by a readout and combine functions that use this information to deal with non-local constructs in formulas. The first component we build is an AC-GNN that computes an invertible function mapping each node to a number representing its neighborhood (how big is this neighborhood depends on the classifier to be captured). This information is aggregated so that we know for each different type of a neighborhood how many times it appears in the graph. We then use the combine function to evaluate $\mathrm { F O C _ { 2 } }$ formulas by decoding back the neighborhoods.
167
+
168
+ # 6 EXPERIMENTAL RESULTS
169
+
170
+ We perform experiments with synthetic data to empirically validate our results. The motivation of this section is to show that the theoretical expressiveness of ACR-GNNs, as well as the differences between AC- and ACR-GNNs, can actually be observed when we learn from examples. We perform two sets of experiments: experiments to show that ACR-GNNs can learn a very simple $\mathrm { F O C _ { 2 } }$ node classifier that AC-GNNs cannot learn, and experiments involving complex $\mathrm { F O C _ { 2 } }$ classifiers that need more intermediate readouts to be learned. We implemented our experiments in the PyTorch Geometric library (Fey & Lenssen, 2019). Besides testing simple AC-GNNs, we also tested the GIN network proposed by Xu et al. (2019) (we consider the implementation by Fey & Lenssen (2019) and adapted it to classify nodes). Our experiments use synthetic graphs, with five initial colors encoded as one-hot features, divided in three sets: train set with $5 \mathrm { k }$ graphs of size up to 50-100 nodes, test set with 500 graphs of size similar to the train set, and another test set with 500 graphs of size bigger than the train set. We tried several configurations for the aggregation, combination and readout functions, and report the accuracy on the best configuration. Accuracy in our experiments is computed as the total number of nodes correctly classified among all nodes in all the graphs in the dataset. In every case we run up to 20 epochs with the Adam optimizer. More details on the experimental setting, data, and code can be found in the Appendix. We finally report results on a real benchmark (PPI) where we did not observe an improvement of ACR-GNNs over AC-GNNs.
171
+
172
+ Separating AC-GNNs and ACR-GNNs We consider a very simple $\mathrm { F O C _ { 2 } }$ formula defined by $\alpha ( \bar { x } ) : = \bar { \operatorname { R e d } } ( x ) \wedge \exists y \ \mathrm { B l u e } ( y )$ , which is satisfied by every red node in a graph provided that the graph contains at least one blue node. We tested with line-shaped graphs and Erdos-Renyi (E-R) ¨ random graphs with different connectivities. In every set (train and test) we consider $50 \%$ of graphs not containing any blue node, and $50 \%$ containing at least one blue node (around $20 \%$ of nodes are in the true class in every set). For both types of graphs, already single-layer ACR-GNNs showed perfect performance (ACR-1 in Table 1). This was what we expected given the simplicity of the property being checked. In contrast, AC-GNNs and GINs (shown in Table 1 as AC- $L$ and GIN$L$ , representing AC-GNNs and GINs with $L$ layers) struggle to fit the data. For the case of the line-shaped graph, they were not able to fit the train data even by allowing 7 layers. For the case of random graphs, the performance with 7 layers was considerably better. In a closer look at the performance for different connectivities of E-R graphs, we found an improvement for AC-GNNs when we train them with more dense graphs (details in the Appendix). This is consistent with the fact that AC-GNNs are able to move information of local aggregations to distances up to their number of layers. This combined with the fact that random graphs that are more dense make the maximum distances between nodes shorter, may explain the boost in performance for AC-GNNs.
173
+
174
+ Table 1: Results on synthetic data for nodes labeled by classifier $\alpha ( x ) : = \operatorname { R e d } ( x ) \wedge \exists y \operatorname { B l u e } ( y )$
175
+
176
+ <table><tr><td></td><td>Line Train</td><td colspan="2">Line Test</td><td>E-R Train</td><td colspan="2">E-R Test</td></tr><tr><td></td><td></td><td>same-size</td><td>bigger</td><td></td><td>same-size</td><td>bigger</td></tr><tr><td>AC-5</td><td>0.887</td><td>0.886</td><td>0.892</td><td>0.951</td><td>0.949</td><td>0.929</td></tr><tr><td>AC-7</td><td>0.892</td><td>0.892</td><td>0.897</td><td>0.967</td><td>0.965</td><td>0.958</td></tr><tr><td>GIN-5</td><td>0.861</td><td>0.861</td><td>0.867</td><td>0.830</td><td>0.831</td><td>0.817</td></tr><tr><td>GIN-7</td><td>0.863</td><td>0.864</td><td>0.870</td><td>0.818</td><td>0.819</td><td>0.813</td></tr><tr><td>ACR-1</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td></tr></table>
177
+
178
+ <table><tr><td></td><td>α1 Train</td><td colspan="2">α1 Test</td><td>α2 Train</td><td colspan="2">Q2 Test</td><td>α3 Train</td><td colspan="2">α3 Test</td></tr><tr><td></td><td></td><td>same-size</td><td>bigger</td><td></td><td>same-size</td><td>bigger</td><td></td><td>same-size</td><td>bigger</td></tr><tr><td>AC</td><td>0.839</td><td>0.826</td><td>0.671</td><td>0.694</td><td>0.695</td><td>0.667</td><td>0.657</td><td>0.636</td><td>0.632</td></tr><tr><td>GIN</td><td>0.567</td><td>0.566</td><td>0.536</td><td>0.689</td><td>0.693</td><td>0.672</td><td>0.656</td><td>0.643</td><td>0.580</td></tr><tr><td>AC-FR-2</td><td>1.000</td><td>1.000</td><td>1.000</td><td>0.863</td><td>0.860</td><td>0.694</td><td>0.788</td><td>0.775</td><td>0.770</td></tr><tr><td>AC-FR-3</td><td>1.000</td><td>1.000</td><td>0.825</td><td>0.840</td><td>0.823</td><td>0.604</td><td>0.787</td><td>0.767</td><td>0.771</td></tr><tr><td>ACR-1</td><td>1.000</td><td>1.000</td><td>1.000</td><td>0.827</td><td>0.834</td><td>0.726</td><td>0.760</td><td>0.762</td><td>0.773</td></tr><tr><td>ACR-2</td><td>1.000</td><td>1.000</td><td>1.000</td><td>0.895</td><td>0.897</td><td>0.770</td><td>0.800</td><td>0.799</td><td>0.771</td></tr><tr><td>ACR-3</td><td>1.000</td><td>1.000</td><td>1.000</td><td>0.903</td><td>0.902</td><td>0.836</td><td>0.817</td><td>0.802</td><td>0.748</td></tr></table>
179
+
180
+ Table 2: Results on E-R synthetic data for nodes labeled by classifiers $\alpha _ { i } ( x )$ in Equation (6)
181
+
182
+ Complex $\mathbf { F O C } _ { 2 }$ properties In the second experiment we consider classifiers $\alpha _ { i } ( x )$ constructed as
183
+
184
+ $$
185
+ \alpha _ { 0 } ( x ) : = \mathtt { B l u e } ( x ) , \qquad \alpha _ { i + 1 } ( x ) : = \exists ^ { [ N , M ] } y \big ( \alpha _ { i } ( y ) \wedge \neg E ( x , y ) \big ) ,
186
+ $$
187
+
188
+ where $\exists ^ { [ N , M ] }$ stands for “there exist between $N$ and $M$ nodes” satisfying a given property. Observe that each $\alpha _ { i } ( x )$ is in $\mathrm { F O C _ { 2 } }$ , as $\exists ^ { [ N , M ] }$ can be expressed by combining $\exists \geq N$ and $\lnot \exists ^ { \geq M + 1 }$ . We created datasets with E-R dense graphs and labeled them according to $\alpha _ { 1 } ( x )$ , $\alpha _ { 2 } ( x )$ , and $\alpha _ { 3 } ( x )$ , ensuring in each case that approximately half of all nodes in our dataset satisfy every property. Our experiments show that when increasing the depth of the formula (existential quantifiers with negations inside other existential quantifiers) more layers are needed to increase train and test accuracy (see Table 2). We report ACR-GNNs performance up to 3 layers (ACR- $L$ in Table 2) as beyond that we did not see any significant improvement. We also note that for the bigger test set, AC-GNNs and GINs are unable to substantially depart from a trivial baseline of $50 \%$ . We tested these networks with up to 10 layers but only report the best results on the bigger test set. We also test AC-FR-GNNs with two and three layers (AC-FR- $L$ in Table 2). As we expected, although theoretically using a single readout gives the same expressive power as using several of them (Theorem 5.2), in practice more than a single readout can actually help the learning process of complex properties.
189
+
190
+ PPI We also tested AC- and ACR-GNNs on the Protein-Protein Interaction (PPI) benchmark (Zitnik & Leskovec, 2017). We chose PPI since it is a node classification benchmark with different graphs in the train set (as opposed to other popular benchmarks for node classification such as Core or Citeseer that have a single graph). Although the best results for both classes of GNNs on PPI were quite high (AC: 97.5 F1, ACR: 95.4 F1 in the test set), we did not observe an improvement when using ACR-GNNs. Chen et al. (2019) recently observed that commonly used benchmarks are inadequate for testing advanced GNN variants, and ACR-GNNs might be suffering from this fact.
191
+
192
+ # 7 FINAL REMARKS
193
+
194
+ Our results show the theoretical advantages of mixing local and global information when classifying nodes in a graph. Recent works have also observed these advantages in practice, e.g., Deng et al.
195
+
196
+ (2018) use global-context aware local descriptors to classify objects in 3D point clouds, You et al. (2019) construct node features by computing shortest-path distances to a set of distant anchor nodes, and Haonan et al. (2019) introduced the idea of a “star node” that stores global information of the graph. As mentioned before, our work is close in spirit to that of $\mathrm { X u }$ et al. (2019) and Morris et al. (2019) establishing the correspondence between the WL test and GNNs. In contrast to our work, they focus on graph classification and do not consider the relationship with logical classifiers.
197
+
198
+ Regarding our results on the links between AC-GNNs and graded modal logic (Theorem 4.2), we point out that very recent work of Sato et al. (2019) establishes close relationships between GNNs and certain classes of distributed local algorithms. These in turn have been shown to have strong correspondences with modal logics (Hella et al., 2015). Hence, variants of our Proposition 4.1 could be obtained by combining these two lines of work (but it is not clear if this combination would yield AC-GNNs that are simple). However, these works do not investigate the impact of having non-local computations (such as the readouts that we consider), hence our results on the relationships between FO an ACR-GNNs (Theorem 5.1 and 5.2) do not follow from these.
199
+
200
+ Morris et al. (2019) also studied $k$ -GNNs, which are inspired by the $k$ -dimensional WL test. In $k$ -GNNs, graphs are considered as structures connecting $k$ -tuples of nodes instead of just pairs of them. We plan to study how our results on logical classifiers relate to $k$ -GNNs, in particular, with respect to the logic $\mathrm { F O C } _ { k }$ that extends $\mathrm { F O C _ { 2 } }$ by allowing formulas with $k$ variables, for each fixed $k > 1$ . Recent work has also explored the extraction of finite state representations from recurrent neural networks as a way of explaining them (Weiss et al., 2018; Koul et al., 2019; Oliva & LagoFernandez ´ , 2019). We would like to study how our results can be applied for extracting logical formulas from GNNs as possible explanations for their computations.
201
+
202
+ # ACKNOWLEDGMENTS
203
+
204
+ This work was partly funded by the Millennium Institute for Foundational Research on Data2.
205
+
206
+ # REFERENCES
207
+
208
+ Franz Baader and Carsten Lutz. Description logic. In Handbook of modal logic, pp. 757–819. North-Holland, 2007.
209
+
210
+ Franz Baader, Diego Calvanese, Deborah L. McGuinness, Daniele Nardi, and Peter F. PatelSchneider (eds.). The description logic handbook: theory, implementation, and applications. Cambridge University Press, 2003.
211
+
212
+ Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vin´ıcius Flores Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, C¸ aglar Gulc¸ehre, H. Francis Song, Andrew J. Ballard, Justin Gilmer, George E. Dahl, Ashish ¨ Vaswani, Kelsey R. Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matthew Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. CoRR, abs/1806.01261, 2018. URL http://arxiv.org/abs/1806.01261.
213
+
214
+ Jin-Yi Cai, Martin Furer, and Neil Immerman. ¨ An optimal lower bound on the number of variables for graph identification. Combinatorica, 12(4):389–410, 1992.
215
+
216
+ Ting Chen, Song Bian, and Yizhou Sun. Are powerful graph neural nets necessary? A dissection on graph classification. CoRR, abs/1905.04579, 2019. URL https://arxiv.org/abs/ 1905.04579.
217
+
218
+ Maarten de Rijke. A Note on graded modal logic. Studia Logica, 64(2):271–283, 2000.
219
+
220
+ Haowen Deng, Tolga Birdal, and Slobodan Ilic. PPFnet: Global context aware local features for robust 3d point matching. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18–22, 2018, pp. 195–205, 2018.
221
+
222
+ Matthias Fey and Jan Eric Lenssen. Fast graph representation learning with PyTorch Geometric. CoRR, abs/1903.02428, 2019. URL https://arxiv.org/abs/1903.02428.
223
+
224
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6–11 August, 2017, pp. 1263–1272, 2017.
225
+
226
+ William L. Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems, NIPS 2017, Long Beach, CA, USA, December 4–9, 2017, pp. 1024–1034, 2017.
227
+
228
+ Lu Haonan, Seth H Huang, Tian Ye, and Guo Xiuyan. Graph star net for generalized multi-task learning. arXiv preprint arXiv:1906.12330, 2019.
229
+
230
+ Lauri Hella, Matti Jarvisalo, Antti Kuusisto, Juhana Laurinharju, Tuomo Lempi ¨ ainen, Kerkko Lu-¨ osto, Jukka Suomela, and Jonni Virtema. Weak models of distributed computing, with connections to modal logic. Distributed Computing, 28(1):31–53, 2015.
231
+
232
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In Proceedings of the 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24–26, 2017, 2017.
233
+
234
+ Anurag Koul, Sam Greydanus, and Alan Fern. Learning finite state representations of recurrent policy networks. In Proceedings of the 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6–9, 2019, 2019.
235
+
236
+ Carsten Lutz, Ulrike Sattler, and Frank Wolter. Modal logic and the two-variable fragment. In Proceedings of the International Workshop on Computer Science Logic, CSL 2001, Paris, France, September 10–13, 2001, pp. 247–261. Springer, 2001.
237
+
238
+ Christian Merkwirth and Thomas Lengauer. Automatic generation of complementary descriptors with molecular graph networks. J. of Chemical Information and Modeling, 45(5):1159–1168, 2005.
239
+
240
+ Christopher Morris, Martin Ritzert, Matthias Fey, William L. Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and Leman go neural: higher-order graph neural networks. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence, AAAI 2019, Honolulu, Hawaii, USA, January 27 – February 1, 2019, pp. 4602–4609, 2019.
241
+
242
+ Boris Motik, Bernardo Cuenca Grau, Ian Horrocks, Zhe Wu, Achille Fokoue, and Carsten Lutz. OWL 2 Web ontology language profiles (second edition). W3C recommendation, W3C, 2012. URL http://www.w3.org/TR/owl2-profiles/.
243
+
244
+ Christian Oliva and Luis F. Lago-Fernandez. ´ On the interpretation of recurrent neural networks as finite state machines. In Part I of the Proceedings of the 28th International Conference on Artificial Neural Networks, ICANN 2019, Munich, Germany, September 17–19, 2019, pp. 312– 323. Springer, 2019.
245
+
246
+ Martin Otto. Graded modal logic and counting bisimulation. https://www2.mathematik. tu-darmstadt.de/˜otto/papers/cml19.pdf, 2019.
247
+
248
+ Ryoma Sato, Makoto Yamada, and Hisashi Kashima. Approximation Ratios of Graph Neural Networks for Combinatorial Problems. arXiv preprint arXiv:1905.10261, 2019.
249
+
250
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Trans. Neural Networks, 20(1):61–80, 2009.
251
+
252
+ Michael Sejr Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In Proceedings of The Semantic Web - 15th International Conference, ESWC 2018, Heraklion, Crete, Greece, June 3–7, 2018, pp. 593–607, 2018.
253
+
254
+ W3C OWL Working Group. OWL 2 Web ontology language document overview (second edition). W3C recommendation, W3C, 2012. URL https://www.w3.org/TR/owl2-overview/.
255
+
256
+ Boris Yu. Weisfeiler and Andrei A. Leman. A Reduction of a graph to a canonical form and an algebra arising during this reduction. Nauchno-Technicheskaya Informatsia, 2(9):12–16, 1968. Translated from Russian.
257
+
258
+ Gail Weiss, Yoav Goldberg, and Eran Yahav. Extracting automata from recurrent neural networks using queries and counterexamples. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10–15, 2018 ¨ , pp. 5244–5253, 2018.
259
+
260
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How Powerful are graph neural networks? In Proceedings of the 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6–9, 2019, 2019.
261
+
262
+ Jiaxuan You, Rex Ying, and Jure Leskovec. Position-aware graph neural networks. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, Long Beach, California, USA, June 9–15, 2019, pp. 7134–7143, 2019.
263
+
264
+ Marinka Zitnik and Jure Leskovec. Predicting multicellular function through multi-layer tissue networks. CoRR, abs/1707.04638, 2017. URL http://arxiv.org/abs/1707.04638.
265
+
266
+ # APPENDIX
267
+
268
+ # A PROOF OF PROPOSITION 3.3
269
+
270
+ We first recall the proposition.
271
+
272
+ Proposition 3.3. There is an $F O C _ { 2 }$ classifier that is not captured by any AC-GNN.
273
+
274
+ Proof. Consider the following $\mathrm { F O C _ { 2 } }$ node property $\alpha ( v ) : = \operatorname { R e d } ( v ) \wedge \exists x \operatorname { G r e e n } ( x )$ . We will show by contradiction that there is no AC-GNN that captures $\alpha$ , no matter which aggregation, combining, and final classification functions are allowed. Indeed, assume that $\mathcal { A }$ is an AC-GNN capturing $\alpha$ , and let $L$ be its number of layers. Consider the graph $G$ that is a chain of $L + 2$ nodes colored Red, and consider the first node $v _ { 0 }$ in that chain. Since $\mathcal { A }$ captures $\alpha$ , and since $( G , v _ { 0 } ) \not \ = \alpha$ , we have that $\mathcal { A }$ labels $v _ { 0 }$ with false, i.e., ${ \mathcal { A } } ( G , v _ { 0 } ) =$ false. Now, consider the graph $G ^ { \prime }$ obtained from $G$ by coloring the last node in the chain with Green (instead of Red). Then one can easily show that $\mathcal { A }$ again labels $v _ { 0 }$ by false in $G ^ { \prime }$ . But we have $\left( G ^ { \prime } , v _ { 0 } \right) \models \alpha$ , a contradiction.
275
+
276
+ The above proof relies on the following weakness of AC-GNNs: if the number of layers is fixed (i.e., does not depend on the input graph), then the information of the color of a node $v$ cannot travel further than at distance $L$ from $v$ . Nevertheless, we can show that the same holds even when we consider AC-GNNs that dispose of an arbitrary number of layers (for instance, one may want to run a homogeneous AC-GNN for $f ( | E | )$ layers for each graph $G = ( V , E )$ , for a fixed function $f$ ). Assume again by way of contradiction that $\mathcal { A }$ is such an extended AC-GNN capturing $\alpha$ . Consider the graph $G$ consisting of two disconnected nodes $v , u$ , with $v$ colored Red and $y$ colored Green. Then, since $( G , v ) \models \alpha$ , we have ${ \mathcal { A } } ( G , v ) =$ true. Now consider the graph $G ^ { \prime }$ obtained from $G$ by changing the color of $u$ from Green to Red. Observe that, since the two nodes are not connected, we will again have $\boldsymbol { \mathcal { A } } ( \boldsymbol { G } ^ { \prime } , \boldsymbol { v } ) =$ true, contradicting the fact that $\left( G ^ { \prime } , v \right) \not \ = \alpha$ and that $\mathcal { A }$ is supposed to capture $\alpha$ .
277
+
278
+ By contrast, it is easy to see that this formula can be done with only one intermediate readout, using the technique in the proof of Theorem 5.1. □
279
+
280
+ # B PROOF OF PROPOSITION 4.1
281
+
282
+ We first recall the proposition.
283
+
284
+ Proposition 4.1. Each graded modal logic classifier is captured by a simple homogeneous AC-GNN.
285
+
286
+ We first define formally the semantics of the graded modal logic (de Rijke, 2000) over simple undirected node-colored graphs (de Rijke, 2000), assuming the FO syntax introduced in the paper.
287
+
288
+ Definition B.1. We define when a node v in a graph $G$ satisfies a graded modal logic formula $\varphi ( x )$ written as $v | = \varphi$ in $G$ (where “in $G$ ” may be omitted when clear), recursively as follows:
289
+
290
+ • $i f \varphi ( x ) = \mathbf { C o l } ( x )$ , then $v \models \varphi$ if and only if Col is the color of v in $G$ ,
291
+ • $i f \varphi ( x ) = \varphi ^ { \prime } ( x ) \wedge \varphi ^ { \prime \prime } ( x )$ , then $v \models \varphi$ if and only if $v \models \varphi ^ { \prime }$ and $v | = \varphi ^ { \prime \prime }$ , and similarly with $\neg \varphi ^ { \prime } ( x )$ , and
292
+ • $i f \varphi ( x ) = \exists ^ { \geq N } ( E ( x , y ) \land \varphi ^ { \prime } ( y ) )$ , then $v | = \varphi$ if and only if the set of nodes $\{ u \mid u \in \mathcal { N } _ { G } ( v )$ and $\boldsymbol { v } \left| = \boldsymbol { \varphi } ^ { \prime } \right\}$ has cardinality at least $N$ .
293
+
294
+ We can now proceed to the proof of the proposition.
295
+
296
+ Proof of Proposition 4.1. Let $\varphi ( x )$ be a graded modal logic formula. We will construct an ACGNN $\mathcal { A } _ { \varphi }$ that is further simple and homogeneous. Let $\operatorname { s u b } ( \varphi ) = ( \varphi _ { 1 } , \varphi _ { 2 } , \dots , \varphi _ { L } )$ be an enumeration of the sub-formulas of $\varphi$ such that if $\varphi _ { k }$ is a subformula of $\varphi _ { \ell }$ then $k \leq \ell$ . The idea of the construction of $\mathcal { A } _ { \varphi }$ is to have feature vectors in $\mathbb { R } ^ { L }$ such that every component of those vectors represents a different formula in sub(ϕ). Then Aϕ will update the feature vector x(i)v of node v ensuring that component \` of x(\`)v g ets a value 1 if and only if the formula $\varphi _ { \ell }$ is satisfied in node $v$ .
297
+
298
+ We note that $\varphi = \varphi _ { L }$ and thus, the last component of each feature vector after evaluating $L$ layers in every node gets a value 1 if and only if the node satisfies $\varphi$ . We will then be able to use a final classification function CLS that simply extracts that particular component.
299
+
300
+ Formally, the simple homogeneous AC-GNN $\mathcal { A } _ { \varphi }$ has $L$ layers and uses the aggregation and combine functions
301
+
302
+ $$
303
+ \begin{array} { r c l } { \operatorname { A G G } ( X ) } & { = } & { \displaystyle \sum _ { \bf x \in X } { \bf x } , } \\ { \operatorname { C O M } ( { \bf x } , { \bf y } ) } & { = } & { \displaystyle \sigma \big ( { \bf x } C + { \bf y } A + b \big ) , } \end{array}
304
+ $$
305
+
306
+ where $A , C \in \mathbb { R } ^ { L \times L }$ , and $\pmb { b } \in \mathbb { R } ^ { L }$ are defined next, and $\sigma$ is the truncated ReLU activation defined by $\sigma ( x ) = \mathrm { m i n } ( \mathrm { m a x } ( 0 , x ) , 1 )$ . The entries of the $\ell$ -th columns of $A , C$ , and $^ { b }$ depend on the sub-formulas of $\varphi$ as follows:
307
+
308
+ Case $O$ . if $\varphi _ { \ell } ( x ) = \mathbf { C } \mathbf { o } \mathbf { l } ( x )$ with Col one of the (base) colors, then $C _ { \ell \ell } = 1$ ,
309
+
310
+ Case $^ { l }$ . if $\varphi _ { \ell } ( x ) = \varphi _ { j } ( x ) \wedge \varphi _ { k } ( x )$ then $C _ { j \ell } = C _ { k \ell } = 1$ and $b _ { \ell } = - 1$ ,
311
+
312
+ Case 2. if $\varphi _ { \ell } ( x ) = \lnot \varphi _ { k } ( x )$ then $C _ { k \ell } = - 1$ and $b _ { \ell } = 1$ ,
313
+
314
+ Case 3. if $\varphi _ { \ell } ( x ) = \exists ^ { \geq N } ( E ( x , y ) \land \varphi _ { k } ( y ) )$ then $A _ { k \ell } = 1$ and $b _ { \ell } = - N + 1$ , and all other values in the $\ell$ -th columns of $A , C$ , and $^ { b }$ are 0.
315
+
316
+ We now prove that $\mathcal { A } _ { \varphi }$ indeed captures $\varphi$ . Let $G = ( V , E )$ be a colored graph. For every node $v$ in $G$ we consider the initial feature vector $\pmb { x } _ { v } ^ { ( 0 ) } = ( x _ { 1 } , \dots , x _ { L } )$ such that $x _ { \ell } = 1$ if sub-formula $\varphi _ { \ell }$ is the initial color assigned to $v$ , and $x _ { \ell } = 0$ otherwise. By definition, AC-GNN $\mathcal { A } _ { \varphi }$ will iterate the aggregation and combine functions defined above for $L$ rounds ( $L$ layers) to produce feature vectors $\pmb { x } _ { v } ^ { ( i ) }$ for every node $v \in G$ and $\ell = 1 , \ldots , L$ as follows:
317
+
318
+ $$
319
+ \begin{array} { r c l } { { \pmb x } _ { v } ^ { ( i ) } } & { = } & { \displaystyle \mathrm { C O M } ( { \pmb x } _ { v } ^ { ( i - 1 ) } , \mathrm { A G G } ( \{ { \pmb x } _ { u } ^ { ( i - 1 ) } \mid u \in \mathcal { N } ( v ) \} \} ) ) } \\ & { = } & { \displaystyle \sigma \bigg ( { \pmb x } _ { v } ^ { ( i - 1 ) } { \pmb C } + \sum _ { u \in \mathcal { N } ( v ) } { \pmb x } _ { u } ^ { ( i - 1 ) } { \pmb A } + b \bigg ) . } \end{array}
320
+ $$
321
+
322
+ We next prove that for every $\varphi _ { \ell } \in \mathrm { s u b } ( \varphi )$ , every $i \in \{ \ell , \ldots , L \}$ , and every node $v$ in $G$ it holds that
323
+
324
+ where $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell }$ is the $\ell$ -th component of $\pmb { x } _ { v } ^ { ( i ) }$ —that is, the $\ell$ -th component of $\pmb { x } _ { v } ^ { ( i ) }$ has a 1 if and only if $v$ satisfies $\varphi _ { \ell }$ in $G$ . In the rest of the proof we will be continuously using the value of $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell }$ whose general expression is
325
+
326
+ $$
327
+ ( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = \sigma \bigg ( \sum _ { k = 1 } ^ { L } ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } C _ { k \ell } + \sum _ { u \in \mathcal { N } ( v ) } \sum _ { k = 1 } ^ { L } ( \pmb { x } _ { u } ^ { ( i - 1 ) } ) _ { k } A _ { k \ell } + b _ { \ell } \bigg ) .
328
+ $$
329
+
330
+ We proceed to prove (8) by induction on the number of sub-formulas of every $\varphi _ { \ell }$ . If $\varphi _ { \ell }$ has one sub-formula, then $\varphi _ { \ell } ( x ) = \operatorname { C o l } ( x )$ with Col a base color. We next prove that $( \pmb { x } _ { v } ^ { ( 1 ) } ) _ { \ell } = 1$ if and only if $v$ has Col as its initial color. Since $\varphi _ { \ell } ( x ) = \mathbf { C } \mathbf { o } \mathbf { l } ( x )$ we know that $C _ { \ell \ell } = 1$ and $C _ { k \ell } = 0$ for every $k \neq \ell$ (see Case 0 above). Moreover, we know that $b _ { \ell } = 0$ and $A _ { k \ell } = 0$ for every $k$ . Then, from Equation (9) we obtain that
331
+
332
+ $$
333
+ ( { \bf x } _ { v } ^ { ( 1 ) } ) _ { \ell } \ = \ \sigma \biggl ( \sum _ { k = 1 } ^ { L } ( { \bf x } _ { v } ^ { ( 0 ) } ) _ { k } C _ { k \ell } + \sum _ { \{ v , u \} \in E } \sum _ { k = 1 } ^ { L } ( { \bf x } _ { u } ^ { ( 0 ) } ) _ { k } A _ { k \ell } + b _ { \ell } \biggr ) \ = \ \sigma \bigl ( ( { \bf x } _ { v } ^ { ( 0 ) } ) _ { \ell } \bigr ) .
334
+ $$
335
+
336
+ Then, given that $( \pmb { x } _ { v } ^ { ( 0 ) } ) _ { \ell } = 1$ if the initial color of $v$ is $\mathrm { C o l }$ and $( { \pmb x } _ { v } ^ { ( 0 ) } ) _ { \ell } = 0$ otherwise, we have that $( \pmb { x } _ { v } ^ { ( 1 ) } ) _ { \ell } = 1$ if $( G , v ) \models \varphi _ { \ell }$ and $( \pmb { x } _ { v } ^ { ( 1 ) } ) _ { \ell } = 0$ otherwise. From this it is easy to prove that for every $i \geq 1$ the vector $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell }$ satisfies the same property. Now assume that $\varphi _ { \ell }$ has more than one
337
+
338
+ sub-formula, and assume that for every $\varphi _ { k }$ with $k < \ell$ the property (8) holds. Let $i \geq \ell$ . We are left to consider the following cases, corresponding to the cases for the shape of the formula above.
339
+
340
+ Case 1. Assume that $\varphi _ { \ell } ( x ) = \varphi _ { j } ( x ) \wedge \varphi _ { k } ( x )$ . Then $C _ { j \ell } = C _ { k \ell } = 1$ and $b _ { \ell } = - 1$ . Moreover, we have $C _ { m \ell } = 0$ for every $m \neq j , k$ and $A _ { n \ell } = 0$ for every $n$ (see Case 2 above). Then, from Equation (9) we obtain that
341
+
342
+ $$
343
+ ( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } \ = \ \sigma \bigg ( ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { j } + ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } - 1 \bigg ) .
344
+ $$
345
+
346
+ Since the number of each proper sub-formula of $\varphi _ { \ell }$ is strictly less than both $\ell$ and $i$ , by in
347
+ duction hypotherwise.Now, since $( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { j } \ = \ 1$ $\ v \ \models \ \varphi _ { \mathcal { j } }$ $( { \pmb x } _ { v } ^ { ( i - 1 ) } ) _ { j } ~ = ~ 0$ $( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } \ = \ 1$ $\ v { v } \ \ v { \ash } \varphi _ { k }$ $( { \pmb x } _ { v } ^ { ( i - 1 ) } ) _ { k } ~ = ~ 0$ $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = \sigma ( ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { j } + ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } - 1 )$ $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } \ = \ 1$
348
+ $( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { j } + ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } - 1 \geq 1$ can only happen if —that is, if and on $( { \pmb x } _ { v } ^ { ( i - 1 ) } ) _ { j } = ( { \pmb x } _ { v } ^ { ( i - 1 ) } ) _ { k } = 1$ $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 1$ $v \models \varphi _ { j }$ $v \models \varphi _ { k }$ $v \left| = \varphi _ { \ell } \right.$ $\varphi _ { \ell } ( x ) = \varphi _ { j } ( x ) \wedge \varphi _ { k } ( x ) )$
349
+ and $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 0$ otherwise. This is exactly what we wanted to prove.
350
+
351
+ Case 2. Assume that $\varphi _ { \ell } ( x ) = \lnot \varphi _ { k } ( x )$ . Then $C _ { k \ell } = - 1$ and $b _ { \ell } = 1$ . Moreover, we have $C _ { m \ell } = 0$ for every $m \neq k$ and $A _ { n \ell } = 0$ for every $n$ (see Case 2 above). Then, from Equation (9) we obtain that
352
+
353
+ $$
354
+ ( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } \ = \ \sigma \bigg ( - ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } + 1 \bigg ) .
355
+ $$
356
+
357
+ By induction hypothesis we know that $( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } = 1$ if and only if $v \left| = \varphi _ { k } \right.$ and $( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } = 0$ otherwise. Since $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = \sigma ( - ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } + 1 )$ we have that $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 1$ if and only if $1 - ( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } \geq 1$ that can only happen if $( \pmb { x } _ { v } ^ { ( i - 1 ) } ) _ { k } = 0$ . Then $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 1$ if and only if $\boldsymbol { v } \not \in \varphi _ { k }$ —that is, if and only if $v \left| = \lnot \varphi _ { k } \right.$ , which holds if and only if $v \left| = \varphi _ { \ell } \right.$ , and $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 0$ otherwise. This is exactly what we wanted to prove.
358
+
359
+ Case 3. Assume that $\varphi _ { \ell } ( x ) = \exists ^ { \geq N } ( E ( x , y ) \land \varphi _ { k } ( y ) )$ . Then $A _ { k \ell } = 1$ and $b _ { \ell } = - N + 1$ . Moreover for every $m$ we have that $C _ { m \ell } = 0$ (see Case 3 above). Then, from Equation (9) we obtain that
360
+
361
+ $$
362
+ ( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } \ = \ \sigma \bigg ( - N + 1 + \sum _ { \{ u , v \} \in E } ( \pmb { x } _ { u } ^ { ( i - 1 ) } ) _ { k } \bigg ) .
363
+ $$
364
+
365
+ By induction hypothesis we know that $( \pmb { x } _ { u } ^ { ( i - 1 ) } ) _ { k } = 1$ if and only if $v \ \models \varphi _ { k }$ and $( \pmb { x } _ { u } ^ { ( i - 1 ) } ) _ { k } = 0$ otherwise. Then we can write $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = \sigma ( - N + 1 + m )$ where
366
+
367
+ $$
368
+ m = | \{ u \mid u \in \mathcal { N } ( v ) \mathrm { ~ a n d ~ } u \mid = \varphi _ { k } \} | .
369
+ $$
370
+
371
+ Thus, we have that $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 1$ if and only if $m \geq N$ , that is if and only if there exists at least $N$ nodes connected with $v$ that satisfy $\varphi _ { k }$ , and $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 0$ otherwise. From that we obtain that $( \pmb { x } _ { v } ^ { ( i ) } ) _ { \ell } = 1$ if and only if $v \left| = \varphi _ { \ell } \right.$ since $\varphi _ { \ell } ( x ) = \exists ^ { \geq N } ( E ( x , y ) \land \varphi _ { k } ( y ) )$ , which is what we wanted to prove.
372
+
373
+ To complete the proof we only need to add a final classification after the $L$ iterations of the aggregate and combine layers that simply classifies a node $v$ as true if the component of $\pmb { x } _ { v } ^ { ( L ) }$ corresponding to $\varphi$ holds 1. □
374
+
375
+ # C PROOF OF THEOREM 4.2
376
+
377
+ We first recall the theorem.
378
+
379
+ Theorem 4.2. A logical classifier is captured by AC-GNNs if and only if it can be expressed in graded modal logic.
380
+
381
+ Note that one direction follows immediately from Proposition 4.1, so we only need to show the following proposition.
382
+
383
+ Proposition C.1. If a logical classifier $\alpha$ is not equivalent to any graded modal logic formula, then there is no AC-GNN that captures $\alpha$ .
384
+
385
+ To prove this proposition, we will need the following definition, which is standard in modal logics theory.
386
+
387
+ Definition C.2. Let $G$ be a graph (simple, undirected and node-colored), v be a node in $G$ , and $L \in$ N. The unravelling of $v$ in $G$ at depth $L$ , denoted by $\mathrm { U n r } _ { G } ^ { L } ( v )$ , is the (simple undirected nodecolored) graph that is the tree having
388
+
389
+ – a node $( v , u _ { 1 } , \ldots , u _ { i } )$ for each path $( v , u _ { 1 } , \ldots , u _ { i } )$ in $G$ with $i \leq L$ ,
390
+ – an edge between $( v , u _ { 1 } , \ldots , u _ { i - 1 } )$ and $( v , u _ { 1 } , \ldots , u _ { i } )$ when $\{ u _ { i - 1 } , u _ { i } \}$ is an edge in $G$ (assuming that $u _ { 0 }$ is $v$ ), and
391
+ – each node $( v , u _ { 1 } , \ldots , u _ { i } )$ colored the same as $u _ { i }$ in $G$ .
392
+
393
+ We then observe the following.
394
+
395
+ Observation C.3. Let $G$ and $G ^ { \prime }$ be two graphs, and $v$ and $v ^ { \prime }$ be two nodes in $G$ and $G ^ { \prime }$ , respectively. Then for every $L \in \mathbb { N } ,$ , the WL test assigns the same color to v and $v ^ { \prime }$ at round $L$ if and only if there is an isomorphism between $\mathrm { U n r } _ { G } ^ { L } ( v )$ and $\operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ sending v to $v ^ { \prime }$ .
396
+
397
+ We will write $\operatorname { U n r } _ { G } ^ { L } ( v ) \simeq \operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ to denote the existence of the isomorphism as in this observation. To prove Proposition C.1, we first rephrase Proposition 2.1 in terms of unravellings.
398
+
399
+ Proposition C.4. Let $G$ and $G ^ { \prime }$ be two graphs with nodes $v$ in $G$ and $v ^ { \prime }$ in $G ^ { \prime }$ such that $\operatorname { U n r } _ { G } ^ { L } ( v ) \simeq \operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ for every $L \in \mathbb { N }$ . Then for any AC-GNN $\mathcal { A }$ , we have $\mathcal { A } ( G , u ) = \mathcal { A } ( G ^ { \prime } , u ^ { \prime } )$ .
400
+
401
+ Proof. Follows directly from Proposition 2.1 and Observation C.3.
402
+
403
+ The crucial part of the proof of Proposition C.1 is the following non-trivial result, intuitively establishing that the fragment of unary FO formulas that only depend on the unravelling of a node is exactly the graded modal logic.
404
+
405
+ Theorem C.5 (Otto, 2019). Let $\alpha$ be a unary $F O$ formula. If $\alpha$ is not equivalent to a graded modal logic formula then there exist two graphs $G$ , $G ^ { \prime }$ and two nodes $v$ in $G$ and $u ^ { \prime }$ in $G ^ { \prime }$ such that $\operatorname { U n r } _ { G } ^ { L } ( v ) \simeq \operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ for every $L \in \mathbb { N }$ and such that $u \models \alpha$ in $G$ but $u ^ { \prime } \not \in \alpha$ in $G ^ { \prime }$ .
406
+
407
+ Proof. This directly follows from the van Benthem & Rosen characterization obtained in (Otto, 2019, Theorem 2.2) for finite structures (graphs), by noticing that for the notion of graded bisimulation $\sim \#$ introduced in this note, we have that $G , u \sim _ { \# } G ^ { \prime } , u ^ { \prime }$ if and only if we have that $\mathrm { U n r } _ { G } ^ { L } ( v ) \simeq$ $\operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ for every $L \in \mathbb { N }$ . We point out here that the fact that the edge relation in $G$ is undirected in our setting (as opposed to $E$ being directed in (Otto, 2019)), and the fact that every node can only have one color in our setting (as opposed to being able to satisfy multiple “unary predicates” in (Otto, 2019)) are inessential, and that the proof of (Otto, 2019, Theorem 2.2) carries over to this setting. □
408
+
409
+ We can now gather all of these to prove Proposition C.1.
410
+
411
+ Proof of Proposition C.1. Let $\alpha$ be a logical classifier (i.e., a unary FO formula) that is not equivalent to any graded modal logic formula. Assume for a contradiction that there exists an AC-GNN $A _ { \alpha }$ that captures $\alpha$ . Since $\alpha$ is not equivalent to any graded modal logic formula, by Theorem C.5 there exist two graphs $G$ , $G ^ { \prime }$ and two nodes $v$ in $G$ and $u ^ { \prime }$ in $G ^ { \prime }$ such that $\operatorname { U n r } _ { G } ^ { L } ( v ) \stackrel { \cdot } { \simeq } \operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ for every $L \in \mathbb { N }$ and such that $( \star ) u \models \alpha$ in $G$ but $u ^ { \prime } \not \in \alpha$ in $G ^ { \prime }$ . Since we have that $\operatorname { U n r } _ { G } ^ { L } ( v ) \simeq \operatorname { U n r } _ { G ^ { \prime } } ^ { L } ( v ^ { \prime } )$ for every $L \in \mathbb { N }$ , by Proposition C.4 we should have that $\mathcal { A } _ { \alpha } ( G , u ) = \mathcal { A } _ { \alpha } ( G ^ { \prime } , u ^ { \prime } )$ . But this contradicts $( { \star } )$ and the fact that $A _ { \alpha }$ is supposed to capture $\alpha$ . □
412
+
413
+ # D PROOF OF THEOREM 5.1
414
+
415
+ We first recall the theorem.
416
+
417
+ Theorem 5.1. Each $F O C _ { 2 }$ classifier can be captured by a simple homogeneous ACR-GNN.
418
+
419
+ To prove the theorem, we will use a characterization of the unary $\mathrm { F O C _ { 2 } }$ formulas provided by (Lutz et al., 2001) that uses a specific modal logic. That logic is defined via what are called modal parameters. We adapt the definitions of (Lutz et al., 2001) to deal with simple undirected node-colored graphs.
420
+
421
+ Definition D.1. $A$ modal parameter is an expression built from the following grammar:
422
+
423
+ $$
424
+ S : = { \mathrm { i d } } \mid e \mid S \cup S \mid S \cap S \mid \neg S .
425
+ $$
426
+
427
+ Given an undirected colored graph $G = ( V , E )$ and a node $v$ of $G$ , the interpretation of $S$ on $v$ is the set $\varepsilon _ { S } ( v ) \subseteq V$ defined inductively as follows:
428
+
429
+ $$
430
+ { \begin{array} { r l } & { - \ i f S = { \mathrm { i d } } \ t h e n \varepsilon _ { S } ( v ) : = \{ v \} ; } \\ & { - \ i f S = e t h e n \varepsilon _ { S } ( v ) : = \{ u \mid \{ u , v \} \in E \} ; } \\ & { - \ i f S = S _ { 1 } \cup S _ { 2 } \ t h e n \varepsilon _ { S } ( v ) : = \varepsilon _ { S _ { 1 } } ( v ) \cup \varepsilon _ { S _ { 2 } } ( v ) ; } \\ & { - \ i f S = S _ { 1 } \cap S _ { 2 } \ t h e n \varepsilon _ { S } ( v ) : = \varepsilon _ { S _ { 1 } } ( v ) \cap \varepsilon _ { S _ { 2 } } ( v ) ; } \\ & { - \ i f S = \lnot S ^ { \prime } \ t h e n \varepsilon _ { S } ( v ) : = V \setminus \varepsilon _ { S } ( v ) . } \end{array} }
431
+ $$
432
+
433
+ The modal logic EMLC consists of all the unary formulas that are built with the following grammar:
434
+
435
+ $$
436
+ \varphi : : = C \mid \varphi \land \varphi \mid \lnot \varphi \mid \langle S \rangle ^ { \geq N } \varphi ,
437
+ $$
438
+
439
+ where $C$ ranges over node colors, $S$ over modal parameters, and $N$ over $\mathbb { N }$ . The semantics of the first four constructs is defined as expected, and for an undirected colored graph $G = ( V , E )$ and node $v \in V$ , we have $( \dot { G } , v ) \ : \models \langle S \rangle \dot { \geq } \ v N _ { \varphi }$ if and only if there exist at least $N$ nodes u in $\varepsilon _ { S } ( v )$ such that $( G , u ) \vdash \varphi$ .
440
+
441
+ Example D.2. On an undirected graph $G = ( V , E )$ , the EMLC formula $\langle \neg e \rangle ^ { \geq 2 } ( \langle e \rangle ^ { \geq 3 } \mathrm { G r e e } .$ n) holds on a node $v \in V$ if v has at least two nonadjacent nodes $u$ (and since our graphs have no self-loops, v could be $u$ ) such that u has at least three green neighbors.
442
+
443
+ The following theorem is essentially a reformulation of (Lutz et al., 2001, Theorem 1) to our context (Lutz et al. (2001) show this for $\mathrm { F O _ { 2 } }$ without counting quantifiers and for $\varepsilon \mathcal { M } \mathcal { L } \mathcal { C }$ without counting, but an inspection of the proofs reveals that the result extends to counting quantifiers).
444
+
445
+ Theorem D.3 (Lutz et al., 2001, Theorem 1). For every EMLC formula, there exists an equivalent $F O C _ { 2 }$ unary formula. Conversely, for every unary $F O C _ { 2 }$ formula, there exists an equivalent EMLC formula.
446
+
447
+ In order to simplify the proof, we will use the following lemma.
448
+
449
+ Lemma D.4. Let $\varphi$ be an EMLC formula. Then there exists an EMLC formula $\varphi ^ { \prime }$ equivalent to $\varphi$ such that each modal parameter appearing in $\varphi ^ { \prime }$ is one of the following:
450
+
451
+ a) id, thus representing the current node;
452
+
453
+ b) e, thus representing the neighbours of the current node;
454
+
455
+ c) ¬e ∩ ¬id, thus representing the nodes distinct from the current node and that are not neighbours of the current node;
456
+
457
+ d) id ∪ e, thus representing the current node and its neighbors;
458
+
459
+ e) ¬id, thus representing all the nodes distinct from the current node:
460
+
461
+ $f )$ ¬e, thus representing the nodes that are not neighbours of the current node (note that this includes the current node);
462
+
463
+ g) $e \cup \lnot e .$ , thus representing all the nodes;
464
+
465
+ h) $e \cap \lnot e$ , thus representing the emptyset.
466
+
467
+ Proof. Let $v$ be a node in a graph $G$ , and consider the following three disjoint sets of nodes:
468
+
469
+ 1. the singleton set consisting of $v$ itself,
470
+ 2. the set of neighbors of $v$ ,
471
+ 3. the set of nodes that are not neighbors of $v$ and that are not $v$ .
472
+
473
+ These sets can be expressed by modal parameters: the first is obtained by taking $S = \mathrm { i d }$ ; the second is obtained by taking $S = e$ ; and the third is obtained by taking $S = \lnot e \cap$ ¬id. It is straightforward to verify by induction on $S$ that, for any modal parameter $S$ , if $\varepsilon _ { S } ( v )$ contains an element of one of the three sets, then it must contain all the elements of that set. But then, this implies that a modal parameter can only represent a (possibly empty) disjoint union of these three sets. Conversely, it is clear that any disjoint union over these three sets can be represented by a modal parameter. It is then routine to check that the 8 cases (a)–(h) are obtained as all the $2 ^ { 3 }$ possible unions of these three sets (including the empty union, i.e., the emptyset). For instance, case (f) is the union of sets 1 and 3.
474
+
475
+ Proof of Theorem 5.1. The proof is similar to that of Proposition 4.1. Let $\varphi$ be an $\varepsilon \mathcal { M } \mathcal { L } \mathcal { C }$ formula equivalent to the targeted $\mathrm { F O C _ { 2 } }$ unary formula that is of the form given by Lemma D.4, and let $\operatorname { s u b } ( \varphi ) = \left( \varphi _ { 1 } , \varphi _ { 2 } , \dots , \varphi _ { L } \right)$ be an enumeration of the sub-formulas of $\varphi$ such that if $\varphi _ { k }$ is a subformula of $\varphi _ { \ell }$ then $k \leq \ell$ . We will build a simple homogeneous ACR-GNN $\mathcal { A } _ { \varphi }$ computing feature vectors $\pmb { x } _ { v } ^ { ( i ) }$ in $\mathbb { R } ^ { L }$ such that every component of those vectors represents a different formula in $\operatorname { s u b } ( \varphi )$ . In addition, we will also make use of global feature vectors $\pmb { x } _ { G } ^ { ( i ) }$ in $\mathbb { R } ^ { L }$ . The GNN $\mathcal { A } _ { \varphi }$ will update the feature vector $\pmb { x } _ { v } ^ { ( i ) }$ of each node $v$ in a graph ensuring that component $\ell$ of $\pmb { x } _ { v } ^ { ( i ) }$ gets a value 1 if and only if the formula $\varphi _ { \ell }$ is satisfied in node $v$ (and 0 otherwise). Similarly, $\pmb { x } _ { G } ^ { ( i ) }$ will be updated to make sure that every component represents the number of nodes in $G$ that satisfy the corresponding subformula. The readout and aggregate functions simply sum the input feature vectors. When $\varphi _ { \ell }$ is of the form described by Cases 0–3 in the proof of Proposition 4.1, we define the $\ell \cdot$ -th columns of the matrices $A , C$ and bias $^ { b }$ as in that proof, and the $\ell$ -th column of $\pmb { R }$ (the matrix that multiplies the global readout feature vector) as the zero vector. We now explain how we define their $\ell$ -th columns when $\varphi _ { \ell }$ is of the form $\langle S \rangle ^ { \geq N } \varphi _ { k }$ , according to the 8 cases given by Lemma D.4:
476
+
477
+ Case a. if $\varphi _ { \ell } = \langle \mathrm { i d } \rangle ^ { \geq N } \varphi _ { k }$ , then $C _ { k \ell } = 1$ if $N = 1$ and 0 otherwise;
478
+
479
+ Case $b .$ . if $\varphi _ { \ell } = \langle e \rangle ^ { \geq N } \varphi _ { k }$ , then $\pmb { A } _ { k \ell } = 1$ and $b _ { \ell } = - N + 1$ ;
480
+
481
+ Case $c$ . if $\varphi _ { \ell } = \langle \neg e \cap \neg \mathrm { i d } \rangle ^ { \geq N } \varphi _ { k }$ , then $R _ { k \ell } = 1$ and $C _ { k \ell } = A _ { k \ell } = - 1$ and $b _ { \ell } = - N + 1$ ;
482
+
483
+ Case d. if $\varphi _ { \ell } = \langle \mathrm { i d } \cup e \rangle ^ { \geq N } \varphi _ { k }$ , then $C _ { k \ell } = 1$ and $\pmb { A } _ { k \ell } = 1$ and $b _ { \ell } = - N + 1$ ;
484
+
485
+ Case e. if $\varphi _ { \ell } = \langle \mathrm { \bar { \varphi } } _ { \mathrm { \ell } } \rangle ^ { \geq N } \varphi _ { k }$ , then $R _ { k \ell } = 1$ and $C _ { k \ell } = - 1$ and $b _ { \ell } = - N + 1$
486
+
487
+ Case f. if $\varphi _ { \ell } = \langle \neg e \rangle ^ { \geq N } \varphi _ { k }$ , then $\pmb { R } _ { k \ell } = 1$ and $\boldsymbol { A } _ { k \ell } = - 1$ and $b _ { \ell } = - N + 1$ ;
488
+
489
+ Case $g .$ . if $\varphi _ { \ell } = \langle e \cup \lnot e \rangle ^ { \geq N } \varphi _ { k }$ , then $\pmb { R } _ { k \ell } = 1$ and $b _ { \ell } = - N + 1$ ;
490
+
491
+ Case h. if $\varphi _ { \ell } = \langle e \cap \neg e \rangle ^ { \geq N } \varphi _ { k }$ , then all relevant values are 0;
492
+
493
+ and all other values in the $\ell$ -th columns of $A , C , R$ , and $^ { b }$ are 0. The proof then goes along the same lines as the proof of Proposition 4.1.
494
+
495
+ # E PROOF OF THEOREM 5.2
496
+
497
+ We first recall the theorem.
498
+
499
+ Theorem 5.2. Each $F O C _ { 2 }$ classifier is captured by an AC-FR-GNN.
500
+
501
+ In the following proof we will use the mmake use of a particular AC-GNN with $L$ hinery introduced in Alayers, which we call $\dot { \lambda } _ { \mathrm { p r i m e s } } ^ { L }$ es C and D. We will al, that maps every node $v$ in a graph to a natural number representing the complete unravelling of of depth in (note that we do not claim that this AC-GNN can be realized in practice, this construction is mostly for theoretical purposes). Let primes : $\mathbb { N } \to \mathbb { N }$ be the function such that $\mathrm { p r i m e s } ( i )$ is the $i$ -th prime number indexed from 0. For instance, we have that primes $( 0 ) \ : = \ : 2$ , $\mathrm { \ p r i m e s } ( 1 ) = 3$ , etc. Now consider the function $\mathrm { f } ( \cdot , \cdot )$ that has as input a pair $( c , X )$ where $c \in \mathbb { N }$ and $X$ is a multiset of numbers in $\mathbb { N }$ , and produces a number in $\mathbb { N }$ as output, defined as follows
502
+
503
+ $$
504
+ \operatorname { f } ( c , \{ \mathrm { \& } { } _ { 1 } , \mathrm { \& } { } , \mathrm { \ldots } , \mathrm { \& } { } _ { k } \} ) = 2 ^ { c } \times \prod _ { i = 1 } ^ { k } { \mathrm { p r i m e s } } ( x _ { i } + 1 ) .
505
+ $$
506
+
507
+ It is not difficult to prove that, as defined above, $\mathrm { f } ( \cdot , \cdot )$ is an injective function. Thus using the results by $\mathrm { X u }$ et al. (2019) (see the proof of their Theorem 3) we know that f can be used to implement the combine and aggregate operators of an AC-GNN such that for every graph $G$ , after $L$ layers, the color (natural number) assiassigned to that node in the ed to every node in -th iteration of the $G$ has a oneL test over one correspondence wi. We call this AC-GNN olor. $L$ $G$ $\mathcal { A } _ { \mathrm { p r i m e s } } ^ { L }$
508
+
509
+ Observation E.1. We note that $X u$ et al. (2019) also constructed an injective function that has $( c , X )$ as inputs where $c \in \mathbb { N }$ and $X$ is a multiset of elements in $\mathbb { N }$ (see their Lemma 5 and Corollary 6). Nevertheless we cannot directly use that construction as it assumes the existence of a fixed $N$ such that the size of all multisets are bounded by $N$ . This would put also a bound of $N$ on the maximum number of neighbors in the input graphs. Thus we developed a new function (using an encoding based on prime numbers) to be able to deal with general graphs of unbounded degree.
510
+
511
+ Proof of Theorem 5.2. Let $\alpha$ be an $\mathrm { F O C _ { 2 } }$ unary formula, and let $\varphi$ be an equivalent $\varepsilon \mathcal { M } \mathcal { L } \mathcal { C }$ formula that uses only modal parameters of the form given by Lemma D.4. We construct an ACR-FR-GNN $\mathcal { A } _ { \varphi }$ capturing $\varphi$ and hence $\alpha$ .
512
+
513
+ Let $L$ be the quantifier depth of $\varphi$ (i.e., the deepest nesting of $\langle S \rangle ^ { \geq N }$ quantifiers). For a subformula $\varphi ^ { \prime }$ of $\varphi$ , we also define the nesting depth $\mathrm { n d } _ { \varphi } ( \varphi ^ { \prime } )$ of $\varphi ^ { \prime }$ in $\varphi$ to be the number of modal parameters under which $\varphi ^ { \prime }$ is in $\varphi$ . The first $L - 1$ layers of $\mathcal { A } _ { \varphi }$ are the same as those of $\mathcal { A } _ { \mathrm { p r i m e s } } ^ { L - 1 }$ , which do not use readouts. With Observation C.3 at hand and using the fact that the inverses of the aggregation and combination functions of $\mathcal { A } _ { \mathrm { p r i m e s } } ^ { L - 1 }$ are computable, this ensures that, after $L - 1$ layers, for any graph $G$ and node $v$ in $G$ , we can compute from $\mathcal { A } _ { \mathrm { p r i m e s } } ^ { L - 1 } ( G , v )$ the unravelling $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ . Thus, we can assume without loss of generality (by modifying the last combination function for instance), that after $L - 1$ layers $\mathcal { A } _ { \varphi }$ computes $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ in every node $v$ of $G$ . We then use a readout whose output is a natural number representing the multiset $\smash { \{ \mathrm { U n r } _ { G } ^ { L - 1 } ( v ) \mid v \} }$ node in $G \ Y$ ; for instance, we can encode this multiset using the same technique that we use for $\mathcal { A } _ { \mathrm { p r i m e s } }$ . Again, since this technique uses functions with computable inverses, we can assume without loss of generality that the output of this readout is actually the multiset $\smash { \{ \mathrm { U n r } _ { G } ^ { L - 1 } ( v ) \mid v \} }$ node in $G \ Y$ . Finally, we use a final combination function $\mathrm { C O M } ^ { ( L ) }$ , that uses only the feature of the current node and the output of the readout—that is, the final feature of a node $v$ is $\operatorname { C O M } ^ { ( L ) } ( \operatorname { U n r } _ { G } ^ { L - 1 } ( v ) , \{ \operatorname { U n r } _ { G } ^ { L - 1 } ( u ) \ | \ u \operatorname { n o d e } \operatorname { i n } G \} ) .$ .
514
+
515
+ We now explain how we define $\mathrm { C O M } ^ { ( L ) }$ . By induction on the structure of $\varphi$ , for every subformula $\varphi ^ { \prime }$ of $\varphi$ , we do the following: for every node $v$ in $G$ and every node $u$ in $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ that is at depth (i.e., the distance from $v$ ) at most $\mathrm { n d } _ { \varphi } ( \varphi ^ { \prime } )$ in the tree $\operatorname { U n r } _ { G } ^ { L - 1 } ( v )$ , we will label $u$ by either $\varphi ^ { \prime }$ or by $\neg \varphi ^ { \prime }$ . We do so to ensure that $( { \star } )$ for every node $v$ in $G$ and every node $u = ( v , u _ { 1 } , \ldots , u _ { i } )$ in $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ , we label $u$ by $\varphi ^ { \prime }$ if and only if $( G , u _ { i } ) \vdash \varphi ^ { \prime }$ . We explain our labeling process by induction on the structure of $\varphi$ , and one can easily check in each case that $( { \star } )$ will hold by induction. Let $v$ be a node in $G$ and $u$ be a node in $\operatorname { U n r } _ { G } ^ { L - 1 } ( v )$ that is at depth at most $\mathrm { n d } _ { \varphi } ( \varphi ^ { \prime } )$ in the unravelling.
516
+
517
+ Case $^ { l }$ . If $\varphi ^ { \prime }$ is a color Col, we label $u$ by $\varphi ^ { \prime }$ if $u$ is of that color, and by $\neg \varphi ^ { \prime }$ otherwise.
518
+
519
+ Case 2. If $\varphi ^ { \prime }$ is $\varphi _ { 1 } \wedge \varphi _ { 2 }$ , then observe that we have $\mathrm { n d } _ { \varphi } ( \varphi ^ { \prime } ) = \mathrm { n d } _ { \varphi } ( \varphi _ { 1 } ) = \mathrm { n d } _ { \varphi } ( \varphi _ { 2 } )$ , so that $u$ is at depth at most both $\mathrm { n d } _ { \varphi } ( \varphi _ { 1 } )$ and $\mathrm { n d } _ { \varphi } ( \varphi _ { 2 } )$ in the unravelling $\mathrm { U n r } ^ { L - 1 } ( v )$ . Thus, we know that we have already labeled $u$ by either $\varphi _ { 1 }$ or $\neg \varphi _ { 1 }$ , and also by either $\varphi _ { 2 }$ or $\neg \varphi _ { 2 }$ . We then label $u$ by $\varphi ^ { \prime }$ if $u$ is already labeled by $\varphi _ { 1 }$ and $\varphi _ { 2 }$ , and we label it by $\neg \varphi ^ { \prime }$ otherwise.
520
+
521
+ Case 3. The case when $\varphi ^ { \prime }$ is a negation is similar.
522
+
523
+ Case 4. If $\varphi ^ { \prime }$ is $\langle S \rangle ^ { \geq N } \varphi ^ { \prime \prime }$ , then we only explain the case when the modal parameter $S$ is $\neg e \wedge$ ¬id, as the other cases work similarly. First, observe that for every node $v ^ { \prime }$ in $G$ , we have labeled the root of $\mathrm { U n r } _ { G } ^ { L - 1 } ( v ^ { \prime } )$ by either $\varphi ^ { \prime \prime }$ or by $\neg \varphi ^ { \prime \prime }$ : this is because the root of $\operatorname { U n r } _ { G } ^ { L - 1 } ( v ^ { \prime } )$ is always at depth $0 ~ \le ~ \mathrm { n d } _ { \varphi } ( \varphi ^ { \prime \prime } )$ in $\operatorname { U n r } _ { G } ^ { L - 1 } ( v ^ { \prime } )$ . Let $m$ be the number of nodes $u ^ { \prime } \in G$ such that we have labeled the root of $\operatorname { U n r } _ { G } ^ { L - 1 } ( v ^ { \prime } )$ by $\varphi ^ { \prime \prime }$ . Next, note that for every children $u ^ { \prime }$ of $u$ in $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ , we have that $u ^ { \prime }$ is at depth at most $\mathrm { n d } _ { \varphi } ( \varphi ^ { \prime \prime } )$ in $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ , so that we have already labeled $u ^ { \prime }$ by either $\varphi ^ { \prime \prime }$ or $\neg \varphi ^ { \prime \prime }$ . Let $n$ be the number of children of $u$ (in $\operatorname { U n r } _ { G } ^ { L - 1 } ( v ) )$ that we have labeled by $\varphi ^ { \prime \prime }$ . Then we label $u$ by $\varphi ^ { \prime }$ if $m - n \geq N$ , and by $\neg \varphi ^ { \prime }$ otherwise.
524
+
525
+ We then simply define $\mathrm { C O M } ^ { ( L ) } ( \mathrm { U n r } _ { G } ^ { L - 1 } ( v ) , \{ \mathrm { U n r } _ { G } ^ { L - 1 } ( u ) | u \mathrm { n o d e } \mathrm { i n } G \} )$ to be 1 if the root of $\mathrm { U n r } _ { G } ^ { L - 1 } ( v )$ is labeled with $\varphi$ , and 0 otherwise, which concludes the proof. □
526
+
527
+ # F DETAILS ON THE EXPERIMENTAL SETTING AND RESULTS
528
+
529
+ All our code and data can be accessed online at https://github.com/juanpablos/ GNN-logic
530
+
531
+ In all our experiments we tested different aggregate, combine and readout functions. For aggregate and readout we only consider the sum, average, and max functions. For the combine function we consider the following variants:
532
+
533
+ $$
534
+ \begin{array} { r l } & { \bullet \mathrm { ~ C O M 1 } _ { 1 } ( { \pmb x } , { \pmb y } , { \pmb z } ) = f ( { \pmb x } { \pmb A } + { \pmb y } { \pmb B } + { \ z } { \pmb C } + { \pmb b } ) , } \\ & { \bullet \mathrm { ~ C O M 2 } _ { 2 } ( { \pmb x } , { \pmb y } , { \pmb z } ) = f ( \mathrm { M L P } _ { 1 } ( { \pmb x } ) + \mathrm { M L P } _ { 2 } ( { \pmb y } ) + \mathrm { M L P } _ { 3 } ( { \pmb z } ) + { \pmb b } ) , } \\ & { \bullet \mathrm { ~ C O M } _ { 3 } ( { \pmb x } , { \pmb y } , { \pmb z } ) = \mathrm { M L P } ( { \pmb x } + { \pmb y } + { \pmb z } + { \pmb b } ) , } \\ & { \bullet \mathrm { ~ C O M } _ { 4 } ( { \pmb x } , { \pmb y } , { \pmb z } ) = \mathrm { M L P } ( { \pmb x } { \pmb A } + { \pmb y } { \pmb B } + { \pmb z } { \pmb C } + { \pmb b } ) . } \end{array}
535
+ $$
536
+
537
+ The above definitions are for ACR-GNNs. For AC-GNNs we consider similar variants but without the $_ z$ input. We also used batch normalization in between every GNN and MLP layer. We did not use any regularization. When processing synthetic data we use a hidden size of 64 and trained with a batch-size of 128, and the Adam optimizer with PyTorch default parameters for 50 epochs. We did not do any hyperparameter search besides changing the aggregation, combination, and readout functions. For the activation functions we always used relu. We observed a consistent pattern in which sum aggregator and readout produced better results compared with the others. This is in line with our constructions in Proposition 4.1 and Theorem 5.1. The choice of the combination function did not produce a significant difference in the performance.
538
+
539
+ # DATA FOR THE EXPERIMENT WITH CLASSIFIER $\alpha ( x ) : = \operatorname { R E D } ( x ) \wedge \exists y \operatorname { B L U E } ( y )$
540
+
541
+ For training and testing we constructed three sets of graphs: (a) Train set containing $5 \mathrm { k }$ graphs with nodes between 50 and 100, (b) Test set, same size, containing 500 graphs with the same number of nodes as in the train set (between 50 and 100 nodes), and (c) Test set, bigger size, containing 500 graphs with nodes between 100 and 200. All graphs contain up to 5 different colors. To force the models to try to learn the formula, in every set (train and test) we consider $50 \%$ of graphs not containing any blue node, and $50 \%$ containing at least one blue node. The number of blue nodes in every graph is fixed to a small number (typically less than 5 nodes). Moreover, to ensure that there is a significant number of nodes satisfying the formula, we force graphs to contain at least 1/4 of its nodes colored with red. The colors of all the other nodes are distributed randomly. With all these restrictions, every dataset that we created had at least a $18 \%$ of nodes satisfying the property. We consider two classes of graphs: line graphs and Erdos-Renyi graphs ¨ .
542
+
543
+ Line graphs these are connected graphs in which every node in the graph has degree 2 except for two nodes (the extreme nodes) that have degree 1. To mimic the impossibility proof in Proposition 3.3 we put the blue nodes in one of the “sides” of the line, and the red nodes in the other “side”. More specifically, consider the line graph with $N$ nodes $v _ { 1 } , \ldots , v _ { N }$ such that $v _ { i }$ is connected with $v _ { i + 1 }$ . Then, we ensure that every blue node appears in one of $v _ { 1 } , \ldots , v _ { \frac { N } { 2 } }$ and every red node appears in one of $v _ { \frac { N } { 2 } + 1 } , \ldots , v _ { N }$ .
544
+
545
+ Table 3: Synthetic data for the experiment with classifier $\alpha ( x ) : = \operatorname { R e d } ( x ) \wedge$ ∃y Blue(y)
546
+
547
+ <table><tr><td></td><td># Graphs</td><td>Avg. # Nodes</td><td>Avg.#Edges</td><td>Avg. #Positive</td></tr><tr><td>Line train</td><td>5,000</td><td>75</td><td>74</td><td>18</td></tr><tr><td>Line test</td><td>500</td><td>75</td><td>74</td><td>18</td></tr><tr><td>Line test bigger</td><td>500</td><td>148</td><td>147</td><td>36</td></tr><tr><td>Erdos-Renyi train</td><td>5,000</td><td>75</td><td>115</td><td>18</td></tr><tr><td>Erdos-Renyi test</td><td>500</td><td>75</td><td>115</td><td>18</td></tr><tr><td>Erdos-Renyi test bigger</td><td>500</td><td>148</td><td>226</td><td>36</td></tr></table>
548
+
549
+ Table 4: Detailed results for Erdos-Renyi synthetic graphs with different connectivities ¨
550
+
551
+ <table><tr><td rowspan="5"></td><td colspan="3">Erdos-Renyi + 20%</td><td colspan="3">Erdos-Renyi + 50%</td><td colspan="3">Erdos-Renyi + 100%</td></tr><tr><td rowspan="2">Train Acc.</td><td colspan="2">Test Acc.</td><td rowspan="2">Train Acc.</td><td colspan="2">Test Acc.</td><td rowspan="2">Train Acc.</td><td colspan="2">Test Acc.</td></tr><tr><td>same-size</td><td>bigger</td><td>same-size</td><td>bigger</td><td>same-size</td><td>bigger</td></tr><tr><td>AC-2</td><td>0.810</td><td>0.807</td><td>0.778</td><td>0.829</td><td>0.835</td><td>0.791</td><td>0.861</td><td>0.864</td><td>0.817</td></tr><tr><td>AC-5</td><td>0.940</td><td>0.937</td><td>0.901</td><td>0.975</td><td>0.971</td><td>0.958</td><td>0.994</td><td>0.994</td><td>0.993</td></tr><tr><td>AC-7</td><td>0.963</td><td>0.961</td><td>0.946</td><td>0.983</td><td>0.978</td><td>0.981</td><td>0.995</td><td>0.995</td><td>0.995</td></tr><tr><td>GIN-2</td><td>0.797</td><td>0.795</td><td>0.771</td><td>0.813</td><td>0.818</td><td>0.784</td><td>0.838</td><td>0.840</td><td>0.803</td></tr><tr><td>GIN-5</td><td>0.838</td><td>0.836</td><td>0.819</td><td>0.846</td><td>0.847</td><td>0.833</td><td>0.841</td><td>0.844</td><td>0.838</td></tr><tr><td>GIN-7</td><td>0.838</td><td>0.840</td><td>0.803</td><td>0.841</td><td>0.844</td><td>0.838</td><td>0.784</td><td>0.788</td><td>0.773</td></tr><tr><td>ACR-1</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td></tr></table>
552
+
553
+ Erdos-Renyi graphs ¨ These are random graphs in which one specifies the number $N$ of nodes and the number $M$ of edges. For this experiment we consider as extreme cases the case in which graphs contain the same number of nodes and edges and graphs in which the number of edges is twice the number of nodes.
554
+
555
+ Some statistics of the datasets are shown in Table 3.
556
+
557
+ EXPERIMENTS FOR DENSE ERDOS¨ -RENYI GRAPHS
558
+
559
+ We also took a closer look at the performance for different connectivities of random graphs (Table 4). We define the set “Erdos-Renyi¨ $+ \ k \% ^ { \prime \prime }$ as a set of graphs in which the number of edges is $k \%$ larger than the number of nodes. For example, “Erdos-Renyi¨ $+ 1 0 0 \% ^ { \prime }$ contains random graphs in which the number of egdes doubles the number of nodes. We see a consistent improvement in the performance of AC-GNNs and GINs when we train and test them with more dense graphs and more layers (Table 4).
560
+
561
+ # DATA FOR THE EXPERIMENT WITH CLASSIFIER $\alpha _ { i } ( x )$ IN EQUATION (6)
562
+
563
+ For this case we only consider dense Erdos-Renyi synthetic graphs. For the train set we consider ¨ graphs with nodes varying from 40 to 50 nodes and edges from 280 to 350 and similarly for the first test set. For the bigger test set, we consider graphs with nodes from 51 to 60 with edges ranging from 360 and 480. For labeling we consider the following formulas (starting from $\alpha _ { 0 } ( x ) : = \mathrm { B l u e } ( x ) )$ :
564
+
565
+ $$
566
+ \begin{array} { r l r } { \alpha _ { 1 } ( x ) } & { : = } & { \exists ^ { [ 8 , 1 0 ] } y \big ( \alpha _ { 0 } ( y ) \wedge \neg E ( x , y ) \big ) , } \\ { \alpha _ { 2 } ( x ) } & { : = } & { \exists ^ { [ 1 0 , 2 0 ] } y \big ( \alpha _ { 1 } ( y ) \wedge \neg E ( x , y ) \big ) , } \\ { \alpha _ { 3 } ( x ) } & { : = } & { \exists ^ { [ 1 0 , 3 0 ] } y \big ( \alpha _ { 2 } ( y ) \wedge \neg E ( x , y ) \big ) . } \end{array}
567
+ $$
568
+
569
+ The choices of the intervals for every classifier were for the pourpose of having approximately half of the nodes in the random graphs marked as true. Statistics of the datasets are shown in Table 5.
570
+
571
+ Table 5: Synthetic data for the experiment with classifier $\alpha _ { i } ( x )$ in Equation (6)
572
+
573
+ <table><tr><td></td><td># Graphs</td><td>Avg. # Nodes</td><td>Avg. #Edges</td><td>Pos. α1</td><td>Pos. α2</td><td>Pos. α3</td></tr><tr><td>Train</td><td>5,000</td><td>45</td><td>315</td><td>47%</td><td>63%</td><td>57%</td></tr><tr><td>Test</td><td>500</td><td>45</td><td>315</td><td>47%</td><td>64%</td><td>56%</td></tr><tr><td>Test bigger</td><td>500</td><td>56</td><td>420</td><td>49%</td><td>40%</td><td>23%</td></tr></table>
574
+
575
+ Table 6: Performance of AC-GNN and ACR-GNN in the PPI benchmark
576
+
577
+ <table><tr><td></td><td>F1 Test</td></tr><tr><td>AC-2</td><td>97.2 ± 0.3</td></tr><tr><td>AC-3</td><td>97.5 ± 0.3</td></tr><tr><td>AC-4</td><td>97.5 ± 0.2</td></tr><tr><td>ACR-2</td><td>93.5 ± 0.3</td></tr><tr><td>ACR-3</td><td>94.2 ±1.2</td></tr><tr><td>ACR-4</td><td>95.4 ± 0.9</td></tr></table>
578
+
579
+ # PPI EXPERIMENTS
580
+
581
+ We consider the standard train/validation/test split for this benchmarck (Fey & Lenssen, 2019). We use a hidden size of 256 and the Adam optimizer for 500 epochs with early stopping when the validation set did not improve for 20 epochs. We did not do any hyperparameter search besides changing the aggregation, combination, and readout functions. As opposed to the synthetic case, in this case we observed a better performance when the average or the max functions are used for aggregation. Table 6 shows the best results for different layers (average of 10 runs). As we can see, ACR-GNNs do not imply an improvement over AC-GNNs for this benchmark.
md/train/rJlEojAqFm/rJlEojAqFm.md ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RELATIONAL FORWARD MODELS FOR MULTI-AGENT LEARNING
2
+
3
+ Andrea Tacchetti\*, H. Francis Song\*, Pedro A. M. Mediano\*, Vinicius Zambaldi,
4
+ János Kramár, Neil C. Rabinowitz, Thore Graepel, Matthew Botvinick & Peter W. Battaglia
5
+ \* denotes equal contrubtion
6
+ Google DeepMind
7
+ {atacchet,songf,pmediano,vzambaldi
8
+ janosk,ncr,thore,botvinick,peterbattaglia}@google.com
9
+
10
+ # ABSTRACT
11
+
12
+ The behavioral dynamics of multi-agent systems have a rich and orderly structure, which can be leveraged to understand these systems, and to improve how artificial agents learn to operate in them. Here we introduce Relational Forward Models (RFM) for multi-agent learning, networks that can learn to make accurate predictions of agents’ future behavior in multi-agent environments. Because these models operate on the discrete entities and relations present in the environment, they produce interpretable intermediate representations which offer insights into what drives agents’ behavior, and what events mediate the intensity and valence of social interactions. Furthermore, we show that embedding RFM modules inside agents results in faster learning systems compared to non-augmented baselines. As more and more of the autonomous systems we develop and interact with become multi-agent in nature, developing richer analysis tools for characterizing how and why agents make decisions is increasingly necessary. Moreover, developing artificial agents that quickly and safely learn to coordinate with one another, and with humans in shared environments, is crucial.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ The study of multi-agent systems has received considerable attention in recent years and some of the most advanced autonomous systems in the world today are multi-agent in nature (e.g. assembly lines and warehouse management systems). In particular, research in multi-agent reinforcement learning (MARL), where multiple learning agents perceive and act in a shared environment, has produced impressive results (Jaderberg et al., 2018; Pachocki et al., 2018; Leibo et al., 2017; Hughes et al., 2018; Peysakhovich & Lerer, 2017a; Lerer & Peysakhovich, 2017; Bansal et al., 2017; Lanctot et al., 2017).
17
+
18
+ One of the outstanding challenges in this domain is how to foster coordinated behavior among learning agents. In hand-engineered multi-agent systems (e.g. assembly lines), it is possible to obtain coordination by design, where expert engineers carefully orchestrate each agent’s behavior and role in the system. This, however, rules out situations where either humans or artificial learning agents are present in the environment. In learning-based systems, there have been some successes by introducing a centralized controller (D’Andrea, 2012; Foerster et al., 2016; 2017; Hong et al., 2017; Lowe et al., 2017). However, these cannot scale to large number of agents or to mixed human-robot ensembles. There is thus an increasing focus on multi-agent systems that learn how to coordinate on their own (Jaderberg et al., 2018; Pachocki et al., 2018; Perolat et al., 2017).
19
+
20
+ Alongside the challenges of learning coordinated behaviors, there are also the challenges of measuring them. In learning-based systems, the analysis tools currently available to researchers focus on the functioning of each single agent, and are ill-equipped to characterize systems of diverse agents as a whole. Moreover, there has been little development of tools for measuring the contextual interdependence of agents’ behaviors in complex environment, which will be valuable for identifying the conditions under which agents are successfully coordinating.
21
+
22
+ Here we address these two challenges by developing Relational Forward Models (RFM) for multiagent systems. We build on recent advances in neural networks that effectively perform relational reasoning with graph networks (GN) (Battaglia et al., 2018) to construct models that learn to predict the forward dynamics of multi-agent systems. First, we show that our models can surpass previous top methods on this task (Kipf et al., 2018; Hoshen, 2017). Perhaps more importantly, they produce intermediate representations that support the social analysis of multi-agent systems: we use our models to propose a new way to characterize what drives each agent’s behavior, track when agents influence each other, and identify which factors in the environment mediate the presence and valence of social interactions. Finally, we embed our models inside agents and use them to augment the host agent’s observations with predictions of others’ behavior. Our results show that this leads to agents that learn to coordinate with one another faster than non-augmented baselines.
23
+
24
+ # 1.1 RELATED WORK
25
+
26
+ Relational reasoning has received considerable attention in recent years and researchers have developed deep learning models that operate on graphs, rather than vectors or images, and structure their computations accordingly. These methods have been successfully applied to learning the forward dynamics of systems comprised of multiple entities and a rich relational structure, like physics simulation, multi-object scenes, visual question answering and motion-capture data (Scarselli et al., 2009; Battaglia et al., 2016; Raposo et al., 2017; Santoro et al., 2017; Gilmer et al., 2017; Watters et al., 2017; Kipf et al., 2018; Zambaldi et al., 2018). Recently, this class of methods have been shown to successfully predict the forward dynamics of multi-agent systems, like basketball or soccer games, and to some extent, to provide insights into the relational and social structures present in the data (Hoshen, 2017; Kipf et al., 2018; Zhan et al., 2018; Zheng et al., 2017).
27
+
28
+ With the recent renaissance of deep-learning methods in general, and of deep reinforcement learning (RL) in particular, considerable attention has been devoted to developing analysis tools that allow researchers to understand what drives agents’ behavior, what are the most common failure modes and provide insights into the inner workings of learning systems (Zeiler & Fergus, 2013; Yosinski et al., 2015; Olah et al., 2017; Morcos et al., 2018). In particular, Rabinowitz et al. (2018) embed entire behavioral trajectories of single RL agents as points in an unstructured, high-dimensional space, relying on the inherent structure of the data to yield interpretable representations of whole behavioral motifs.
29
+
30
+ Finally, coordination in multi-agent system has been a topic of major interest as of late and some of the most advanced MARL systems rely on the emergence of coordination among teammates to complete the task at hand (Jaderberg et al., 2018; Pachocki et al., 2018). Despite these recent successes, coordination is still considered a hard problem and several attempts have been made to promote the emergence of coordination by relaxing some assumptions (Foerster et al., 2016; 2017; Sukhbaatar et al., 2016; Raileanu et al., 2018; He et al., 2016a). Here we show that, by embedding RFM modules in RL agents, they can learn to coordinate with one another faster than baseline agents, analogous to imagination-augmented agents in single-agent RL settings (Hamrick et al., 2017; Pascanu et al., 2017; Weber et al., 2017).
31
+
32
+ # 2 RELATIONAL ANALYSIS OF MARL SYSTEMS
33
+
34
+ # 2.1 METHODS
35
+
36
+ Our RFM is based on graph networks (GN) (Battaglia et al., 2018), and is trained by supervised learning to predict the dynamics of multi-agent systems. Our model takes as input a semantic description of the state of the environment, and outputs either an action prediction for each agent, or a prediction of the cumulative reward each agent will receive until the end of the episode. We show that our model performs well at these tasks, and crucially, produces interpretable intermediate representations that are useful both as analysis tools, and as inputs to artificial agents who can exploit these predictions to improve their decision-making.
37
+
38
+ ![](images/a1361e59b1d9307a42f513fe008b2b608f8f2ccb922fe1672153e2e14fd23f9f.jpg)
39
+ Figure 1: (a) The RFM module stacks a GN Encoder, a Graph GRU and a GN Decoder to obtain a relational reasoning module that holds state information across time steps. (b) Example of an environment graph representation. Edges connect agents (magenta and orange) to all entities and are color-coded according to the identity of the receiver. (c) RFM-augmented agents, the output of the the RFM module is appended to the original observation input to the policy network. The on-board RFM module is trained with full supervision and alongside the policy network.
40
+
41
+ # 2.1.1 RELATIONAL FORWARD MODELS AND BASELINES ARCHITECTURES
42
+
43
+ A GN is a neural network that operates on graphs. The input to a GN is a directed graph, $( u , V , E )$ , where $u \in \mathbb { R } ^ { d _ { u } }$ is a graph-level attribute vector (e.g. the score in a football game), $V = \{ v _ { i } \} _ { i = 1 : n _ { v } }$ is a set of vertices (e.g. the players) with attributes $\bar { v _ { i } } \in \mathbb { R } ^ { d _ { v } }$ (e.g the players’ $( x , y )$ coordinates on the pitch), and $E = \{ ( \bar { e } _ { k } , r _ { k } , s _ { k } ) \} _ { k = 1 : n _ { e } }$ is a set of directed edges which connect sender vertex, $v _ { s _ { k } }$ to receiver vertex ${ \boldsymbol { v } } _ { { \boldsymbol { r } } _ { k } }$ and have attribute $e _ { k } \in \mathbb { R } ^ { d _ { e } }$ (e.g. same team or opponent). The output of a GN is also a graph, with the same connectivity structure as the input graph (i.e., same number of vertices and edges, as well as same sender and receiver for each edge), but updated global, vertex, and edge attributes. See Fig. 1b for an example graph.
44
+
45
+ The sequence of computations in a GN proceed by updating the edge attributes, followed by the vertex attributes, and finally the global attributes. These computations are implemented via three “update” functions (the $\phi \mathbf { s } _ { \cdot }$ ) and three “aggregation” functions (the $\rho \mathbf { s } _ { , }$ ),
46
+
47
+ $$
48
+ \begin{array} { l l } { { e _ { k } ^ { \prime } = \phi ^ { e } \left( e _ { k } , v _ { r _ { k } } , v _ { s _ { k } } , u \right) , } } & { { \qquad { \bar { e } } _ { i } ^ { \prime } = \rho ^ { e \to v } \left( E _ { i } ^ { \prime } \right) , } } \\ { { v _ { i } ^ { \prime } = \phi ^ { v } \left( { \bar { e } } _ { i } ^ { \prime } , v _ { i } , u \right) , } } & { { \qquad { \bar { v } } ^ { \prime } = \rho ^ { v \to u } \left( V ^ { \prime } \right) , } } \\ { { u ^ { \prime } = \phi ^ { u } \left( { \bar { e } } ^ { \prime } , { \bar { v } } ^ { \prime } , u \right) , } } & { { \qquad { \bar { e } } ^ { \prime } = \rho ^ { e \to u } \left( E ^ { \prime } \right) } } \end{array}
49
+ $$
50
+
51
+ where $E _ { i } ^ { \prime } = \{ ( e _ { k } ^ { \prime } , r _ { k } , s _ { k } ) \} _ { r _ { k } = i }$ . The edges are updated by $\phi ^ { e }$ , as a function of the sender vertex, receiver vertex, edge, and global attributes. We term the updated edge attribute the “message”, $\boldsymbol { e } _ { k } ^ { \prime }$ . Next, each vertex, $i$ , is updated by aggregating the $\boldsymbol { e } _ { k } ^ { \prime }$ messages for which $i = r _ { k }$ , and computing the updated vertex attribute, $\boldsymbol { v } _ { i } ^ { \prime }$ , as a function $( \phi ^ { v } )$ of these aggregated messages, as well as the current vertex and global attributes. Finally, the global attributes are updated, by $\phi ^ { u }$ , as a function of the current global attribute and all aggregated $\boldsymbol { e } _ { k } ^ { \prime }$ and $\boldsymbol { v } _ { i } ^ { \prime }$ attributes.
52
+
53
+ Since a GN takes as input a graph and outputs a graph, GN blocks can be composed to form more complex, and powerful, architectures. These architecture can also be made recurrent in time by introducing a state graph, and using recurrent neural networks (RNNs) as the $\phi$ functions. GN-based architectures can be optimized with respect to some objective function by gradient descent (using backpropagation through time for recurrent implementations). Here we focus on supervised learning using datasets of input-output pairs. See (Battaglia et al., 2018) for further details.
54
+
55
+ We construct our RFM architecture by arranging three GN blocks as in Fig. 1a. We selected this specific architecture to allow our model to perform relational reasoning steps both on the raw input data, before time recurrence is included, and then again on the output of our time recurrent block. This allows the recurrent block to construct memories of the relations between entities and not simply of their current state.
56
+
57
+ Architecture details are as follows: input graphs $G _ { \mathrm { i n } } ^ { t }$ go through a GN encoder block, a basic GN module whose $\phi ^ { v }$ , $\phi ^ { e }$ and $\phi ^ { u }$ are three separate 64-unit MLPs, with 1 hidden layer, and ReLU activations and whose functions are summations. The output of the GN encoder block is used, in conjunction with a state graph Unit (GRU) (Cho et al., 2014) $G _ { \mathrm { h i d } } ^ { t - 1 }$ , in a “GraphGRU”, where each a hidden state size of 32 for eac $\phi$ function is a Gated Recurrentof vertices, edges and globals. The GraphGRU’s output is then copied into a state graph and an output graph. The state graph is used in the following time step, while the output graph is passed through a GN decoder block. This last block’s structure has an identical to the GN encoder’s, and outputs the model’s predictions (e.g. the actions of each agent).
58
+
59
+ We compared the prediction performance of our RFM module to two state-of-the-art relational reasoning baselines: Neural Relational Inference networks (Kipf et al., 2018) and Vertex Attention Interaction Networks (Hoshen, 2017). These architectures are similar to our RFM module. In particular, NRI models operate on graph structured data and, with the exception that the graph connectivity map is not given, but rather estimated from trajectories using an auto-encoder architecture, they are identical to our model. VAIN networks are essentially single feed-forward GN blocks where the $\phi ^ { e }$ and $\rho ^ { e \to v }$ functions take particular and restricted form: $\phi ^ { e } ( e _ { k } , v _ { r _ { k } } , v _ { s _ { k } } , u ) = e ^ { \| a ( v _ { r _ { k } } ) - a ( v _ { s _ { k } } ) \| ^ { 2 } }$ and $\rho ^ { e v } ( \not E _ { i } ^ { \prime } ) = v _ { i } \sum _ { s _ { k } } e _ { k } ^ { \prime }$ , with $a ( \cdot )$ a learnable function.
60
+
61
+ We also compared our full RFM against ablated variants, which allowed us to measure the importance of the relational reasoning component, and of time recurrence. In particular we considered a Feedforward model, which had no GraphGRU block, and a No-relation model, which was a full fledged RFM module but operated on graphs with only self-connections (i.e., edges where $s _ { i } = r _ { i } ,$ ). Finally, we included a vector-based $\mathbf { M L P + L S T M }$ model among our baselines, so as to highlight the advantage of using graphs over vector based modules. This last model operated on the concatenation of the vertex attributes and had a standard Encoder MLP (64-units), LSTM (32-hidden units), Decoder MLP (2 hidden layers, 32-units each) architecture. We matched all models for capacity (with the exception of NRI which has about $3 \mathbf { x }$ more parameters than other models because of its autoencoder connectivity map estimator). Models were within $3 \%$ of each other in terms of number of parameters (as reported by the TensorFlow checkpoint loader).
62
+
63
+ # 2.1.2 MARL ENVIRONMENTS AND AGENT ARCHITECTURE
64
+
65
+ We considered three multi-agent environments for our study: Cooperative Navigation (Lowe et al., 2017), Coin Game (Raileanu et al., 2018) and Stag Hunt (Peysakhovich & Lerer, 2017b).
66
+
67
+ Cooperative Navigation (Lowe et al., 2017). Two agents navigate an empty $6 \times 6$ arena to cover two tiles. A reward of $+ 1$ is given to both agents whenever both tiles are covered, i.e., when each agent is on a tile of its own. Episodes are of fixed length (20 environment steps), to encourage a swift resolution of the underlying assignment problem. The positions of both tiles and the starting positions of each agent are randomized at the start of each episode.
68
+
69
+ Coin Game (Raileanu et al., 2018). Two agents roam an $8 \times 8$ arena populated with 12 coins, 4 of each of 3 colors, for 10 environment steps. Agents can collect coins by stepping on them; out of the 3 coin colors, two colors carried a reward and one a punishment. Crucially, each of the two agents only has access to information about 1 good color. The short episode duration incentivizes agents to quickly infer what the unknown good color is by observing their teammate actions, so that all good coins can be collected. At the end of each episode both agents are rewarded according to how many good coins have been collected by either agent. Conversely, they are penalized according to the number of bad coins collected, again by either agent. The role of each color, coin positions, and starting coordinates for the agents are randomized in each episode.
70
+
71
+ Stag Hunt (Peysakhovich & Lerer, 2017b). We implemented a Markov version of the classic Stag Hunt game where two (or four) agents navigate an arena populated with 3 red Stags (each of which is static, and occupies a $2 \times 2$ tile) and 12 green apples, for 32 environment steps. Agents can collect apples by themselves for a reward of $+ 1$ or, by both stepping on the same stag, capture it for a reward of $+ 1 0$ . Collected apples and captured stags became unavailable for some time (denoted by dimmed colors), and at each time step have a small probability of becoming available again. All entities’ locations are randomized at the start of each episode.
72
+
73
+ We trained populations of RL agents to convergence on these three tasks using a multi-agent implementation of importance-weighted actor-learner (Jaderberg et al., 2018; Espeholt et al., 2018), a batched advantage actor-critic (A2C) algorithm. For each episode, a group of agents were randomly sampled, with replacement, from a population of 4 learners; at each time step agents received an ego-centric, top-down view of the environment which was large enough to contain the entire arena, and, in the Coin Game, one of the 2 good colors. Agents then selected one of 5 actions to be performed (move left, move right, move up, move down, and stay). Within each agent, the input image was parsed by a single convolutional layer $3 \times 3$ -filters, 6 output channels) whose output was fed to a 256-unit single-layer MLP. The MLP output vector was concatenated with each player’s last reward, and one-hot encoded last action, as well as, for the Coin Game, one of the two coin colors that carried a positive reward. The resulting vector served as input to a 256-hidden-units LSTM whose output was fed into a single soft-max layer. Throughout the learning process, there was no sharing of weights, gradients or any communication channel between the agents, consistent with standard MARL settings.
74
+
75
+ ![](images/22ee00c20cc9be260628d783715e7ea87bf98a8f093ada01077139d180c8231c.jpg)
76
+ Figure 2: Action prediction performance of our RFM module and baseline models. The reported quantity is the mean number of environment steps for which the predicted actions matched the ground truth exactly, for all agents. Mean across 128 episodes, bars indicate standard deviation across episodes. Alternative measures of model performance show similar results (Fig. 10).
77
+
78
+ # .1.3 OFFLINE TRAJECTORIES COLLECTION AND MODEL TRAINING
79
+
80
+ To train the forward RFM model, we collected 500,000 episodes of behavioral trajectories of trained agents acting in their respective environments. At each time step, we collected a semantic description of the state of the environment, as well as the action taken by each agent and the reward they received. These descriptions were compiled into a graph, where agents and static entities (i.e., apples, stags, coins, and tiles) were represented by vertices whose attributes, $v _ { i }$ , were: the entity’s position in the arena; the one-hot encoded type of the entity (e.g. agent, apple, etc.); (when applicable) the entity’s state (e.g. available / collected); and (when applicable) the last action taken. When attributes were not applicable (e.g. the last action of an apple), we padded the corresponding attribute features with zeros. Edges connected all non-agent entities to all agents as well as agents to each other. Input edges contained no attributes and were characterized by senders and receivers only (see Fig. 1b for an example environment graph). In order to understand our analysis contributions, it is crucial to note that while the input graph to our RFM module contained no edge attributes, and edges were simply characterized by their sender and receiver vertices, the edges of a RFM’s output graph did contain attributes. These attributes were computed by the network itself and amounted to distributed representations of the effect the sender entity had on the receiver agent.
81
+
82
+ We also collected 2,500 further episode trajectories for performance reporting and analysis. Training of both RFM and baseline models was conducted using gradient descent to minimize the cross-entropy loss between predicted and ground-truth actions. The training procedure was halted after one million steps, during each of which the gradient was estimated using a batch of 128 episodes. Results are presented in Sec. 2.2.1.
83
+
84
+ # 2.2 RESULTS
85
+
86
+ # 2.2.1 ACTION PREDICTION PERFORMANCE
87
+
88
+ We trained our RFM modules and baseline models to predict the actions of each agent in each of the three games we considered. Models were given a graph representation of the state of the environment, and produced an action prediction for each agent. After training (see Sec. 2.1.3), we used held-out episodes to assess the performance of each model in terms of mean length of perfect roll-out: the mean number of steps during which prediction and ground truth do not diverge. This metric gives us a measure of how long we could simulate the agents’ behavior before making a mistake. For completeness, we report next-action classification accuracy in Sec. A.5.
89
+
90
+ Results are shown in Fig. 2. As expected, all models achieve similar scores on the Coop Nav game, which is a rather simple environment. Our RFM module outperforms the NRI baseline by a substantial margin on the Coin Game and Stag Hunt environments. Since the two models are identical, except for the initial graph structure inference step, this result suggests that when the importance of some relations is revealed over time, rather than obvious from the start, the graph structure inference step proposed in NRI might not be appropriate. Our RFM consistently outperforms the VAIN model, and on Stag Hunt our Feedforward model does as well. This indicates that, for this particular task, distributed interaction representations are superior to simple attention weights. Finally, the MLP+LSTM and No-relation models performed worst across the board, which suggests that relations between entities, rather than the state of the entities themselves, carry most of the predictive power in these environments.
91
+
92
+ These results reproduce and advance the conclusion that relational models can be trained to perform action prediction for multi-agent systems, and are superior to non-relational models for this task (Kipf et al., 2018; Hoshen, 2017).
93
+
94
+ 2.2.2 RELATIONAL ANALYSIS OF THE STAG HUNT GAME: ACTIONS
95
+
96
+ Here we introduce our relational analysis tools and use the Stag Hunt game as a case study. While we illustrate our findings on a simple game, these intuitions can be easily transferred to more complex domains.
97
+
98
+ We propose the Euclidean norm of a message vector (i.e., $\| e _ { k } ^ { \prime } \| ,$ as a measure of the influence a sender entity, $v _ { s _ { k } }$ , has on a receiver, ${ \boldsymbol { v } } _ { { \boldsymbol { r } } _ { k } }$ . We validate this suggestion in Fig. 3 (top row), where we show that the edge norm between a sender entity (either a stag or an apple) and a receiver agent is predictive of which entity the agent will move towards, or away from, at the next time step.
99
+
100
+ This intuition can be developed to discover the events that qualitatively change agents’ behavior, as well as the factors that mediate how agents interact with one another. Fig. 3 (middle row), for example, shows how the norm of an edge between a stag and an agent changes over time. The importance of the relation is modulated by the prey’s state: when a stag becomes available, the edge norm rises substantially; when a stag is consumed, the edge norm drops. Remarkably, the presence or absence of a stag also influences the edge norm between the two teammates, as shown in Fig. 3 (bottom row): in the time step immediately before they consume a stag, the edge between the two teammates is higher than immediately afterwards. In contrast, this effect does not occur with apples, which do not require coordination between teammates to consume. Finally, as shown in Fig. 3 (bottom row), we find that agents’ influence on each other’s behavior is higher when there is a scarcity of apples (as agents compete for this resource). We note that while significant changes in edge norm or the rank order of edge norm can be used to discover events that qualitatively change agents behavior and factors that mediate agents’ social interaction, the raw values have no intrinsic meaning.
101
+
102
+ Taken as a whole, these findings highlight how the norm of the edge messages, computed by a RFM which is trained to predict the future actions in a multi-agent system, contain intepretable and quantifiable information about when and how certain entities and relations influence agents’ behavior, and about which entities and situations mediate the social influence between agents.
103
+
104
+ # 2.2.3 RELATIONAL ANALYSIS OF THE STAG HUNT GAME: RETURN
105
+
106
+ A second key finding is that beyond measuring the intensity of a social influence relation, RFM modules can also be used to quantify their valence. We trained a RFM model to predict the return received by each agent (until the end of the episode), rather than their future action. We used this model to measure the marginal utility of the actual social context, i.e., to ask: what would happen to agent 1’s return if we didn’t know the exact state of agent 2?
107
+
108
+ ![](images/8876b23114a521b0b294b75e762708512458f6464005314b1c15a14f48e77a2a.jpg)
109
+ (c) Edge activation magnitude discovers situations that alter agents’ social influence.
110
+ Figure 3: Edge analysis. Top-row: the norm of output edge activations is predictive of future behavior. On the $y$ -axis we plot the average relative displacement between the agent (receiver) and an entity (sender), we order the plot by the rank of the edge activation magnitude; predictive power declines sharply with rank. Middle-row: edge activations discover what agents care about and how this changes over time, here we have time series plots (left and right) of an edge activation norm when a stag becomes available and unavailable, and averages over all time steps grouped by stag state (middle). Bottom row: when stags become available, agents care about each other more than just before that happens, $\mathit { p } < 0 . 0 5$ ; middle). Apples becoming available has no effect $p = 0 . 2 7$ ; middle). See also control experiments in Fig. 9. The norm of the edge connecting the two agents is also modulated by scarcity (right), agents compete for apple consumption and the fewer apple there are, the more the two agents influence each other behavior $\mathrm { \Delta \cdot } r = - 0 . 3 9$ , $p < 0 . 0 5 )$ .
111
+
112
+ The proposed approach is to effectively compare two estimators for agent 1’s return:
113
+
114
+ $$
115
+ \begin{array} { r l r } { { \hat { R } _ { \mathrm { F u l l \ g r a p h } } ^ { a _ { 1 } } = M ( s _ { a _ { 1 } } , s _ { a _ { 2 } } , z ) } } \\ & { } & { \hat { R } _ { \mathrm { P r u n e d \ g r a p h } } ^ { a _ { 1 } } = M ( s _ { a _ { 1 } } , z ) } \\ & { } & { \approx \int M ( s _ { a _ { 1 } } , s _ { a _ { 2 } } ^ { \prime } , z ) p ( s _ { a _ { 2 } } ^ { \prime } | s _ { a _ { 1 } } , z ) d s _ { a _ { 2 } } ^ { \prime } } \end{array}
116
+ $$
117
+
118
+ ![](images/bb970aebc8d62ab60c6adf6d02f55bb9c660ccfb7b0cee19a26f6fb03d0b6f3e.jpg)
119
+ Figure 4: Return analysis: we trained our RFM model to predict the return (until the end of the episode) received by each agent. We trained our model on graphs with and without edges connecting the two Full graph Pruned Graph estimates that the social influence has a positive marginal utility. (Right) $\bar { \hat { R } } _ { \mathrm { F u l l g r a p h } } ^ { a _ { 1 } } - \hat { R } _ { \mathrm { P r u n e d G r a p h } } ^ { \bar { a } _ { 1 } }$ uth and predicted return (using both graphs) for a sample episode. (Middle)around the time a stag is captured. Positive value indicates that the model $\hat { R } _ { \mathrm { F u l l g r a p h } } ^ { a _ { 1 } } - \hat { R } _ { \mathrm { P r u } } ^ { a _ { 1 } }$ ned Graph right before and right after a stag is captured: agents’ influence are most beneficial for each other when they a capture a stag. Episodes ran for 128 steps for this analysis.
120
+
121
+ where $\hat { R } _ { \mathrm { F u l l \ g r a p h } } ^ { a _ { 1 } }$ is the model $M$ ’s estimate of the return received by agent 1, given the state of both agents 1 and 2, and all other environment variables, $z$ , whereas $\hat { R } _ { \mathrm { P r u n e d g r a p h } } ^ { a _ { 1 } }$ is that same estimate, without knowledge of the state of agent 2 (i.e., marginalizing out $s _ { a _ { 2 } }$ ). In practice, this latter estimate can be obtained by removing the edge connecting the two agents from the input graph1.
122
+
123
+ If we find thagent 2 (i.e., $\hat { R } _ { \mathrm { F u l l g r a p h } } ^ { a _ { 1 } } > \hat { R } _ { \mathrm { P r u n e d g r a p h } } ^ { a _ { 1 } } )$ e predicted return decreases when removing information about, we would conclude that the actual state of agent 2 results in a better-than-expected return for agent 1, that is, agent 2 is helping agent 1. Conversely, if the predicted return increases we would conclude that agent 2 is hindering agent 1.
124
+
125
+ We ran this experiment using a set-up identical to the one we used for action prediction, except for three modifications: (1) the target variable and (2) loss function were changed, from cross-entropy between predicted and ground-truth actions, to mean squared error between predicted and true return; and (3) the training set contained an equal proportion of environment graphs with and without edges between teammates. The latter modification ensured that the pruned-graph computations were not out-of-distribution. The ground truth and predicted return (using both the full and pruned graph) for a sample episode are shown in Fig. 4 (left).
126
+
127
+ We note that within this setup, both the pruned-graph estimator and the full-graph estimator are produced by a single graph neural network. This network is trained to predict agent 1’s return both using the full graph (i.e. knowing the actual state of $a _ { 2 }$ ) and the pruned graph (i.e. not knowing the actual state of $a _ { 2 }$ ). During training we randomly drop out edges between teammates (to ensure that both full graph and pruned graph are in-distribution for $M$ ). At test time, we then compute the full-graph estimate by using all edges, and the pruned-graph estimator by dropping out edges between teammates.
128
+
129
+ Similar to the edge-norm relational analysis above, we can find the entities and events that mediate the value of a social interaction. Fa teammate’s particular state (i.e. $\hat { R } _ { \mathrm { F u l l g r a p h } } ^ { a _ { 1 } } - \hat { R } _ { \mathrm { P r u n e d G r a p h } } ^ { a _ { 1 } } )$ le and right) show the marginal value of over time and around the time of a stag capture. Thus the model estimates that teammates’ specific interactions during this time are beneficial to their return.
130
+
131
+ ![](images/6b23386f80013c5f206166b19af3d5594a967b3f8971e8aafae43255f6addeb1.jpg)
132
+ Figure 5: Training curves for A2C agents with and without on-board RFM modules. Allowing agents to access the output of a RFM module results in agents that learn to coordinate faster than baseline agents. This also scales to different number of agents. Importantly, the on-board RFM module is trained alongside the policy network, and there is no sharing of parameters or gradients between the agents. We also show curves for training alongside learning teammates in Fig. 8. Embedding an RFM is also more beneficial than embedding an MLP+LSTM (see Fig. 7.)
133
+
134
+ # 3 RFM-AUGMENTED AGENTS
135
+
136
+ # 3.1 METHODS
137
+
138
+ We have shown that relational reasoning modules capture information about the social dynamics of multi-agent environments. We now detail how these modules’ predictions can be useful for improving MARL agents’ speed of learning. We extended the agent architecture (described in Sec. 2.1.2) by embedding a RFM module in each agent, and augmenting the policy network’s observations with the RFM’s output. This agent architecture is depicted in Fig. 1c.
139
+
140
+ Incorporating an on-board RFM module did not provide the agents with any additional information above and beyond that provided to baseline agents. All games were fully observable, so the additional inputs (i.e. the true last action, and the environment graph, which was provided as input to the embedded RFM) did not add any new information to the original egocentric observations. Similarly, the on-board RFM modules were trained from scratch alongside the policy networks, while the agents were learning to act, so that no additional game structure was given to the augmented agents. Finally, we highlight that each learning agent in the arena had its own RFM module and policy networks; there was never any sharing of weights, gradients or communication between the agents.
141
+
142
+ Our baseline agent policy network architecture comprised of a CNN that processed the actor’s egocentric observation, followed by a MLP+LSTM network that provided action logits (see Sec. 2.1.2 for architecture details). Our augmented agents had an embedded RFM module, which was fed graph representations of the state of the environment, just as in the offline RFM modules in the forward modeling experiments. We trained this module to minimize the cross-entropy loss between its prediction and the last action taken by all fellow agents. We used the prediction output of the on-board RFM module to augment the observation stream at the input of the original policy network. Specifically, the output of the RFM module—predicted action logits for fellow agents—was rendered as image planes whose pixel intensity was proportional to the estimated probability that an agent would be at a certain location at the next time step2. These image planes were appended to the ego-centric top-down observation and fed to the original policy network.
143
+
144
+ # 3.1.1 RESULTS
145
+
146
+ Our experimental design was relatively straightforward. First, we trained A2C agents (as described in Sec. 2.1.2) to play the three games we considered, as well as a four-player variant of the Stag Hunt game. Second, we paired learning agents with these pre-trained experts: learning agents occupied a single-player slot in each game, while all their teammates were pre-trained experts. We repeated this procedure using both RFM-enhanced agents and baseline A2C agents as learners. During training we recorded the reward received by the singular learning agent in each episode.
147
+
148
+ Our results show that agents that explicitly model each other using an on-board RFM learn to coordinate with one another faster than baseline agents (Fig. 5). In Stag Hunt our RFM-augmented agent achieves a score above 25 after around 600K steps, while baseline agents required around 1M steps. This effect is even more prominent in the 4-player version of the game where these scores are achieved around 500K and 1M steps respectively. Similarly in Coop Nav baseline agents required twice as many steps of experience to consistently score above 25 as our RFM-augmented agents. Moreover, in the Coin Game environment, the faster learning rate of RFM-augmented agents appears to be due to a superior efficiency in learning to interpret the teammate’s action and infer the negative coin color in each episode (see Sec. A.1). Finally, we found that augmenting agents with on-board RFM modules was more beneficial to agents learning than using $\mathbf { M L P + L S T M }$ models (see Sec. A.2). These results suggest that agents take into account the on-board RFM’s predictions when planning their next action, and that this results in agents that learn faster to coordinate with others, and to discover others’ preferences from their actions.
149
+
150
+ # 4 CONCLUSIONS
151
+
152
+ Here we showed that our Relational Forward Model can capture the rich social dynamics of multiagent environments, that its intermediate representations contained valuable interpretable information, and that providing this information to learning agents results in faster learning system.
153
+
154
+ The analysis tools we introduced allow researchers to answer new questions, which are specifically tailored to multi-agent systems, such as what entities, relations and social interactions drive agents’ behaviors, and what environment events or behavior patterns mediate these social and non-social influence signals. Importantly our methods require no access to agents internals, only to behavioral trajectories, making them amenable to analyzing human behavior, sports and ecological systems.
155
+
156
+ Providing agents with access the output of RFM modules results in agents that learn to coordinate with one another faster than non-augmented baselines. We posit that explicit modeling of teammates and opponents is an important research direction in multi-agent RL, and one that might alleviate the need for communication, parameter sharing or centralized controllers to achieve coordination.
157
+
158
+ Future work will see our methods applied to more complex and varied domains where artificial and non-artificial agents interact and learn in shared environments. We will focus on identifying entire patterns of behavior for in-agent modeling, so as to adapt the host agent policy more efficiently.
159
+
160
+ # REFERENCES
161
+
162
+ Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent Complexity via Multi-Agent Competition. 2017. URL http://arxiv.org/abs/1710.03748.
163
+
164
+ Peter W. Battaglia, Razvan Pascanu, Matthew Lai, Danilo Rezende, and Koray Kavukcuoglu. Interaction Networks for Learning about Objects, Relations and Physics. arXiv, 2016. URL http://arxiv.org/abs/1612.00222.
165
+
166
+ Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andrew Ballard, Justin Gilmer, George Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. 2018. URL http://arxiv.org/abs/1806.01261.
167
+
168
+ Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation. 2014. URL http://arxiv.org/abs/1406.1078.
169
+
170
+ Raffaello D’Andrea. Guest Editorial: A Revolution in the Warehouse: A Retrospective on Kiva Systems and the Grand Challenges Ahead. IEEE Transactions on Automation Science and
171
+
172
+ Engineering, 9(4):638–639, 2012. ISSN 1545-5955. doi: 10.1109/TASE.2012.2214676. URL http://ieeexplore.ieee.org/document/6295687/.
173
+
174
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, Shane Legg, and Koray Kavukcuoglu. IMPALA: Scalable Distributed Deep-RL with Importance Weighted Actor-Learner Architectures. arXiv, 2018. URL http://arxiv.org/abs/1802.01561.
175
+
176
+ Jakob N. Foerster, Yannis M. Assael, Nando de Freitas, and Shimon Whiteson. Learning to Communicate with Deep Multi-Agent Reinforcement Learning. 2016. URL http://arxiv.org/ abs/1605.06676.
177
+
178
+ Jakob N. Foerster, Richard Y. Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with Opponent-Learning Awareness. 2017. URL http://arxiv.org/ abs/1709.04326.
179
+
180
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural Message Passing for Quantum Chemistry. 2017. URL http://arxiv.org/abs/1704. 01212.
181
+
182
+ Jessica B. Hamrick, Andrew J. Ballard, Razvan Pascanu, Oriol Vinyals, Nicolas Heess, and Peter W. Battaglia. Metacontrol for Adaptive Imagination-Based Optimization. 2017. URL http: //arxiv.org/abs/1705.02670.
183
+
184
+ He He, Jordan Boyd-Graber, Kevin Kwok, and Hal Daumé. Opponent Modeling in Deep Reinforcement Learning. arXiv, 2016a. URL http://arxiv.org/abs/1609.05559.
185
+
186
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In IEEE International Conference on Computer Vision (ICCV), volume 11-18-Dece, pp. 1026–1034, 2016b. ISBN 9781467383912. doi: 10.1109/ICCV.2015.123.
187
+
188
+ Zhang-Wei Hong, Shih-Yang Su, Tzu-Yun Shann, Yi-Hsiang Chang, and Chun-Yi Lee. A Deep Policy Inference Q-Network for Multi-Agent Systems. 2017. URL https://arxiv.org/ abs/1712.07893.
189
+
190
+ Yedid Hoshen. VAIN: Attentional Multi-agent Predictive Modeling. arXiv, 2017. URL http: //arxiv.org/abs/1706.06122.
191
+
192
+ Edward Hughes, Joel Z Leibo, Matthew G Philips, Karl Tuyls, Edgar A Du Nez-Guzmán, Antonio García, Castã Neda, Iain Dunning, Tina Zhu, Kevin R Mckee, Raphael Koster, Heather Roff, and Thore Graepel. Inequity aversion resolves intertemporal social dilemmas. arXiv, 2018. URL https://arxiv.org/pdf/1803.08884.pdf.
193
+
194
+ 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. 2018. URL http://arxiv.org/abs/1807.01281.
195
+
196
+ Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural Relational Inference for Interacting Systems. arXiv, 2018. URL http://arxiv.org/abs/1802. 04687.
197
+
198
+ Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Karl Tuyls, Julien Perolat, David Silver, and Thore Graepel. A Unified Game-Theoretic Approach to Multiagent Reinforcement Learning. Advances in Neural Information Processing Systems 30, (Nips), 2017. ISSN 10495258. URL http://arxiv.org/abs/1711.00832.
199
+
200
+ Joel Z. Leibo, Vinicius Zambaldi, Marc Lanctot, Janusz Marecki, and Thore Graepel. Multi-agent Reinforcement Learning in Sequential Social Dilemmas. Proceedings of the 16th Conference on Autonomous Agents and MultiAgent Systems, pp. 464–473, 2017. URL https://dl.acm. org/citation.cfm?id=3091194.
201
+
202
+ Adam Lerer and Alexander Peysakhovich. Maintaining cooperation in complex social dilemmas using deep reinforcement learning. CoRR, abs/1707.0, 2017. URL http://arxiv.org/abs/ 1707.01068{%}0Ahttps://arxiv.org/pdf/1707.01068.pdf.
203
+
204
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-Agent ActorCritic for Mixed Cooperative-Competitive Environments. arXiv, 2017. URL http://arxiv. org/abs/1706.02275.
205
+
206
+ Ari S. Morcos, David G. T. Barrett, Neil C. Rabinowitz, and Matthew Botvinick. On the importance of single directions for generalization. 2018. URL http://arxiv.org/abs/1803.06959.
207
+
208
+ Chris Olah, Alexander Mordvintsev, and Ludwig Schubert. Feature Visualization. Distill, 2(11):e7, 2017. ISSN 2476-0757. doi: 10.23915/distill.00007. URL https://distill.pub/2017/ feature-visualization.
209
+
210
+ Jakub Pachocki, Szymon Sidor, Greg Brockman, Filiip Wolski, Jie Tang, Jonathan Raiman, Christy Dennison, Przemyslaw Debiak, Susan Zhang, David Farhi, Brooke Chan, Henrique Ponde, and Petrov Michael. OpenAI Five, 2018. URL https://openai.com/five/.
211
+
212
+ Razvan Pascanu, Yujia Li, Oriol Vinyals, Nicolas Heess, Lars Buesing, Sebastien Racanière, David Reichert, Théophane Weber, Daan Wierstra, and Peter Battaglia. Learning model-based planning from scratch. 2017. URL http://arxiv.org/abs/1707.06170.
213
+
214
+ Julien Perolat, Joel Z. Leibo, Vinicius Zambaldi, Charles Beattie, Karl Tuyls, and Thore Graepel. A multi-agent reinforcement learning model of common-pool resource appropriation. 2017. URL http://arxiv.org/abs/1707.06600.
215
+
216
+ Alexander Peysakhovich and Adam Lerer. Consequentialist conditional cooperation in social dilemmas with imperfect information. arXiv, 2017a. URL http://arxiv.org/abs/1710. 06975.
217
+
218
+ Alexander Peysakhovich and Adam Lerer. Prosocial learning agents solve generalized Stag Hunts better than selfish ones. arXiv, 2017b. URL http://arxiv.org/abs/1709.02865.
219
+
220
+ Neil C. Rabinowitz, Frank Perbet, H. Francis Song, Chiyuan Zhang, S. M. Ali Eslami, and Matthew Botvinick. Machine Theory of Mind. arXiv, 2018. URL http://arxiv.org/abs/1802. 07740.
221
+
222
+ Roberta Raileanu, Emily Denton, Arthur Szlam, and Rob Fergus. Modeling Others using Oneself in Multi-Agent Reinforcement Learning. arXiv preprint arXiv:1902.09640, 2018. URL http: //arxiv.org/abs/1802.09640.
223
+
224
+ David Raposo, Adam Santoro, David Barrett, Razvan Pascanu, Timothy Lillicrap, and Peter Battaglia. Discovering objects and their relations from entangled scene representations. arXiv, 2017. URL http://arxiv.org/abs/1702.05068.
225
+
226
+ Adam Santoro, David Raposo, David G. T. Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. arXiv, 2017. URL http://arxiv.org/abs/1706.01427.
227
+
228
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 2009.
229
+
230
+ Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning Multiagent Communication with Backpropagation. arXiv, 2016. URL http://arxiv.org/abs/1605.07736.
231
+
232
+ Nicholas Watters, Andrea Tacchetti, Theophane Weber, Razvan Pascanu, Peter Battaglia, and Daniel Zoran. Visual Interaction Networks. arXiv, 2017. URL http://arxiv.org/abs/1706. 01433.
233
+
234
+ Théophane Weber, Sébastien Racanière, David P. Reichert, Lars Buesing, Arthur Guez, Danilo Jimenez Rezende, Adria Puigdomènech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, Razvan Pascanu, Peter Battaglia, Demis Hassabis, David Silver, and Daan Wierstra. ImaginationAugmented Agents for Deep Reinforcement Learning. 2017. URL http://arxiv.org/abs/ 1707.06203.
235
+
236
+ Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding Neural Networks Through Deep Visualization. 2015. URL http://arxiv.org/abs/1506.06579.
237
+ Vinicius Zambaldi, David Raposo, Adam Santoro, Victor Bapst, Yujia Li, Igor Babuschkin, Karl Tuyls, David Reichert, Timothy Lillicrap, Edward Lockhart, Murray Shanahan, Victoria Langston, Razvan Pascanu, Matthew Botvinick, Oriol Vinyals, and Peter Battaglia. Relational Deep Reinforcement Learning. 2018. URL http://arxiv.org/abs/1806.01830.
238
+ Matthew D Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks. 2013. URL http://arxiv.org/abs/1311.2901.
239
+ Eric Zhan, Stephan Zheng, Yisong Yue, Long Sha, and Patrick Lucey. Generative Multi-Agent Behavioral Cloning. 2018. URL http://arxiv.org/abs/1803.07612.
240
+ Stephan Zheng, Yisong Yue, and Patrick Lucey. Generating Long-term Trajectories Using Deep Hierarchical Networks. 2017. URL http://arxiv.org/abs/1706.07138.
241
+
242
+ # A APPENDIX
243
+
244
+ # A.1 COIN COLLECTION ANALYSIS IN THE COIN GAME
245
+
246
+ ![](images/c3298d56aa55ed2094bbd963c48458027cc78a8cf7639c206268ea7efcd2e084.jpg)
247
+ Figure 6: Coin collection analysis in the Coin Game.
248
+
249
+ As described in the main text, RFM-augmented agents learn the Coin Game faster than non-augmented baseline agents. This appears to result from learning more efficiently to discern their teammate’s preference. In Fig. 6, the middle panel shows the average number of coins of each color (R: revealed good, U: unrevealed good, B: bad) collected by our RFM-augmented agent during an episode. The right panel shows the same quantities for our baseline agent. We find that the gap between the U curve and the B curve is significantly wider for the RFM-augmented agent than it is for the baseline agent (see, for example, around 50M steps). This suggests that the learning efficiency difference is due to a superior ability to discern the teammate’s preferences.
250
+
251
+ Finally we highlight that our agents, as well as our baselines, vastly outperform previously-published agents on this game: Separate policy predictor agents (He et al., 2016b) and Self-Other Modeling agents (see Fig. 3 in Raileanu et al. (2018). This might imply that the original paper where this game was suggested had poor baseline agents. We suspect this game is not as complex as it may appear, and that baseline agents are close to optimal; this leaves less room for improvement than other games explored in this work.
252
+
253
+ ![](images/fee39abd74a6b7b32af1a09248bc0642cc23d753df64a6c5475bed805daa604d.jpg)
254
+ A.2 AUGMENTING AGENTS WITH NON-RELATIONAL MODELS
255
+ Figure 7: Augmenting agents with predictions from a non-relational model.
256
+
257
+ In the main text we showed that agents that explicitly model each other using an on-board RFM learn to coordinate with one another faster than baseline agents. For completeness, we show in Fig. 7 the learning performance of agents that have instead been augmented with $\mathbf { M L P + L S T M }$ models (as described in the main text). The learning performance of these agents (red) falls between baseline agents (green), which do not explicitly model other agents, and the RFM-augmented agents (blue), which use a relational architecture to model their teammates’ behavior. The better performance of RFM-augmented agents is expected, given the more accurate forward predictions that RFMs provide.
258
+
259
+ # A.3 TRAINING WITH NON-EXPERT TEAMMATES
260
+
261
+ In the main text we showed how RFM augmented agents learn to coordinate with expert teammates faster than non-augmented baselines. This set-up as is relevant for many interesting situations, e.g.
262
+
263
+ ![](images/125466d1ce71155544de51884daf86a28ed64e99f1599475abbcf5e4d26f1d69.jpg)
264
+ Figure 8: Agents training with non-expert teammates. Reward shown as the average return per agent, averaged over four agent seeds.
265
+
266
+ ![](images/34ecd1e15fae21f59fc0b80a5393a2c1c5fa10f246fea0a9f0182410ea845d9b.jpg)
267
+ (a) Stags carry no reward. Differences are not signifi-(b) Stags can be collected by lone hunters. Differences cant $\gamma = 0 . 3 4$ for Stag, $p = 0 . 4 6$ for apples). are not significant $( p = 0 . 6 7$ for Stag, $p = 0 . 3 2$ for apples).
268
+ Figure 9: If coordination is not required to collect stags, or if agents are not interested in collecting stags, the edge norm between the two agents is not affected by the appearance of available stags. (Compare to Fig. 3 bottom row left and middle panels.)
269
+
270
+ when artificial learning agents interact with human experts. For completeness, we show in Fig. 8 the corresponding results when RFM-augments agents train alongside other learning agents (i.e. non-experts). In this case, either all agents in the environment were RFM-augmented (green), or all agents were baseline (blue). We use longer episodes in these experiments (128 steps, rather than 32) in order to make training easier (hence total returns were higher). For brevity, we only report results on the two-player versions of the games.
271
+
272
+ We see a similar result to the main text: allowing agents to model one another explicitly results in faster learning (e.g. in StagHunt $\mathbf { R F M } + \mathbf { A } 2 \mathbf { C }$ achieves scores around 48 around 30M steps while vanilla A2C requires 45M training steps. Similarly in CoinGame $\mathrm { R F M } + \mathrm { A } 2 \mathrm { C }$ achieves a score around 15 in 100M steps while vanilla A2C requires almost 200M steps). We note that this setting presents an additional challenge: a learned model of a teammate’s behavior can only provide useful information for coordination after the teammate’s policy becomes sensible. The advantage conferred by embedding the RFM into the learning agent will thus be delayed relative to the expert teammate condition shown in the main text. Nonetheless, augmenting agents with RFM models still results in faster learning than omitting it altogether.
273
+
274
+ # A.4 CONTROL EXPERIMENTS: WHICH EVENTS MEDIATE INTERDEPENDENT BEHAVIOR
275
+
276
+ In the main text we showed that our RFM model reveals how agents’ influence on each other is contextual. In particular, we observe in Fig: 3 (bottom row, left and middle panels) that the Euclidean norm of the activation of the edge between the two agents increases when a stag appears. We argue that this indicates that agents coordinate their behavior when stags are available. Here we report control experiments to test alternative hypotheses. In these experiments, we trained agents on two modifications of the StagHunt game, wherein there is no explicit incentive for agents to coordinate:
277
+
278
+ • Stags carry no rewards. This tests whether the changes in Fig. 3 could be due to arbitrary changes in the environment. Here our hypothesis predicts that stag appearance would have no effect on edge norms, since agents should learn to ignore them.
279
+
280
+ • Stags can be collected by a lone hunter. This tests whether the changes in Fig. 3 could be due to the appearance of new reward-carrying objects that do not require coordination. Again, our hypothesis predicts that stags would have no effect on the edge norm between agents, since collecting a stag does not require coordination, like apples.
281
+
282
+ In both cases our experimental pipeline was as described in the main text: (1) train A2C agents on the modified version of the StagHunt game; (2) collect behavioral trajectories from these agents; (3) train a RFM model to predict the action of each agent given the state of the environment; and (4) report the Euclidean norm of the edge activations in the link connecting the two agents at a time just before and just after a Stag or an Apple appear.
283
+
284
+ Consistent with our primary hypothesis, there is no significant change in the norm of the activations in the edge connecting two agents when Stags (or apples) appear in these situation. This provides evidence that our RFM model is able to reveal which events in the environment mediate how agents influence each one another.
285
+
286
+ # A.5 ACCURACY MEASURE
287
+
288
+ ![](images/6d8b68227de19a025d238f648f60a2b6036d1cd9e98a45fd0a37649dd47f73ac.jpg)
289
+ Figure 10: Next-step action classification accuracy.
290
+
291
+ In the main text we show that our RFM model provides longer perfect rollouts than competing models. Here we provide an alternative metric to measure the relative accuracy of different models. In Fig. 10, we show the next-step action classification accuracy, in the same manner as Fig. 2. Model ranking remain unchanged (with the exception of NRI on CoinGame): the RFM outperforms other models on predicting agent behavior.
md/train/rJzIBfZAb/rJzIBfZAb.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS DEEP LEARNING MODELS RESISTANT TO ADVERSARIAL ATTACKS
2
+
3
+ Aleksander M ˛adry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, Adrian Vladu∗
4
+
5
+ Department of Electrical Engineering and Computer Science
6
+ Massachusetts Institute of Technology
7
+ Cambridge, MA 02139, USA
8
+ {madry,amakelov,ludwigs,tsipras,avladu}@mit.ed
9
+
10
+ # ABSTRACT
11
+
12
+ Recent work has demonstrated that neural networks are vulnerable to adversarial examples, i.e., inputs that are almost indistinguishable from natural data and yet classified incorrectly by the network. To address this problem, we study the adversarial robustness of neural networks through the lens of robust optimization. This approach provides us with a broad and unifying view on much prior work on this topic. Its principled nature also enables us to identify methods for both training and attacking neural networks that are reliable and, in a certain sense, universal. In particular, they specify a concrete security guarantee that would protect against a well-defined class of adversaries. These methods let us train networks with significantly improved resistance to a wide range of adversarial attacks. They also suggest robustness against a first-order adversary as a natural security guarantee. We believe that robustness against such well-defined classes of adversaries is an important stepping stone towards fully resistant deep learning models.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Recent breakthroughs in computer vision and speech recognition are bringing trained classifiers into the center of security-critical systems. Important examples include vision for autonomous cars, face recognition, and malware detection. These developments make security aspects of machine learning increasingly important. In particular, resistance to adversarially chosen inputs is becoming a crucial design goal. While trained models tend to be very effective in classifying benign inputs, recent work (Dalvi et al., 2004; Szegedy et al., 2013; Goodfellow et al., 2014; Nguyen et al., 2015; Sharif et al., 2016) shows that an adversary is often able to manipulate the input so that the model produces an incorrect output.
17
+
18
+ This phenomenon has received particular attention in the context of deep neural networks, and there is now a quickly growing body of work on this topic (Fawzi et al., 2015; Kurakin et al., 2016; Papernot & McDaniel, 2016; Rozsa et al., 2016; Torkamani, 2016; Sokolic et al., 2016; Tramèr et al., 2017b). Computer vision presents a particularly striking challenge: very small changes to the input image can fool state-of-the-art neural networks with high probability (Szegedy et al., 2013; Goodfellow et al., 2014; Nguyen et al., 2015; Sharif et al., 2016; Moosavi-Dezfooli et al., 2016). This holds even when the benign example was classified correctly, and the change is imperceptible to a human. Apart from the security implications, this phenomenon also demonstrates that our current models are not learning the underlying concepts in a robust manner. All these findings raise a fundamental question:
19
+
20
+ # How can we learn models robust to adversarial inputs?
21
+
22
+ There are now many proposed defense mechanisms for the adversarial setting. Examples include defensive distillation (Papernot et al., 2016a; Papernot & McDaniel, 2016), feature squeezing (Xu et al., 2017), and several detection approaches for adversarial inputs (see Carlini & Wagner (2017) for references). While these works constitute important first steps in exploring the realm of possibilities, they do not offer a good understanding of the guarantees they provide. We can never be certain that a particular defense mechanism prevents the existence of some well-defined class of adversarial attacks. This makes it difficult to navigate the landscape of adversarial robustness or to fully evaluate the possible security implications. Moreover, subsequent work (Carlini & Wagner, 2016a; He et al., 2017) has shown that most of these defenses can be bypassed by stronger, adaptive adversaries.
23
+
24
+ In this paper, we study the adversarial robustness of neural networks through the lens of robust optimization. We use a natural saddle point (min-max) formulation to capture the notion of security against adversarial attacks in a principled manner. This formulation allows us to be precise about the type of security guarantee we would like to achieve, i.e., the broad class of attacks we want to be resistant to (in contrast to defending only against specific known attacks). The formulation also enables us to cast both attacks and defenses into a common theoretical framework. Most prior work on adversarial examples naturally fits into this framework. In particular, adversarial training directly corresponds to optimizing this saddle point problem. Similarly, prior methods for attacking neural networks correspond to specific algorithms for solving the underlying optimization problem.
25
+
26
+ Equipped with this perspective, we make the following contributions.
27
+
28
+ 1. We conduct a careful experimental study of the optimization landscape corresponding to this saddle point formulation. Despite the non-convexity and non-concavity of its constituent parts, we find that the underlying optimization problem is tractable after all. In particular, we provide strong evidence that first-order methods can reliably solve this problem and motivate projected gradient descent (PGD) as a universal “first-order adversary”, i.e., the strongest attack utilizing the local first order information about the network. We supplement these insights with ideas from real analysis to further motivate adversarial training against a PGD adversary as a strong and natural defense.
29
+
30
+ 2. We explore the impact of network architecture on adversarial robustness and find that model capacity plays an important role. To reliably withstand strong adversarial attacks, networks require a significantly larger capacity than for correctly classifying benign examples only. This shows that a robust decision boundary of the saddle point problem can be significantly more complicated than a decision boundary that simply separates the benign data points.
31
+
32
+ 3. Building on the above insights, we train networks on MNIST and CIFAR10 that are robust to a wide range of adversarial attacks against adversaries bounded by 0.3 and 8 in $\ell _ { \infty }$ norm respectively. Our approach is based on optimizing the aforementioned saddle point formulation and uses our optimal “first-order adversary”. Our best MNIST model achieves an accuracy of more than $89 \%$ against the strongest adversaries in our test suite. In particular, our MNIST network is even robust against white box attacks of an iterative adversary. Our CIFAR10 model achieves an accuracy of $46 \%$ against the same adversary. Furthermore, in case of the weaker black box (transfer) attacks, our MNIST and CIFAR10 networks achieve an accuracy of more than $9 5 \%$ and $64 \%$ , respectively (a more detailed overview can be found in Tables 1 and 2). To the best of our knowledge, we are the first to achieve these levels of robustness on MNIST and CIFAR10 against a broad set of attacks.
33
+
34
+ Overall, these findings suggest that secure neural networks are within reach. In order to further support this claim, we have invited the community to attempt attacks against our MNIST and CIFAR10 networks in the form of an open challenge1,2. At the time of writing, we received about fifteen submissions to the MNIST challenge and the best submission achieved roughly $93 \%$ accuracy in a black box attack. We received no submissions for the CIFAR10 challenge that went beyond the $64 \%$ accuracy of our attack. Considering that other proposed defenses were often quickly broken (Carlini & Wagner, 2017), we believe that our robust models are significant progress on the defense side. Furthermore, recent work (Carlini et al., 2017) on verifiable adversarial examples showed that our proposed defense reliably increased the robustness to any $\ell _ { \infty }$ -bounded attack.
35
+
36
+ # 2 AN OPTIMIZATION VIEW ON ADVERSARIAL ROBUSTNESS
37
+
38
+ Much of our discussion will revolve around an optimization view of adversarial robustness. This perspective not only captures the phenomena we want to study in a precise manner, but will also inform our investigations. To this end, let us consider a standard classification task with an underlying data distribution $\mathcal { D }$ over pairs of examples $\boldsymbol { x } \in \mathbb { R } ^ { d }$ and corresponding labels $y \in [ k ]$ . We also assume that we are given a suitable loss function $L ( \theta , x , y )$ , for instance the cross-entropy loss for a neural network. As usual, $\theta \in \mathbb { R } ^ { p }$ is the set of model parameters. Our goal then is to find model parameters $\theta$ that minimize the risk $\mathbb { E } _ { ( x , y ) \sim \mathcal { D } } [ L ( x , y , \theta ) ]$ .
39
+
40
+ Empirical risk minimization (ERM) has been tremendously successful as a recipe for finding classifiers with small population risk. Unfortunately, ERM often does not yield models that are robust to adversarially crafted examples (Goodfellow et al., 2014; Kurakin et al., 2016; Moosavi-Dezfooli et al., 2016; Tramèr et al., 2017b). Formally, there are efficient algorithms (“adversaries”) that take an example $x$ belonging to class $c _ { 1 }$ as input and find examples $x ^ { \mathrm { a d v } }$ such that $x ^ { \mathrm { a d v } }$ is very close to $x$ but the model incorrectly classifies $x ^ { \mathrm { a d v } }$ as belonging to class $c _ { 2 } \neq c _ { 1 }$ .
41
+
42
+ In order to reliably train models that are robust to adversarial attacks, it is necessary to augment the ERM paradigm. Instead of resorting to methods that directly focus on improving the robustness to specific attacks, our approach is to first propose a concrete guarantee that an adversarially robust model should satisfy. We then adapt our training methods towards achieving this guarantee.
43
+
44
+ The first step towards such a guarantee is to specify an threat model, i.e., a precise definition of the attacks our models should be resistant to. For each data point $x$ , we introduce a set of allowed perturbations $S \subseteq \mathbb { R } ^ { d }$ that formalizes the manipulative power of the adversary. In image classification, we choose $s$ so that it captures perceptual similarity between images. For instance, the $\ell _ { \infty }$ -ball around $x$ has recently been studied as a natural notion for adversarial perturbations (Goodfellow et al., 2014). While we focus on robustness against $\ell _ { \infty }$ -bounded attacks in this paper, we remark that more comprehensive notions of perceptual similarity are an important direction for future research.
45
+
46
+ Next, we modify the definition of population risk $\mathbb { E } _ { \mathcal { D } } [ L ]$ by incorporating the above adversary. Instead of computing the loss $L$ directly on samples from the distribution $\mathcal { D }$ , we allow the adversary to perturb the input first. This gives rise to the following saddle point problem, which is our central object of study:
47
+
48
+ $$
49
+ \operatorname* { m i n } _ { \theta } \rho ( \theta ) , \quad \mathrm { w h e r e } \quad \rho ( \theta ) = \mathbb { E } _ { ( x , y ) \sim \mathcal { D } } \left[ \operatorname* { m a x } _ { \delta \in \mathcal { S } } L ( \theta , x + \delta , y ) \right] \ .
50
+ $$
51
+
52
+ Formulations of this type (and their finite-sample counterparts) have a long history in robust optimization, going back to Wald (Wald, 1939; 1945; 1992). It turns out that this formulation is also particularly useful in our context. We will refer to the quantity $\rho ( \theta )$ as the adversarial loss of the network with parameters $\theta$ .
53
+
54
+ First, this formulation gives us a unifying perspective that encompasses much prior work on adversarial robustness. Our perspective stems from viewing the saddle point problem as the composition of an inner maximization problem and an outer minimization problem. Both of these problems have a natural interpretation in our context. The inner maximization problem aims to find an adversarial version of a given data point $x$ that achieves a high loss. This is precisely the problem of attacking a given neural network. On the other hand, the goal of the outer minimization problem is to find model parameters so that the adversarial loss given by the inner attack problem is minimized. This is precisely the problem of training a robust classifier using adversarial training techniques.
55
+
56
+ Second, the saddle point problem specifies a clear goal that a robust classifier should achieve, as well as a quantitative measure of its robustness. In particular, when the parameters $\theta$ yield a (nearly) vanishing risk, the corresponding model is perfectly robust to attacks specified by our threat model.
57
+
58
+ Our paper investigates the structure of this saddle point problem in the context of deep neural networks. This formulation will be the main drive of our investigations that will lead us to training techniques that produce models with high resistance to a wide range of adversarial attacks.
59
+
60
+ # 3 TOWARDS ADVERSARIALLY ROBUST NETWORKS
61
+
62
+ Current work on adversarial examples usually focuses on specific defensive mechanisms, or on attacks against such defenses. An important feature of formulation (2.1) is that attaining small adversarial loss gives a guarantee that no allowed attack will fool the network. By definition, no adversarial perturbations are possible because the loss is small for all perturbations allowed by our threat model. This perspective allows us to reduce the task of finding truly robust models to an optimization problem. Hence, we can now focus our attention solely on obtaining a good solution to Problem (2.1).
63
+
64
+ Gradients from attacks. Since Stochastic Gradient Descent (SGD) and its variants are by far the most successful algorithms for training neural networks, we also want to apply SGD to Problem (2.1). This raises the question how we can compute gradients $\nabla _ { \boldsymbol { \theta } } \rho ( \boldsymbol { \theta } )$ for the outer minimization problem. Since the adversarial loss function $\rho ( \theta )$ corresponds to a maximization problem, we cannot simply apply the usual backpropagation algorithm. Instead, a natural approach is to compute the gradient at the maximizer of the inner maximization problem. A priori, it is not clear that this is a valid descent direction for the saddle point problem. However, for the case of continuously differentiable functions, Danskin’s theorem – a classic theorem in optimization – states that this is indeed true and gradients at maximizers of the inner problem correspond to descent directions for the saddle point problem (see Appendix C for details).
65
+
66
+ Leveraging this connection, our goal now is to find a reliable algorithm for solving the inner maximization problem, i.e., to evaluate $\rho ( \theta )$ . When instantiated for a batch of examples (instead of the expectation over the entire distribution $\mathcal { D }$ ), finding a maximizer $\delta \in S$ of $\rho ( \theta )$ corresponds exactly to finding an attack on the neural network. This allows us to employ known attacks as inner maximization algorithms. Prior work has proposed methods such as the Fast Gradient Sign Method (FGSM) and multiple variations of it (Goodfellow et al., 2014). FGSM is an attack for an $\ell _ { \infty }$ -bounded adversary and computes an adversarial example as
67
+
68
+ $$
69
+ x + \varepsilon \operatorname { s g n } ( \nabla _ { x } L ( \theta , x , y ) ) .
70
+ $$
71
+
72
+ One can interpret this attack as a simple one-step scheme for maximizing the inner part of the saddle point formulation. A more powerful adversary is the multi-step variant $\bar { \mathrm { F G S M } } ^ { k }$ , which is essentially projected gradient descent (PGD) on the negative loss function (Kurakin et al., 2016):3
73
+
74
+ $$
75
+ x ^ { t + 1 } = \operatorname { P r o j } _ { x + S } \left( x ^ { t } + \alpha \operatorname { s g n } ( \nabla _ { x ^ { t } } L ( \theta , x ^ { t } , y ) ) \right) .
76
+ $$
77
+
78
+ Loss landscape. While PGD is a well-motivated approach for the inner maximization problem, it is not clear whether we can actually find a good solution in a reasonable amount of time. The problem is non-concave, so a priori we have no guarantees on the solution quality of PGD. One of our contributions is demonstrating that, in practice, the inner maximization problem is indeed well-behaved. In particular, we experimentally explore the structure given by the non-concave inner problem and find that its loss landscape has a surprisingly tractable structure of local maxima (see Appendix A). This structure also points towards projected gradient descent as the “ultimate” first-order adversary (see Section 5).
79
+
80
+ Despite the fact that the exact assumptions of Danskin’s theorem do not hold for our problem (the function is not continuously differentiable due to ReLU activations, and we only compute approximate maximizers of the inner problem), our experiments suggest that we can still use these gradients to optimize our problem. By applying SGD using the gradient of the loss at adversarial examples, we can consistently reduce the loss of the saddle point problem during training (e.g., see Figure 1 in Section 4). These observations suggest that we reliably optimize the saddle point formulation (2.1) and thus train robust classifiers.
81
+
82
+ Model capacity. Before we proceed to our main experiment results in the next section, we briefly mention another important insight from our robust optimization perspective. Solving the problem from Equation (2.1) successfully is not sufficient to guarantee robust and accurate classification. We also require that the value of the problem (i.e., the final loss we achieve against adversarial examples) is small, which then provides guarantees for the performance of our classifier. In particular, achieving a very small value corresponds to a perfect classifier, which is robust to adversarial inputs. In Appendix B, we show experimentally that network capacity plays a crucial role in enabling robustness. In particular, training a robust classifier requires a significantly larger network than only achieving high accuracy on natural examples.
83
+
84
+ # 4 EXPERIMENTS: ADVERSARIALLY ROBUST DEEP LEARNING MODELS?
85
+
86
+ Following our understanding developed in the previous section, we can now apply our proposed approach to train robust classifiers. For both MNIST and CIFAR10, our adversary of choice will be projected gradient descent starting from a random perturbation around the natural example. As our experiments suggest (Appendix A) this algorithm is very efficient at reliably producing examples of (near) maximal loss. In a sense, it seems to correspond to a “ultimate” f irst order adversary. Since we are training the model for multiple epochs, we did not see any benefit in restarting PGD multiple times per batch – a new start is chosen each time the same example is encountered.
87
+
88
+ During the training procedure against the PGD adversary, we observe a steady decrease in the training loss of adversarial examples, illustrated in Figure 1. This behavior indicates that we are consistently decreasing the adversarial loss and indeed successfully solving our original optimization problem.
89
+
90
+ ![](images/a075c178644df2c3ad6a5cfe992d76e6f74b9a58bbe31a5587d4350e584ff0f1.jpg)
91
+ Figure 1: Cross-entropy loss on adversarial examples during training. The plots show how the adversarial loss on training examples evolves during training the MNIST and CIFAR10 networks against a PGD adversary. The sharp drops in the CIFAR10 plot correspond to decreases in training learning rate. These plots illustrate that we can consistently reduce the value of the inner problem of the saddle point formulation (2.1), thus producing an increasingly robust classifier.
92
+
93
+ We evaluate the trained models against a range of adversaries. We illustrate our results in Table 1 for MNIST and Table 2 for CIFAR10. The adversaries we consider are:
94
+
95
+ • White-box attacks with PGD for a different number of of iterations and restarts, denoted by source A.
96
+ White-box attacks from Carlini & Wagner (2016b). We use their suggested loss function and minimize it using PGD. This is denoted as CW, where the corresponding attack with a high confidence parameter $\kappa = 5 0$ ) is denoted as $\mathrm { C W } +$ .
97
+ • Black-box attacks from an independently trained copy of the network, denoted A’.
98
+ • Black-box attacks from a version of the same network trained only on natural examples, denoted $A _ { n a t }$ .
99
+ • Black-box attacks from a different convolution architecture, denoted B, described in Tramèr et al. (2017a).
100
+
101
+ MNIST. We run 40 iterations of projected gradient descent as our adversary, with a step size of 0.01 (we choose to take gradient steps in the $\ell _ { \infty }$ norm, i.e. adding the sign of the gradient, since this makes the choice of the step size simpler). We train and evaluate against perturbations of size $\varepsilon = 0 . 3$ We use a network consisting of two convolutional layers with 32 and 64 filters respectively, each followed by $2 \times 2$ max-pooling, and a fully connected layer of size 1024. When trained with natural examples, this network reaches $9 9 . 2 \%$ accuracy on the evaluation set. However, when evaluating on examples perturbed with FGSM the accuracy drops to $6 . 4 \%$ . Given that the resulting MNIST model is very robust, we investigated the learned parameters in order to understand how they affect adversarial robustness. The results of the investigation are presented in Appendix E.
102
+
103
+ CIFAR10. For the CIFAR10 dataset, we use the two architectures described in $\mathbf { B }$ (the original Resnet and its $1 0 \times$ wider variant). We trained the network against a PGD adversary with $\ell _ { \infty }$ projected
104
+
105
+ Table 1: MNIST: Performance of the adversarially trained network against different adversaries for $\varepsilon = 0 . 3$ . For each model of attack we show the most successful attack with bold. The source networks used for the attack are: the network itself (A) (white-box attack), an indepentenly initialized and trained copy of the network (A’), architecture B from Tramèr et al. (2017a) (B).
106
+
107
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Steps</td><td rowspan=1 colspan=1>Restarts</td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Natural</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>98.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>95.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>93.2%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>91.8%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>90.4%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>89.3%</td></tr><tr><td rowspan=1 colspan=1>Targeted</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>92.7%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>94.0%</td></tr><tr><td rowspan=1 colspan=1>CW+</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>93.9%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>96.8%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>96.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>95.7%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>97.0%</td></tr><tr><td rowspan=1 colspan=1>CW+</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>96.4%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>95.4%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>96.4%</td></tr><tr><td rowspan=1 colspan=1>CW+</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>95.7%</td></tr></table>
108
+
109
+ gradient descent again, this time using 7 steps of size 2, and a total $\varepsilon = 8$ . For our hardest adversary we chose 20 steps with the same settings, since other hyperparameter choices didn’t offer a significant decrease in accuracy. The results of our experiments appear in Table 2. The adversarial robustness of our network is significant, given the power of iterative adversaries, but still far from satisfactory. We believe that further progress is possible along these lines by understanding how adversarial training works and what techniques can complement it leading to robust models.
110
+
111
+ Table 2: CIFAR10: Performance of the adversarially trained network against different adversaries for $\varepsilon = 8$ . For each model of attack we show the most effective attack in bold. The source networks considered for the attack are: the network itself (A) (white-box attack), an independtly initialized and trained copy of the network (A’), a copy of the network trained on natural examples $( \mathrm { A } _ { n a t } )$ .
112
+
113
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Steps</td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Natural</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>87.3%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>56.1%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>50.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>45.8%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>46.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>67.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>64.2%</td></tr><tr><td rowspan=1 colspan=1>CW</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>78.7%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>Anat</td><td rowspan=1 colspan=1>85.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>Anat</td><td rowspan=1 colspan=1>86.0%</td></tr></table>
114
+
115
+ Resistance for different values of $\varepsilon$ and $\ell _ { 2 }$ -bounded attacks. In order to perform a broader evaluation of the adversarial robustness of our models, we run two kinds of additional experiments. On one hand, we investigate the resistance to $\ell _ { \infty }$ -bounded attacks for different values of $\varepsilon$ . On the other hand, we examine the resistance of our model to attacks that are bounded in $\ell _ { 2 }$ as opposed to $\ell _ { \infty }$ norm. The results appear in Figure 2. We emphasize that the models we are examining here correspond to training against $\ell _ { \infty }$ -bounded attacks with the original value of $\varepsilon = 0 . 3$ , for
116
+
117
+ MNIST, and $\varepsilon = 8$ for CIFAR10. In particular, our MNIST model retains significant resistance to $\ell _ { 2 }$ -norm-bounded perturbations too – it has good accuracy even for $\varepsilon = 4 . 5 . \mathrm { W e }$ provide a sample of corresponding adversarial examples in Figure 12 of Appendix F. One can observe that some of the underlying perturbations are large enough that even a human could be confused.
118
+
119
+ Training Accuracy. It is worth noting our MNIST and (wide) CIFAR10 networks reached $100 \%$ adversarial accuracy on the training set. That is we can fit the training set even against a PGD adversary of $\varepsilon = 0 . 3$ and $\varepsilon = 8$ respectively. This shows that the landscape of the underlying optimization problem is tractable and does not present a significant barrier to our techniques.
120
+
121
+ ![](images/3124475d5dd1494654fc4f747dacac62694871f28f9e36a1a8919210c5f08c89.jpg)
122
+ Figure 2: Performance of our adversarially trained networks against PGD adversaries of different strength. The MNIST and CIFAR10 networks were trained against $\varepsilon = 0 . 3$ and $\varepsilon = 8$ PGD $\ell _ { \infty }$ adversaries respectively (the training $\varepsilon$ is denoted with a red dashed lines in the $\ell _ { \infty }$ plots). We notice that for $\varepsilon$ less or equal to the value used during training, the performance is equal or better.
123
+
124
+ Running Time. Unfortunately, solving the robust version of the problem instead of the standard one imposes a significant computational overhead. Standard training requires one forward and one backward pass through the network for each training batch. Instead, adversarial training with a $k$ -step PGD adversary, requires additionally $k$ forward and $k$ backward passes through the network to compute the adversarial version of the training batch. This implies an increase in running time of a factor of $( k + 1 )$ . We hope that future research will propose ways to mitigate this drawback.
125
+
126
+ # 5 FIRST-ORDER ADVERSARIES.
127
+
128
+ Our exploration of the loss landscape (Appendix A) shows that the local maxima found by PGD all have similar loss values, both for normally trained networks and adversarially trained networks. This concentration phenomenon suggests an intriguing view on the problem in which robustness against the PGD adversary yields robustness against all first-order adversaries, i.e., attacks that rely only on first-order information. As long as the adversary only uses gradients of the loss function with respect to the input, we conjecture that it will not find significantly better local maxima than PGD. This hypothesis is validated by the experimental evidence provided in Section 4: if we train a network to be robust against PGD adversaries, it becomes robust against a wide range of other attacks as well.
129
+
130
+ Of course, our exploration with PGD does not preclude the existence of some isolated maxima with much larger function value. However, our experiments suggest that such better local maxima are hard to find with first order methods: even a large number of random restarts did not find function values with significantly different loss values (see Appendix A). Incorporating the computational power of the adversary into the threat model should be reminiscent of the notion of polynomially bounded adversary that is a cornerstone of modern cryptography. There, this classic threat model allows the adversary to only solve problems that require at most polynomial computation time. Here, we employ an optimization-based view on the power of the adversary as it is more suitable in the context of machine learning. After all, we have not yet developed a thorough understanding of the computational complexity of many recent machine learning problems. However, the vast majority of optimization problems in ML is solved with first-order methods, and variants of SGD are the most effective way of training deep learning models in particular. Hence we believe that the class of attacks relying on first-order information is, in some sense, universal for the current practice of deep learning.
131
+
132
+ Put together, these two ideas chart the way towards machine learning models with guaranteed robustness. If we train the network to be robust against PGD adversaries, it will be robust against a wide range of attacks that encompasses all current approaches.
133
+
134
+ In fact, this robustness guarantee would become even stronger in the context of transfer attacks, i.e., attacks in which the adversary does not have a direct access to the target network. Instead, the adversary only has less specific information such as the (rough) model architecture and the training data set. One can view this threat model as an example of “zero order” attacks, i.e., attacks in which the adversary has no direct access to the classifier and is only able to evaluate it on chosen examples without gradient feedback. Still, even for the case of zero-order attacks, the gradient of the network can be estimated using a finite differences method, rendering first-order attacks also relevant in this context.
135
+
136
+ We discuss transferability in Appendix D. We observe that increasing network capacity and strengthening the adversary we train against (FGSM or PGD training, rather than natural training) improves resistance against transfer attacks. Also, as expected, the resistance of our best models to such attacks tends to be significantly larger than to the (strongest) first order attacks.
137
+
138
+ # 6 RELATED WORK
139
+
140
+ Due to the growing body of work on adversarial examples in the context of deep learning networks (Gu & Rigazio, 2014; Fawzi et al., 2015; Torkamani, 2016; Papernot et al., 2016b; Carlini & Wagner, 2016a; Tramèr et al., 2017b; Goodfellow et al., 2014; Kurakin et al., 2016), we focus only on the most related papers here. Before we compare our contributions, we remark that robust optimization has been studied outside deep learning for multiple decades. We refer the reader to Ben-Tal et al. (2009) for an overview of this field.
141
+
142
+ To the best of our knowledge, in the context of adversarial examples, an explicit formulation of the min-max optimization first appeared in Huang et al. (2015), Shaham et al. (2015), and Lyu et al. (2015). All of these works, however, consider very weak adversaries/methods for solving the maximization problem, mainly relying on linearizing the loss and performing a single step, similar to FGSM. These adversaries do not capture the full range of possible attacks and thus training only against them leaves the resulting classifier vulnerable to more powerful, iterative attacks.
143
+
144
+ Recent work on adversarial training on ImageNet also observed that the model capacity is important for adversarial training Kurakin et al. (2016). However, their work was focused on FGSM attacks, since they report the iterative attacks are too expensive computationally and don’t provide any significant benefits. In contrast to that, we discover that for the datasets we considered training against iterative adversaries does result in a model that is robust against such adversaries.
145
+
146
+ A more recent paper (Tramèr et al., 2017b) also explores the transferability phenomenon. This exploration focuses mostly on the region around natural examples where the loss is (close to) linear. When large perturbations are allowed, this region does not give a complete picture of the adversarial landscape. This is confirmed by our experiments, as well as pointed out by Tramèr et al. (2017a).
147
+
148
+ Another recent paper (Tramèr et al., 2017a), considers adversarial training using black-box attacks from similar networks in order to increase the robustness of the network against such adversaries. However, this is not an effective defense against the white-box setting we consider, since a PGD adversary can reliably produce adversarial examples for such networks.
149
+
150
+ # 7 CONCLUSION
151
+
152
+ Our findings provide evidence that deep neural networks can be made resistant to adversarial attacks. As our theory and experiments indicate, we can design reliable adversarial training methods. One of the key insights behind this is the unexpectedly regular structure of the underlying optimization task: even though the relevant problem corresponds to the maximization of a highly non-concave function with many distinct local maxima, their values are highly concentrated. Overall, our findings give us hope that adversarially robust deep learning models may be within current reach.
153
+
154
+ For the MNIST dataset, our networks are very robust, achieving high accuracy for a wide range of powerful adversaries and large perturbations. Our experiments on CIFAR10 have not reached the same level of performance yet. However, our results already show that our techniques lead to significant increase in the robustness of the network. We believe that further exploring this direction will lead to adversarially robust networks for this dataset.
155
+
156
+ # ACKNOWLEDGMENTS
157
+
158
+ Aleksander M ˛adry, Aleksandar Makelov, and Dimitris Tsipras were supported by the NSF Grant No. 1553428, a Google Research Fellowship, and a Sloan Research Fellowship. Ludwig Schmidt was supported by a Google PhD Fellowship. Adrian Vladu was supported by the NSF Grants No. 1111109 and No. 1553428.
159
+
160
+ We thank Wojciech Matusik for kindly providing us with computing resources to perform this work.
161
+
162
+ # REFERENCES
163
+
164
+ Tensor flow models repository. https://github.com/tensorflow/models/tree/ master/resnet, 2017.
165
+ Aharon Ben-Tal, Laurent El Ghaoui, and Arkadi Nemirovski. Robust optimization. Princeton University Press, 2009.
166
+ Nicholas Carlini and David Wagner. Defensive distillation is not robust to adversarial examples. arXiv preprint arXiv:1607.04311, 2016a.
167
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. arXiv preprint arXiv:1608.04644, 2016b.
168
+ Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. arXiv preprint arXiv:1705.07263, 2017.
169
+ Nicholas Carlini, Guy Katz, Clark Barrett, and David L Dill. Ground-truth adversarial examples. arXiv preprint arXiv:1709.10207, 2017.
170
+ Nilesh Dalvi, Pedro Domingos, Mausam, Sumit Sanghai, and Deepak Verma. Adversarial classification. In International Conference on Knowledge Discovery and Data Mining (KDD), 2004.
171
+ Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Analysis of classifiers’ robustness to adversarial perturbations. arXiv preprint arXiv:1502.02590, 2015.
172
+ Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
173
+ Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
174
+ 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.
175
+ Warren He, James Wei, Xinyun Chen, Nicholas Carlini, and Dawn Song. Adversarial example defenses: Ensembles of weak defenses are not strong. arXiv preprint arXiv:1706.04701, 2017.
176
+ Ruitong Huang, Bing Xu, Dale Schuurmans, and Csaba Szepesvári. Learning with a strong adversary. arXiv preprint arXiv:1511.03034, 2015.
177
+ Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016.
178
+ Chunchuan Lyu, Kaizhu Huang, and Hai-Ning Liang. A unified gradient regularization family for adversarial examples. In Data Mining (ICDM), 2015 IEEE International Conference on, pp. 301–309. IEEE, 2015.
179
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: A simple and accurate method to fool deep neural networks. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 2574–2582, 2016.
180
+ Anh Mai Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2015, Boston, MA, USA, June 7-12, 2015, pp. 427–436, 2015.
181
+
182
+ Nicolas Papernot and Patrick D. McDaniel. On the effectiveness of defensive distillation. arXiv preprint arXiv:1607.05113, 2016.
183
+
184
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016a.
185
+
186
+ Nicolas Papernot, Patrick D. McDaniel, Somesh Jha, Matt Fredrikson, Z. Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In IEEE European Symposium on Security and Privacy, EuroS&P 2016, Saarbrücken, Germany, March 21-24, 2016, pp. 372–387, 2016b.
187
+
188
+ Andras Rozsa, Manuel Günther, and Terrance E. Boult. Towards robust deep neural networks with BANG. arXiv preprint arXiv:1612.00138, 2016.
189
+
190
+ Uri Shaham, Yutaro Yamada, and Sahand Negahban. Understanding adversarial training: Increasing local stability of neural nets through robust optimization. arXiv preprint arXiv:1511.05432, 2015.
191
+
192
+ Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K. Reiter. Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, October 24-28, 2016, pp. 1528–1540, 2016.
193
+
194
+ Jure Sokolic, Raja Giryes, Guillermo Sapiro, and Miguel RD Rodrigues. Robust large margin deep neural networks. arXiv preprint arXiv:1605.08254, 2016.
195
+
196
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
197
+
198
+ MohamadAli Torkamani. Robust Large Margin Approaches for Machine Learning in Adversarial Settings. PhD thesis, University of Oregon, 2016.
199
+
200
+ Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick D. McDaniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017a.
201
+
202
+ Florian Tramèr, Nicolas Papernot, Ian J. Goodfellow, Dan Boneh, and Patrick D. McDaniel. The space of transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017b. URL http://arxiv.org/abs/1704.03453.
203
+
204
+ Abraham Wald. Contributions to the theory of statistical estimation and testing hypotheses. The Annals of Mathematical Statistics, 10(4):299–326, 1939.
205
+
206
+ Abraham Wald. Statistical decision functions which minimize the maximum risk. Annals of Mathematics, pp. 265–280, 1945.
207
+
208
+ Abraham Wald. Statistical decision functions. In Breakthroughs in Statistics, pp. 342–357. Springer, 1992.
209
+
210
+ Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. arXiv preprint arXiv:1704.01155, 2017.
211
+
212
+ # A THE LANDSCAPE OF ADVERSARIAL EXAMPLES
213
+
214
+ The inner problem of the saddle point formulation (2.1) corresponds to finding an adversarial example for a given network and data point (subject to our attack model). As this problem requires us to maximize a highly non-concave function, one would expect it to be intractable. Indeed, this is the conclusion reached by prior work which then resorted to linearizing the inner maximization problem (Huang et al., 2015; Shaham et al., 2015). As pointed out above, this linearization approach yields well-known methods such as FGSM. While training against FGSM adversaries has shown some successes, recent work also highlights important shortcomings of this one-step approach (Tramèr et al., 2017a).
215
+
216
+ To understand the inner problem in more detail, we investigate the landscape of local maxima for multiple models on MNIST and CIFAR10. The main tool in our experiments is projected gradient descent (PGD), since it is the standard method for large-scale constrained optimization. In order to explore a large part of the loss landscape, we re-start PGD from many points in the $\ell _ { \infty }$ balls around data points from the respective evaluation sets.
217
+
218
+ Surprisingly, our experiments show that the inner problem is tractable after all, at least from the perspective of first-order methods. While there are many local maxima spread widely apart within $x _ { i } + \mathcal { S }$ , they tend to have very well-concentrated loss values. This echoes the folklore belief that training neural networks is possible because the loss (as a function of model parameters) typically has many local minima with very similar values.
219
+
220
+ Specifically, in our experiments we found the following phenomena:
221
+
222
+ • We observe that the loss achieved by the adversary increases in a fairly consistent way and plateaus rapidly when performing projected $\ell _ { \infty }$ gradient descent for randomly chosen starting points inside $x + { \mathcal { S } }$ (see Figure 3).
223
+
224
+ ![](images/93e7d012fbb3e52f3c0dbba80dccb025773446a7bbb9d5419dcd308da9993280.jpg)
225
+ Figure 3: Cross-entropy loss values while creating an adversarial example from the MNIST and CIFAR10 evaluation datasets. The plots show how the loss evolves during 20 runs of projected gradient descent (PGD). Each run starts at a uniformly random point in the $\ell _ { \infty }$ -ball around the same natural example (additional plots for different examples appear in Figure 11). The adversarial loss plateaus after a small number of iterations. The optimization trajectories and final loss values are also fairly clustered, especially on CIFAR10. Moreover, the final loss values on adversarially trained networks are significantly smaller than on their naturally trained counterparts.
226
+
227
+ • Investigating the concentration of maxima further, we observe that over a large number of random restarts, the loss of the final iterate follows a well-concentrated distribution without extreme outliers (see Figure 4; we verified this concentration based on $1 0 ^ { 5 }$ restarts). To demonstrate that maxima are noticeably distinct, we also measured the $\ell _ { 2 }$ distance and angles between all pairs of them and observed that distances are distributed close to the expected distance between two random points in the $\ell _ { \infty }$ ball, and angles are close to $9 0 °$ . Along the line segment between local maxima, the loss is convex, attaining its maximum at the endpoints and is reduced by a constant factor in the middle. Nevertheless, for the entire segment, the loss is considerably higher than that of a random point.
228
+ • Finally, we observe that the distribution of maxima suggests that the recently developed subspace view of adversarial examples is not fully capturing the richness of attacks (Tramèr et al., 2017b). In particular, we observe adversarial perturbations with negative inner product with the gradient
229
+
230
+ ![](images/1dadd46a427e0c9b9ea40096cdc1895b05fc9376f15cca7def88e3d2c9cee894.jpg)
231
+ Figure 4: Values of the local maxima given by the cross-entropy loss for five examples from the MNIST and CIFAR10 evaluation datasets. For each example, we start projected gradient descent (PGD) from $1 0 ^ { 5 }$ uniformly random points in the $\ell _ { \infty }$ -ball around the example and iterate PGD until the loss plateaus. The blue histogram corresponds to the loss on a naturally trained network, while the red histogram corresponds to the adversarially trained counterpart. The loss is significantly smaller for the adversarially trained networks, and the final loss values are very concentrated without any outliers.
232
+
233
+ of the example, and deteriorating overall correlation with the gradient direction as the scale of perturbation increases.
234
+
235
+ # B NETWORK CAPACITY AND ADVERSARIAL ROBUSTNESS
236
+
237
+ For a fixed set $s$ of possible perturbations, the value of the problem (2.1) is entirely dependent on the architecture of the classifier we are learning. Consequently, the architectural capacity of the model becomes a major factor affecting its overall performance. At a high level, classifying examples in a robust way requires a stronger classifier, since the presence of adversarial examples changes the decision boundary of the problem to a more complicated one (see Figure 5 for an illustration).
238
+
239
+ ![](images/36cb97ed8caa3c7d3fc12935fe9787ee1cacab53006e77dd7c59f923132ee179.jpg)
240
+ Figure 5: A conceptual illustration of “natural” vs. “adversarial” decision boundaries. Left: A set of points that can be easily separated with a simple (in this case, linear) decision boundary. Middle: The simple decision boundary does not separate the $\ell _ { \infty }$ -balls (here, squares) around the data points. Hence there are adversarial examples (the red stars) that will be misclassified. Right: Separating the $\ell _ { \infty }$ -balls requires a significantly more complicated decision boundary. The resulting classifier is robust to adversarial examples with bounded $\ell _ { \infty }$ -norm perturbations.
241
+
242
+ Our experiments verify that capacity is crucial for robustness, as well as for the ability to successfully train against strong adversaries. For the MNIST dataset, we consider a simple convolutional network and study how its behavior changes against different adversaries as we keep doubling the size of network (i.e. double the number of convolutional filters and the size of the fully connected layer). The initial network has a convolutional layer with 2 filters, followed by another convolutional layer with 4 filters, and a fully connected hidden layer with 64 units. Convolutional layers are followed by $2 \times 2$ max-pooling layers and adversarial examples are constructed with $\varepsilon = 0 . 3$ . The results are in Figure 6.
243
+
244
+ For the CIFAR10 dataset, we used the Resnet model He et al. (2016); TFM (2017). We performed data augmentation using random crops and flips, as well as per image standarization. To increase the capacity, we modified the network incorporating wider layers by a factor of 10. This results in a network with 5 residual units with (16, 160, 320, 640) filters each. This network can achieve an accuracy of $9 5 . 2 \%$ when trained with natural examples. Adversarial examples were constructed with $\varepsilon = 8$ . Results on capacity experiments appear in Figure 6.
245
+
246
+ We observe the following phenomena:
247
+
248
+ Capacity alone helps. We observe that increasing the capacity of the network when training using only natural examples (apart from increasing accuracy on these examples) increases the robustness against one-step perturbations. This effect is greater when considering adversarial examples with smaller $\varepsilon$ .
249
+
250
+ FGSM adversaries don’t increase robustness (for large $\varepsilon$ ). When training the network using adversarial examples generated with the FGSM, we observe that the network overfits to these adversarial examples. This behavior is known as label leaking Kurakin et al. (2016) and stems from the fact that the adversary produces a very restricted set of adversarial examples that the network can overfit to. These networks have poor performance on natural examples and don’t exhibit any kind of robustness against PGD adversaries. For the case of smaller $\varepsilon$ the loss is ofter linear enough in the $\ell _ { \infty }$ ball around natural examples, that FGSM finds adversarial examples close to those found by PGD thus being a reasonable adversary to train against.
251
+
252
+ Weak models may fail to learn non-trivial classifiers. In the case of small capacity networks, attempting to train against a strong adversary (PGD) prevents the network from learning anything meaningful. The network converges to always predicting a fixed class, even though it could converge to an accurate classifier through natural training. The small capacity of the network forces the training procedure to sacrifice performance on natural examples in order to provide any kind of robustness against adversarial inputs.
253
+
254
+ The value of the saddle point problem decreases as we increase the capacity. Fixing an adversary model, and training against it, the value of (2.1) drops as capacity increases, indicating the the model can fit the adversarial examples increasingly well.
255
+
256
+ More capacity and stronger adversaries decrease transferability. Either increasing the capacity of the network, or using a stronger method for the inner optimization problem reduces the effectiveness of transferred adversarial inputs. We validate this experimentally by observing that the correlation between gradients from the source and the transfer network, becomes less significant as capacity increases. We describe our experiments in Appendix D.
257
+
258
+ # C STATEMENT AND APPLICATION OF DANSKIN’S THEOREM
259
+
260
+ Recall that our goal is to minimize the value of the saddle point problem
261
+
262
+ $$
263
+ \operatorname* { m i n } _ { \theta } \rho ( \theta ) , \quad \mathrm { w h e r e } \quad \rho ( \theta ) = \mathbb { E } _ { ( x , y ) \sim \mathcal { D } } \left[ \operatorname* { m a x } _ { \delta \in \mathcal { S } } L ( \theta , x + \delta , y ) \right] \ .
264
+ $$
265
+
266
+ In practice, we don’t have access to the distribution $\mathcal { D }$ so both the gradients and the value of $\rho ( \theta )$ will be computed using sampled input points. Therefore we can consider –without loss of generality– the case of a single random example $x$ with label $y$ , in which case the problem becomes
267
+
268
+ $$
269
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \delta \in S } g ( \theta , \delta ) , \quad \mathrm { w h e r e } \quad g ( \theta , \delta ) = L ( \theta , x + \delta , y ) ~ .
270
+ $$
271
+
272
+ If we assume that the loss $L$ is continuously differentiable in $\theta$ , we can compute a descent direction for $\theta$ by utilizing the classical theorem of Danskin.
273
+
274
+ ![](images/232804b3b40c8cdf3b08b55474656181ec7e923bdcc45127f2416fa3bd074d9c.jpg)
275
+
276
+ Figure 6: The effect of network capacity on the performance of the network. We trained MNIST and CIFAR10 networks of varying capacity on: (a) natural examples, (b) with FGSM-made adversarial examples, (c) with PGD-made adversarial examples. In the first three plots/tables of each dataset, we show how the natural and adversarial accuracy changes with respect to capacity for each training regime. In the final plot/table, we show the value of the cross-entropy loss on the adversarial examples the networks were trained on. This corresponds to the value of our saddle point formulation (2.1) for different sets of allowed perturbations.
277
+
278
+ Theorem C.1 (Danskin). Let $s$ be nonempty compact topological space and $g : \mathbb { R } ^ { n } \times S \mathbb { R }$ be such that $g ( \cdot , \delta )$ is differentiable for every $\delta \in S$ and $\nabla _ { \boldsymbol { \theta } } g ( \boldsymbol { \theta } , \boldsymbol { \delta } )$ is continuous on $\mathbb { R } ^ { n } \times S$ . Also, let $\delta ^ { * } ( \theta ) = \{ \delta \in \arg \operatorname* { m a x } _ { \delta \in { \mathcal { S } } } g ( \theta , \delta ) \}$ .
279
+
280
+ Then the corresponding max-function
281
+
282
+ $$
283
+ \phi ( \theta ) = \operatorname* { m a x } _ { \delta \in { \mathcal { S } } } g ( \theta , \delta )
284
+ $$
285
+
286
+ is locally Lipschitz continuous, directionally differentiable, and its directional derivatives satisfy
287
+
288
+ $$
289
+ \phi ^ { \prime } ( \theta , h ) = \operatorname* { s u p } _ { \delta \in \delta ^ { * } ( \theta ) } h ^ { \top } \nabla _ { \theta } g ( \theta , \delta ) .
290
+ $$
291
+
292
+ In particular, if for some $\theta \in \mathbb { R } ^ { n }$ the set $\delta ^ { * } ( \theta ) = \{ \delta _ { \theta } ^ { * } \}$ is a singleton, the the max-function is differentiable at $\theta$ and
293
+
294
+ $$
295
+ \nabla \phi ( \theta ) = \nabla _ { \theta } g ( \theta , \delta _ { \theta } ^ { * } ) .
296
+ $$
297
+
298
+ The intution behind the theorem is that since gradients are local objects, and the function $\phi ( \theta )$ is locally the same as $g ( \theta , \delta _ { \theta } ^ { * } )$ their gradients will be the same. The theorem immediately gives us the following corollary, stating the we can indeed compute gradients for the saddle point by computing gradients at the inner optimizers.
299
+
300
+ Corollary C.2. Let $\overline { { \delta } }$ be such that $\bar { \delta } \in \mathcal { S }$ and is a maximizer for maxδ $L ( \theta , x + \delta , y )$ . Then, as long as it is nonzero, $- \nabla _ { \boldsymbol { \theta } } L ( \boldsymbol { \theta } , \boldsymbol { x } + \overline { { \boldsymbol { \delta } } } , y )$ is a descent direction for $\phi ( \theta ) = \mathrm { m a x } _ { \delta \in { \cal S } } { \cal L } ( \theta , x + \delta , y )$ .
301
+
302
+ Proof of Corollary C.2. We apply Theorem C.1 to $g ( \theta , \delta ) : = L ( \theta , x + \delta , y )$ and $S = B _ { \parallel \cdot \parallel } ( \varepsilon )$ . We see that the directional derivative in the direction of $h = \nabla _ { \boldsymbol { \theta } } L ( \boldsymbol { \theta } , x + \overline { { \boldsymbol { \delta } } } , y )$ satisfies
303
+
304
+ $$
305
+ \phi ^ { \prime } ( \theta , h ) = \operatorname* { s u p } _ { \delta \in \delta ^ { * } ( \theta ) } h ^ { \top } \nabla _ { \theta } L ( \theta , x + \delta , y ) \geq h ^ { \top } h = \| \nabla _ { \theta } L ( \theta , x + \bar { \delta } , y ) \| _ { 2 } ^ { 2 } \geq 0 .
306
+ $$
307
+
308
+ If this gradient is nonzero, then the inequality above is strict. Therefore it gives a descent direction.
309
+
310
+ A technical issue is that, since we use ReLU and max-pooling units in our neural network architecture, the loss function is not continuously differentiable. Nevertheless, since the set of discontinuities has measure zero, we can assume that this will not be an issue in practice, as we will never encounter the problematic points.
311
+
312
+ Another technical issue is that, due to the not concavity of the inner problem, we are not able to compute global maximizers, since PGD will converge to local maxima. In such cases, we can consider a subset $S ^ { \prime }$ of $s$ such that the local maximum is a global maximum in the region $S ^ { \prime }$ . Applying the theorem for $S ^ { \prime }$ gives us that the gradient corresponds to a descent direction for the saddle point problem when the adversary is constrained in $S ^ { \prime }$ . Therefore if the inner maximum is a true adversarial example for the network, then SGD using the gradient at that point will decrease the loss value at this particular adversarial examples, thus making progress towards a robust model.
313
+
314
+ These arguments suggest that the conclusions of the theorem are still valid in our saddle point problem, and –as our experiments confirm– we can solve it reliably.
315
+
316
+ # D TRANSFERABILITY
317
+
318
+ A lot of recent literature on adversarial training discusses the phenomenon of transferability Goodfellow et al. (2014); Kurakin et al. (2016); Tramèr et al. (2017b), i.e. adversarial examples transfer between differently trained networks. This raises concerns for practical applications, since it suggests that deep networks are extremely vulnerable to attacks, even when there is no direct access to the target network.
319
+
320
+ This phenomenon is further confirmed by our current experiments. 4 Moreover, we notice that the extent to which adversarial examples transfer decreases as we increase either network capacity or the power of the adversary used for training the network. This serves as evidence for the fact that the transferability phenomenon can be alleviated by using high capacity networks in conjunction with strong oracles for the inner optimization problem.
321
+
322
+ MNIST. In an attempt to understand these phenomena we inspect the loss functions corresponding to the trained models we used for testing transferability. More precisely, we compute angles between gradients of the loss functions evaluated over a large set of input examples, and plot their distribution. Similarly, we plot the value of the loss functions between clean and perturbed examples for both the source and transfer networks. In Figure 8 we plot our experimental findings on the MNIST dataset for $\varepsilon = 0 . 3$ . We consider a naturally trained large network (two convolutional layers of sizes 32 and 64, and a fully connected layer of size 1024), which we train twice starting with different initializations. We plot the distribution of angles between gradients for the same test image in the two resulting networks (orange histograms), noting that they are somewhat correlated. As opposed to this, we see that pairs of gradients for random pairs of inputs for one architecture are as uncorrelated as they can be (blue histograms), since the distribution of their angles looks Gaussian.
323
+
324
+ Next, we run the same experiment on a naturally trained very large network (two convolutional layers of sizes 64 and 128, and a fully connected layer of size 1024). We notice a mild increase in classification accuracy for transferred examples.
325
+
326
+ Finally, we repeat the same set of experiments, after training the large and very large networks against the FGSM adversary. We notice that gradients between the two architectures become significantly less correlated. Also, the classification accuracy for transferred examples increases significantly compared to the naturally trained networks.
327
+
328
+ We further plot how the value of the loss function changes when moving from the natural input towards the adversarially perturbed input (in Figure 8 we show these plots for four images in the MNIST test dataset), for each pair of networks we considered. We observe that, while for the naturally trained networks, when moving towards the perturbed point, the value of the loss function on the transfer architecture tends to start increasing soon after it starts increasing on the source architecture. In contrast, for the stronger models, the loss function on the transfer network tends to start increasing later, and less aggressively.
329
+
330
+ CIFAR10. For the CIFAR10 dataset, we investigate the transferability of the FGSM and PGD adversaries between our simple and wide architectures, each trained on natural, FGSM and PGD examples. Transfer accuracies for the FGSM adversary and PGD adversary between all pairs of such configurations (model $^ +$ training method) with independently random weight initialization are given in tables 3 and 4 respectively. The results exhibit the following trends:
331
+
332
+ • Stronger adversaries decrease transferability: In particular, transfer attacks between two PGD-trained models are less successful than transfer attacks between their naturally-trained counterparts. Moreover, adding PGD training helps with transferability from all adversarial datasets, except for those with source a PGD-trained model themselves. This applies to both FGSM attacks and PGD attacks. Capacity decreases transferability: In particular, transfer attacks between two PGDtrained wide networks are less successful than transfer attacks between their simple PGDtrained counterparts. Moreover, with few close exceptions, changing the architecture from simple to wide (and keeping the training method the same) helps with transferability from all adversarial datasets.
333
+
334
+ We additionally plotted how the loss of a network behaves in the direction of FGSM and PGD examples obtained from itself and an independently trained copy; results for the simple naturally trained network and the wide PGD trained network are given in Table 7. As expected, we observe the following phenomena:
335
+
336
+ • sometimes, the FGSM adversary manages to increase loss faster near the natural example, but as we move towards the boundary of the $\ell _ { \infty }$ box of radius $\varepsilon$ , the PGD attack always achieves higher loss.
337
+ • the transferred attacks do worse than their white-box counterparts in terms of increasing the loss;
338
+ • and yet, the transferred PGD attacks dominate the white-box FGSM attacks for the naturally trained network (and sometimes for the PGD-trained one too).
339
+
340
+ Table 3: CIFAR10: black-box FGSM attacks. We create FGSM adversarial examples with $\varepsilon = 8$ from the evaluation set on the source network, and then evaluate them on an independently initialized target network.
341
+
342
+ <table><tr><td rowspan=1 colspan=1>SourceTarget</td><td rowspan=1 colspan=1>Simple(naturaltraining)</td><td rowspan=1 colspan=1>Simple(FGSMtraining)</td><td rowspan=1 colspan=1>Simple(PGDtraining)</td><td rowspan=1 colspan=1>Wide(naturaltraining)</td><td rowspan=1 colspan=1>Wide(FGSMtraining)</td><td rowspan=1 colspan=1>Wide(PGDtraining)</td></tr><tr><td rowspan=1 colspan=1>Simple(natural training)</td><td rowspan=1 colspan=1>32.9%</td><td rowspan=1 colspan=1>74.0%</td><td rowspan=1 colspan=1>73.7%</td><td rowspan=1 colspan=1>27.6%</td><td rowspan=1 colspan=1>71.8%</td><td rowspan=1 colspan=1>76.6%</td></tr><tr><td rowspan=1 colspan=1>Simple(FGSM training)</td><td rowspan=1 colspan=1>64.2%</td><td rowspan=1 colspan=1>90.7%</td><td rowspan=1 colspan=1>60.9%</td><td rowspan=1 colspan=1>61.5%</td><td rowspan=1 colspan=1>90.2%</td><td rowspan=1 colspan=1>67.3%</td></tr><tr><td rowspan=1 colspan=1>Simple(PGD training)</td><td rowspan=1 colspan=1>77.1%</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>60.2%</td><td rowspan=1 colspan=1>77.0%</td><td rowspan=1 colspan=1>77.9%</td><td rowspan=1 colspan=1>66.3%</td></tr><tr><td rowspan=1 colspan=1>Wide(natural training)</td><td rowspan=1 colspan=1>34.9%</td><td rowspan=1 colspan=1>78.7%</td><td rowspan=1 colspan=1>80.2%</td><td rowspan=1 colspan=1>21.3%</td><td rowspan=1 colspan=1>75.8%</td><td rowspan=1 colspan=1>80.6%</td></tr><tr><td rowspan=1 colspan=1>Wide(FGSM training)</td><td rowspan=1 colspan=1>64.5%</td><td rowspan=1 colspan=1>93.6%</td><td rowspan=1 colspan=1>69.1%</td><td rowspan=1 colspan=1>53.7%</td><td rowspan=1 colspan=1>92.2%</td><td rowspan=1 colspan=1>72.8%</td></tr><tr><td rowspan=1 colspan=1>Wide(PGD training)</td><td rowspan=1 colspan=1>85.8%</td><td rowspan=1 colspan=1>86.6%</td><td rowspan=1 colspan=1>73.3%</td><td rowspan=1 colspan=1>85.6%</td><td rowspan=1 colspan=1>86.2%</td><td rowspan=1 colspan=1>67.0%</td></tr></table>
343
+
344
+ Table 4: CIFAR10: black-box PGD attacks. We create PGD adversarial examples with $\varepsilon = 8$ for 7 iterations from the evaluation set on the source network, and then evaluate them on an independently initialized target network.
345
+
346
+ <table><tr><td rowspan=1 colspan=1>SourceTarget</td><td rowspan=1 colspan=1>Simple(naturaltraining)</td><td rowspan=1 colspan=1>Simple(FGSMtraining)</td><td rowspan=1 colspan=1>Simple(PGDtraining)</td><td rowspan=1 colspan=1>Wide(naturaltraining)</td><td rowspan=1 colspan=1>Wide(FGSMtraining)</td><td rowspan=1 colspan=1>Wide(PGDtraining)</td></tr><tr><td rowspan=1 colspan=1>Simple(natural training)</td><td rowspan=1 colspan=1>6.6%</td><td rowspan=1 colspan=1>71.6%</td><td rowspan=1 colspan=1>71.8%</td><td rowspan=1 colspan=1>1.4%</td><td rowspan=1 colspan=1>51.4%</td><td rowspan=1 colspan=1>75.6%</td></tr><tr><td rowspan=1 colspan=1>Simple(FGSM training)</td><td rowspan=1 colspan=1>66.3%</td><td rowspan=1 colspan=1>40.3%</td><td rowspan=1 colspan=1>58.4%</td><td rowspan=1 colspan=1>65.4%</td><td rowspan=1 colspan=1>26.8%</td><td rowspan=1 colspan=1>66.2%</td></tr><tr><td rowspan=1 colspan=1>Simple(PGD training)</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>78.2%</td><td rowspan=1 colspan=1>57.7%</td><td rowspan=1 colspan=1>77.9%</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>65.2%</td></tr><tr><td rowspan=1 colspan=1>Wide(natural training)</td><td rowspan=1 colspan=1>10.9%</td><td rowspan=1 colspan=1>79.6%</td><td rowspan=1 colspan=1>79.1%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>51.3%</td><td rowspan=1 colspan=1>79.7%</td></tr><tr><td rowspan=1 colspan=1>Wide(FGSM training)</td><td rowspan=1 colspan=1>67.6%</td><td rowspan=1 colspan=1>51.7%</td><td rowspan=1 colspan=1>67.4%</td><td rowspan=1 colspan=1>56.5%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>71.6%</td></tr><tr><td rowspan=1 colspan=1>Wide(PGD training)</td><td rowspan=1 colspan=1>86.4%</td><td rowspan=1 colspan=1>86.8%</td><td rowspan=1 colspan=1>72.1%</td><td rowspan=1 colspan=1>86.0%</td><td rowspan=1 colspan=1>86.3%</td><td rowspan=1 colspan=1>64.2%</td></tr></table>
347
+
348
+ Table 5: CIFAR10: white-box attacks for $\varepsilon = 8$ . For each architecture and training method, we list the accuracy of the resulting network on the full CIFAR10 evaluation set of 10,000 examples. The FGSM random method is the one suggested by Tramèr et al. (2017a), whereby we first do a small random perturbation of the natural example, and the apply FGSM to that.
349
+
350
+ <table><tr><td rowspan=1 colspan=1>AdversaryModel</td><td rowspan=1 colspan=1>Natural</td><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>FGSM random|PGD (7 steps)</td><td rowspan=1 colspan=1>FGSM random|PGD (7 steps)</td><td rowspan=1 colspan=1>PGD (20 steps)</td></tr><tr><td rowspan=1 colspan=1>Simple(natural training)</td><td rowspan=1 colspan=1>92.7%</td><td rowspan=1 colspan=1>27.5%</td><td rowspan=1 colspan=1>19.6%</td><td rowspan=1 colspan=1>1.2%</td><td rowspan=1 colspan=1>0.8%</td></tr><tr><td rowspan=1 colspan=1>Simple(FGSM training)</td><td rowspan=1 colspan=1>87.4%</td><td rowspan=1 colspan=1>90.9%</td><td rowspan=1 colspan=1>90.4%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>0.0%</td></tr><tr><td rowspan=1 colspan=1>Simple(PGD training)</td><td rowspan=1 colspan=1>79.4%</td><td rowspan=1 colspan=1>51.7%</td><td rowspan=1 colspan=1>55.9%</td><td rowspan=1 colspan=1>47.1%</td><td rowspan=1 colspan=1>43.7%</td></tr><tr><td rowspan=1 colspan=1>Wide(natural training)</td><td rowspan=1 colspan=1>95.2%</td><td rowspan=1 colspan=1>32.7%</td><td rowspan=1 colspan=1>25.1%</td><td rowspan=1 colspan=1>4.1%</td><td rowspan=1 colspan=1>3.5%</td></tr><tr><td rowspan=1 colspan=1>Wide(FGSM training)</td><td rowspan=1 colspan=1>90.3%</td><td rowspan=1 colspan=1>95.1%</td><td rowspan=1 colspan=1>95.0%</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>0.0%</td></tr><tr><td rowspan=1 colspan=1>Wide(PGD training)</td><td rowspan=1 colspan=1>87.3%</td><td rowspan=1 colspan=1>56.1%</td><td rowspan=1 colspan=1>60.3%</td><td rowspan=1 colspan=1>50.0%</td><td rowspan=1 colspan=1>45.8%</td></tr></table>
351
+
352
+ ![](images/30f9a4cfeaff5640e9040aba4d1d44dd69632bc9c1ef5b25bdddfc385e319972.jpg)
353
+ Figure 7: CIFAR10: change of loss function in the direction of white-box and black-box FGSM and PGD examples with $\varepsilon = 8$ for the same five natural examples. Each line shows how the loss changes as we move from the natural example to the corresponding adversarial example. Top: simple naturally trained model. Bottom: wide PGD trained model. We plot the loss of the original network in the direction of the FGSM example for the original network (red lines), 5 PGD examples for the original network obtained from 5 random starting points (blue lines), the FGSM example for an independently trained copy network (green lines) and 5 PGD examples for the copy network obtained from 5 random starting points (black lines). All PGD attacks use 100 steps with step size 0.3.
354
+
355
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>99.2%</td><td rowspan=1 colspan=1>99.2%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>3.9%</td><td rowspan=1 colspan=1>41.9%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>26.0%</td></tr></table>
356
+
357
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>92.9%</td><td rowspan=1 colspan=1>96.1%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>99.9%</td><td rowspan=1 colspan=1>62.0%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>54.1%</td></tr></table>
358
+
359
+ Large network, FGSM training
360
+
361
+ Very large network, natural training
362
+
363
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>99.2%</td><td rowspan=1 colspan=1>99.3%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>7.2%</td><td rowspan=1 colspan=1>44.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>35.0%</td></tr></table>
364
+
365
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Transfer</td></tr><tr><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>96.4%</td><td rowspan=1 colspan=1>97.8%</td></tr><tr><td rowspan=1 colspan=1>FGSM</td><td rowspan=1 colspan=1>99.4%</td><td rowspan=1 colspan=1>71.6%</td></tr><tr><td rowspan=1 colspan=1>PGD</td><td rowspan=1 colspan=1>0.0%</td><td rowspan=1 colspan=1>60.6%</td></tr></table>
366
+
367
+ ![](images/cf4496228e3128a1ca678c430d22bf5104058b8333c15791c811be049900538e.jpg)
368
+ Figure 8: Transferability experiments for four different instances (naturally trained large and very large networks, and FGSM-trained large and very large networks, respectively). For each instance we ran the same training algorithm twice, starting from different initializations. Tables on the left show the accuracy of the networks against three types of input (clean, perturbed with FGSM, perturbed with PGD ran for 40 steps); the first column shows the resilience of the first network against examples produced using its own gradients, the second column shows resilience of the second network against examples transferred from the former network. The histograms reflect angles between pairs of gradients corresponding to the same inputs versus the baseline consisting of angles between gradients from random pairs of points. Images on the right hand side reflect how the loss functions of the native and the transfer network change when moving in the direction of the perturbation; the perturbation is at 1 on the horizontal axis. Plots in the top row are for FGSM perturbations, plots in the bottom row are for PGD perturbations produced over 40 iterations.
369
+
370
+ Very large network, FGSM training
371
+
372
+ Large network, natural training
373
+
374
+ # E MNIST INSPECTION
375
+
376
+ The robust MNIST model described so far is small enough that we can visually inspect most of its parameters. Doing so will allow us to understand how it is different from a naturally trained variant and what are the general characteristics of a network that is robust against $\ell _ { \infty }$ adversaries. We will compare three different networks: a naturally trained model, and two adversarially trained ones. The latter two models are identical, modulo the random weight initialization, and were used as the public and secret models used for our robustness challenge.
377
+
378
+ Initially, we examine the first convolutional layer of each network. We observe that the robust models only utilize 3 out of the total 32 filters, and for each of these filters only one weight is non-zero. By doing so, the convolution degrades into a scaling of the original image. Combined with the bias and the ReLU that follows, this results in a thresholding filter, or equivalently $\mathrm { R e L U } ( \alpha x - \beta )$ for some constants $\alpha$ , $\beta$ . From the perspective of adversarial robustness, thresholding filters are immune to any perturbations on pixels with value less than $\beta - \varepsilon$ . We visualize a sample of the filters in Figure 9 (plots a, c, and e).
379
+
380
+ Having observed that the first layer of the network essentially maps the original image to three copies thresholded at different values, we examine the second convolutional layer of the classifier. Again, the filter weights are relatively sparse and have a significantly wider value range than the naturally trained version. Since only three channels coming out of the first layer matter, is follows (and is verified) that the only relevant convolutional filters are those that interact with these three channels. We visualize a sample of the filters in Figure 9 (plots b, d, and f).
381
+
382
+ Finally, we examine the softmax/output layer of the network. While the weights seem to be roughly similar between all three version of the network, we notice a significant difference in the class biases. The adversarially trained networks heavily utilize class biases (far from uniform), and do so in a way very similar to each other. A plausible explanation is that certain classes tend to be very vulnerable to adversarial perturbations, and the network learns to be more conservative in predicting them. The plots can be found in Figure 10.
383
+
384
+ All of the “tricks” described so far seem intuitive to a human and would seem reasonable directions when trying to increase the adversarial robustness of a classifier. We emphasize the none of these modifications were hard-coded in any way and they were all learned solely through adversarial training. We attempted to manually introduce these modifications ourselves, aiming to achieve adversarial robustness without adversarial training, but with no success. A simple PGD adversary could fool the resulting models on all the test set examples.
385
+
386
+ ![](images/dbb24eb20cc9bd4cc699d6f4ecde36d76e21e1c5e2052afbfde1a72e5f2142fd.jpg)
387
+ (a) Natural Model First Conv. Layers
388
+ (b) Natural Model Second Conv. Layer
389
+ Figure 9: Visualizing a sample of the convolutional filters. For the natural model (a,b) we visualize random filters, since there is no observable difference in any of them. For the first layer of robust networks we make sure to include the 3 non-zero filters. For the second layer, the first three columns represent convolutional filters that utilize the 3 non-zero channels, and we choose the most interesting ones (larger range of values). We observe that adversarially trained networks have significantly more concentrated weights. Moreover, the first convolutional layer degrades into a few thresholding filters.
390
+
391
+ ![](images/6f841cf01e7dc83fd47f6373870734999b53027be5d1ea987b391f3714b84b72.jpg)
392
+ Figure 10: Softmax layer examination. For each network we create a histogram of the layer’s weights and plot the per-class bias. We observe that while weights are similar (slightly more concentrated for the natural one) the biases are far from uniform and with a similar pattern for the two adversarially trained networks.
393
+
394
+ ![](images/295347f2615bff0e6df31523308b6b1bb94a5000099b40e452b41e350d5cfd16.jpg)
395
+ Figure 11: Loss function value over PGD iterations for 20 random restarts on random examples. The 1st and 3rd rows correspond to naturally trained networks, while the 2nd and 4th to adversarially trained ones.
396
+
397
+ ![](images/0bfe21b4b9afda97427b514d2b2a7e30677152063b0166fe480a55437d899283.jpg)
398
+ Figure 12: Sample adversarial examples with $\ell _ { 2 }$ norm bounded by 4. The perturbations are significant enough to cause misclassification by humans too.
md/train/rkQkBnJAb/rkQkBnJAb.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING GANS USING OPTIMAL TRANSPORT
2
+
3
+ Tim Salimans∗ OpenAI tim@openai.com
4
+
5
+ Han Zhang∗†
6
+ Rutgers University
7
+ han.zhang@cs.rutgers.edu
8
+
9
+ Alec Radford OpenAI alec@openai.com
10
+
11
+ Dimitris Metaxas Rutgers University dnm@cs.rutgers.edu
12
+
13
+ # ABSTRACT
14
+
15
+ We present Optimal Transport GAN (OT-GAN), a variant of generative adversarial nets minimizing a new metric measuring the distance between the generator distribution and the data distribution. This metric, which we call mini-batch energy distance, combines optimal transport in primal form with an energy distance defined in an adversarially learned feature space, resulting in a highly discriminative distance function with unbiased mini-batch gradients. Experimentally we show OT-GAN to be highly stable when trained with large mini-batches, and we present state-of-the-art results on several popular benchmark problems for image generation.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Generative modeling is a major sub-field of Machine Learning that studies the problem of how to learn models that generate images, audio, video, text or other data. Applications of generative models include image compression, generating speech from text, planning in reinforcement learning, semi-supervised and unsupervised representation learning, and many others. Since generative models can be trained on unlabeled data, which is almost endlessly available, they have enormous potential in the development of artificial intelligence.
20
+
21
+ The central problem in generative modeling is how to train a generative model such that the distribution of its generated data will match the distribution of the training data. Generative adversarial nets (GANs) represent an advance in solving this problem, using a neural network discriminator or critic to distinguish between generated data and training data. The critic defines a distance between the model distribution and the data distribution which the generative model can optimize to produce data that more closely resembles the training data.
22
+
23
+ A closely related approach to measuring the distance between the distributions of generated data and training data is provided by optimal transport theory. By framing the problem as optimally transporting one set of data points to another, it represents an alternative method of specifying a metric over probability distributions and provides another objective for training generative models. The dual problem of optimal transport is closely related to GANs, as discussed in the next section. However, the primal formulation of optimal transport has the advantage that it allows for closed form solutions and can thus more easily be used to define tractable training objectives that can be evaluated in practice without making approximations. A complication in using primal form optimal transport is that it may give biased gradients when used with mini-batches (see Bellemare et al., 2017) and may therefore be inconsistent as a technique for statistical estimation.
24
+
25
+ In this paper we present OT-GAN, a variant of generative adversarial nets incorporating primal form optimal transport into its critic. We derive and justify our model by defining a new metric over probability distributions, which we call Mini-batch Energy Distance, combining optimal transport in primal form with an energy distance defined in an adversarially learned feature space. This combination results in a highly discriminative metric with unbiased mini-batch gradients.
26
+
27
+ In Section 2 we provide the preliminaries required to understand our work, and we put our contribution into context by discussing the relevant literature. Section 3 presents our main theoretical contribution: Minibatch energy distance. We apply this new distance metric to the problem of learning generative models in Section 4, and show state-of-the-art results in Section 5. Finally, Section 6 concludes by discussing the strengths and weaknesses of the proposed method, as well as directions for future work.
28
+
29
+ # 2 GANS AND OPTIMAL TRANSPORT
30
+
31
+ Generative adversarial nets (Goodfellow et al., 2014) were originally motivated using game theory: A generator $g$ and a discriminator $d$ play a zero-sum game where the generator maps noise $\mathbf { z }$ to simulated images $\mathbf { y } = g ( \mathbf { z } )$ and where the discriminator tries to distinguish the simulated images y from images $\mathbf { x }$ drawn from the distribution of training data $p$ . The discriminator takes in each image $\mathbf { x }$ and y and outputs an estimated probability that the given image is real rather than generated. The discriminator is rewarded for putting high probability on the correct classification, and the generator is rewarded for fooling the discriminator. The goal of training is then to find a pair of $( g , d )$ for which this game is at a Nash equilibrium. At such an equilibrium, the generator minimizes its loss, or negative game value, which can be defined as
32
+
33
+ $$
34
+ L _ { g } = \operatorname* { s u p } _ { d } \mathbb { E } _ { \mathbf { x } \sim p } \log [ d ( \mathbf { x } ) ] + \mathbb { E } _ { \mathbf { y } \sim g } \log [ 1 - d ( \mathbf { y } ) ]
35
+ $$
36
+
37
+ Arjovsky et al. (2017) re-interpret GANs in the framework of optimal transport theory. Specifically, they propose the Earth-Mover distance or Wasserstein- $^ { l }$ distance as a good objective for generative modeling:
38
+
39
+ $$
40
+ D _ { \mathrm { E M D } } ( p , g ) = \operatorname* { i n f } _ { \gamma \in \Pi ( p , g ) } \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim \gamma } c ( \mathbf { x } , \mathbf { y } ) ,
41
+ $$
42
+
43
+ where $\Pi ( p , g )$ is the set of all joint distributions $\gamma ( \mathbf { x } , \mathbf { y } )$ with marginals $p ( \mathbf { x } ) , g ( \mathbf { y } )$ , and where $c ( \mathbf { x } , \mathbf { y } )$ is a cost function that Arjovsky et al. (2017) take to be the Euclidean distance. If the $p ( \mathbf { x } )$ and $g ( \mathbf { y } )$ distributions are interpreted as piles of earth, the Earth-Mover distance $D _ { \mathrm { E M D } } ( p , g )$ can be interpreted as the minimum amount of “mass” that $\gamma$ has to transport to turn the generator distribution $g ( \mathbf { y } )$ into the data distribution $p ( \mathbf { x } )$ . For the right choice of cost $c$ , this quantity is a metric in the mathematical sense, meaning that $D _ { \mathrm { E M D } } ( p , g ) \geq 0$ and $D _ { \mathrm { E M D } } ( p , g ) = 0$ if and only if $p = g$ . Minimizing the Earth-Mover distance in $g$ is thus a valid method for deriving a statistically consistent estimator of $p$ , provided $p$ is in the model class of our generator $g$ .
44
+
45
+ Unfortunately, the minimization over $\gamma$ in Equation 2 is generally intractable, so Arjovsky et al. (2017) turn to the dual formulation of this optimal transport problem:
46
+
47
+ $$
48
+ D _ { \mathrm { E M D } } ( p , g ) = \operatorname* { s u p } _ { \| f \| _ { L } \leq 1 } \mathbb { E } _ { \mathbf { x } \sim p } f ( \mathbf { x } ) - \mathbb { E } _ { \mathbf { y } \sim g } f ( \mathbf { y } ) ,
49
+ $$
50
+
51
+ where we have replaced the minimization over $\gamma$ with a maximization over the set of 1-Lipschitz functions. This optimization problem is generally still intractable, but Arjovsky et al. (2017) argue that it is well approximated by using the class of neural network GAN discriminators or critics described earlier in place of the class of 1-Lipschitz functions, provided we bound the norm of their gradient with respect to the image input. Making this substitution, the objective becomes quite similar to that of our original GAN formulation in Equation 1.
52
+
53
+ In followup work Gulrajani et al. (2017) propose a different method of bounding the gradients in the class of allowed critics, and provide strong empirical results supporting this interpretation of GANs. In spite of their success, however, we should note that GANs are still only able to solve this optimal transport problem approximately. The optimization with respect to the critic cannot be performed perfectly, and the class of obtainable critics only very roughly corresponds to the class of 1-Lipschitz functions. The connection between GANs and dual form optimal transport is further explored by Bousquet et al. (2017) and Genevay et al. (2017a), who extend the analysis to different optimal transport costs and to a broader model class including latent variables.
54
+
55
+ An alternative approach to generative modeling is chosen by Genevay et al. (2017b) who instead chose to approximate the primal formulation of optimal transport. They start by taking an entropically smoothed generalization of the Earth Mover distance, called the Sinkhorn distance (Cuturi,
56
+
57
+ $$
58
+ D _ { \mathrm { S i n k h o r n } } ( p , g ) = \operatorname* { i n f } _ { \gamma \in \Pi _ { \beta } ( p , g ) } \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim \gamma } c ( \mathbf { x } , \mathbf { y } ) ,
59
+ $$
60
+
61
+ where the set of allowed joint distribution $\Pi _ { \beta }$ is now restricted to distributions with entropy of at least some constant $\beta$ . Genevay et al. (2017b) then approximate this distance by evaluating it on mini-batches of data $\mathbf { X } , \mathbf { Y }$ consisting of $K$ data vectors $\mathbf x , \mathbf y$ . The cost function $c$ then gives rise to a $K \times K$ transport cost matrix $C$ , where $C _ { i , j } = c ( \mathbf { x } _ { i } , \mathbf { y } _ { j } )$ tells us how expensive it is to transport the $i$ - th data vector $\mathbf { x } _ { i }$ in mini-batch $\mathbf { X }$ to the $j$ -th data vector $\mathbf { y } _ { j }$ in mini-batch $\mathbf { Y }$ . Similarly, the coupling distribution $\gamma$ is replaced by a $K \times K$ matrix $M$ of soft matchings between these $i , j$ elements, which is restricted to the set of matrices $\mathcal { M }$ with all positive entries, with all rows and columns summing to one, and with sufficient entropy $- \operatorname { T r } [ M \log ( M ^ { \mathrm { T } } ) ] \geq \alpha$ . The resulting distance, evaluated on a minibatch, is then
62
+
63
+ $$
64
+ { \mathcal { W } } _ { c } ( X , Y ) = \operatorname* { i n f } _ { M \in { \mathcal { M } } } \mathrm { T r } [ M C ^ { \mathrm { T } } ] .
65
+ $$
66
+
67
+ In practice, the minimization over the soft matchings $M$ can be found efficiently on the GPU using the Sinkhorn algorithm. Consequently, Genevay et al. (2017b) call their method of using Equation 5 in generative modeling Sinkhorn AutoDiff.
68
+
69
+ The great advantage of this mini-batch Sinkhorn distance is that it is fully tractable, eliminating the instabilities often experienced with GANs due to imperfect optimization of the critic. However, a disadvantage is that the expectation of Equation 5 over mini-batches is no longer a valid metric over probability distributions. Viewed another way, the gradients of Equation 5, for fixed mini-batch size, are not unbiased estimators of the gradients of our original optimal transport problem in Equation 4. For this reason, Bellemare et al. (2017) propose to instead use the Energy Distance, also called Cramer Distance, as the basis of generative modeling:
70
+
71
+ $$
72
+ D _ { \mathrm { E D } } ( p , g ) = \sqrt { 2 \mathbb { E } [ \left\| \mathbf { x } - \mathbf { y } \right\| ] - \mathbb { E } [ \left\| \mathbf { x } - \mathbf { x } ^ { \prime } \right\| ] - \mathbb { E } [ \left\| \mathbf { y } - \mathbf { y } ^ { \prime } \right\| ] } ,
73
+ $$
74
+
75
+ where $\mathbf { x } , \mathbf { x } ^ { \prime }$ are independent samples from data distribution $p$ and $\mathbf { y } , \mathbf { y } ^ { \prime }$ independent samples from the generator dsitribution $g$ . In Cramer $G A N$ they propose training the generator by minimizing this distance metric, evaluated in a latent space which is learned by the GAN critic.
76
+
77
+ In the next section we propose a new metric for generative modeling, combining the insights of GANs and optimal transport. Although our work was performed concurrently to that by Genevay et al. (2017b) and Bellemare et al. (2017), it can be understood most easily as forming a synthesis of the ideas used in Sinkhorn AutoDiff and Cramer GAN.
78
+
79
+ # 3 MINI-BATCH ENERGY DISTANCE
80
+
81
+ As discussed in the last section, most previous work in generative modeling can be interpreted as minimizing a distance $D ( g , p )$ between a generator distribution $g ( \mathbf { x } )$ and the data distribution $p ( \mathbf { x } )$ , where the distributions are defined over a single vector $\mathbf { x }$ which we here take to be an image. However, in practice deep learning typically works with mini-batches of images $\mathbf { X }$ rather than individual images. For example, a GAN generator is typically implemented as a high dimensional function $G ( \mathbf { Z } )$ that turns a mini-batch of random noise $\mathbf { Z }$ into a mini-batch of images $\mathbf { X }$ , which the GAN discriminator then compares to a mini-batch of images from the training data. The central insight of Mini-batch GAN (Salimans et al., 2016) is that it is strictly more powerful to work with the distributions over mini-batches $g ( \mathbf { X } ) , p ( \mathbf { X } )$ than with the distributions over individual images. Here we further pursue this insight and propose a new distance over mini-batch distributions $\bar { D [ { g ( \mathbf { X } ) , p ( \mathbf { X } ) } ] }$ which we call the Mini-batch Energy Distance. This new distance combines optimal transport in primal form with an energy distance defined in an adversarially learned feature space, resulting in a highly discriminative distance function with unbiased mini-batch gradients.
82
+
83
+ In order to derive our new distance function, we start by generalizing the energy distance given in Equation 6 to general non-Euclidean distance functions $d$ . Doing so gives us the generalized energy distance:
84
+
85
+ $$
86
+ D _ { \mathtt { G E D } } ( p , g ) = { \sqrt { 2 \mathbb { E } [ d ( \mathbf { X } , \mathbf { Y } ) ] - \mathbb { E } [ d ( \mathbf { X } , \mathbf { X } ^ { \prime } ) ] - \mathbb { E } [ d ( \mathbf { Y } , \mathbf { Y } ^ { \prime } ) ] } } ,
87
+ $$
88
+
89
+ where $\mathbf { X } , \mathbf { X } ^ { \prime }$ are independent samples from distribution $p$ and $\mathbf { Y } , \mathbf { Y } ^ { \prime }$ independent samples from $g$ . This distance is typically defined for individual samples, but it is valid for general random objects, including mini-batches like we assume here. The energy distance $D _ { \mathrm { G E D } } ( \bar { p } , g )$ is a metric, in the mathematical sense, as long as the distance function $d$ is a metric (Klebanov et al., 2005). Under this condition, meaning that $d$ satisfies the triangle inequality and several other conditions, we have that $D ( p , g ) \geq 0$ , and $\bar { D } ( p , g ) = 0$ if and only if $p = g$ .
90
+
91
+ Using individual samples $\mathbf x , \mathbf y$ instead of minibatches $\mathbf { X } , \mathbf { Y }$ , Sejdinovic et al. (2013) showed that such generalizations of the energy distance can equivalently be viewed as a form of maximum mean discrepancy, where the MMD kernel $k$ is related to the distance function $d$ by $d ( { \bf x } , { \bf x } ^ { \prime } ) \equiv k ( { \bf x } , { \bf x } ) +$ $k ( \mathbf { x } ^ { \prime } , \mathbf { \bar { x } } ^ { \prime } ) - 2 k ( \mathbf { x } , \mathbf { x } ^ { \prime } )$ . We find the energy distance perspective more intuitive here and follow Cramer GAN in using this perspective instead.
92
+
93
+ We are free to choose any metric $d$ for use in Equation 7, but not all choices will be equally discriminative when used for generative modeling. Here, we choose $d$ to be the entropy-regularized Wasserstein distance, or Sinkhorn distance, as defined for mini-batches in Equation 5. Although the average over mini-batch Sinkhorn distances is not a valid metric over probability distributions $p , g$ , resulting in the biased gradients problem discussed in Section 2, the Sinkhorn distance is a valid metric between individual mini-batches, which is all we require for use inside the generalized energy distance.
94
+
95
+ Putting everything together, we arrive at our final distance function over distributions, which we call the Minibatch Energy Distance. Like with the Cramer distance, we typically work with the squared distance, which we define as
96
+
97
+ $$
98
+ D _ { \mathrm { M E D } } ^ { 2 } ( p , g ) = 2 \mathbb { E } [ \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { Y } ) ] - \mathbb { E } [ \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) ] - \mathbb { E } [ \mathcal { W } _ { c } ( \mathbf { Y } , \mathbf { Y } ^ { \prime } ) ] ,
99
+ $$
100
+
101
+ where $\mathbf { X }$ , $\mathbf { X } ^ { \prime }$ are independently sampled mini-batches from distribution $p$ and $\mathbf { Y } , \mathbf { Y } ^ { \prime }$ are independent mini-batches from $g$ . We include the subscript $c$ to make explicit that this distance depends on the choice of transport cost function $c$ , which we will learn adversarially as discussed in Section 4.
102
+
103
+ In comparison with the original Sinkhorn distance (Equation 5 the loss function for training $g$ implied by this metric adds a repulsive term − $\mathbf { \nabla } \cdot \mathcal { W } _ { c } ( \mathbf { Y } , \mathbf { Y } ^ { \prime } )$ to the attractive term ${ \mathcal W } _ { c } ( { \bf X } , { \bf Y } )$ . Like with the energy distance used by Cramer GAN, this is what makes the resulting mini-batch gradients unbiased and the objective statistically consistent. However, unlike the plain energy distance, the mini-batch energy distance $D _ { \mathrm { M E D } } ^ { 2 } ( p , \bar { g } )$ still incorporates the primal form optimal transport of the Sinkhorn distance, which in Section 5 we show leads to much stronger discriminative power and more stable generative modeling.
104
+
105
+ In concurrent work, Genevay et al. (2018) independently propose a very similar loss function to (8), but using a single sample from the data and generator distributions. We obtained best results using two independently sampled minibatches from each distribution.
106
+
107
+ # 4 OPTIMAL TRANSPORT GAN (OT-GAN)
108
+
109
+ In the last section we defined the mini-batch energy distance which we propose using for training generative models. However, we left undefined the transport cost function $c ( \mathbf { x } , \mathbf { y } )$ on which it depends. One possibility would be to choose $c$ to be some fixed function over vectors, like Euclidean distance, but we found this to perform poorly in preliminary experiments. Although minimizing the mini-batch energy distance $\bar { D } _ { M E D } ^ { 2 } ( \bar { p } , g )$ guarantees statistical consistency for simple fixed cost functions $c$ like Euclidean distance, the resulting statistical efficiency is generally poor in high dimensions. This means that there typically exist many bad distributions distributions $g$ for which $D _ { M E D } ^ { 2 } ( p , g )$ is so close to zero that we cannot tell $p$ and $g$ apart without requiring an enormous sample size. To solve this we propose learning the cost function adversarially, so that it can adapt to the generator distribution $g$ and thereby become more discriminative. In practice we implement this by defining $c$ to be the cosine distance between vectors $v _ { \eta } ( \mathbf { x } )$ and $v _ { \eta } ( \mathbf { y } )$ , where $v _ { \eta }$ is a deep neural network that maps the images in our mini-batch into a learned latent space. That is we define the transport cost to be
110
+
111
+ $$
112
+ c _ { \eta } ( \mathbf x , \mathbf y ) = 1 - \frac { v _ { \eta } ( \mathbf x ) \cdot v _ { \eta } ( \mathbf y ) } { \| v _ { \eta } ( \mathbf x ) \| _ { 2 } \| v _ { \eta } ( \mathbf y ) \| _ { 2 } } ,
113
+ $$
114
+
115
+ where we choose $\eta$ to maximize the resulting minibatch energy distance.
116
+
117
+ In practice, training our generative model $g _ { \boldsymbol { \theta } }$ and our adversarial transport cost $c _ { \eta }$ is done by alternating gradient descent as is standard practice in GANs (Goodfellow et al., 2014). Here we choose to update the generator more often than we update our critic. This is contrary to standard practice (e.g. Arjovsky et al., 2017) and ensures our cost function $c$ does not become degenerate. If $c$ were to assign zero transport cost to two non-identical regions in image space, the generator would quickly adjust to take advantage of this. Similar to how a quickly adapting critic controls the generator in standard GANs, this works the other way around in our case. Contrary to standard GANs, our generator has a well defined and statistically consistent training objective even when the critic is not updated, as long as the cost function $c$ is not degenerate. We also investigated forcing $v _ { \eta }$ to be one-to-one by parameterizing it using a RevNet Gomez et al. (2017), thereby ensuring $c$ cannot degenerate, but this proved unnecessary if the generator is updated often enough.
118
+
119
+ Our full training procedure is described in Algorithm 1, and is visually depicted in Figure 1. Here we compute the matching matrix $M$ in ${ \mathcal { W } } _ { c }$ using the Sinkhorn algorithm. Unlike Genevay et al. (2017b) we do not backpropagate through this algorithm. Ignoring the gradient flow through the matchings $M$ is justified by the envelope theorem (see e.g. Carter, 2001): Since $M$ is chosen to minimize ${ \mathcal { W } } _ { c }$ , the gradient of ${ \mathcal { W } } _ { c }$ with respect to this variable is zero (when projected into the allowed space $\mathcal { M }$ ). Algorithm 1 assumes we use standard SGD for optimization, but we are free to use other optimizers. In our experiments we use Adam (Kingma & Ba, 2014).
120
+
121
+ Our algorithm for training generative models can be generalized to include conditional generation of images given some side information $s$ , such as a text-description of the image or a label. When generating an image y we simply draw $s$ from the training data and condition the generator on it. The rest of the algorithm is identical to Algorithm 1 but with $( \mathbf { Y } , S )$ in place of $\mathbf { Y }$ , and similar substitutions for $\breve { \mathbf { X } } , \mathbf { X } ^ { \prime } , \mathbf { Y } ^ { \prime }$ . The full algorithm for conditional generation is detailed in Algorithm 2 in the appendix.
122
+
123
+ Require: $n _ { g e n }$ , the number of iterations of the generator per critic iteration
124
+ Require: $\eta _ { 0 }$ , initial critic parameters. $\theta _ { 0 }$ , initial generator parameters
125
+ 1: for $t = 1$ to $N$ do
126
+ 2: Sample $\mathbf { X } , \mathbf { X } ^ { \prime }$ two independent mini-batches from real data, and $\mathbf { Y } , \mathbf { Y } ^ { \prime }$ two independent mini-batches from the generated samples
127
+ 3: ${ \mathcal { L } } = \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { Y } ) + \mathcal { W } _ { c } ( \mathbf { \tilde { X } } , \mathbf { Y } ^ { \prime } ) + \mathcal { W } _ { c } \mathbf { \tilde { ( X ' , Y ) } } + \mathcal { W } _ { c } ( \mathbf { X } ^ { \prime } , \mathbf { Y } ^ { \prime } ) - 2 \mathcal { W } _ { c } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) - 2 \mathcal { W } _ { c } ( \mathbf { Y } , \mathbf { Y } ^ { \prime } )$
128
+ 4: if $t$ mod $n _ { g e n } + 1 = 0$ then
129
+ 5: $\eta \eta + \alpha \cdot \nabla _ { \eta } \mathcal { L }$
130
+ 6: else
131
+ 7: $\theta \theta - \alpha \cdot \nabla _ { \theta } \mathcal { L }$
132
+ 8: end if
133
+ 9: end for
134
+
135
+ ![](images/1e58273fd7719f4bfa348121cdbe49a29a843f422b7306bcbedd5a9726afdbb0.jpg)
136
+ Figure 1: Illustration of OT-GAN. Mini-batches from the generator and training data are embedded into a learned feature space via the critic. A transport cost matrix is calculated between the two mini-batches of features. Soft matching aligns features across mini-batches and aligned features are compared. The figure only illustrates the distance calculation between one pair of mini-batches whereas several are computed.
137
+
138
+ # 5 EXPERIMENTS
139
+
140
+ In this section, we demonstrate the improved stability and consistency of the proposed method on five different datasets with increasing complexity.
141
+
142
+ # 5.1 MIXTURE OF GAUSSIAN DATASET
143
+
144
+ One advantage of OT-GAN compared to regular GAN is that for any setting of the transport cost $c$ , i.e. any fixed critic, the objective is statistically consistent for training the generator $g$ . Even if we stop updating the critic, the generator should thus never diverge. With a bad fixed cost function $c$ the signal for learning $g$ may be very weak, but at least it should never point in the wrong direction. We investigate whether this theoretical property holds in practice by examining a simple toy example. We train generative models using different types of GAN on a 2D mixture of 8 Gaussians, with means arranged on a circle. The goal for the generator is to recover all 8 modes. For the proposed method and all the baseline methods, the architectures are simple MLPs with ReLU activations. A similar experimental setting has been considered in (Metz et al., 2017; Li et al., 2017) to demonstrate the mode coverage behavior of various GAN models. There, GANs using mini-batch features, DAN-S (Li et al., 2017), are shown to capture all the 8 modes when training converges. To test the consistency of GAN models, we stop updating the discriminator after $1 5 \mathrm { k }$ iterations and visualize the generator distribution for an additional 25K iterations. As shown in Figure 2, mode collapse occurs in a mini-batch feature GAN after a few thousand iterations training with a fixed discriminator. However, using the mini-batch energy distance, the generator does not diverge and the generated samples still cover all 8 modes of the data.
145
+
146
+ ![](images/1687b47c7688836cb6bf32cf7cfdd10ff315315751109cb91d4da734f7b693bc.jpg)
147
+ Figure 2: Results for consistency when fixing the critic on data generated from 8 Gaussian mixtures. The first column shows the data distribution. The top row shows the training results of OT-GAN using mini-batch energy distance. The bottom row shows the training result with the original GAN loss (DAN-S). The latter collapses to 3 out of 8 modes after fixing the discriminator, while OT-GAN remains consistent.
148
+
149
+ # 5.2 CIFAR-10
150
+
151
+ CIFAR-10 is a well-studied dataset of $3 2 \times 3 2$ color images for generative models (Krizhevsky, 2009). We use this data set to investigate the importance of the different design decisions made with OT-GAN, and we compare the visual quality of its generated samples with other state-of-theart GAN models. Our model and the other reported results are trained in an unsupervised manner. We choose “inception score” (Salimans et al., 2016) as numerical assessment to compare the visual quality of samples generated by different models. Our generator and critic are standard convnets, similar to those used by DCGAN (Radford et al., 2015), but without any batch normalization, layer normalization, or other stabilizing additions. Appendix B contains additional architecture and training details.
152
+
153
+ We first investigate the effect of batch size on training stability and sample quality. As shown in Figure 3, training is not very stable when the batch size is small (i.e. 200). As batch size increases, training becomes more stable and the inception score of samples increases. Unlike previous methods, our objective (the minibatch energy distance, Section 3) depends on the chosen minibatch size: Larger minibatches are more likely to cover many modes of the data distribution, thereby not only yielding lower variance estimates but also making our distance metric more discriminative. To reach the large batch sizes needed for optimal performance we make use of multi GPU training. In this work we only use up to 8 GPUs per experiment, but we anticipate more GPUs to be useful when using larger models.
154
+
155
+ In Figure 4 we present the samples generated by our model trained with a batch size of 8000. In addition, we also compare with the sample quality of other state-of-the-art GAN models in Table 1. OT-GAN achieves a score of $8 . 4 7 \pm . 1 2$ , outperforming all baseline models.
156
+
157
+ To evaluate the importance of using optimal transport in OT-GAN, we repeat our CIFAR-10 experiment with random matching of samples. Our minibatch energy distance objective remains valid when we match samples randomly rather than using optimal transport. In this case the minibatch energy distance reduces to the regular (generalized) energy distance. We repeat our CIFAR-10 experiment and train a generator with the same architecture and hyperparameters as above, but with random matching of samples instead of optimal transport. The highest resulting Inception score achieved during the training process is 4.64 using this approach, as compared to 8.47 with optimal transport. Figure 5 shows a random sample from the resulting model.
158
+
159
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Inception score</td></tr><tr><td rowspan=1 colspan=1>Real Data</td><td rowspan=1 colspan=1>11.95 ± .12</td></tr><tr><td rowspan=1 colspan=1>DCGAN</td><td rowspan=1 colspan=1>6.16±.07</td></tr><tr><td rowspan=1 colspan=1>Improved GAN</td><td rowspan=1 colspan=1>6.86±.06</td></tr><tr><td rowspan=1 colspan=1>DenoisingFM</td><td rowspan=1 colspan=1>7.72±.13</td></tr><tr><td rowspan=1 colspan=1>WGAN-GP</td><td rowspan=1 colspan=1>7.86± .07</td></tr><tr><td rowspan=1 colspan=1>OT-GAN</td><td rowspan=1 colspan=1>8.47±.12</td></tr></table>
160
+
161
+ Table 1: Inception scores on CIFAR-10. All the models are trained in an unsupervised manner.
162
+
163
+ ![](images/a54c9124dd2c9ce0fbf6f3b48b53066b7a43bbea3a067d23c1d5ead9061ec014.jpg)
164
+ Figure 3: CIFAR-10 inception score over the course of training for different batch sizes.
165
+
166
+ ![](images/2bf7a927be164f1ae5be549e065c1add2c85346abe9fed718132083af632ff1f.jpg)
167
+ Figure 4: Samples generated by OT-GAN on CIFAR-10, without using labels.
168
+
169
+ ![](images/41ab2c798337bfae4bf37c8b841670c515c8340fa9046e2edb009ce8972bd7d0.jpg)
170
+ Figure 5: Samples generated without using optimal transport.
171
+
172
+ # 5.3 IMAGENET DOGS
173
+
174
+ To illustrate the ability of OT-GAN in generating high quality images on more complex data sets, we train OT-GAN to generate $1 2 8 \times 1 2 8$ images on the dog subset of ImageNet (Russakovsky et al., 2015). A smaller batch size of 2048 is used due to GPU memory contraints. As shown in Figure 6, the samples generated by OT-GAN contain less nonsensical images, and the sample quality is significantly better than that of a tuned DCGAN variant which still suffers from mode collapse. The superior image quality is confirmed by the inception score achieved by OT-GAN $( 8 . 9 7 { \scriptstyle \pm 0 . 0 9 } )$ on this dataset, which outperforms that of DCGAN(8.19±0.11)
175
+
176
+ ![](images/f014376b44941bf3c6b56a596486ceca17208002ae78bcc958f676fc2b5e1b13.jpg)
177
+ Figure 6: ImageNet Dog subset samples generated by OT-GAN (left) and DCGAN (right).
178
+
179
+ # 5.4 CONDITIONAL GENERATION OF BIRDS
180
+
181
+ To further demonstrate the effectiveness of the proposed method on conditional image synthesis, we compare OT-GAN with state-of-the-art models on text-to-image generation (Reed et al., 2016b;a; Zhang et al., 2017). As shown in Table 2, the images generated by OT-GAN with batch size 2048 also achieve the best inception score here. Example images generated by our conditional generative model on the CUB test set are presented in Figure 7.
182
+
183
+ Table 2: Inception scores by state-of-the-art methods (Reed et al., 2016b;a; Zhang et al., 2017) and the proposed OT-GAN on the CUB test set. Higher inception scores mean better image quality.
184
+
185
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>GAN-INT-CLS</td><td rowspan=1 colspan=1>GAWWN</td><td rowspan=1 colspan=1>StackGAN</td><td rowspan=1 colspan=1>OT-GAN</td></tr><tr><td rowspan=1 colspan=1>Inception Score</td><td rowspan=1 colspan=1>2.88± .04</td><td rowspan=1 colspan=1>3.62 ± .07</td><td rowspan=1 colspan=1>3.70±.04</td><td rowspan=1 colspan=1>3.84 ± .05</td></tr></table>
186
+
187
+ ![](images/60dfbeabf4e67698c3c1e31fa5a3ee4ca6acba57bf8cfac62732229ae9d9f4eb.jpg)
188
+ Figure 7: Bird example images generated by conditional OT-GAN
189
+
190
+ # 6 DISCUSSION
191
+
192
+ We have presented OT-GAN, a new variant of GANs where the generator is trained to minimize a novel distance metric over probability distributions. This metric, which we call mini-batch energy distance, combines optimal transport in primal form with an energy distance defined in an adversarially learned feature space, resulting in a highly discriminative distance function with unbiased mini-batch gradients. OT-GAN was shown to be uniquely stable when trained with large mini-batches and to achieve state-of-the-art results on several common benchmarks.
193
+
194
+ One downside of OT-GAN, as currently proposed, is that it requires large amounts of computation and memory. We achieve the best results when using very large mini-batches, which increases the time required for each update of the parameters. All experiments in this paper, except for the mixture of Gaussians toy example, were performed using 8 GPUs and trained for several days. In future work we hope to make the method more computationally efficient, as well as to scale up our approach to multi-machine training to enable generation of even more challenging and high resolution image data sets.
195
+
196
+ A unique property of OT-GAN is that the mini-batch energy distance remains a valid training objective even when we stop training the critic. Our implementation of OT-GAN updates the generative model more often than the critic, where GANs typically do this the other way around (see e.g. Gulrajani et al., 2017). As a result we learn a relatively stable transport cost function $c ( \mathbf { x } , \mathbf { y } )$ , describing how (dis)similar two images are, as well as an image embedding function $v _ { \eta } ( \mathbf { x } )$ capturing the geometry of the training data. Preliminary experiments suggest these learned functions can be used successfully for unsupervised learning and other applications, which we plan to investigate further in future work.
197
+
198
+ # REFERENCES
199
+
200
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
201
+ Marc G Bellemare, Ivo Danihelka, Will Dabney, Shakir Mohamed, Balaji Lakshminarayanan, Stephan Hoyer, and Remi Munos. The cramer distance as a solution to biased wasserstein gradients. ´ arXiv preprint arXiv:1705.10743, 2017.
202
+ Olivier Bousquet, Sylvain Gelly, Ilya Tolstikhin, Carl-Johann Simon-Gabriel, and Bernhard Schoelkopf. From optimal transport to generative modeling: the vegan cookbook. arXiv preprint arXiv:1705.07642, 2017.
203
+ Michael Carter. Foundations of mathematical economics. MIT Press, 2001.
204
+ Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, pp. 2292–2300, 2013.
205
+ Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. arXiv preprint arXiv:1612.08083, 2016.
206
+ Aude Genevay, Gabriel Peyre, and Marco Cuturi. Gan and vae from an optimal transport point of view. ´ arXiv preprint arXiv:1706.01807, 2017a.
207
+ Aude Genevay, Gabriel Peyre, and Marco Cuturi. Sinkhorn-autodiff: Tractable wasserstein learning of genera- ´ tive models. arXiv preprint arXiv:1706.00292, 2017b.
208
+ Aude Genevay, Gabriel Peyre, and Marco Cuturi. Learning generative models with sinkhorn divergences. ´ AISTATS Proceedings, 2018.
209
+ Aidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. In Advances in Neural Information Processing Systems, pp. 2211– 2221, 2017.
210
+ 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.
211
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
212
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
213
+ Lev Borisovich Klebanov, Viktor Benes, and Ivan Saxl. ˇ N-distances and their applications. Charles University in Prague, the Karolinum Press, 2005.
214
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
215
+ Chengtao Li, David Alvarez-Melis, Keyulu Xu, Stefanie Jegelka, and Suvrit Sra. Distributional adversarial networks. arXiv:1706.09549, 2017.
216
+ Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. In ICLR, 2017.
217
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
218
+ Scott Reed, Zeynep Akata, Santosh Mohan, Samuel Tenka, Bernt Schiele, and Honglak Lee. Learning what and where to draw. In NIPS, 2016a.
219
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text-to-image synthesis. In ICML, 2016b.
220
+ 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.
221
+ Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909, 2016.
222
+ Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016.
223
+ Dino Sejdinovic, Bharath Sriperumbudur, Arthur Gretton, and Kenji Fukumizu. Equivalence of distance-based and rkhs-based statistics in hypothesis testing. The Annals of Statistics, pp. 2263–2291, 2013.
224
+ Wenling Shang, Kihyuk Sohn, Diogo Almeida, and Honglak Lee. Understanding and improving convolutional neural networks via concatenated rectified linear units. In International Conference on Machine Learning, pp. 2217–2225, 2016.
225
+ Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In ICCV, 2017.
226
+
227
+ A CONDITIONAL GENERATION
228
+
229
+ Algorithm 2 Conditional Optimal Transport GAN (OT-GAN) training algorithm with step size α, using minibatch SGD for simplicity
230
+
231
+ Require: $n _ { g e n }$ , the number of iterations of the generator per critic iteration
232
+ Require: $\eta _ { 0 }$ , initial critic parameters. $\theta _ { 0 }$ , initial generator parameters
233
+ 1: for $t = 1$ to $N$ do
234
+ 2: Sample $( \mathbf { X } , S )$ , $( \mathbf { X } ^ { \prime } , S ^ { \prime } )$ two independent mini-batches from real data, with side information, and $( \mathbf { Y } , S ) , ( \mathbf { Y } ^ { \prime } , S ^ { \prime } )$ two independent mini-batches from the generator, re-using the same side information
235
+ 3: $\begin{array} { r l r } { \mathcal { L } } & { { } = } & { \mathcal { W } _ { c } [ ( { \bf X } , S ) , ( { \bf Y } ^ { \prime } , S ^ { \prime } ) ] ~ + ~ \mathcal { W } _ { c } [ ( { \bf X } ^ { \prime } , S ^ { \prime } ) , ( { \bf Y } , S ) ] ~ - ~ \mathcal { W } _ { c } [ ( { \bf X } , S ) , ( { \bf X } ^ { \prime } , S ^ { \prime } ) ] ~ - ~ \mathcal { W } _ { c } [ ( { \bf X } , S ) , ( { \bf X } ^ { \prime } , S ^ { \prime } ) ] ~ } \end{array}$ $\mathcal { W } _ { c } [ ( \mathbf { Y } , S ) , ( \mathbf { Y } ^ { \prime } , S ^ { \prime } ) ]$
236
+ 4: if $t$ mod $n _ { g e n } + 1 = 0$ then
237
+ 5: $\eta \eta + \alpha \cdot \nabla _ { \eta } \mathcal { L }$
238
+ 6: else
239
+ 7: $\theta \theta - \alpha \cdot \nabla _ { \theta } \mathcal { L }$
240
+ 8: end if
241
+ 9: end for
242
+
243
+ # B CIFAR-10 ARCHITECTURE AND TRAINING DETAILS
244
+
245
+ The generator and critic are implemented as convolutional networks. Their architectures are loosely based on DCGAN with various modifications. Weight normalization and data-dependent initialization (Salimans & Kingma, 2016) are used for both. The generator maps latent codes sampled from a 100 dimensional uniform distribution between $^ { - 1 }$ and 1 to $3 2 \times 3 2$ color images. The main module of the generator is a $2 \mathbf { x } 2$ nearest-neighbor upsampling operation followed by a convolution with a $5 \times 5$ kernel using gated linear units (Dauphin et al., 2016). The main module of the critic is a convolution with a $5 \times 5$ kernel and stride 2 using the concatenated ReLU activation function (Shang et al., 2016). Notably, the generator and critic do not use an activation normalization technique such as batch or layer normalization. We train the model using Adam with a learning rate of $3 \times 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We update the generator 3 times for every critic update. OT-GAN includes two additional hyperparameters for the Sinkhorn algorithm, the number of iterations to run the algorithm and $\textstyle { \frac { 1 } { \lambda } }$ which is the entropy penalty of alignments. Initial tuning found a value of 500 to work well for both.
246
+
247
+ Table 3: Generator architecture for CIFAR-10.
248
+
249
+ <table><tr><td>operation</td><td>activation</td><td>kernel</td><td>stride</td><td>output shape</td></tr><tr><td rowspan="5">Z linear reshape 2x NN upsample convolution 2x NN upsample convolution</td><td>GLU</td><td></td><td></td><td>100 16384</td></tr><tr><td></td><td></td><td></td><td>1024×4×4</td></tr><tr><td>GLU</td><td>5×5</td><td>1</td><td>1024×8×8 512×8×8</td></tr><tr><td></td><td></td><td></td><td>512 ×16 × 16</td></tr><tr><td>GLU</td><td>5×5</td><td>1</td><td>256×1 16 ×16</td></tr><tr><td>2x NN upsample</td><td></td><td></td><td></td><td>256 × 32 × 32</td></tr><tr><td>convolution</td><td>GLU</td><td>5×5</td><td>1</td><td>128 × 32 × 32</td></tr><tr><td>convolution</td><td>tanh</td><td>5×5</td><td>1</td><td>3 × 32× 32</td></tr></table>
250
+
251
+ Table 4: Critic architecture for CIFAR-10.
252
+
253
+ <table><tr><td rowspan=1 colspan=1>operation</td><td rowspan=1 colspan=2>activation</td><td rowspan=1 colspan=1>kernel</td><td rowspan=1 colspan=1>stride</td><td rowspan=1 colspan=1> output shape</td></tr><tr><td rowspan=1 colspan=1>convolution</td><td rowspan=1 colspan=2>CReLU</td><td rowspan=1 colspan=1>5×5</td><td rowspan=1 colspan=1>1</td><td rowspan=5 colspan=1>256× 32×32512 ×16×161024×8×82048×4×43276832768</td></tr><tr><td rowspan=4 colspan=1>convolutionconvolutionconvolutionreshape12 normalize</td><td rowspan=3 colspan=2>CReLUCReLUCReLU</td><td rowspan=1 colspan=1>5×5</td><td rowspan=4 colspan=1>222</td></tr><tr><td rowspan=2 colspan=1>5×55×5</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td></tr></table>
254
+
255
+ # C ADVERSARIALLY LEARNING THE TRANSPORT COST FUNCTION
256
+
257
+ To illustrate the importance of learning the transport cost function adversarially, we repeat our CIFAR-10 experiment using cosine distance defined in the original feature space:
258
+
259
+ $$
260
+ c ( \mathbf { x } , \mathbf { y } ) = 1 - { \frac { \mathbf { x } \cdot \mathbf { y } } { \| \mathbf { x } \| _ { 2 } \| \mathbf { y } \| _ { 2 } } } ,
261
+ $$
262
+
263
+ where x, y are original image pixel values. In this case, only the transport cost function is a fixed distance function, but all the rest experiment settings are the same as those of OT-GAN. The highest inception score during the training process is 4.93, as compared to 8.47 when learning cost function adversarially using another neural network. The generated samples are shown in Figure 8.
264
+
265
+ ![](images/b73148457d2daeac3ccdd99d209d8eeebb6514005247c6dd560417366a7d254e.jpg)
266
+ Figure 8: CIFAR-10 Samples generated without adversarially learning the cost function.
267
+
268
+ # D MODEL COLLAPSE AND SAMPLE DIVERSITY
269
+
270
+ To further investigate sample diversity and mode collapse in GANs, we train the same generator using DCGAN and OT-GAN on the Imagenet dog data set for a large number of epochs. For DCGAN we observe mode collapse starting to occur after about 900 epochs, as indicated in figure 9. The model does not recover from this if we continue training. We have observed similar behavior for many other types of GAN. For OT-GAN we continued to train for 13000 epochs on this data set but never observed any mode collapse or reduction in sample diversity.
271
+
272
+ ![](images/d695e9bb1e93fa6444466b1317a36d31e797fae6fa95c3932de83ad4d5357d5b.jpg)
273
+ Figure 9: Imagenet dog samples generated with DCGAN (left) after 900 epochs and OT-GAN (right) after 13000 epochs. When training long enough, DCGAN suffers from mode collapse as indicated by the highlighted samples. We did not observe any mode collapse for OT-GAN, even when training for many more epochs.
md/train/ryfz73C9KQ/ryfz73C9KQ.md ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL PREDICTIVE BELIEF REPRESENTATIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Unsupervised representation learning has succeeded with excellent results in many applications. It is an especially powerful tool to learn a good representation of environments with partial or noisy observations. In partially observable domains it is important for the representation to encode a belief state—a sufficient statistic of the observations seen so far. In this paper, we investigate whether it is possible to learn such a belief representation using modern neural architectures. Specifically, we focus on one-step frame prediction and two variants of contrastive predictive coding (CPC) as the objective functions to learn the representations. To evaluate these learned representations, we test how well they can predict various pieces of information about the underlying state of the environment, e.g., position of the agent in a 3D maze. We show that all three methods are able to learn belief representations of the environment—they encode not only the state information, but also its uncertainty, a crucial aspect of belief states. We also find that for CPC multi-step predictions and action-conditioning are critical for accurate belief representations in visually complex environments. The ability of neural representations to capture the belief information has the potential to spur new advances for learning and planning in partially observable domains, where leveraging uncertainty is essential for optimal decision making.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Modern supervised learning (Hastie et al., 2009a) and reinforcement learning (RL Sutton & Barto, 1998) methods have been applied successfully to many challenging applications (He et al., 2016; Sutskever et al., 2014; Mnih et al., 2015; Silver et al., 2016). On the other hand, in most domains there exists a great wealth of information in the raw data alone. Unsupervised learning provides a generic framework allowing machines to learn independently of supervision (Hastie et al., 2009b).
12
+
13
+ Unsupervised learning encompasses a wide range of learning problems (Rezende et al., 2014; Goodfellow et al., 2014; Erhan et al., 2010). Among them representation learning has drawn significant attraction in recent years (Bengio et al., 2013). In representation learning the goal of the learner is to learn a representation that encodes useful information required to solve a variety of tasks.
14
+
15
+ Representation learning is especially important in partially observable dynamical environments, such as navigation tasks with a first-person view, where each observation only provides a partial and possibly noisy view of the environment. In these settings it is critical for the agent to build a belief state representation which encodes its uncertainty about the underlying state of the environment. This is due to the fact that the belief state is a sufficient statistic for predicting future observations and future states, as well as the optimal policy in the RL setting (Rabiner, 1989; Jaakkola et al., 1995). Representation learning has been proven useful to enhance the performance of agents in various partially observable dynamical domains (Jaderberg et al., 2016; Oord et al., 2018; Eslami et al., 2018).
16
+
17
+ Despite these successes, prior work mostly evaluate the quality of the learned state representation indirectly through the performance in some supervised or RL task (Jaderberg et al., 2016). This black-box approach is effective for evaluating the usefulness of the learned representation for a particular task. However, it provides no answer to the question of whether the state representation encodes a belief embedding, nor whether the representation learns more general concepts that can be used across tasks.
18
+
19
+ In this paper, as an alternative to the current black-box approach, we adopt a glass-box approach to the problem of evaluating the representation learning methods. More specifically we directly use the learned representation to predict the ground-truth state of the environment. This information is only used for evaluating the representation, while the representation itself is learned in a fully unsupervised fashion.
20
+
21
+ For our experiments, we use a set of simulated tasks in the DeepMind Lab suite (Beattie et al., 2016). We compare three different representation learning methods: One-step frame prediction, contrastive predictive coding (CPC) (Oord et al., 2018), and CPC|Action, a new action-dependent variant of CPC. CPC and CPC|Action are both able to represent distributions of future observations, whereas one-step frame prediction can only represent the mean; however, frame prediction is better at paying attention to details in the observations.
22
+
23
+ Our main finding is that all three methods are able to learn a representation of the belief state of the environment. We observe that the learned representations encode important pieces of information about the environment including the agent’s current position and orientation, its past trajectory, and even the position of objects in the environment. In fact, our results show that the belief representations not only encode these pieces of information, they also encode the agent’s uncertainty over them—a crucial aspect of a belief state. However, we find that not all objects can be captured equally well by the learned representations, and that the representations are able to better capture those objects that have higher impact on the agent’s future observations. Finally, we observe that for CPC, predicting further into the future and conditioning on actions (CPC|Action) results in the best learned belief on visually complex environments, while being more computationally efficient than the one-step frame predictor.
24
+
25
+ # 2 BACKGROUND AND NOTATION
26
+
27
+ # 2.1 PARTIALLY OBSERVABLE MARKOV DECISION PROCESSES
28
+
29
+ We consider Partially Observable Markov Decision Processes (POMDPs; Lovejoy, 1991; Cassandra, 1998) as a general framework to deal with partially-observable and stochastic environments with actions. Formally, a POMDP is a tuple $M = ( \mathcal { X } , \mathcal { A } , \mathcal { O } , P , O )$ where $\mathcal { X }$ is the state space, $\mathcal { A }$ is the action space, $\mathcal { O }$ the observation space, $P$ models the dynamics and maps to each state-action couple $( x , a )$ a probability $P ( \boldsymbol { y } | \boldsymbol { x } , \boldsymbol { a } )$ over the next state $y$ and $O$ is the observation distribution that maps to each state $x$ a probability $O ( \cdot | x )$ over possible observations. Typically, POMDPs also include a reward observation; however, as we are not considering the control problem here, there is no need to distinguish between the reward and the observations, so we omit the reward.
30
+
31
+ At any given time $t$ , the agent acting in a POMDP has only access to some observation $o _ { t } \in \mathcal { O }$ that gives incomplete information about the real state $x _ { t } \in \mathcal X$ . Thus, it has an uncertainty on the real state $x _ { t }$ as well as on the next state $x _ { t + 1 }$ as the dynamics depends on the state-action pair $\left( { { x } _ { t } } , { { a } _ { t } } \right)$ . Therefore a key aspect in POMDPs is to be able to compute a belief state $b _ { t }$ , which is a probability distribution over possible states, from the current history $h _ { t }$ . More formally, at a given time $t$ , the current history $h _ { t }$ is the set of past actions and observations $h _ { t } = \left\{ o _ { 0 } , a _ { 0 } , o _ { 1 } , a _ { 1 } , \ldots , a _ { t - 1 } , o _ { t } \right\}$ , and a belief distribution $P _ { b } ( \cdot | h _ { t } )$ over the possible states conditioned on the history of past actions and observations. Ideally, we would like to compute the belief distribution $P _ { b }$ or a surrogate representation $b _ { t } \in \mathbb { R } ^ { d }$ that encodes the information with regard to $P _ { b }$ , thus capturing the uncertainty on the underlying state $x _ { t }$ .
32
+
33
+ # 2.2 CONTRASTIVE PREDICTIVE CODING
34
+
35
+ Contrastive Predictive Coding (Oord et al., 2018) (CPC) is an unsupervised representaion learning which relies on noise contrastive estimation (Gutmann & Hyvärinen, 2010; 2012) as the statistical method for learning distributions. We provide a brief overview of noise contrastive estimation approach and based on this we describe the CPC approach. Discriminating between samples coming from the data distribution (positive examples) and samples coming from another distribution (negative examples), is known as learning from comparison. A simple way to implement this general principle is via binary classification where samples coming from the data distribution will be labelled as positive examples and samples coming from another distribution will be labelled as negative examples. Then, training such a binary classifier can be a good way to learn features that encode information on the data distribution. More precisely, assume that we have $N ^ { + }$ samples $( o _ { i } ^ { + } ) _ { i = 1 } ^ { N ^ { + } }$ coming from our data distribution with probability density $\rho ^ { + }$ and $N ^ { - }$ samples $( o _ { i } ^ { - } ) _ { i = 1 } ^ { N ^ { - } }$ coming from our data distribution with probability density $\rho ^ { - }$ . Training a binary classifier $f$ with logistic regression consists in finding $f$ that maximises $\hat { J } ( f )$ :
36
+
37
+ $$
38
+ \hat { J } ( f ) = \frac { 1 } { N ^ { + } } \sum _ { i = 1 } ^ { N ^ { + } } \log ( f ( o ^ { + } ) ) + \frac { 1 } { N ^ { - } } \sum _ { i = 1 } ^ { N ^ { - } } \log ( 1 - f ( o ^ { - } ) ) .
39
+ $$
40
+
41
+ The quantity $\hat { J } ( f )$ is the empirical version of $J ( f )$
42
+
43
+ $$
44
+ J ( f ) = \mathbb { E } _ { o ^ { + } \sim \rho ^ { + } } \left[ \log ( f ( o ^ { + } ) ) \right] + \mathbb { E } _ { o ^ { - } \sim \rho ^ { - } } \left[ \log ( 1 - f ( o ^ { - } ) ) \right] .
45
+ $$
46
+
47
+ As it is shown in Goodfellow et al. (2014) the quantity $\operatorname* { m a x } _ { f } J ( f )$ is simply the Jensen-Shannon divergence $D _ { J S } ( \rho ^ { + } | \rho ^ { - } )$ between the data distribution and the other distribution:
48
+
49
+ $$
50
+ \operatorname* { m a x } _ { f } J ( f ) = 2 D _ { J S } ( \rho ^ { + } | \rho ^ { - } ) - \log ( 4 ) .
51
+ $$
52
+
53
+ In other words, by estimating this divergence, we learn how different the positive examples are from the negative examples and hope that the learned representation encodes that information.
54
+
55
+ CPC makes use of a noise contrastive estimation model to discriminate observations $o _ { t + k } ^ { + }$ at a “future” time step $t { + } k$ from negative observations $o _ { t + k } ^ { - }$ , which is randomly chosen from the dataset (see Sec. 4 for details). CPC bases this estimation on a state representation $b _ { t }$ that depends on the history up to time step $t$ and embeddings of positive and negative observations at time $t + k$ . The CPC architecture takes into account the belief state representation $b _ { t }$ by using modern memory architecture such as LSTM (Hochreiter & Schmidhuber, 1997; Xingjian et al., 2015) and GRU (Chung et al., 2014). Different possible losses based on this description can be formulated as shown in the appendix.
56
+
57
+ # 3 RELATED WORK
58
+
59
+ In this work, we are interested in learning representations that can compactly encode the belief state in partially observable problems. We also want these representations to capture information about different attributes of the state such as agent and object positions in navigation tasks. It is to be expected that compact representations of POMDPs make it easier to learn and represent models (Boutilier et al., 1999). Indeed, representations that encode important parts of the state have led to improved performance in RL tasks, both with model-based and value-based methods (Guestrin et al., 2003; Diuk et al., 2008; Boots et al., 2011; Levine et al., 2016; Higgins et al., 2017; Karkus et al., 2018).
60
+
61
+ Predictive State Representations (PSRs; Littman & Sutton, 2002) are one such expressive and compact representation, in terms of tests on the POMDP (Rivest & Schapire, 1993). A test is the indicator of a specific sequence of future observations given a specific sequence of actions. With an appropriate collection of tests (and their conditional distributions given histories), one can encode belief states (Rivest & Schapire, 1993; Littman & Sutton, 2002). A PSR is a collection of tests that is expressive enough to effectively encode the conditional distribution of any other test, and as a consequence any belief state in the POMDP. Recently Hefny et al. (2018) have implemented a deep variant of PSR architecture with recurrent neural networking, proving the compatibility of this idea with modern deep architectures. Our work is inspired by the idea that predicting future observations conditioned on future actions can give us an expressive state representation, and this principle guided the design of our representation learning architecture.
62
+
63
+ Sutton et al. (2011); Li et al. (2015); Jaderberg et al. (2016); Dosovitskiy & Koltun (2017); Higgins et al. (2017); Wayne et al. (2018); Igl et al. (2018) used auxiliary tasks to improve agent performance, but only partially investigated what information the learned representations encode. Dosovitskiy & Koltun (2017) uses supervised learning to learn representations that capture state information, and showed that this leads to improved performance in different ViZDoom tasks. Higgins et al. (2017) used methods that learn factored state representations (Burgess et al., 2018) and showed improved performance and effective transfer in 3D RL tasks where the agent must identify and collect good objects, while avoiding bad ones. Wayne et al. (2018) showed that the representation of their proposed agent architecture is able to capture the absolute position of the goal in a large-maze navigation task.
64
+
65
+ Schmidhuber (1991); Diuk et al. (2008); Kolter & $\mathrm { N g }$ (2009); Sorg et al. (2010); Anandkumar et al. (2014) and many others prescribed or tried to estimate the state transition model of the POMDP explicitly. Although our approach learns about the dynamics of the environment, we do not directly evaluate the quality of the learned dynamics model. Instead, we focus on evaluating the quality of the learned representation, which implicitly captures the quality of the learned dynamics as well. In Section 5 we investigate the accuracy of these representations across different domains when trained with different approaches.
66
+
67
+ # 4 ARCHITECTURE AND ALGORITHM
68
+
69
+ Inspired by the PSR literature, our approach relies on predictions of future observations conditioned on future actions as a way to predict the belief state. In particular, we base our architecture on CPC, using a variant of this model to learn rich representations in virtual environments.
70
+
71
+ We now describe the architectures we use in our experiments. Figure 1 outlines the CPC|Action architecture which is a variant of CPC architecture (see Sec. 2.2). We use a GRU network (blue) to take in the history of embedded observations $z _ { t }$ and actions $a _ { t }$ and output the representation $b _ { t }$ for the current time step $t$ . In addition to standard CPC our architecture uses the $b _ { t }$ to initialise an action-GRU (red) which is then fed by the future actions $\{ a _ { t + k } \} _ { k = 0 } ^ { T - 1 }$ . Finally, for each time step $t + k$ , a multi-layer perceptron (MLP) (grey) is fed both by the output of this GRU and the positive example order to $z _ { t + k } ^ { + }$ in order to predict 1 or by the output of the GRU and the negative example t 0 (for a more detailed description of the architecture i.e. ConvNet and fully-co $z _ { t + k } ^ { - }$ inted layer please see the Architecture Details section in the appendix.). We also implement the CPC without actions as exactly the same architecture as CPC|Action except that the action-GRU (red) is not fed by the future actions {at+k}T −1k=0 but by a dummy input $\{ c _ { t + k } \} _ { k = 0 } ^ { T - 1 }$ where $c _ { t + k } = c$ is a constant null vector. Finally we implement one-step frame prediction (FP; Bengio et al., 2007). This architecture learns a belief state $b _ { t }$ for the task of predicting the next observation $o _ { t + 1 }$ given the action $a _ { t }$ via a transposed convolutional network (orange). Common to all 3 architectures is a convolutional neural network (CNN; LeCun et al., 1998) (yellow) that transforms the raw observation $o _ { t }$ to a vector $z _ { t }$ . For evaluation, the belief state $b _ { t }$ is then used by an MLP (green) in order to estimate the position, orientation or other features of the environments. It is important to note that we do not back-propagate the gradient from this MLP (green) that predicts the ground truth to the rest of the architecture. Algorithm 1 outlines how we train the CPC|action architecture. We sample mini-batches of sub-trajectories from our dataset, and unroll the belief GRU $f$ to compute the beliefs $b _ { t }$ for every time step. Then, for every $b _ { t }$ , we sample how far we want to predict into the future up to a maximum of $F$ . We compute the forwarded belief from the Action GRU, and then feed it to the CPC classifier with both the true future observation as the positive example, and a randomly picked observation from the mini-batch as a negative example. We average the classification losses across all time steps of the mini-batch and take a gradient step. For the frame predictor, the training procedure is similar, except we compute the prediction loss of the next future observation instead of the CPC loss for each time step. The distribution of negative examples, and the ratio of the number of positive
72
+
73
+ ![](images/664edaa8df98195ee9ae69d01cc9adc89b7f6871ae189c58e38685bdaff5d6cf.jpg)
74
+ Figure 1: Different architectures used in our experiments.
75
+
76
+ # Algorithm 1: CPC|Action
77
+
78
+ Data: Belief GRU $f$ , Future Prediction Length $F$ , Action GRU $g$ , CPC Classifier h for $i \gets 0$ to $\infty$ do
79
+
80
+ 2 Initialise loss $\ell \gets 0$ ;
81
+ 3 Sample mini-batch $B$ of size $N$ from replay;
82
+ 4 Compute beliefs $b _ { t } = f ( b _ { 0 } , z _ { 1 : t } , a _ { 1 : t - 1 } )$ ;
83
+ 5 for sub-trajectory $j 0$ to $N$ do
84
+ 6 for step $t \gets 0$ to $T$ do
85
+ 7 Sample $f$ uniformly from $[ 1 , \ldots , F ]$ ;
86
+ 8 Let $a _ { t : t + f - 1 }$ be the future actions starting from the current step ;
87
+ 9 Let $z _ { t + f }$ be the future observation $f$ steps in the future ;
88
+ 10 Let $b _ { t }$ be the belief state at current step ;
89
+ 11 Sample negative example $z ^ { - }$ uniformly from $B$ ;
90
+ 12 $\begin{array} { r l } & { b ^ { a } \stackrel { } { = } g ( b _ { t } , \stackrel { \smile } { a } _ { t : t + f - 1 } ) ~ ; } \\ & { \ell ^ { + } = \mathrm { s i g m o i d \_ c r o s s \_ e n t r o p y } ( h ( b ^ { a } , z _ { t + f } ) , 1 ) ~ ; } \\ & { \ell ^ { - } = \mathrm { s i g m o i d \_ c r o s s \_ e n t r o p y } ( h ( b ^ { a } , z ^ { - } ) , 0 ) ~ ; } \\ & { \ell \ell + \ell ^ { + } + \ell ^ { - } ~ ; } \end{array}$
91
+ 13
92
+ 14
93
+ 15
94
+ 16 end
95
+ 17 end
96
+ 18 $\ell \gets \frac { \ell } { | B | }$ ;
97
+ 19 Take gradient step to minimise $\ell$ ;
98
+ 20 end
99
+
100
+ and negative examples can be an important choice for CPC and CPC|Action. We found that taking one negative observation uniformly from the rest of the mini-batch performed very well. We also found that the distribution and ratio became significantly less important when we predict further into the future.
101
+
102
+ # 5 EXPERIMENTS
103
+
104
+ In this section we describe our experimental setup and discuss the results. We would like to evaluate whether our learned representations can encode information about the underlying state of the environment from just partial observations. After motivating our results with experiments in a toy domain (Section 5.1), we present two sets of experiments in a visually rich partially observable 3D environment. In the first set of experiments (Section 5.2), we compare the three different approaches, and look into their capacity to encode the agent’s position and orientation. In the second set of experiments, we delve deeper into the subject of encoding beliefs about objects’ positions (Section 5.3), and the uncertainty on agent’s position and orientation (Section 5.4). Additional details about the experimental setups can be found in Appendix A.
105
+
106
+ # 5.1 TOY GRIDWORLD
107
+
108
+ To give a sense of the belief representations being learned, we first present qualitative results in a toy domain, where we can see how the learned belief changes (in particular reduction in uncertainty) as the agent interacts with the environment. To evaluate the learned belief, we train a separate classifier to predict the true position and orientation of the agent from the learned belief, without letting the gradient flow back into the representation.
109
+
110
+ The toy domain is a square gridworld room. At each step the agent moves (forward or backwards) or rotates (a quarter of a circle to the left or right) at random, and it is only able to observe a square of length 5 centred on it. Fig. 2 shows screenshots from an episode with an agent trained with CPC|Action and predicting 30 steps into the future. We observe that the agent’s representation encodes a belief that reflects the inherent uncertainty on the agent’s position and orientation. This uncertainty is a result of partial observability and, as the agent moves around the room and observes more of the environment, it is progressively reduced, until eventually there is no more uncertainty on the agent’s position and orientation for the rest of the episode. More specifically we observe that throughout the early stage of episode, Figs. 2(a) to 2(d), when the agent’s observation are not informative, the agent is able to refine his belief only by ruling out the states which are not feasible under the past actions. When the agent observes the top wall at time step 32 (Fig. 2(e)) it immediately narrows down its belief to only 3 neighboring states. After that it takes the agent another 20 time steps to completely resolve the uncertainty again by using the past actions.
111
+
112
+ ![](images/bcf09265b013349a245b0e05194e9466671b4163c8a2fc6fe72ab0bf5f2cd1e0.jpg)
113
+ Figure 2: Frames from the agent moving at random in a gridworld (outermost cells are walls, see Fig. 2(e)). In each image, the agent’s partial observation is on the left (agent and walls in black, empty spaces in white), the agent’s position and orientation are on the centre, and the predicted position and orientation are on the right. The diamond-looking shapes result from flattening the beliefs for each of the four possible orientations in the same cell.
114
+
115
+ # 5.2 ALGORITHM COMPARISON
116
+
117
+ In this section we are interested in a variety of visually rich, partially observable environments, so we used four different environments of the DeepMind Lab platform (Beattie et al., 2016).
118
+
119
+ We tested whether the representations encoded the following: 1) agent’s relative $( x , y )$ -position and orientation $\theta$ at each time step, given the agent’s initial position and orientation, 2) the agent’s past relative positions and orientations up to each time step, and 3) the relative position of uncollected objects in the environment at each time step. The reason we test for the agent’s past positions and orientations is because the history is necessary for the agent to remember collected objects.
120
+
121
+ We trained separate networks to estimate the learned representation and initial position and orientation and predict the associated piece of information at every time step. These networks were used only for inspection, that is, gradients did not flow through them into the representation. The positions and orientations are discretised for easier evaluation. To generate data, we used a random policy that repeats a randomly chosen action a random number of times between 1 and 5.
122
+
123
+ The four environments used in our experiment span different kinds of layouts from rooms to mazes to natural terrain, and different object positioning—fixed positions or per-episode randomised positions. Objects are collectable in all four environments. fixed is a single room with objects in fixed locations, room is a single room with objects in randomised locations, $\mathtt { m a z e }$ is a fixed maze with objects in randomised locations, and terrain is a naturalistic, hilly, terrain with desert and forest features, and objects. In terrain, the map (including object positions) is randomly selected in every episode from a fixed, finite set. Fig. 3 gives examples of agent observations from each of these environments (the specific DeepMind Lab environment names are given in Appendix A).
124
+
125
+ ![](images/d5aa60db9408853d5aa40811e3c49a49658d8f08e2119ebfe5717975f9b65749.jpg)
126
+ Figure 3: Examples of agent observations for different environments.
127
+
128
+ We compared CPC|Action to CPC (Oord et al., 2018), as well as frame prediction (FP), which predicts the next frame given the current representation and action. For both CPC|Action and CPC approaches, we test the architectures trained from predicting 1 and 30 steps into the future. Table 1 summarises the prediction losses across all algorithms and environments1, and we can make several observations.
129
+
130
+ <table><tr><td>Env</td><td>Algorithm</td><td>(x,y,0)</td><td>Past (x,y,0)</td><td>Objects (x,y)</td></tr><tr><td>fixed</td><td>FP</td><td>0.118 ± 0.015</td><td>0.121 ± 0.007</td><td>0.043 ± 0.006</td></tr><tr><td></td><td>CPC 1</td><td>0.579 ± 0.067</td><td>0.132 ± 0.010</td><td>0.049 ± 0.005</td></tr><tr><td></td><td>CPC 30</td><td>0.562 ± 0.204</td><td>0.118 ± 0.010</td><td>0.045 ± 0.004</td></tr><tr><td></td><td>CPClAction 1</td><td>0.689 ± 0.057</td><td>0.137 ± 0.006</td><td>0.049 ± 0.004</td></tr><tr><td></td><td>CPCIAction 30</td><td>0.240 ± 0.030</td><td>0.100 ± 0.007</td><td>0.040 ± 0.003</td></tr><tr><td>room</td><td>FP</td><td>0.517 ± 0.123</td><td>0.285± 0.017</td><td>0.484 ± 0.005</td></tr><tr><td></td><td>CPC 1</td><td>2.010 ±0.142</td><td>0.311 ± 0.017</td><td>0.498 ± 0.008</td></tr><tr><td></td><td>CPC 30</td><td>0.482 ± 0.157</td><td>0.257 ± 0.022</td><td>0.481 ± 0.005</td></tr><tr><td></td><td>CPClAction 1</td><td>2.274±0.117</td><td>0.308 ± 0.018</td><td>0.484 ± 0.005</td></tr><tr><td></td><td>CPCIAction 30</td><td>0.689 ± 0.066</td><td>0.276 ± 0.029</td><td>0.484 ± 0.008</td></tr><tr><td>maze</td><td>FP</td><td>0.178 ± 0.207</td><td>0.233 ± 0.029</td><td>0.322 ± 0.008</td></tr><tr><td></td><td>CPC 1</td><td>0.622 ± 0.158</td><td>0.278 ± 0.055</td><td>0.330 ± 0.009</td></tr><tr><td></td><td>CPC 30</td><td>0.244 ± 0.058</td><td>0.213 ± 0.031</td><td>0.325 ± 0.015</td></tr><tr><td></td><td>CPClAction 1</td><td>0.638 ± 0.094</td><td>0.264± 0.028</td><td>0.323 ± 0.010</td></tr><tr><td></td><td>CPCIAction 30</td><td>0.182 ± 0.034</td><td>0.206 ± 0.029</td><td>0.323 ± 0.010</td></tr><tr><td>terrain</td><td>FP</td><td>1.831 ± 0.162</td><td>0.405 ± 0.077</td><td>0.181 ± 0.084</td></tr><tr><td></td><td>CPC1</td><td>3.393 ± 0.252</td><td>0.417 ± 0.074</td><td>0.307 ± 0.174</td></tr><tr><td></td><td>CPC 30</td><td>2.280 ± 0.853</td><td>0.340 ± 0.104</td><td>0.131 ± 0.185</td></tr><tr><td></td><td>CPClAction 1</td><td>3.348 ± 0.482</td><td>0.414 ± 0.042</td><td>0.312 ± 0.049</td></tr><tr><td></td><td>CPClAction 30</td><td>1.589±0.358</td><td>0.344 ± 0.065</td><td>0.139 ±0.136</td></tr></table>
131
+
132
+ Table 1: Evaluation classification losses after $2 \cdot 1 0 ^ { 5 }$ mini-batch updates for the 5 algorithm settings across all 4 environments over 2 seeds.
133
+
134
+ First, predicting 30 steps into the future with CPC and CPC|Action significantly outperforms predicting only 1 step in the future. The poor performance of CPC 1 and CPC|Action 1 is evidence that using a contrastive loss allows the representation to ignore more details of observations compared to FP. Predicting 30 steps into the future with the CPC methods allows representations to encode at least as much relevant information as FP, and at a lower computational cost. It is possible to formulate a version of FP that also predicts further into the future at an even greater computational cost, but it is not clear how much that can improve the learned belief since FP cannot represent distributions over observations, only the mean.
135
+
136
+ Second, in environments with simple observations (not terrain), all three approaches (FP, CPC 30, CPC|Action 30) are able to accurately encode the agent’s position and orientation, and perform reasonably well encoding the agent’s past position and orientation. FP consistently edges out the others in encoding position and orientation. An inspection of the predictions from videos of the evaluation episodes confirm this result. However in terrain with more complex observations, we see from Table 1 that the prediction task is more challenging for all approaches, and there is a larger gap between the accuracy of the predictions. In Figs. 4(a) to 4(c), we see typical examples where all algorithms can accurately predict the position and orientation of the agent. In Figs. 4(d) to 4(f), we see typical examples of prediction mistakes corresponding to each of the approaches. In particular, mistakes from FP are noticeably worse than CPC and CPC|Action 30, and CPC|Action performs the best.
137
+
138
+ Third, for past position and orientation, the general trend is that both CPC approaches are slightly better than FP. This is seen in Table 1 and in evaluation videos. The CPC methods (Figs. 4(b), 4(c), 4(e) and 4(f)) are noticeably better than FP (Figs. 4(a) and 4(d)).
139
+
140
+ ![](images/efd786f476fd0dd691db9b22d75a0816e304dca2797c99b931dd83c9bb7b4aa4.jpg)
141
+ Figure 4: Example predictions for terrain. In each image, ground truths are on the top, predictions on the bottom, $( x , y , \theta )$ (ground truth and predictions) on the left, and past $( x , y , \theta )$ on the right. Figs. 4(a) to 4(c) show examples of accurate $( x , y , \theta )$ predictions, Figs. 4(d) to 4(f) show examples for inaccurate $( x , y , \theta )$ predictions.
142
+
143
+ ![](images/736c7fa6df9b3b6989949db0024c3b09bd4fcf1cf799c536a13a51724b52c1f2.jpg)
144
+ Figure 5: Symmetry of the $( x , y , \theta )$ prediction with the frame predictor in room. Ground truths are on the top, predictions on the bottom, $( x , y , \theta )$ (ground truth and predictions) on the left, and past $( x , y , \theta )$ on the right.
145
+
146
+ Fourth, we take a closer look at room as it is an interesting environment because it is almost symmetric in both $x$ and $y$ axes. The room is almost a square, measuring 9 by 10 units. There are faint vertical pulses of light on the walls that move from small to larger $( x , y )$ , and they are the only symmetry-breaking elements. Table 1 and video inspection suggest that the representations trained with the three algorithms do not allow asymmetries to be consistently resolved. Fig. 5 shows an example of the symmetry in position predictions, reflecting uncertainty about the position and orientation. The higher position and orientation prediction errors of FP and CPC|Action 30 in room are mainly due to the ambiguity from symmetry. We are unsure why CPC is slightly better than CPC|Action at paying attention to the moving vertical lines of light on the walls, but we speculate it is because knowledge of actions taken does not help break the symmetry, and because CPC|Action may be encoding the action-dependent dynamics.
147
+
148
+ Finally, for object positions, we see varied results in Table 1, depending on the type of environment. For fixed, unsurprisingly, all predictors have similar accuracy, since objects are fixed. It is likely that the information is not encoded in the representation—as our results in Section 5.3 suggest—but in the evaluator which simply memorises the fixed positions. For room and maze, which randomise object locations each episode, the prediction errors indicate that the representation is unable to encode any information object position. Finally, for terrain, which has a finite set of fixed object positions, the three approaches FP, CPC 30 and CPC|Action 30 allow for reasonably accurate predictions. We believe that the representations only encode information about the specific map instance, from which the evaluators can decode object position. In Section 5.3 we discuss the issue of representing objects in more detail.
149
+
150
+ # 5.3 INCREASED OBJECT INTERACTION
151
+
152
+ Table 1 shows that none of the approaches are able to encode much information about object positions (cf. room and maze). We hypothesise that the objects are not a significant enough part of the observations to warrant the CPC algorithms to pay attention to them, and there is no reason for FP to continue to remember objects once they go out of the agent’s view.
153
+
154
+ To test this hypothesis, we constructed two simple DeepMind Lab environments: non teleport, where objects cannot be interacted with, and teleport, where objects, when touched, teleport the agent back to its initial position. Both environments are a small square room with the agent’s initial position in a notch on the wall (to create asymmetry), and two visually different objects are placed in random positions at each episode.
155
+
156
+ The teleporting interaction results in a drastic change in the observations of the agent, which should force the representations to encode information about these objects in order to better predict future observations. In contrast, non-interactive objects (in non teleport) are equally visible to the agent, but do not cause drastic changes to observations.
157
+
158
+ Table 2 shows the losses for evaluating the prediction of object position for teleport and non teleport. All of the algorithms are significantly better at encoding information about the position of the objects with the teleport interaction, with CPC|Action 30 being slightly better than the others. Fig. 6 shows screenshots of an evaluation video, where we see that in the case of non teleport (Figs. 6(a) and 6(b)) the representation is only able to react to immediately visible objects. As soon as the agent turns away, the representation no longer contains the object information. However, in the case of teleport (Figs. 6(c) and 6(d)), we see that the representations are able to remember information about the objects even after the agent has turned away and moved elsewhere.
159
+
160
+ Table 2: Evaluation classification losses on object position.
161
+
162
+ <table><tr><td>Algorithm</td><td colspan="2">Objects (x,y)</td></tr><tr><td></td><td>non teleport</td><td>teleport</td></tr><tr><td>FP</td><td>0.148 ± 0.003</td><td>0.108 ± 0.014</td></tr><tr><td>CPC 30</td><td>0.168 ± 0.001</td><td>0.137 ± 0.017</td></tr><tr><td>CPCIAction 30</td><td>0.164 ± 0.002</td><td>0.086 ± 0.020</td></tr></table>
163
+
164
+ ![](images/2d3fc4fd7a4ffd1a5cd1b41faa5c7339a529793b0e849d1a66839721e0b363d5.jpg)
165
+ Figure 6: Example predictions for non teleport and teleport. Ground truths are on the top, predictions on the bottom, $( x , y , \theta )$ (ground truth and predictions) on the centre, object $( x , y )$ on the right, and frame seen by the agent on the left.
166
+
167
+ Furthermore, in Figs. 6(c) and 6(d) we see that the representation is able to maintain uncertainty over the object positions. When the agent only sees one of the two objects, the position of the second object is still uncertain, but the representation is already able to encode some negative evidence, narrowing down the possible locations of the second object.
168
+
169
+ # 5.4 RICHER UNCERTAINTY OVER POSITION
170
+
171
+ In the DeepMind Lab environments, there is not an instance of uncertainty over the agent’s position and orientation similar to the toy Gridworld (Section 5.1) due to being able to see far into the distance in a first-person view. Therefore we constructed a simple DeepMind Lab environment with two parallel hallways (see Fig. 7(a)) to demonstrate this kind of uncertainty in a 3D environment. The agent randomly starts in one of the two hallways, and its position can only be resolved near the exit of the hallways (we do not give the agent’s initial position to the evaluator). Fig. 7(b) illustrates (for CPC|Action 30) how, initially, the representation cannot distinguish in which hallway the agent is. Fig. 7(b) illustrates the representation immediately resolving the location when the agent able to peek out. This behaviour is consistent for all three algorithms: FP, CPC 30 and CPC|Action 30. Thus, even in 3D environments, we are able to learn a belief that can encode a richer uncertainty over the agent’s position.
172
+
173
+ ![](images/c86003dbcff09de13b2565a5e66ead1062dc44df4553db6d4c55c09d5a556d2a.jpg)
174
+ Figure 7: Example predictions for two hallways. Ground truths are on the top, predictions on the bottom, $( x , y , \theta )$ (ground truth and predictions) on the centre, past $( x , y , \theta )$ on the right, and frame seen by the agent on the left.
175
+
176
+ # 6 CONCLUSION AND FUTURE WORK
177
+
178
+ Using a glass box approach, we investigated the quality of representations learned by three different methods: FP, CPC, and CPC|Action. Specifically, we considered a variety of first-person 3D navigation environments, and looked at whether the representation can encode a belief on different aspects of the environment. We found that FP, CPC 30 and CPC|Action 30 are all able to learn representations that encode the agent’s position and orientation, the agent’s trajectory (previous positions and orientations)—cf. Table 1. The position of objects can be encoded as well, provided that interacting with the objects strongly impacts the agent’s future observations (Table 2).
179
+
180
+ More importantly, the representations also encode the agent’s uncertainty over its position and object positions. We showed that this uncertainty is reduced as the agent obtains more information from the environment, including negative evidence, e.g., when the agent sees where the object is not (Fig. 6).
181
+
182
+ In visually simple environments (e.g. fixed), FP was the best at encoding agent position and orientation. In visually complex environment (terrain), CPC 30 and CPC|Action 30 performed best, with multi-step predictions being the key to their success, and action-conditioning providing further improvements.
183
+
184
+ There remains much interesting future work to pursue. We believe the ability of these representations to learn various belief concepts can be further explored to improve performance and generalisation in multi-task settings, by transferring concepts across tasks. The capability of encoding uncertainty can also be useful for learning policies that efficiently explore partially observable environments by acting to reduce uncertainty on the agent’s belief (as in Bayes-optimal exploration; Wilson et al., 2007; Kolter & Ng, 2009; Sorg et al., 2010; Asmuth & Littman, 2012; Ghavamzadeh et al., 2015). As another direction, the three methods we considered can go beyond predicting only visual observations to other modalities of sensory inputs, such as proprioception and touch sensors (Amos et al., 2018). This should lead to belief representations that encode a richer variety of information about the environment and its structure.
185
+
186
+ # REFERENCES
187
+
188
+ Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A System for Large-Scale Machine Learning. In Proceedings of the $I 2 ^ { t h }$ USENIX Symposium on Operating Systems Design and Implementation (OSDI 2016), volume 16, pp. 265–283, 2016.
189
+
190
+ Brandon Amos, Laurent Dinh, Serkan Cabi, Thomas Rothörl, Sergio Gómez Colmenarejo, Alistair Muldal, Tom Erez, Yuval Tassa, Nando de Freitas, and Misha Denil. Learning Awareness Models. Sixth International Conference on Learning Representations (ICLR 2018), 2018. arXiv preprint arXiv:1804.06318.
191
+
192
+ Animashree Anandkumar, Rong Ge, Daniel Hsu, Sham M Kakade, and Matus Telgarsky. Tensor Decompositions for Learning Latent Variable Models. The Journal of Machine Learning Research, 15(1):2773–2832, 2014.
193
+
194
+ John Asmuth and Michael L Littman. Learning is Planning: Near Bayes-Optimal Reinforcement Learning via Monte-Carlo Tree Search. arXiv preprint arXiv:1202.3699, 2012.
195
+
196
+ Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Küttler, Andrew Lefrancq, Simon Green, Víctor Valdés, Amir Sadik, et al. Deepmind Lab. arXiv preprint arXiv:1612.03801, 2016.
197
+
198
+ Yoshua Bengio, Pascal Lamblin, Dan Popovici, and Hugo Larochelle. Greedy Layer-wise Training of Deep Networks. In Advances in Neural Information Processing Systems 20 (NIPS 2007), pp. 153–160, 2007.
199
+
200
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation Learning: A Review and New Perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1798–1828, 2013.
201
+
202
+ Byron Boots, Sajid M Siddiqi, and Geoffrey J Gordon. Closing the Learning-Planning Loop with Predictive State Representations. The International Journal of Robotics Research, 30(7):954–966, 2011.
203
+
204
+ Craig Boutilier, Thomas Dean, and Steve Hanks. Decision-Theoretic Planning: Structural Assumptions and Computational Leverage. Journal of Artificial Intelligence Research, 11:1–94, 1999.
205
+
206
+ Christopher P. Burgess, Irina Higgins, Arka Pal, Loic Matthey, Nick Watters, Guillaume Desjardins, and Alexander Lerchner. Understanding Disentangling in $\beta$ -VAE. arXiv preprint arXiv:1804.03599, 2018.
207
+
208
+ Anthony Rocco Cassandra. Exact and Approximate Algorithms for Partially Observable Markov Decision Processes. Brown University, 1998.
209
+
210
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. arXiv preprint arXiv:1412.3555, 2014.
211
+
212
+ Carlos Diuk, Andre Cohen, and Michael L. Littman. An Object-Oriented Representation for Efficient Reinforcement Learning. In Proceedings of the $2 5 ^ { t h }$ International Conference on Machine Learning, pp. 240–247. ACM, 2008.
213
+
214
+ Alexey Dosovitskiy and Vladlen Koltun. Learning to Act by Predicting the Future. Fifth International Conference on Learning Representations (ICLR 2017), 2017. arXiv preprint arXiv:1611.01779.
215
+
216
+ Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why Does Unsupervised Pre-Training Help Deep Learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010.
217
+
218
+ SM Ali Eslami, Danilo Jimenez Rezende, Frederic Besse, Fabio Viola, Ari S Morcos, Marta Garnelo, Avraham Ruderman, Andrei A Rusu, Ivo Danihelka, Karol Gregor, et al. Neural Scene Representation and Rendering. Science, 360(6394):1204–1210, 2018.
219
+
220
+ Mohammad Ghavamzadeh, Shie Mannor, Joelle Pineau, Aviv Tamar, et al. Bayesian Reinforcement Learning: A Survey. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 8(5-6):359–483, 2015.
221
+
222
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Nets. In Advances in Neural Information Processing Systems 27 (NIPS 2014), pp. 2672–2680, 2014.
223
+
224
+ Carlos Guestrin, Daphne Koller, Chris Gearhart, and Neal Kanodia. Generalizing Plans to New Environments in Relational MDPs. In Proceedings of the $I { \boldsymbol { \delta } } ^ { t h }$ International Joint Conference on Artificial Intelligence (IJCAI 2003), pp. 1003–1010. Morgan Kaufmann Publishers Inc., 2003.
225
+
226
+ Michael Gutmann and Aapo Hyvärinen. Noise-Contrastive Estimation: A New Estimation Principle for Unnormalized Statistical Models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2010), pp. 297–304, 2010.
227
+
228
+ Michael U Gutmann and Aapo Hyvärinen. Noise-Contrastive Estimation of Unnormalized Statistical Models, with Applications to Natural Image Statistics. Journal of Machine Learning Research, 13 (Feb):307–361, 2012.
229
+
230
+ Trevor Hastie, Robert Tibshirani, and Jerome Friedman. The Elements of Statistical Learning. Springer Series in Statistics. Springer New York, NY, USA, $2 ^ { \mathrm { n d } }$ edition, 2009a.
231
+
232
+ Trevor Hastie, Robert Tibshirani, and Jerome Friedman. Unsupervised Learning. In The Elements of Statistical Learning, pp. 485–585. Springer New York, NY, USA, $2 ^ { \mathrm { n d } }$ edition, 2009b.
233
+
234
+ 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), pp. 770–778, 2016.
235
+
236
+ Ahmed Hefny, Zita Marinho, Wen Sun, Siddhartha Srinivasa, and Geoffrey Gordon. Recurrent predictive state policy networks. In Proceedings of The $3 5 ^ { r d }$ International Conference on Machine Learning (ICML 2018). PMLR, 2018.
237
+
238
+ Irina Higgins, Arka Pal, Andrei Rusu, Loic Matthey, Christopher Burgess, Alexander Pritzel, Matthew Botvinick, Charles Blundell, and Alexander Lerchner. DARLA: Improving Zero-Shot Transfer in Reinforcement Learning. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the $3 4 ^ { t h }$ International Conference on Machine Learning (ICML 2017), volume 70 of Proceedings of Machine Learning Research, pp. 1480–1490, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
239
+
240
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
241
+
242
+ Maximilian Igl, Luisa Zintgraf, Tuan Anh Le, Frank Wood, and Shimon Whiteson. Deep Variational Reinforcement Learning for POMDPs. In Proceedings of The $3 5 ^ { r d }$ International Conference on Machine Learning (ICML 2018). PMLR, 2018.
243
+
244
+ Tommi Jaakkola, Satinder P Singh, and Michael I Jordan. Reinforcement Learning Algorithm for Partially Observable Markov Decision Problems. In Advances in Neural Information Processing Systems 8 (NIPS 1995), pp. 345–352, 1995.
245
+
246
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement Learning with Unsupervised Auxiliary Tasks. arXiv preprint arXiv:1611.05397, 2016.
247
+
248
+ Peter Karkus, David Hsu, and Wee Sun Lee. Integrating Algorithmic Planning and Deep Learning for Partially Observable Navigation. arXiv preprint arXiv:1807.06696, 2018.
249
+
250
+ Diederik P Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. Third International Conference on Learning Representations (ICLR 2015), 2015. arXiv preprint arXiv:1412.6980.
251
+
252
+ J Zico Kolter and Andrew Y Ng. Near-Bayesian Exploration in Polynomial Time. In Proceedings of the $2 6 ^ { t h }$ Annual International Conference on Machine Learning (ICML 2009), pp. 513–520. ACM, 2009.
253
+
254
+ Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-Based Learning Applied to Document Recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
255
+
256
+ 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.
257
+
258
+ Xiujun Li, Lihong Li, Jianfeng Gao, Xiaodong He, Jianshu Chen, Li Deng, and Ji He. Recurrent Reinforcement Learning: a Hybrid Approach. arXiv preprint arXiv:1509.03044, 2015.
259
+
260
+ Michael L. Littman and Richard S. Sutton. Predictive Representations of State. In Advances in Neural Information Processing Systems 15 (NIPS 2002), pp. 1555–1561, 2002.
261
+
262
+ William S. Lovejoy. A Survey of Algorithmic Methods for Partially Observed Markov Decision Processes. Annals of Operations Research, 28(1):47–65, 1991.
263
+
264
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level Control through Deep Reinforcement Learning. Nature, 518(7540):529, 2015.
265
+
266
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation Learning with Contrastive Predictive Coding. arXiv preprint arXiv:1807.03748, 2018.
267
+
268
+ Lawrence R Rabiner. A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition. Proceedings of the IEEE, 77(2):257–286, 1989.
269
+
270
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. arXiv preprint arXiv:1401.4082, 2014.
271
+
272
+ Ronald L. Rivest and Robert E. Schapire. Inference of Finite Automata Using Homing Sequences. Information and Computation, 103(2):299–347, 1993.
273
+
274
+ Jürgen Schmidhuber. Curious Model-Building Control Systems. In Neural Networks, 1991. IEEE International Joint Conference on, pp. 1458–1463. IEEE, 1991.
275
+
276
+ 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, 2016.
277
+
278
+ Jonathan Sorg, Satinder Singh, and Richard L. Lewis. Variance-Based Rewards for Approximate Bayesian Reinforcement Learning. In Proceedings of the $2 6 ^ { t h }$ Conference on Uncertainty in Artificial Intelligence (UAI 2010), pp. 564–571, 2010.
279
+
280
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to Sequence Learning with Neural Networks. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27 (NIPS 201), pp. 3104–3112. Curran Associates, Inc., 2014.
281
+
282
+ Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. MIT press, 1998.
283
+
284
+ Richard S Sutton, Joseph Modayil, Michael Delp, Thomas Degris, Patrick M Pilarski, Adam White, and Doina Precup. Horde: A Scalable Real-Time Architecture for Learning Knowledge from Unsupervised Sensorimotor Interaction. In The $I O ^ { t h }$ International Conference on Autonomous Agents and Multiagent Systems-Volume 2, pp. 761–768. International Foundation for Autonomous Agents and Multiagent Systems, 2011.
285
+
286
+ Greg Wayne, Chia-Chun Hung, David Amos, Mehdi Mirza, Arun Ahuja, Agnieszka GrabskaBarwinska, Jack Rae, Piotr Mirowski, Joel Z Leibo, Adam Santoro, et al. Unsupervised Predictive Memory in a Goal-Directed Agent. arXiv preprint arXiv:1803.10760, 2018.
287
+
288
+ Aaron Wilson, Alan Fern, Soumya Ray, and Prasad Tadepalli. Multi-Task Reinforcement Learning: A Hierarchical Bayesian Approach. In Proceedings of the $2 4 ^ { t h }$ International Conference on Machine Learning (ICML 2007), pp. 1015–1022. ACM, 2007.
289
+
290
+ SHI Xingjian, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. In Advances in neural information processing systems, pp. 802–810, 2015.
291
+
292
+ # A IMPLEMENTATION DETAILS
293
+
294
+ Environments. Table 3 gives the names of the four environments (levels) of the DeepMind Lab platform (Beattie et al., 2016) that we used. The latter three tasks are custom DeepMind Lab environments that we created.
295
+
296
+ Table 3: Correspondences of our environments to DeepMind Lab levels.
297
+
298
+ <table><tr><td>Name in this paper</td><td>dmlab30name</td></tr><tr><td>fixed</td><td>seekavoid_arena_01</td></tr><tr><td>room</td><td>rooms_collect_good_objects_train</td></tr><tr><td>maze</td><td>nav_maze_random_goal_01</td></tr><tr><td>terrain</td><td>Smaller variant of natlab_fixed_large_map</td></tr><tr><td>teleport</td><td>一</td></tr><tr><td>non teleport</td><td>一</td></tr><tr><td>two hallways</td><td>1</td></tr></table>
299
+
300
+ Frame Reconstruction Loss. For frame prediction, we normalise the pixel colour values to be between 0 and 1 and use the sigmoid cross-entropy loss.
301
+
302
+ CPC Losses. We implement the CPC losses differently from Oord et al. (2018). They score examples for the contrastive loss at $k$ time steps in the future with $f _ { k } ( o ) \dot { = } \exp ( \mathrm { c o n v } ( o ) ^ { \top } \dot { W _ { k } } b _ { t } )$ for a matrix $W _ { k }$ , where $b _ { t }$ is the current belief. The contrastive loss to be minimised at time step $t$ and looking $k$ steps in the future is
303
+
304
+ $$
305
+ - \ln { \frac { f _ { k } ( o ^ { + } ) } { f _ { k } ( o ^ { + } ) + \sum _ { j = 1 } ^ { m } f _ { k } ( o _ { j } ^ { - } ) } } ,
306
+ $$
307
+
308
+ where the positive example is $o ^ { + } = o _ { t + k }$ (the observation at time step $t + k )$ , and the negative examples are $( o _ { 1 } ^ { - } , \ldots , o _ { m } ^ { - } )$ , which can be sampled from a minibatch of data.
309
+
310
+ In our case, the score function $f$ is a one-hidden-layer perceptron with ReLU activation in the hidden layers, taking as inputs the concatenation of $\operatorname { c o n v } ( o )$ and $b _ { t }$ . The contrastive loss to be minimised at time step $t$ and looking $k$ steps in the future is the binary classification loss
311
+
312
+ $$
313
+ \sigma ( f ( o ^ { + } , b _ { t } ) ) + \sigma ( - f ( o ^ { - } , b _ { t } ) ) ,
314
+ $$
315
+
316
+ where $\sigma$ is the sigmoid function, the positive example is $o ^ { + } = o _ { t + k }$ (the observation at time step $t + k )$ , and the negative example $o ^ { - }$ is drawn uniformly at random from the minibatch (including different time steps of the trajectory $o _ { t + k }$ belongs to).
317
+
318
+ Architecture Details. A diagram of the architecture is in Fig. 1.
319
+
320
+ The observations from DeepMind Lab are $8 4 \times 8 4$ pixels, each pixel consisting of three bytes representing RGB values respectively. This observation is passed through our convolutional network, which has three convolutional layers with filter sizes $8 , 4 , 3$ , strides $4 , 2 , 1$ , and number of filters 32, 64, 64 respectively, and a final hidden layer of size 512 with ReLU activations after every layer.
321
+
322
+ The belief GRU takes as input the concatenation of $z _ { t }$ and $a _ { t - 1 }$ and outputs $b _ { t }$ , where $z _ { t }$ is the output of size 512 of the conv net after passing in the observation $o _ { t }$ , and $a _ { t - 1 }$ is a one-hot vector of the discrete action. The belief GRU has a hidden size of 512 and thus the output $b _ { t }$ also has a size of 512.
323
+
324
+ The action GRU also has a hidden size of 512, and takes $b _ { t }$ as the initial hidden state. It takes one-hot vectors of the discrete actions $a _ { t }$ as input, and outputs a forwarded belief of size 512.
325
+
326
+ The forwarded belief is then concatenated with the corresponding positive example $z ^ { + }$ , which is the output of size 512 of the same convnet as before of a positive observation example $o ^ { + }$ . The concatenation is then fed to the contrastive discriminator which is an MLP with a hidden layer of size 512 and ReLU activations, and a linear output of size 1. This output of size 1 is then fed into a sigmoid cross-entropy loss for classifying the positive example as class 1. A similar process is used for classifying a negative example that uses the same forwarded belief and contrastive discriminator.
327
+
328
+ For the frame predictor, the deconv network architecture is the transpose of the same convnet we use for observations.
329
+
330
+ For evaluating the encoded information the belief $b _ { t }$ of position and orientation, past position and orientation, and object positions, we use a two hidden layer MLP with each hidden layer having size 512 and ReLU activations. The input to the MLP is the concatenation of $b _ { t }$ . In the case of ’fixed’, ’room’ , ’maze’ and ’terrain’ levels, we provide the one-hot of the agent’s initial discretised position and orientation to break the symmetry in these environments. The output is a softmax for predicting position and orientation, a grid of sigmoids for past position and orientation, and again a grid of sigmoids for object positions. We discretised the orientation into the 4 cardinal directions. For position, we did the following discretisations: fixed is $9 \times 1 0$ , room is $9 \times 1 0$ , maze is $1 0 \times 5$ terrain is $1 0 \times 1 0$ , two hallways is $7 \times 7$ , and teleport and non teleport are $6 \times 6$
331
+
332
+ Training Details. To gather data, we used a policy that picks an action at random, and then repeats that action between 1 and 5 times. We trained using a distributed framework, where we used 128 processes to interact with the environment and push trajectories into a FIFO replay buffer. The trajectories are partitioned into 100-step sub-trajectories, and the replay buffer has a max capacity of $5 \cdot 1 0 ^ { 4 }$ sub-trajectories. We have one training process that samples mini-batches of 64 sub-trajectories uniformly from the replay buffer and trains using the Adam optimiser (Kingma & Ba, 2015) in TensorFlow (Abadi et al., 2016) with default hyperparameters with a learning rate of 0.0005. The belief GRU is shared with the 128 interacting processes, as they also push the hidden state of the GRU of the first step of each sub-trajectory into the replay buffer as well. In the training process, after sampling a mini-batch, we use this stored initial hidden state and unroll the belief GRU for the rest of the steps to compute the beliefs.
md/train/ryxwJhC9YX/ryxwJhC9YX.md ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INSTAGAN: INSTANCE-AWARE IMAGE-TO-IMAGE TRANSLATION
2
+
3
+ Sangwoo $\mathbf { M o } ^ { * }$ , Minsu Cho†, Jinwoo Shin∗,‡
4
+ ∗Korea Advanced Institute of Science and Technology (KAIST), Daejeon, Korea
5
+ †Pohang University of Science and Technology (POSTECH), Pohang, Korea
6
+ ‡AItrics, Seoul, Korea
7
+ ∗{swmo, jinwoos}@kaist.ac.kr, †mscho@postech.ac.kr
8
+
9
+ # ABSTRACT
10
+
11
+ Unsupervised image-to-image translation has gained considerable attention due to the recent impressive progress based on generative adversarial networks (GANs). However, previous methods often fail in challenging cases, in particular, when an image has multiple target instances and a translation task involves significant changes in shape, e.g., translating pants to skirts in fashion images. To tackle the issues, we propose a novel method, coined instance-aware GAN (InstaGAN), that incorporates the instance information (e.g., object segmentation masks) and improves multi-instance transfiguration. The proposed method translates both an image and the corresponding set of instance attributes while maintaining the permutation invariance property of the instances. To this end, we introduce a context preserving loss that encourages the network to learn the identity function outside of target instances. We also propose a sequential mini-batch inference/training technique that handles multiple instances with a limited GPU memory and enhances the network to generalize better for multiple instances. Our comparative evaluation demonstrates the effectiveness of the proposed method on different image datasets, in particular, in the aforementioned challenging cases. Code and results are available in https://github.com/sangwoomo/instagan.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Cross-domain generation arises in many machine learning tasks, including neural machine translation (Artetxe et al., 2017; Lample et al., 2017), image synthesis (Reed et al., 2016; Zhu et al., 2016), text style transfer (Shen et al., 2017), and video generation (Bansal et al., 2018; Wang et al., 2018a; Chan et al., 2018). In particular, the unpaired (or unsupervised) image-to-image translation has achieved an impressive progress based on variants of generative adversarial networks (GANs) (Zhu et al., 2017; Liu et al., 2017; Choi et al., 2017; Almahairi et al., 2018; Huang et al., 2018; Lee et al., 2018), and has also drawn considerable attention due to its practical applications including colorization (Zhang et al., 2016), super-resolution (Ledig et al., 2017), semantic manipulation (Wang et al., 2018b), and domain adaptation (Bousmalis et al., 2017; Shrivastava et al., 2017; Hoffman et al., 2017). Previous methods on this line of research, however, often fail on challenging tasks, in particular, when the translation task involves significant changes in shape of instances (Zhu et al., 2017) or the images to translate contains multiple target instances (Gokaslan et al., 2018). Our goal is to extend image-to-image translation towards such challenging tasks, which can strengthen its applicability up to the next level, e.g., changing pants to skirts in fashion images for a customer to decide which one is better to buy. To this end, we propose a novel method that incorporates the instance information of multiple target objectsin the framework of generative adversarial networks (GAN); hence we called it instance-aware GAN (InstaGAN). In this work, we use the object segmentation masks for instance information, which may be a good representation for instance shapes, as it contains object boundaries while ignoring other details such as color. Using the information, our method shows impressive results for multi-instance transfiguration tasks, as shown in Figure 1.
16
+
17
+ Our main contribution is three-fold: an instance-augmented neural architecture, a context preserving loss, and a sequential mini-batch inference/training technique. First, we propose a neural network architecture that translates both an image and the corresponding set of instance attributes. Our architecture can translate an arbitrary number of instance attributes conditioned by the input, and is designed to be permutation-invariant to the order of instances. Second, we propose a context preserving loss that encourages the network to focus on target instances in translation and learn an identity function outside of them. Namely, it aims at preserving the background context while transforming the target instances. Finally, we propose a sequential mini-batch inference/training technique, i.e., translating the mini-batches of instance attributes sequentially, instead of doing the entire set at once. It allows to handle a large number of instance attributes with a limited GPU memory, and thus enhances the network to generalize better for images with many instances. Furthermore, it improves the translation quality of images with even a few instances because it acts as data augmentation during training by producing multiple intermediate samples. All the aforementioned contributions are dedicated to how to incorporates the instance information (e.g., segmentation masks) for image-to-image translation. However, we believe that our approach is applicable to numerous other cross-domain generation tasks where set-structured side information is available.
18
+
19
+ ![](images/993386266e49719b6e059a02f613ea7494b01cde551d0855405e729188da3f50.jpg)
20
+ Figure 1: Translation results of the prior work (CycleGAN, Zhu et al. (2017)), and our proposed method, InstaGAN. Our method shows better results for multi-instance transfiguration problems.
21
+
22
+ To the best of our knowledge, we are the first to report image-to-image translation results for multiinstance transfiguration tasks. A few number of recent methods (Kim et al., 2017; Liu et al., 2017; Gokaslan et al., 2018) show some transfiguration results but only for images with a single instance often in a clear background. Unlike the previous results in a simple setting, our focus is on the harmony of instances naturally rendered with the background. On the other hand, CycleGAN (Zhu et al., 2017) show some results for multi-instance cases, but report only a limited performance for transfiguration tasks. At a high level, the significance of our work is also on discovering that the instance information is effective for shape-transforming image-to-image translation, which we think would be influential to other related research in the future. Mask contrast-GAN (Liang et al., 2017) and Attention-GAN (Mejjati et al., 2018) use segmentation masks or predicted attentions, but only to attach the background to the (translated) cropped instances. They do not allow to transform the shapes of the instances. To the contrary, our method learns how to preserve the background by optimizing the context preserving loss, thus facilitating the shape transformation.
23
+
24
+ # 2 INSTAGAN: INSTANCE-AWARE IMAGE-TO-IMAGE TRANSLATION
25
+
26
+ Given two image domains $\mathcal { X }$ and $\mathcal { V }$ , the problem of image-to-image translation aims to learn mappings across different image domains, $G _ { \mathrm { X Y } } : \mathcal { X } \mathcal { Y }$ or/and $G _ { \mathrm { Y X } } : \mathcal { Y } \mathcal { X }$ , i.e., transforming target scene elements while preserving the original contexts. This can also be formulated as a conditional generative modeling task where we estimate the conditionals $p ( y | x )$ or/and $p ( x | y )$ . The goal of unsupervised translation we tackle is to recover such mappings only using unpaired samples from marginal distributions of original data, $p _ { \mathtt { d a t a } } ( x )$ and $p _ { \mathtt { d a t a } } ( y )$ of two image domains.
27
+
28
+ The main and unique idea of our approach is to incorporate the additional instance information, i.e., augment a space of set of instance attributes $\mathcal { A }$ to the original image space $\mathcal { X }$ , to improve the image-to-image translation. The set of instance attributes $\mathbf { \pmb { a } } \in \mathcal { A }$ comprises all individual attributes of $N$ target instances: $\mathbf { a } = \{ a _ { i } \} _ { i = 1 } ^ { N }$ . In this work, we use an instance segmentation mask only, but we remark that any useful type of instance information can be incorporated for the attributes. Our approach then can be described as learning joint-mappings between attribute-augmented spaces $\mathcal { X } \times \mathcal { A }$ and $\mathcal { V } \times B$ . This leads to disentangle different instances in the image and allows the generator to perform an accurate and detailed translation. We learn our attribute-augmented mapping in the framework of generative adversarial networks (GANs) (Goodfellow et al., 2014), hence, we call it instance-aware GAN (InstaGAN). We present details of our approach in the following subsections.
29
+
30
+ # 2.1 INSTAGAN ARCHITECTURE
31
+
32
+ Recent GAN-based methods (Zhu et al., 2017; Liu et al., 2017) have achieved impressive performance in the unsupervised translation by jointly training two coupled mappings $G _ { \mathrm { X Y } }$ and $G _ { \mathrm { Y X } }$ with a cycle-consistency loss that encourages $G _ { \mathrm { Y X } } ( G _ { \mathrm { X Y } } ( x ) ) \approx x$ and $G _ { \mathrm { X Y } } ( G _ { \mathrm { Y X } } ( y ) ) \approx y$ . Namely, we choose to leverage the CycleGAN approach (Zhu et al., 2017) to build our InstaGAN. However, we remark that training two coupled mappings is not essential for our method, and one can also design a single mapping following other approaches (Benaim & Wolf, 2017; Galanti et al., 2018). Figure 2 illustrates the overall architecture of our model. We train two coupled generators $G _ { \mathrm { X Y } } : \mathcal { X } \times \mathcal { A } \mathcal { Y } \times \mathcal { B }$ and $G _ { \mathrm { Y X } } : \mathcal { Y } \times \mathcal { B } \mathcal { X } \times \mathcal { A }$ , where $G _ { \mathrm { X Y } }$ translates the original data $( x , a )$ to the target domain data $( \boldsymbol { y } ^ { \prime } , \boldsymbol { b } ^ { \prime } )$ (and vice versa for $G _ { \mathrm { Y X } } )$ , with adversarial discriminators $D _ { \mathrm { X } } : \mathcal { X } \times \mathcal { A } \{ \cdot \mathrm { X } ^ { \bullet }$ , ‘not $X ^ { \prime } \}$ and $D _ { \mathrm { Y } } : \mathcal { Y } \times \mathcal { B } \{ \ \cdot \mathrm { Y } ^ { \bullet }$ , ‘not $\mathrm { Y } ^ { \prime } \}$ , where $D _ { \mathrm { { X } } }$ determines if the data (original $( x , a )$ or translated $( x ^ { \prime } , a ^ { \prime } ) )$ is in the target domain $\mathcal { X } \times \mathcal { A }$ or not (and vice versa for $D _ { \mathrm { Y } }$ ).
33
+
34
+ ![](images/405297e0061b3a2ccd494050c2f7f22dd57a95d516d668fac37ac0fe1c9de09e.jpg)
35
+ Figure 2: (a) Overview of InstaGAN, where generators $G _ { \mathrm { X Y } }$ , $G _ { \mathrm { Y X } }$ and discriminator $D _ { \mathrm { { X } } }$ , $D _ { \mathrm { Y } }$ follows the architectures in (b) and (c), respectively. Each network is designed to encode both an image and set of instance masks. $G$ is permutation equivariant, and $D$ is permutation invariant to the set order. To achieve properties, we sum features of all set elements for invariance, and then concatenate it with the identity mapping for equivariance.
36
+
37
+ Our generator $G$ encodes both $x$ and $^ { a }$ , and translates them into $y ^ { \prime }$ and $\pmb { b } ^ { \prime }$ . Notably, the order of the instance attributes in the set $^ { a }$ should not affect the translated image $y ^ { \prime }$ , and each instance attribute in the set $\textbf { \em a }$ should be translated to the corresponding one in $\pmb { b } ^ { \prime }$ . In other words, $y ^ { \prime }$ is permutation-invariant with respect to the instances in $^ { a }$ , and $\pmb { b } ^ { \prime }$ is permutation-equivariant with respect to them. These properties can be implemented by introducing proper operators in feature encoding (Zaheer et al., 2017). We first extract individual features from image and attributes using image feature extractor $f _ { \mathtt { G } \mathtt { X } }$ and attribute feature extractor $f _ { \mathtt { G A } }$ , respectively. The attribute features individuallysummation: features wit ng . Are, $f _ { \mathtt { G A } }$ are then aggregated into a permutation-invariant set feature vialustrated in Figure 2b, we concatenate some of image and attribute feed them to image and attribute generators. Formally, the image $\textstyle \sum _ { i = 1 } ^ { N } f _ { \mathtt { G A } } ( a _ { i } )$ representation $h _ { \tt G X }$ and the $n$ -th attribute representation $h _ { \mathtt { G A } } ^ { n }$ in generator $G$ can be formulated as:
38
+
39
+ $$
40
+ h _ { \mathbb { G } \mathtt { X } } ( x , a ) = \left[ f _ { \mathbb { G } \mathtt { X } } ( x ) ; \sum _ { i = 1 } ^ { N } f _ { \mathbb { G } \mathtt { A } } ( a _ { i } ) \right] , \quad h _ { \mathbb { G } \mathtt { A } } ^ { n } ( x , a ) = \left[ f _ { \mathbb { G } \mathtt { X } } ( x ) ; \sum _ { i = 1 } ^ { N } f _ { \mathbb { G } \mathtt { A } } ( a _ { i } ) ; f _ { \mathbb { G } \mathtt { A } } ( a _ { n } ) \right] ,
41
+ $$
42
+
43
+ where each attribute encoding $h _ { \mathtt { G A } } ^ { n }$ process features of all attributes as a contextual feature. Finally, $h _ { \tt G X }$ is fed to the image generator $g _ { \tt G X }$ , and $h _ { \mathtt { G A } } ^ { n }$ $( n = 1 , \ldots , N )$ are to the attribute generator $g _ { \tt G A }$ .
44
+
45
+ On the other hand, our discriminator $D$ encodes both $x$ and $^ { a }$ (or $x ^ { \prime }$ and $\mathbf { { a } ^ { \prime } }$ ), and determines whether the pair is from the domain or not. Here, the order of the instance attributes in the set $\textbf { \em a }$ should not affect the output. In a similar manner above, our representation in discriminator $D$ , which is permutation-invariant to the instances, is formulated as:
46
+
47
+ $$
48
+ h _ { \tt D X } ( x , \pmb { a } ) = \left[ f _ { \tt D X } ( x ) ; \sum _ { i = 1 } ^ { N } f _ { \tt D A } ( a _ { i } ) \right] ,
49
+ $$
50
+
51
+ which is fed to an adversarial discriminator $g _ { \tt D X }$
52
+
53
+ We emphasize that the joint encoding of both image $x$ and instance attributes $\textbf { \em a }$ for each neural component is crucial because it allows the network to learn the relation between $x$ and $\textbf { \em a }$ . For example, if two separate encodings and discriminators are used for $x$ and $\textbf { \em a }$ , the generator may be misled to produce image and instance masks that do not match with each other. By using the joint encoding and discriminator, our generator can produce an image of instances properly depicted on the area consistent with its segmentation masks. As will be seen in Section 3, our approach can disentangle output instances considering their original layouts. Note that any types of neural networks may be used for sub-network architectures mentioned above such as $f _ { \mathtt { G X } } , f _ { \mathtt { G A } } , f _ { \mathtt { D X } } , f _ { \mathtt { D A } } , g _ { \mathtt { G X } } .$ , $g _ { \tt G A }$ , and $g _ { \tt D X }$ . We describe the detailed architectures used in our experiments in Appendix A.
54
+
55
+ # 2.2 TRAINING LOSS
56
+
57
+ Remind that an image-to-image translation model aims to translate a domain while keeping the original contexts (e.g., background or instances’ domain-independent characteristics such as the looking direction). To this end, we both consider the domain loss, which makes the generated outputs to follow the style of a target domain, and the content loss, which makes the outputs to keep the original contents. Following our baseline model, CycleGAN (Zhu et al., 2017), we use the GAN loss for the domain loss, and consider both the cycle-consistency loss (Kim et al., 2017; Yi et al., 2017) and the identity mapping loss (Taigman et al., 2016) for the content losses.1 In addition, we also propose a new content loss, coined context preserving loss, using the original and predicted segmentation information. In what follows, we formally define our training loss in detail. For simplicity, we denote our loss function as a function of a single training sample $( x , \pmb { a } ) \in \mathcal { X } \times \mathcal { A }$ and $( y , \bar { b } ) \in \mathcal { \dot { V } } \times B$ , while one has to minimize its empirical means in training.
58
+
59
+ The GAN loss is originally proposed by Goodfellow et al. (2014) for generative modeling via alternately training generator $G$ and discriminator $D$ . Here, $D$ determines if the data is a real one of a fake/generated/translated one made by $G$ . There are numerous variants of the GAN loss (Nowozin et al., 2016; Arjovsky et al., 2017; Li et al., 2017; Mroueh et al., 2017), and we follow the LSGAN scheme (Mao et al., 2017), which is empirically known to show a stably good performance:
60
+
61
+ $$
62
+ \mathcal { L } _ { \mathrm { L S G A N } } = ( D _ { \mathrm { X } } ( x , a ) - 1 ) ^ { 2 } + D _ { \mathrm { X } } ( G _ { \mathrm { Y X } } ( y , b ) ) ^ { 2 } + ( D _ { \mathrm { Y } } ( y , b ) - 1 ) ^ { 2 } + D _ { \mathrm { Y } } ( G _ { \mathrm { X Y } } ( x , a ) ) ^ { 2 } .
63
+ $$
64
+
65
+ For keeping the original content, the cycle-consistency loss $\mathcal { L } _ { \mathrm { c y c } }$ and the identity mapping loss $\mathcal { L } _ { \mathrm { i d t } }$ enforce samples not to lose the original information after translating twice and once, respectively:
66
+
67
+ $$
68
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { c y c } } = \| G _ { \mathrm { Y X } } ( G _ { \mathrm { X Y } } ( \boldsymbol { x } , \boldsymbol { a } ) ) - ( \boldsymbol { x } , \boldsymbol { a } ) \| _ { 1 } + \| G _ { \mathrm { X Y } } ( G _ { \mathrm { Y X } } ( \boldsymbol { y } , \boldsymbol { b } ) ) - ( \boldsymbol { y } , \boldsymbol { b } ) \| _ { 1 } , } \\ & { \mathcal { L } _ { \mathrm { i d t } } = \| G _ { \mathrm { X Y } } ( \boldsymbol { y } , \boldsymbol { b } ) - ( \boldsymbol { y } , \boldsymbol { b } ) \| _ { 1 } + \| G _ { \mathrm { Y X } } ( \boldsymbol { x } , \boldsymbol { a } ) - ( \boldsymbol { x } , \boldsymbol { a } ) \| _ { 1 } . } \end{array}
69
+ $$
70
+
71
+ Finally, our newly proposed context preserving loss $\mathcal { L } _ { \mathrm { c t x } }$ enforces to translate instances only, while keeping outside of them, i.e., background. Formally, it is a pixel-wise weighted $\ell _ { 1 }$ -loss where the weight is 1 for background and 0 for instances. Here, note that backgrounds for two domains become different in transfiguration-type translation involving significant shape changes. Hence, we consider the non-zero weight only if a pixel is in background in both original and translated ones. Namely, for the original samples $( x , \bar { a } )$ , $( y , b )$ and the translated one $( \bar { y } ^ { \prime } , b ^ { \prime } )$ , $( x ^ { \prime } , a ^ { \prime } )$ , we let the weight $w ( a , b ^ { \prime } )$ , $w ( b , a ^ { \prime } )$ be one minus the element-wise minimum of binary represented instance masks, and we propose
72
+
73
+ $$
74
+ \mathcal { L } _ { \mathrm { c t x } } = \| w ( \boldsymbol { \mathbf { \mathit { a } } } , \boldsymbol { \mathbf { \mathit { b } } } ^ { \prime } ) \odot ( x - y ^ { \prime } ) \| _ { 1 } ] + \| w ( \boldsymbol { \mathbf { \mathit { b } } } , \boldsymbol { \mathbf { \mathit { a } } } ^ { \prime } ) \odot ( y - x ^ { \prime } ) \| _ { 1 }
75
+ $$
76
+
77
+ where $\odot$ is the element-wise product. In our experiments, we found that the context preserving loss not only keeps the background better, but also improves the quality of generated instance segmentations. Finally, the total loss of InstaGAN is
78
+
79
+ $$
80
+ { \mathcal { L } } _ { \mathrm { I n s t a G A N } } = \underbrace { { \mathcal { L } } _ { \mathrm { L S G A N } } } _ { \mathrm { G A N ( d o m a i n ) ~ l o s s } } + \underbrace { \lambda _ { \mathrm { c y c } } { \mathcal { L } } _ { \mathrm { c y c } } + \lambda _ { \mathrm { i d t } } { \mathcal { L } } _ { \mathrm { i d t } } + \lambda _ { \mathrm { c t x } } { \mathcal { L } } _ { \mathrm { c t x } } } _ { \mathrm { c o n t e n t ~ l o s s } } ,
81
+ $$
82
+
83
+ where $\lambda _ { \mathrm { c y c } } , \lambda _ { \mathrm { i d t } } , \lambda _ { \mathrm { c t x } } > 0$ are some hyper-parameters balancing the losses.
84
+
85
+ # 2.3 SEQUENTIAL MINI-BATCH TRANSLATION
86
+
87
+ While the proposed architecture is able to translate an arbitrary number of instances in principle, the GPU memory required linearly increases with the number of instances. For example, in our experiments, a machine was able to forward only a small number (say, 2) of instance attributes during training, and thus the learned model suffered from poor generalization to images with a larger number of instances. To address this issue, we propose a new inference/training technique, which allows to train an arbitrary number of instances without increasing the GPU memory. We first describe the sequential inference scheme that translates the subset of instances sequentially, and then describe the corresponding mini-batch training technique.
88
+
89
+ ![](images/8a7eafc04564d1abc5671d609ff6a19f2803059894d41ba9043777e76b12fdfd.jpg)
90
+ Figure 3: Overview of the sequential mini-batch training with instance subsets (mini-batches) of size 1,2, and 1, as shown in the top right side. The content loss is applied to the intermediate samples of current mini-batch, and GAN loss is applied to the samples of aggregated mini-batches. We detach every iteration in training, in that the real line indicates the backpropagated paths and dashed lines indicates the detached paths. See text for details.
91
+
92
+ Given an input $( x , a )$ , we first divide the set of instance masks $\textbf { \em a }$ into mini-batches $\pmb { a } _ { 1 } , \dots , \pmb { a } _ { M }$ , i.e., $\textstyle { \pmb { a } } = \bigcup _ { i } { \pmb { a } } _ { i }$ and $\mathbf { \alpha } _ { \mathbf { { i } } } \cap \mathbf { \alpha } _ { \mathbf { { i } } } = \emptyset$ for $i \neq j$ . Then, at the $m$ -th iteration for $m = 1 , 2 , \ldots , M$ , we translate the image-mask pair $( x _ { m } , \pmb { a } _ { m } )$ , where $x _ { m }$ is the translated image $y _ { m - 1 } ^ { \prime }$ from the previous iteration, and $x _ { 1 } = x$ . In this sequential scheme, at each iteration, the generator $G$ outputs an intermediate translated image $y _ { m } ^ { \prime }$ , which accumulates all mini-batch translations up to the current iteration, and a translated mini-batch of instance masks $\pmb { b } _ { m } ^ { \prime }$ :
93
+
94
+ $$
95
+ ( y _ { m } ^ { \prime } , \pmb { b } _ { m } ^ { \prime } ) = G ( x _ { m } , \pmb { a } _ { m } ) = G ( y _ { m - 1 } ^ { \prime } , \pmb { a } _ { m } ) .
96
+ $$
97
+
98
+ In order to align the translated image with mini-batches of instance masks, we aggregate all the translated mini-batch and produce a translated sample:
99
+
100
+ $$
101
+ ( y _ { m } ^ { \prime } , b _ { 1 : m } ^ { \prime } ) = ( y _ { m } ^ { \prime } , \cup _ { i = 1 } ^ { m } pmb { b } _ { i } ^ { \prime } ) .
102
+ $$
103
+
104
+ The final output of the proposed sequential inference scheme is $( y _ { M } ^ { \prime } , b _ { 1 : M } ^ { \prime } )$
105
+
106
+ We also propose the corresponding sequential training algorithm, as illustrated in Figure 3. We apply content loss (4-6) to the intermediate samples $( y _ { m } ^ { \prime } , b _ { m } ^ { \prime } )$ of current mini-batch $\mathbf { a } _ { m }$ , as it is just a function of inputs and outputs of the generator $G$ .2 In contrast, we apply GAN loss (3) to the samples of aggregated mini-batches $( y _ { m } ^ { \prime } , b _ { 1 : m } ^ { \prime } )$ , because the network fails to align images and masks when using only a partial subset of instance masks. We used real/original samples $\{ \bar { x } \}$ with the full set of instance masks only. Formally, the sequential version of the training loss of InstaGAN is
107
+
108
+ $$
109
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { I n s t a G a M - S M } } = \displaystyle \sum _ { m = 1 } ^ { M } \mathcal { L } _ { \mathrm { L S G a N } } ( ( \boldsymbol { x } , \boldsymbol { a } ) , ( \boldsymbol { y } _ { m } ^ { \prime } , \boldsymbol { b } _ { 1 : m } ^ { \prime } ) ) + \mathcal { L } _ { \mathrm { c o n t e n t } } ( ( \boldsymbol { x } _ { m } , \boldsymbol { a } _ { m } ) , ( \boldsymbol { y } _ { m } ^ { \prime } , \boldsymbol { b } _ { m } ^ { \prime } ) ) } \\ & { \mathfrak { L } _ { \mathrm { c o n t e n t } } = \lambda _ { \mathrm { c y c } } \mathcal { L } _ { \mathrm { c y c } } + \lambda _ { \mathrm { i d t } } \mathcal { L } _ { \mathrm { i d t } } + \lambda _ { \mathrm { c t x } } \mathcal { L } _ { \mathrm { c t x } } . } \end{array}
110
+ $$
111
+
112
+ We detach every $m$ -th iteration of training, i.e., backpropagating with the mini-batch $\mathbf { a } _ { m }$ , so that only a fixed GPU memory is required, regardless of the number of training instances.3 Hence, the sequential training allows for training with samples containing many instances, and thus improves the generalization performance. Furthermore, it also improves translation of an image even with a few instances, compared to the one-step approach, due to its data augmentation effect using intermediate samples $( x _ { m } , \pmb { a } _ { m } )$ . In our experiments, we divided the instances into mini-batches $\pmb { a } _ { 1 } , \dots , \pmb { a } _ { M }$ according to the decreasing order of the spatial sizes of instances. Interestingly, the decreasing order showed a better performance than the random order. We believe that this is because small instances tend to be occluded by other instances in images, thus often losing their intrinsic shape information.
113
+
114
+ ![](images/f5cef0fb3fd9da68fe9bb53ee79a44137639a3a6173aeb43f5a2172b24f43ec7.jpg)
115
+ Figure 4: Translation results on clothing co-parsing (CCP) (Yang et al., 2014) dataset.
116
+
117
+ ![](images/5753906d0de05542d7dacd5cf8e7b4f35f7f076bc2505f765dede3e362b81aeb.jpg)
118
+ Figure 5: Translation results on multi-human parsing (MHP) (Zhao et al., 2018) dataset.
119
+
120
+ ![](images/8446bf508389d8bb6c079efffd9214bbc5db9410248be466a6b47907338709c4.jpg)
121
+ Figure 6: Translation results on COCO (Lin et al., 2014) dataset.
122
+
123
+ # 3 EXPERIMENTAL RESULTS
124
+
125
+ # 3.1 IMAGE-TO-IMAGE TRANSLATION RESULTS
126
+
127
+ We first qualitatively evaluate our method on various datasets. We compare our model, InstaGAN, with the baseline model, CycleGAN (Zhu et al., 2017). For fair comparisons, we doubled the number of parameters of CycleGAN, as InstaGAN uses two networks for image and masks, respectively. We sample two classes from various datasets, including clothing co-parsing (CCP) (Yang et al.,
128
+
129
+ ![](images/592484bf91f8124a89f88c4cb36d982b55ce67d61f06e8f2d51e97c01a903954.jpg)
130
+ Figure 7: Results of InstaGAN varying over different input masks.
131
+
132
+ ![](images/2d4d3e337c42cfc9f76c3277f725667387533214882d634d9e454686e3d89734.jpg)
133
+ Figure 8: Translation results on CCP dataset, using predicted mask for inference.
134
+
135
+ 2014), multi-human parsing (MHP) (Zhao et al., 2018), and MS COCO (Lin et al., 2014) datasets, and use them as the two domains for translation. In visualizations, we merge all instance masks into one for the sake of compactness. See Appendix B for detailed settings for our experiments. The translation results for three datasets are presented in Figure 4, 5, and 6, respectively. While CycleGAN mostly fails, our method generates reasonable shapes of the target instances and keeps the original contexts by focusing on the instances via the context preserving loss. For example, see the results on sheep giraffe in Figure 6. CycleGAN often generates sheep-like instances but loses the original background. InstaGAN not only generates better sheep or giraffes, but also preserves the layout of the original instances, i.e., the looking direction (left, right, front) of sheep and giraffes are consistent after translation. More experimental results are presented in Appendix E. Code and results are available in https://github.com/sangwoomo/instagan.
136
+
137
+ On the other hand, our method can control the instances to translate by conditioning the input, as shown in Figure 7. Such a control is impossible under CycleGAN. We also note that we focus on complex (multi-instance transfiguration) tasks to emphasize the advantages of our method. Nevertheless, our method is also attractive to use even for simple tasks (e.g., horse zebra) as it reduces false positives/negatives via the context preserving loss and enables to control translation. We finally emphasize that our method showed good results even when we use predicted segmentation for inference, as shown in Figure 8, and this can reduce the cost of collecting mask labels in practice.4
138
+
139
+ Finally, we also quantitatively evaluate the translation performance of our method. We measure the classification score, the ratio of images predicted as the target class by a pretrained classifier. Specifically, we fine-tune the final layers of the ImageNet (Deng et al., 2009) pretrained VGG-16 (Simonyan & Zisserman, 2014) network, as a binary classifier for each domain. Table 1 and Table 2 in Appendix D show the classification scores for CCP and COCO datasets, respectively. Our method outperforms CycleGAN in all classification experiments, e.g., ours achieves $2 3 . 2 \%$ accuracy for the pants shorts task, while CycleGAN obtains only $8 . 5 \%$ .
140
+
141
+ # 3.2 ABLATION STUDY
142
+
143
+ We now investigate the effects of each component of our proposed method in Figure 9. Our method is composed of the InstaGAN architecture, the context preserving loss $\mathcal { L } _ { \mathrm { c t x } }$ , and the sequential minibatch inference/training technique. We progressively add each component to the baseline model, CycleGAN (with doubled parameters). First, we study the effect of our architecture. For fair comparison, we train a CycleGAN model with an additional input channel, which translates the mask-augmented image, hence we call it $\mathrm { C y c l e G A N + S e g }$ . Unlike our architecture which translates the set of instance masks, CycleGAN+Seg translates the union of all masks at once. Due to this, CycleGAN+Seg fails to translate some instances and often merge them. On the other hand, our architecture keeps every instance and disentangles better. Second, we study the effect of the context preserving loss: it not only preserves the background better (row 2), but also improves the translation results as it regularizes the mapping (row 3). Third, we study the effect of our sequential translation: it not only improves the generalization performance (row 2,3) but also improves the translation results on few instances, via data augmentation (row 1).
144
+
145
+ ![](images/c1b8ea7b2cb412ef2e97c2413c62a2429e2b2ba711d32b2e3fceeae67f25a1d0.jpg)
146
+ Figure 9: Ablation study on the effect of each component of our method: the InstaGAN architecture, the context preserving loss, and the sequential mini-batch inference/training algorithm, which are denoted as InstaGAN, $\mathcal { L } _ { \mathrm { c t x } }$ , and Sequential, respectively.
147
+
148
+ ![](images/919ea9e38b746daedcb4360f87b8fcb5ded7b6d70638c318e5da042915c6e419.jpg)
149
+ Figure 10: Ablation study on the effects of the sequential mini-batch inference/training technique. The left and right side of title indicates which method used for training and inference, respectively, where “One” and “Seq” indicate the one-step and sequential schemes, respectively.
150
+
151
+ Finally, Figure 10 reports how much the sequential translation, denoted by “Seq”, is effective in inference and training, compared to the one-step approach, denoted by “One”. For the one-step training, we consider only two instances, as it is the maximum number affordable for our machines. On the other hand, for the sequential training, we sequentially train two instances twice, i.e., images of four instances. For the one-step inference, we translate the entire set at once, and for the sequential inference, we sequentially translate two instances at each iteration. We find that our sequential algorithm is effective for both training and inference: (a) training/inference $= \mathrm { O n e / S e q }$ shows blurry results as intermediate data have not shown during training and stacks noise as the iteration goes, and (b) Seq/One shows poor generalization performance for multiple instances as the one-step inference for many instances is not shown in training (due to a limited GPU memory).
152
+
153
+ # 4 CONCLUSION
154
+
155
+ We have proposed a novel method incorporating the set of instance attributes for image-to-image translation. The experiments on different datasets have shown successful image-to-image translation on the challenging tasks of multi-instance transfiguration, including new tasks, e.g., translating jeans to skirt in fashion images. We remark that our ideas utilizing the set-structured side information have potential to be applied to other cross-domain generations tasks, e.g., neural machine translation or video generation. Investigating new tasks and new information could be an interesting research direction in the future.
156
+
157
+ # ACKNOWLEDGMENTS
158
+
159
+ This work was supported by the National Research Council of Science & Technology (NST) grant by the Korea government (MSIP) (No. CRC-15-05-ETRI), by the ICT R&D program of MSIT/IITP [2016-0-00563, Research on Adaptive Machine Learning Technology Development for Intelligent Autonomous Digital Companion], and also by Basic Science Research Program (NRF2017R1E1A1A01077999) through the National Research Foundation of Korea (NRF) funded by the Ministry of Science, ICT.
160
+
161
+ # REFERENCES
162
+
163
+ Amjad Almahairi, Sai Rajeswar, Alessandro Sordoni, Philip Bachman, and Aaron Courville. Augmented cyclegan: Learning many-to-many mappings from unpaired data. arXiv preprint arXiv:1802.10151, 2018.
164
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
165
+ Mikel Artetxe, Gorka Labaka, Eneko Agirre, and Kyunghyun Cho. Unsupervised neural machine translation. arXiv preprint arXiv:1710.11041, 2017.
166
+ Aayush Bansal, Shugao Ma, Deva Ramanan, and Yaser Sheikh. Recycle-gan: Unsupervised video retargeting. arXiv preprint arXiv:1808.05174, 2018.
167
+ Sagie Benaim and Lior Wolf. One-sided unsupervised domain mapping. In Advances in Neural Information Processing Systems, pp. 752–762, 2017.
168
+ Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume 1, pp. 7, 2017.
169
+ Caroline Chan, Shiry Ginosar, Tinghui Zhou, and Alexei A Efros. Everybody dance now. arXiv preprint arXiv:1808.07371, 2018.
170
+ Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. Stargan: Unified generative adversarial networks for multi-domain image-to-image translation. arXiv preprint arXiv:1711.09020, 2017.
171
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
172
+ Tomer Galanti, Lior Wolf, and Sagie Benaim. The role of minimal complexity functions in unsupervised learning of semantic mappings. 2018.
173
+ Aaron Gokaslan, Vivek Ramanujan, Daniel Ritchie, Kwang In Kim, and James Tompkin. Improving shape deformation in unsupervised image-to-image translation. arXiv preprint arXiv:1808.04325, 2018.
174
+ 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.
175
+ 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.
176
+ 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.
177
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Computer Vision (ICCV), 2017 IEEE International Conference on, pp. 2980–2988. IEEE, 2017.
178
+
179
+ Judy Hoffman, Eric Tzeng, Taesung Park, Jun-Yan Zhu, Phillip Isola, Kate Saenko, Alexei A Efros, and Trevor Darrell. Cycada: Cycle-consistent adversarial domain adaptation. arXiv preprint arXiv:1711.03213, 2017.
180
+
181
+ Xun Huang, Ming-Yu Liu, Serge Belongie, and Jan Kautz. Multimodal unsupervised image-toimage translation. arXiv preprint arXiv:1804.04732, 2018.
182
+
183
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arXiv preprint, 2017.
184
+
185
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In European Conference on Computer Vision, pp. 694–711. Springer, 2016.
186
+
187
+ Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jungkwon Lee, and Jiwon Kim. Learning to discover cross-domain relations with generative adversarial networks. arXiv preprint arXiv:1703.05192, 2017.
188
+
189
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
190
+
191
+ Guillaume Lample, Ludovic Denoyer, and Marc’Aurelio Ranzato. Unsupervised machine translation using monolingual corpora only. arXiv preprint arXiv:1711.00043, 2017.
192
+
193
+ Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Cunningham, Alejandro ´ Acosta, Andrew P Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. In CVPR, volume 2, pp. 4, 2017.
194
+
195
+ Hsin-Ying Lee, Hung-Yu Tseng, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Diverse image-to-image translation via disentangled representations. arXiv preprint arXiv:1808.00948, 2018.
196
+
197
+ Chun-Liang Li, Wei-Cheng Chang, Yu Cheng, Yiming Yang, and Barnabas P ´ oczos. Mmd gan: ´ Towards deeper understanding of moment matching network. In Advances in Neural Information Processing Systems, pp. 2203–2213, 2017.
198
+
199
+ Xiaodan Liang, Hao Zhang, and Eric P Xing. Generative semantic manipulation with contrasting gan. arXiv preprint arXiv:1708.00315, 2017.
200
+
201
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
202
+
203
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In Advances in Neural Information Processing Systems, pp. 700–708, 2017.
204
+
205
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 2813–2821. IEEE, 2017.
206
+
207
+ Youssef A Mejjati, Christian Richardt, James Tompkin, Darren Cosker, and Kwang In Kim. Unsupervised attention-guided image to image translation. arXiv preprint arXiv:1806.02311, 2018.
208
+
209
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
210
+
211
+ Youssef Mroueh, Chun-Liang Li, Tom Sercu, Anant Raj, and Yu Cheng. Sobolev gan. arXiv preprint arXiv:1711.04894, 2017.
212
+
213
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, pp. 271–279, 2016.
214
+
215
+ 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.
216
+
217
+ Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. Style transfer from non-parallel text by cross-alignment. In Advances in Neural Information Processing Systems, pp. 6830–6841, 2017.
218
+
219
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Josh Susskind, Wenda Wang, and Russ Webb. Learning from simulated and unsupervised images through adversarial training. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume 3, pp. 6, 2017.
220
+
221
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
222
+
223
+ Yaniv Taigman, Adam Polyak, and Lior Wolf. Unsupervised cross-domain image generation. arXiv preprint arXiv:1611.02200, 2016.
224
+
225
+ Vedaldi Ulyanov and Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.
226
+
227
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Guilin Liu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Video-to-video synthesis. arXiv preprint arXiv:1808.06601, 2018a.
228
+
229
+ 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 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume 1, pp. 5, 2018b.
230
+
231
+ Wei Yang, Ping Luo, and Liang Lin. Clothing co-parsing by joint image segmentation and labeling. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3182– 3189, 2014.
232
+
233
+ Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. Dualgan: Unsupervised dual learning for imageto-image translation. arXiv preprint, 2017.
234
+
235
+ Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep sets. In Advances in Neural Information Processing Systems, pp. 3391–3401, 2017.
236
+
237
+ Han Zhang, Ian Goodfellow, Dimitris Metaxas, and Augustus Odena. Self-attention generative adversarial networks. arXiv preprint arXiv:1805.08318, 2018.
238
+
239
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European Conference on Computer Vision, pp. 649–666. Springer, 2016.
240
+
241
+ Jian Zhao, Jianshu Li, Yu Cheng, Li Zhou, Terence Sim, Shuicheng Yan, and Jiashi Feng. Understanding humans in crowded scenes: Deep nested adversarial learning and a new benchmark for multi-human parsing. arXiv preprint arXiv:1804.03287, 2018.
242
+
243
+ Yanzhao Zhou, Yi Zhu, Qixiang Ye, Qiang Qiu, and Jianbin Jiao. Weakly supervised instance segmentation using class peak response. arXiv preprint arXiv:1804.00880, 2018.
244
+
245
+ Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A Efros. Generative visual manipu- ¨ lation on the natural image manifold. In European Conference on Computer Vision, pp. 597–613. Springer, 2016.
246
+
247
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017.
248
+
249
+ # A ARCHITECTURE DETAILS
250
+
251
+ We adopted the network architectures of CycleGAN (Zhu et al., 2017) as the building blocks for our proposed model. In specific, we adopted ResNet 9-blocks generator (Johnson et al., 2016; He et al., 2016) and PatchGAN (Isola et al., 2017) discriminator. ResNet generator is composed of downsampling blocks, residual blocks, and upsampling blocks. We used downsampling blocks and residual blocks for encoders, and used upsampling blocks for generators. On the other hand, PatchGAN discriminator is composed of 5 convolutional layers, including normalization and non-linearity layers. We used the first 3 convolution layers for feature extractors, and the last 2 convolution layers for classifier. We preprocessed instance segmentation as a binary foreground/background mask, hence simply used it as an 1-channel binary image. Also, since we concatenated two or three features to generate the final outputs, we doubled or tripled the input dimension of those architectures. Similar to prior works (Johnson et al., 2016; Zhu et al., 2017), we applied Instance Normalization (IN) (Ulyanov & Lempitsky, 2016) for both generators and discriminators. In addition, we observed that applying Spectral Normalization (SN) (Miyato et al., 2018) for discriminators significantly improves the performance, although we used LSGAN (Mao et al., 2017), while the original motivation of SN was to enforce Lipschitz condition to match with the theory of WGAN (Arjovsky et al., 2017; Gulrajani et al., 2017). We also applied SN for generators as suggested in Self-Attention GAN (Zhang et al., 2018), but did not observed gain for our setting.
252
+
253
+ # B TRAINING DETAILS
254
+
255
+ For all the experiments, we simply set $\lambda _ { \mathrm { c y c } } = 1 0$ , $\lambda _ { \mathrm { i d t } } = 1 0$ , and $\lambda _ { \mathrm { c t x } } = 1 0$ for our loss (7). We used Adam (Kingma & Ba, 2014) optimizer with batch size 4, training with 4 GPUs in parallel. All networks were trained from scratch, with learning rate of 0.0002 for $G$ and 0.0001 for $D$ , and $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ for the optimizer. Similar to CycleGAN (Zhu et al., 2017), we kept learning rate for first 100 epochs and linearly decayed to zero for next 100 epochs for multi-human parsing (MHP) (Zhao et al., 2018) and COCO (Lin et al., 2014) dataset, and kept learning rate for first 400 epochs and linearly decayed for next 200 epochs for clothing co-parsing (CCP) (Yang et al., 2014) dataset, as it contains smaller number of samples. We sampled two classes from the datasets above, and used it as two domains for translation. We resized images with size $3 0 0 \times 2 0 0$ (height $\times$ width) for CCP dataset, $2 4 0 \times 1 6 0$ for MHP dataset, and $2 0 0 \times 2 0 0$ for COCO dataset, respectively.
256
+
257
+ # C TREND OF TRANSLATION RESULTS
258
+
259
+ We tracked the trend of translation results over epoch increases, as shown in Figure 11. Both image and mask smoothly adopted to the target instances. For example, the remaining parts in legs slowly disappears, and the skirt slowly constructs the triangular shapes.
260
+
261
+ ![](images/95d4780477ee0ff64234d4f58a6e722aa6124b6ee47cebd9c66e70ddbd964dba.jpg)
262
+ Figure 11: Trend of the translation results of our method over epoch increases.
263
+
264
+ # D QUANTITATIVE RESULTS
265
+
266
+ We evaluated the classification score for CCP and COCO dataset. Unlike CCP dataset, COCO dataset suffers from the false positive problem, that the classifier fails to determine if the generator produced target instances on the right place. To overcome this issue, we measured the masked classification score, where the input images are masked by the corresponding segmentations. We note that CycleGAN and our method showed comparable results for the na¨ıve classification score, but ours outperformed for the masked classification score, as it reduces the false positive problem.
267
+
268
+ Table 1: Classification score for CCP dataset.
269
+
270
+ <table><tr><td rowspan="2"></td><td colspan="2"> jeans-&gt;skirt</td><td colspan="2">skirt-→jeans</td><td colspan="2">shorts-→&gt;pants</td><td colspan="2">pants-→shorts</td></tr><tr><td>train</td><td>test</td><td>train</td><td>test</td><td>train</td><td>test</td><td>train</td><td>test</td></tr><tr><td>Real</td><td>0.970</td><td>0.888</td><td>0.982</td><td>0.946</td><td>1.000</td><td>0.984</td><td>0.990</td><td>0.720</td></tr><tr><td>CycleGAN</td><td>0.465</td><td>0.371</td><td>0.561</td><td>0.483</td><td>0.845</td><td>0.524</td><td>0.305</td><td>0.085</td></tr><tr><td>InstaGAN (ours)</td><td>0.665</td><td>0.600</td><td>0.658</td><td>0.540</td><td>0.898</td><td>0.768</td><td>0.373</td><td>0.232</td></tr></table>
271
+
272
+ Table 2: Classification score (masked) for COCO dataset.
273
+
274
+ <table><tr><td rowspan="2"></td><td colspan="2">sheep-→giraffe</td><td colspan="2">giraffe-&gt;sheep</td><td colspan="2">cup-→bottle</td><td colspan="2">bottle-&gt;cup</td></tr><tr><td>train</td><td>test</td><td>train</td><td>test</td><td>train</td><td>test</td><td>train</td><td>test</td></tr><tr><td>Real</td><td>0.891</td><td>0.911</td><td>0.925</td><td>0.930</td><td>0.746</td><td>0.723</td><td>0.622</td><td>0.566</td></tr><tr><td>CycleGAN</td><td>0.313</td><td>0.594</td><td>0.291</td><td>0.512</td><td>0.368</td><td>0.403</td><td>0.290</td><td>0.275</td></tr><tr><td>InstaGAN (ours)</td><td>0.406</td><td>0.781</td><td>0.355</td><td>0.642</td><td>0.443</td><td>0.465</td><td>0.322</td><td>0.333</td></tr></table>
275
+
276
+ # E MORE TRANSLATION RESULTS
277
+
278
+ We present more qualitative results in high resolution images.
279
+
280
+ ![](images/ab61dcd79976659d518e448ecfde6bb503566cd85090320edfb308ab978de8a9.jpg)
281
+ Figure 12: Translation results for images searched from Google to test the generalization performance of our model. We used a pix2pix (Isola et al., 2017) model to predict the segmentation.
282
+
283
+ ![](images/805fd425910a61e7911f2f8bf33894ddd06c0f10eb5312008e22f183667ec225.jpg)
284
+ Figure 13: More translation results on MHP dataset (pants skirt).
285
+
286
+ ![](images/863cd5e7df9d453617c11ce1811210b2aa5ce5895735feada1f92180a61b7e7c.jpg)
287
+ Figure 14: More translation results on MHP dataset (skirt pants).
288
+
289
+ ![](images/ad611563b972f9515a3b5d2376d09170c6ca587e7b178ddf9ec2d7a53b67cb03.jpg)
290
+ Figure 15: More translation results on COCO dataset (sheep giraffe).
291
+
292
+ ![](images/e36bc5204f309bee92cc580cdf176315d881e16b67f7daac8f0668366208f105.jpg)
293
+ Figure 16: More translation results on COCO dataset (giraffe sheep).
294
+
295
+ ![](images/ad78b637d5a75f8169b520d272645d356bfe7668c696eaf41b39a4f4b6dd5722.jpg)
296
+ Figure 17: More translation results on COCO dataset (zebra elephant).
297
+
298
+ ![](images/9a268f261b37c0980e1ea9e30fdca6bf8de536bc42acfb8a908312e5b25c9435.jpg)
299
+ Figure 18: More translation results on COCO dataset (elephant zebra).
300
+
301
+ ![](images/bbb9a58ec809b1e7b7af4c7eee33dca67673d54205e1a8fa47d8c5b88ef027d4.jpg)
302
+ Figure 19: More translation results on COCO dataset (bird zebra).
303
+
304
+ ![](images/21e677a79df29da16ac333b6408f6fd9729863111c9377c1b01ee773924d312b.jpg)
305
+ Figure 20: More translation results on COCO dataset (zebra bird).
306
+
307
+ ![](images/13026b64c5e76726db03be5238fb9c397c1433be650f66f12879b98b415874a0.jpg)
308
+ Figure 21: More translation results on COCO dataset (horse car).
309
+
310
+ ![](images/5d6b6a43c7e170d1220b4047cd91a75d1264c9be17eea9226ef29623651f5008.jpg)
311
+ Figure 22: More translation results on COCO dataset (car horse).
312
+
313
+ # F MORE COMPARISONS WITH CYCLEGAN+SEG
314
+
315
+ To demonstrate the effectiveness of our method further, we provide more comparison results with CycleGAN+Seg. Since CycleGAN+Seg translates all instances at once, it often (a) fails to translate instances, or (b) merges multiple instances (see Figure 23 and 25), or (c) generates multiple instances from one instance (see Figure 24 and 26). On the other hand, our method does not have such issues due to its instance-aware nature. In addition, since the unioned mask losses the original shape information, our instance-aware method produces better shape results (e.g., see row 1 of Figure 25).
316
+
317
+ ![](images/e62fd61ae7c2e51b787fb5016de2e21510954397167e369b7d9e762dad85d1fc.jpg)
318
+ Figure 23: Comparisons with CycleGAN+Seg on MHP dataset (pants skirt).
319
+
320
+ ![](images/a981d03293a6692af62965819f444f05909f962ba59791b04517503f569f94b0.jpg)
321
+ Figure 24: Comparisons with CycleGAN+Seg on MHP dataset (skirt pants).
322
+
323
+ ![](images/559e335f670309bb53e99b64d3f198951365027d066a7693fbc9078bbe8889ae.jpg)
324
+ Figure 25: Comparisons with CycleGAN+Seg on COCO dataset (sheep giraffe).
325
+
326
+ ![](images/0c751c96c7ae1e97a5138f6f2995bf28f2296e23c5e7767185a576dbb8e27e4d.jpg)
327
+ Figure 26: Comparisons with CycleGAN $^ +$ Seg on COCO dataset (giraffe sheep).
328
+
329
+ # G GENERALIZATION OF TRANSLATED MASKS
330
+
331
+ To show that our model generalizes well, we searched the nearest training neighbors (in $L _ { 2 }$ -norm) of translated target masks. As reported in Figure 27, we observe that the translated masks (col 3,4) are often much different from the nearest neighbors (col 5,6). This confirms that our model does not simply memorize training instance masks, but learns a mapping that generalizes for target instances.
332
+
333
+ ![](images/fb93fb12ced8500cf7185f096fb0947c54340d1634019b90184b42d3a2173eda.jpg)
334
+ Figure 27: Nearest training neighbors of translated masks.
335
+
336
+ # H TRANSLATION RESULTS OF CROP & ATTACH BASELINE
337
+
338
+ For interested readers, we also present the translation results of the simple crop & attach baseline in Figure 28, that find the nearest neighbors of the original masks from target masks, and crop & attach the corresponding image to the original image. Here, since the distance in pixel space (e.g., $L _ { 2 }$ -norm) obviously does not capture semantics, the cropped instances do not fit with the original contexts as well.
339
+
340
+ ![](images/e2715b9c366ddae2bde4239390b648a58180b15107732a3e580b363dedd39a40.jpg)
341
+ Figure 28: Translation results of crop & attach baseline.
342
+
343
+ # I VIDEO TRANSLATION RESULTS
344
+
345
+ For interested readers, we also present video translation results in Figure 29. Here, we use a predicted segmentation (generated by a pix2pix (Isola et al., 2017) model as in Figure 8 and Figure 12) for each frame. Similar to CycleGAN, our method shows temporally coherent results, even though we did not used any explicit regularization. One might design a more advanced version of our model utilizing temporal patterns e.g., using the idea of Recycle-GAN (Bansal et al., 2018) for video-to-video translation, which we think is an interesting future direction to explore.
346
+
347
+ ![](images/edb9a89c608a8c550b22485771c8eefb4b737524cd70106a48795d5be59ec7ca.jpg)
348
+ Figure 29: Original images (row 1) and translated results of our method (row 2) on a video searched from YouTube. We present translation results on successive eight frames for visualization.
349
+
350
+ # J RECONSTRUCTION RESULTS
351
+
352
+ For interested readers, we also report the translation and reconstruction results of our method in Figure 30. One can observe that our method shows good reconstruction results while showing good translation results. This implies that our translated results preserve the original context well.
353
+
354
+ ![](images/c3d485e0b9d0eac779509dd07ef9afd0bcfc22ba2d5f7fe47d23debdbc643c1d.jpg)
355
+ Figure 30: Translation and reconstruction results of our method.
md/train/ucEXZQncukK/ucEXZQncukK.md ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BAYESIAN ONLINE META-LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Neural networks are known to suffer from catastrophic forgetting when trained on sequential datasets. While there have been numerous attempts to solve this problem for large-scale supervised classification, little has been done to overcome catastrophic forgetting for few-shot classification problems. Few-shot metalearning algorithms often require all few-shot tasks to be readily available in a batch for training. The popular gradient-based model-agnostic meta-learning algorithm (MAML) is a typical algorithm that suffers from these limitations. This work introduces a Bayesian online meta-learning framework to tackle the catastrophic forgetting and the sequential few-shot tasks problems. Our framework incorporates MAML into a Bayesian online learning algorithm with Laplace approximation or variational inference. This framework enables few-shot classification on a range of sequentially arriving datasets with a single meta-learned model and training on sequentially arriving few-shot tasks. The experimental evaluations demonstrate that our framework can effectively prevent catastrophic forgetting and is capable of online meta-learning in various few-shot classification settings.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Image classification models and algorithms often require an enormous amount of labelled examples for training to achieve state-of-the-art performance. Labelled examples can be expensive and time-consuming to acquire. Human visual systems, on the other hand, are able to recognise new classes after being shown a few labelled examples. Few-shot classification (Miller et al., 2000; Li et al., 2004; 2006; Lake et al., 2011) tackles this issue by learning to adapt to unseen classes (known as novel classes) with very few labelled examples from each class. Recent works show that metalearning provides promising approaches to few-shot classification problems (Santoro et al., 2016; Finn et al., 2017; Li et al., 2017; Ravi & Larochelle, 2017). Meta-learning or learning-to-learn (Schmidhuber, 1987; Thrun & Pratt, 1998) takes the learning process a level deeper – instead of learning from the labelled examples in the training classes (known as base classes), meta-learning learns the example-learning process. The training process in meta-learning that utilises the base classes is called the meta-training stage, and the evaluation process that reports the few-shot performance on the novel classes is known as the meta-evaluation stage.
12
+
13
+ Despite being a promising solution to few-shot classification problems, meta-learning methods suffer from several limitations:
14
+
15
+ 1. Unable to continually learn from sequential few-shot tasks: It is mandatory to have all base classes readily available for meta-training. Such meta-learning algorithms often require sampling a number of few-shot tasks in every iteration for optimisation.
16
+ 2. Unable to retain few-shot classification ability on sequential datasets that have evident distributional shift: A meta-learned model is restricted to perform few-shot classification on a specific dataset, in the sense that the base and novel classes have to originate from the same dataset distribution. A meta-learned model loses its few-shot classification ability on previous datasets as new ones arrive subsequently for meta-training.
17
+
18
+ We emphasise that the task mentioned in this paper refers to the few-shot task for meta-learning. This paper considers meta-learning a single model for few-shot classification in the sequential datasets and sequential few-shot tasks settings respectively.
19
+
20
+ We introduce a Bayesian online meta-learning framework that can train a few-shot learning model under the sequential few-shot tasks setting and train a model that is applicable to a broader scope of few-shot classification datasets by overcoming catastrophic forgetting. We extend the Bayesian online learning (BOL) framework (Opper, 1998) to a Bayesian online meta-learning framework using the model-agnostic meta-learning (MAML) algorithm (Finn et al., 2017). MAML finds a good model parameter initialisation (called meta-parameters) that can quickly adapt to novel classes using very few labelled examples, while BOL provides a principled framework for finding the posterior of the model parameters. Our framework aims to combine both BOL and MAML to find the posterior of the meta-parameters. Our work builds on Ritter et al. (2018a) which combines the BOL framework and Laplace approximation with block-diagonal Kronecker-factored Fisher approximation, and Nguyen et al. (2018) which uses variational inference with BOL to overcome catastrophic forgetting in large-scale supervised classification.
21
+
22
+ An important reason to implement Bayesian inference over non-Bayesian methods for an online setting is that BOL provides a grounded framework that suggests using the previous posterior as the prior recursively. Bayesian inference inherits an advantage for robust meta-learning (Yoon et al., 2018) to overcome training instability problems addressed by Antoniou et al. (2019). BOL implicitly keeps a memory on previous knowledge via the posterior, in contrast to recent online meta-learning methods that explicitly accumulate previous data in a task buffer (Finn et al., 2019; Zhuang et al., 2019). Explicitly keeping a memory on previous data often triggers an important question: how should the carried-forward data be processed in future task rounds, in order to accumulate knowledge? Finn et al. (2019) update the meta-parameters at each iteration using previous few-shot tasks in the task buffer. This defeats the purpose of online learning, which by definition means to update the parameters each round using only the new data encountered. Having to re-train on previous data to avoid forgetting also increases the training time as the data accumulate (Finn et al., 2019; He et al., 2019). Certainly one can clamp the amount of data at some maximal limit and sample from the buffer, but the final performance of such an algorithm would be dependent on the samples being informative and of good quality which may vary across different seed runs. In contrast to memorising the datasets, having an implicit memory via the posterior automatically deals with the question on how to process carried-forward data and allows a better carry forward in previous experiences.
23
+
24
+ Below are the contributions we make in this paper:
25
+
26
+ We develop the Bayesian online meta-learning (BOML) framework for sequential few-shot classification problems. Under this framework we introduce the algorithms Bayesian online meta-learning with Laplace approximation (BOMLA) and Bayesian online meta-learning with variational inference (BOMVI). We propose a simple approximation to the Fisher corresponding to the BOMLA algorithm that carries over the desirable block-diagonal Kronecker-factored structure from the Fisher approximation in the non-meta-learning setting. We demonstrate that BOML can overcome catastrophic forgetting in the sequential few-shot datasets setting with apparent distributional shift in the datasets.
27
+ • We demonstrate that BOML can continually learn to few-shot classify the novel classes in the sequential meta-training few-shot tasks setting.
28
+
29
+ # 2 META-LEARNING
30
+
31
+ Most meta-learning algorithms comprise an inner loop for example-learning and an outer loop that learns the example-learning process. Such algorithms often require sampling a meta-batch of tasks at each iteration, where a task is formed by sampling a subset of classes from the pool of base classes or novel classes during meta-training or meta-evaluation respectively. The $N$ -way $K$ -shot task, for instance, refers to sampling $N$ classes and using $K$ examples per class for few-shot quick adaptation.
32
+
33
+ An offline meta-learning algorithm learns a few-shot classification model only for a specific dataset $\mathcal { D } _ { t + 1 }$ where all base classes of $\mathcal { D } _ { t + 1 }$ have to be readily available for meta-training. For notational convenience, we drop the $t + 1$ subscript in this section, as there is only one dataset involved in offline meta-learning. The dataset $\mathcal { D } _ { t + 1 }$ is divided into the set of base classes $\widetilde { \mathcal { D } }$ and novel classes $\widehat { \mathcal { D } }$ for meta-training and meta-evaluation respectively. Upon completing meta-training on the base class set $\widetilde { \mathcal { D } }$ , the goal of few-shot classification is to perform well on an unseen task ${ \widehat { \mathcal { D } } } ^ { * }$ sampled from the novel class set $\widehat { \mathcal { D } }$ after a quick adaptation on a small subset $\widehat { \mathcal { D } } ^ { * , S }$ (known as the support set) of $\widehat { \mathcal { D } } ^ { * }$ . The performance of this unseen task is evaluated on the query set $\widehat { \mathcal { D } } ^ { * , Q }$ , where $\hat { \mathcal { D } } ^ { * , Q } = \widehat { \mathcal { D } } ^ { * } \backslash \widehat { \mathcal { D } } ^ { * , S }$ . Since $\widehat { \mathcal { D } }$ is not accessible during meta-training, this support-query split is mimicked on the base class set $\widetilde { \mathcal { D } }$ for meta-training.
34
+
35
+ Model-agnostic meta-learning We are interested in the well-known meta-learning algorithm MAML (Finn et al., 2017). Each updating step of MAML aims to improve the ability of the metaparameters to act as a good model initialisation for a quick adaptation on unseen tasks. Each iteration of the MAML algorithm samples $M$ tasks from the base class set $\widetilde { \mathcal { D } }$ and runs a few steps of stochastic gradient descent (SGD) for an inner loop task-specific learning. The number of tasks sampled per iteration is known as the meta-batch size. For task $m$ , the inner loop outputs the task-specific parameters $\tilde { \theta } ^ { m }$ from a $k$ -step SGD quick adaptation on the objective $\mathcal { L } ( \boldsymbol { \theta } , \widetilde { \mathcal { D } } ^ { m , S } )$ with the support set $\widetilde { \mathcal { D } } ^ { m , S }$ and initialised at $\theta$ :
36
+
37
+ $$
38
+ \tilde { \theta } ^ { m } = S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { D } ^ { m , S } ) ) ,
39
+ $$
40
+
41
+ where $m = 1 , \ldots , M$ . The outer loop gathers all task-specific adaptations to update the metaparameters $\theta$ using the loss $\mathcal { L } ( \tilde { \theta } ^ { m } , \widetilde { D } ^ { m , Q } )$ on the query set $\bar { \mathcal { D } } ^ { m , Q }$ .
42
+
43
+ The overall MAML optimisation objective is
44
+
45
+ $$
46
+ \underset { \theta } { \arg \operatorname* { m i n } } \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathcal { L } ( S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { \mathcal { D } } ^ { m , S } ) ) , \widetilde { \mathcal { D } } ^ { m , Q } ) .
47
+ $$
48
+
49
+ Like most offline meta-learning algorithms, MAML requires all base classes to be readily available for tasks-sampling at each iteration. We aim to overcome this limitation by meta-learning a model that can few-shot classify unseen tasks from the novel classes, while the tasks from the base classes arrive sequentially for meta-training. MAML also assumes a stationary task distribution during meta-training and meta-evaluation. Under this assumption, a meta-learned model is only applicable to a specific dataset distribution. When the model encounters a sequence of datasets with apparent distributional shift, it loses the few-shot classification ability on previous datasets as new ones arrive for meta-training. Our work also aims to meta-learn a single model for few-shot classification on multiple datasets that arrive sequentially for meta-training. We achieve these two goals by incorporating MAML into the BOL framework to give the Bayesian online meta-learning (BOML) framework that finds the posterior of the meta-parameters.
50
+
51
+ # 3 OVERVIEW OF OUR BAYESIAN ONLINE META-LEARNING APPROACH
52
+
53
+ Our central contribution is to extend the benefits of meta-learning to the Bayesian online scenario, thereby training models that can generalise across tasks whilst dealing with parameter uncertainty in the setting of sequential tasks or sequential datasets.
54
+
55
+ Sequential datasets setting In this setting, online meta-training occurs sequentially on the datasets $\mathcal { D } _ { 1 } , \ldots , \mathcal { D } _ { T }$ . Each dataset $\mathcal { D } _ { i }$ can be seen as a knowledge domain with an associated underlying task distribution $p ( \mathcal T _ { i } )$ . A newly-arrived $\mathcal { D } _ { t + 1 }$ is separated into the base class set $\widetilde { \mathcal { D } } _ { t + 1 }$ and novel class set $\widehat { \mathcal { D } } _ { t + 1 }$ for meta-training and meta-evaluation respectively, where the tasks in these two stages are drawn from the task distribution $p ( \mathcal T _ { t + 1 } )$ .
56
+
57
+ Sequential tasks setting The sequential tasks setting only involves one dataset $\mathcal { D }$ with an associated underlying task distribution $p ( \mathcal { T } )$ , where $\mathcal { D }$ is separated into the base and novel class sets. In this setting, $\widetilde { \cal D } _ { 1 } , \ldots , \widetilde { \cal D } _ { t + 1 }$ denote the non-overlapping tasks formed from the base class set and they arrive sequentially for meta-training. These tasks $\widetilde { \mathcal { D } } _ { 1 } , \ldots , \widetilde { \mathcal { D } } _ { t + 1 }$ and the meta-evaluation tasks are drawn from the task distribution $p ( \tau )$ .
58
+
59
+ Notationally, for both sequential tasks and sequential datasets settings, let $\mathcal { \widetilde { D } } _ { t + 1 } ^ { S }$ and $\widetilde { \mathcal { D } } _ { t + 1 } ^ { Q }$ denote the collection of support sets and query sets respectively from $\widetilde { \mathcal { D } } _ { t + 1 }$ , so that $\widetilde { D } _ { t + 1 } = \widetilde { D } _ { t + 1 } ^ { S } \cup \widetilde { D } _ { t + 1 } ^ { Q }$ .
60
+
61
+ We are interested in a MAP estimate $\theta ^ { * } = \arg \operatorname* { m a x } _ { \theta } p ( \theta | \widetilde { D } _ { 1 : t + 1 } )$ . Using Bayes’ rule on the posterior gives the recursive formula
62
+
63
+ $$
64
+ \begin{array} { r l } & { p ( \theta | \widetilde { D } _ { 1 : t + 1 } ) \propto p ( \widetilde { D } _ { t + 1 } ^ { S } , \widetilde { D } _ { t + 1 } ^ { Q } | \theta ) p ( \theta | \widetilde { D } _ { 1 : t } ) } \\ & { \qquad = p ( \widetilde { D } _ { t + 1 } ^ { Q } | \theta , \widetilde { D } _ { t + 1 } ^ { S } ) p ( \widetilde { D } _ { t + 1 } ^ { S } | \theta ) p ( \theta | \widetilde { D } _ { 1 : t } ) } \\ & { \qquad = \bigg \{ \int p ( \widetilde { D } _ { t + 1 } ^ { Q } | \widetilde { \theta } ) p ( \widetilde { \theta } | \theta , \widetilde { D } _ { t + 1 } ^ { S } ) d \widetilde { \theta } \bigg \} p ( \widetilde { D } _ { t + 1 } ^ { S } | \theta ) p ( \theta | \widetilde { D } _ { 1 : t } ) } \end{array}
65
+ $$
66
+
67
+ where Eq. (3) follows from the assumption that each dataset is independent given $\theta$ .
68
+
69
+ From the meta-learning perspective, the parameters $\tilde { \theta }$ introduced in Eq. (5) can be viewed as the task-specific parameters in MAML. There are various choices for the distribution $p ( \tilde { \theta } | \theta , \widetilde { D } _ { t + 1 } ^ { S } )$ in Eq. (5). In particular if we choose to set it as the deterministic function of taking several steps of SGD on loss $\mathcal { L }$ with the support set collection $\mathcal { \widetilde { D } } _ { t + 1 } ^ { S }$ and initialised at $\theta$ , we have
70
+
71
+ $$
72
+ p ( { \tilde { \theta } } | \theta , { \widetilde { \mathcal { D } } } _ { t + 1 } ^ { S } ) = \mathbb { 1 } \{ { \tilde { \theta } } = S G D _ { k } ( { \mathcal { L } } ( \theta , { \widetilde { \mathcal { D } } } _ { t + 1 } ^ { S } ) ) \} .
73
+ $$
74
+
75
+ and this recovers the MAML inner loop with SGD quick adaptation in Eq. (1). The recursion given by Eq. (5) forms the basis of our approach and the remainder of this paper explains how we implement this. In order to do so we give a mini tutorial in Appendix A on Bayesian online learning, Laplace approximation and variational continual learning.
76
+
77
+ # 4 BAYESIAN ONLINE META-LEARNING IMPLEMENTATION
78
+
79
+ This section demonstrates how we arrive at the algorithms Bayesian online meta-learning with Laplace approximation (BOMLA) and Bayesian online meta-learning with variational inference (BOMVI) by implementing Laplace approximation and variational continual learning respectively to the posterior of the BOML framework in Eq. (5). These algorithms from the grounded BOML framework are useful for online training on the sequential few-shot classification datasets or tasks.
80
+
81
+ # 4.1 BAYESIAN ONLINE META-LEARNING WITH LAPLACE APPROXIMATION
82
+
83
+ We discover that the Laplace approximation method provides a well-fitted meta-training framework for Bayesian online meta-learning in Eq. (5). Each updating step in the approximation procedure can be modified to correspond to the meta-parameters for few-shot classification, instead of the model parameters for large-scale supervised classification.
84
+
85
+ Laplace approximation rationalises the use of a Gaussian approximate posterior by Taylor expanding the log-posterior around a mode up to the second order, as described in Appendix A.2. The second order term corresponds to the log-probability of a Gaussian distribution. The BOML framework in Section 3 with a Gaussian approximate posterior $q$ of mean and precision $\phi _ { t } = \{ \mu _ { t } , \Lambda _ { t } \}$ from the Laplace approximation gives a MAP estimate:
86
+
87
+ $$
88
+ \theta ^ { * } = \arg \operatorname* { m a x } _ { \theta } \Bigg \{ \log \int p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { Q } | \widetilde { \theta } ) p ( \widetilde { \theta } | \theta , \widetilde { \mathcal { D } } _ { t + 1 } ^ { S } ) d \widetilde { \theta } + \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { S } | \theta ) - \frac { 1 } { 2 } ( \theta - \mu _ { t } ) ^ { T } \Lambda _ { t } ( \theta - \mu _ { t } ) \Bigg \} .
89
+ $$
90
+
91
+ For an efficient optimisation, we use the deterministic $\tilde { \theta }$ in Eq. (6). The objective in Eq. (7) can be batched (for sequential tasks) or meta-batched (for sequential datasets). This leads to minimising the objective
92
+
93
+ $$
94
+ \mathsf { \Pi } _ { t + 1 } ^ { \mathsf { R O M L A } } ( \theta , \mu _ { t } , \Lambda _ { t } ) = - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , Q } | \widetilde { \theta } ^ { m } ) - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , S } | \theta ) + \frac { 1 } { 2 } ( \theta - \mu _ { t } ) ^ { T } \Lambda _ { t } ( \theta - \mu _ { t } ) ,
95
+ $$
96
+
97
+ where $\tilde { \theta } ^ { m } = S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { D } _ { t + 1 } ^ { m , S } ) )$ for $m = 1 , \ldots , M$ . In the sequential datasets setting $M$ denotes the number of tasks sampled per iteration, whereas in the sequential tasks setting denotes the number of batches per epoch. The first term of the objective in Eq. (8) corresponds to the MAML objective in Eq. (2) with a cross-entropy loss, the second term can be viewed as the pre-adaptation loss on the support set and the last term can be seen as a regulariser.
98
+
99
+ # 4.2 HESSIAN APPROXIMATION
100
+
101
+ We calculate a block-diagonal Kronecker-factored Hessian approximation in order to update the precision $\Lambda _ { t }$ , as explained in Appendix A.3. The Hessian approximations in both sequential datasets and sequential tasks settings are very similar, except that the sequential datasets setting averages over the meta-batch size and the sequential tasks setting averages over the number of batches.
102
+
103
+ The Hessian matrix corresponding to the first term of the BOMLA objective in Eq. (8) is
104
+
105
+ $$
106
+ \widetilde { H } _ { t + 1 } ^ { i j } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \frac { \partial ^ { 2 } } { \partial \theta ^ { ( i ) } \partial \theta ^ { ( j ) } } \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , Q } | \widetilde { \theta } ^ { m } ) ) \Bigg | _ { \theta = \mu _ { t + 1 } } .
107
+ $$
108
+
109
+ It is worth noting that the BOMLA Hessian deviates from the original BOL Hessian in Appendix A.2. This requires deriving an adjusted approximation to the Hessian with some further assumptions.
110
+
111
+ The BOL Hessian for a single data point can be approximated using the Fisher information matrix $F$ to ensure its positive semi-definiteness (Martens $\&$ Grosse, 2015):
112
+
113
+ $$
114
+ F = \mathbb { E } _ { x , y } \bigg [ \frac { d } { d \theta } \log p ( y | x , \theta ) \frac { d } { d \theta } \log p ( y | x , \theta ) ^ { T } \bigg ] .
115
+ $$
116
+
117
+ Each $( x , y )$ pair for the Fisher in BOMLA is associated to a task (or a batch) $m$ . The Fisher information matrix $\widetilde { F }$ corresponding to the BOMLA Hessian in Eq. (9) for a single data point is
118
+
119
+ $$
120
+ \widetilde { F } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathbb { E } _ { x , y } \bigg [ \bigg ( \frac { \partial \widetilde { \theta } ^ { m } } { \partial \theta } \bigg ) \frac { d } { d \widetilde { \theta } ^ { m } } \log p ( y | x , \widetilde { \theta } ^ { m } ) \frac { d } { d \widetilde { \theta } ^ { m } } \log p ( y | x , \widetilde { \theta } ^ { m } ) ^ { T } \bigg ( \frac { \partial \widetilde { \theta } ^ { m } } { \partial \theta } \bigg ) ^ { T } \bigg ] .
121
+ $$
122
+
123
+ The additional Jacobian matrix $\frac { \partial \tilde { \theta } ^ { m } } { \partial \theta }$ breaks the Kronecker-factored structure described by Martens & Grosse (2015) for the original Fisher in Eq. (10).
124
+
125
+ The results in Finn et al. (2017) show that the first step of the quick adaptation in $\tilde { \theta } ^ { m }$ contributes the largest change to the meta-evaluation objective, and the remaining adaptation steps give a relatively small change to the objective. It is reasonable to assume that the quick adaptation is a one-step SGD for Fisher approximation:
126
+
127
+ $$
128
+ \begin{array} { r } { \tilde { \theta } ^ { m } = \theta - \nabla _ { \theta } \mathcal { L } ( \theta , \widetilde { D } _ { t + 1 } ^ { m , S } ) . } \end{array}
129
+ $$
130
+
131
+ By imposing this assumption, the $( i , j )$ -th entry of the Jacobian term can be interpreted as
132
+
133
+ $$
134
+ \left( \frac { \partial \tilde { \theta } ^ { m } } { \partial \theta } \right) ^ { i j } = I ^ { i j } - \frac { \partial ^ { 2 } ( - \log p ( \widetilde { D } _ { t + 1 } ^ { m , S } | \theta ) ) } { \partial \theta ^ { ( i ) } \partial \theta ^ { ( j ) } } ,
135
+ $$
136
+
137
+ where $I$ is the corresponding identity matrix and the objective $\mathcal { L }$ involved is the negative loglikelihood. The Hessian for a single data point in the second term of Eq. (13) can be approximated by $F$ in Eq. (10) via the usual block-diagonal Kronecker-factored approximation. Putting the Jacobian back into Eq. (11) and expanding the factors give terms that multiply two or more Kronecker products together. The detailed derivation of $\widetilde { F }$ is explained in Appendix A.3.1. We introduce the posterior regulariser $\lambda$ when updating the precision: $\Lambda _ { t + 1 } = \lambda { \widetilde { \cal H } } _ { t + 1 } + \Lambda _ { t }$ and the rationale for introducing $\lambda$ is explained in Appendix A.3.2. The pseudo-code of the BOMLA algorithm can be found in Appendix B.1.
138
+
139
+ # 4.3 BAYESIAN ONLINE META-LEARNING WITH VARIATIONAL INFERENCE
140
+
141
+ The variational continual learning (VCL) framework (Nguyen et al., 2018) is directly applicable to BOML. This section demonstrates how we arrive at the BOMVI algorithm by implementing VCL to the posterior of the BOML framework in Eq. (5).
142
+
143
+ As described in Appendix A.4, VCL approximates the posterior by minimising the KL-divergence over some pre-determined approximate posterior family $\mathcal { Q }$ . Fitting the BOML posterior in Eq. (5) into the VCL framework gives the approximate posterior:
144
+
145
+ $$
146
+ q ( \theta | \phi _ { t + 1 } ) = \underset { q \in \mathcal { Q } } { \operatorname { a r g m i n } } D _ { \mathrm { K L } } \Bigg ( q ( \theta | \phi ) \bigg | \bigg | \bigg \{ \int p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { Q } | \widetilde { \theta } ) p ( \widetilde { \theta } | \theta , \widetilde { \mathcal { D } } _ { t + 1 } ^ { S } ) d \widetilde { \theta } \bigg \} p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { S } | \theta ) q ( \theta | \phi _ { t } ) \Bigg ) .
147
+ $$
148
+
149
+ Similar to BOMLA, we use the deterministic $\tilde { \theta }$ in Eq. (6), and the objective in Eq. (14) can be batched (for sequential tasks) or meta-batched (for sequential datasets). This leads to minimising the objective
150
+
151
+ $$
152
+ f _ { t + 1 } ^ { \mathrm { B o n v I } } ( \phi , \phi _ { t } ) = - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathbb { E } _ { q ( \theta | \phi ) } \big [ \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , Q } | \widetilde { \theta } ^ { m } ) \big ] - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathbb { E } _ { q ( \theta | \phi ) } \big [ \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , S } | \theta ) \big ]
153
+ $$
154
+
155
+ where $\tilde { \theta } ^ { m } = S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { D } _ { t + 1 } ^ { m , S } ) )$ for $m = 1 , \ldots , M$ . In the sequential datasets setting $M$ denotes the number of tasks sampled per iteration, whereas in the sequential tasks setting $M$ denotes the number of batches per epoch. We use a Gaussian mean-field approximate posterior $q ( \theta | \phi _ { t } ) =$ $\textstyle \prod _ { d = 1 } ^ { D } N ( \mu _ { t , d } , \sigma _ { t , d } ^ { 2 } )$ , where $\phi _ { t } ~ = ~ \{ \mu _ { t , d } , \sigma _ { t , d } \} _ { d = 1 } ^ { D }$ , $D = \dim ( \theta )$ and the objective in Eq. (15) is minimised over $\phi$ . The pseudo-code of the BOMVI algorithm can be found in Appendix B.1.
156
+
157
+ The first term in Eq. (15) is rather cumbersome to estimate in optimisation. To compute its Monte Carlo estimator, we have to generate samples $\theta _ { r } \sim q$ for $r = 1 , \ldots , R$ , and run a quick adaptation on each sampled meta-parameters $\theta _ { r }$ before evaluating its log-likelihood. This is computationally intensive and it gives an estimator with large variance. We propose a workaround by modifying the inner loop SGD quick adaptation, and the details can be found in Appendix B.2.
158
+
159
+ # 5 RELATED WORK
160
+
161
+ Online Meta-Learning There are two common problem settings in the current online metalearning works:
162
+
163
+ • Underlying task distribution: Sequential tasks are assumed to originate from the same underlying task distribution $p ( \mathcal { T } )$ in this setting. Our work in the sequential tasks setting belongs to this category. Denevi et al. (2019) introduce the online-within-online (OWO) and online-within-batch (OWB) settings, where OWO encounters tasks and examples within tasks sequentially while OWB encounters tasks sequentially but examples within tasks are in batch. The BOML framework in the sequential tasks setting corresponds to the OWB setting. On the other hand, our work in the sequential datasets setting is novel in overcoming few-shot catastrophic forgetting, where the goal is to few-shot classify tasks drawn from a sequence of distributions $p ( { \bar { \mathcal { T } } } _ { 1 } ) , \dots , p ( { \mathcal { T } } _ { T } )$ as explained in Section 3. He et al. (2019), Harrison et al. (2019) and Jerfel et al. (2019) look into continual meta-learning for nonstationary task distributions where the task boundaries are unknown to the model. Jerfel et al. (2019) consider a latent task structure to adapt to the non-stationary task distributions.
164
+
165
+ • Regret minimisation: In this setting, the goal is to minimise the regret function, and the assumptions are made on the loss function rather than the task distribution. Recent works Finn et al. (2019); Zhuang et al. (2019) belong to this category, where the aim is to compete with the best meta-learner and supersede it. These methods accumulate data as they arrive and meta-learn using all data acquired so far. Data accumulation is not desirable as the algorithmic complexity of training grows with the amount of data accumulated, and training time increases as new data arrive (Finn et al., 2019; He et al., 2019). The agent will eventually run out of memory for a long sequence of data. The BOML framework on the other hand is advantageous, as it only takes the posterior of the meta-parameters into consideration during optimisation. This gives a framework with an algorithmic complexity independent of the length of the dataset sequence.
166
+
167
+ Offline Meta-Learning Previous meta-learning works attempt to solve few-shot classification problems in an offline setting, under the assumption of having a stationary task distribution during meta-training and meta-evaluation. A single meta-learned model is aimed to few-shot classify one specific dataset with all base classes of the dataset readily available in a batch for meta-training. There are two general frameworks for the offline meta-learning setting:
168
+
169
+ • Probabilistic framework: The MAML algorithm can be cast into a probabilistic inference problem (Finn et al., 2018) or with a hierarchical Bayesian structure (Grant et al.,
170
+
171
+ 2018; Yoon et al., 2018). Grant et al. (2018) discuss the use of a Laplace approximation in the task-specific inner loop to improve MAML using the curvature information, whilst Yoon et al. (2018) use Stein Variational Gradient Descent (SVGD) for task-specific learning. Gordon et al. (2019) implement probabilistic inference by considering the posterior predictive distribution with amortised networks.
172
+
173
+ • Non-probabilistic framework: Gradient-based meta-learning (Finn et al., 2017; Nichol et al., 2018; Rusu et al., 2019) updates the meta-parameters by accumulating the gradients of a meta-batch of task-specific inner loop updates. The meta-parameters will be used as a model initialisation for a quick adaptation on the novel classes. Metric-based metalearning (Koch et al., 2015; Vinyals et al., 2016; Snell et al., 2017) utilises the metric distance between labelled examples. Such methods assume that base and novel classes are from the same dataset distribution, and the metric distance estimations can be generalised to the novel classes upon meta-learning the base classes.
174
+
175
+ Continual Learning Modern continual learning works (Goodfellow et al., 2013; Lee et al., 2017; Zenke et al., 2017) focus primarily on large-scale supervised learning, in contrast to our work that looks into continual few-shot classification across sequential tasks and datasets. Wen et al. (2018) utilise few-shot learning to improve on overcoming catastrophic forgetting via logit matching on a small sample from the previous tasks. The online learning element in this paper is closely related to (Kirkpatrick et al., 2017; Zenke et al., 2017; Ritter et al., 2018a; Nguyen et al., 2018) that overcome catastrophic forgetting for large-scale supervised classification. In particular, our work builds on the online Laplace approximation method in (Ritter et al., 2018a). We extend this to the meta-learning scenario to avoid forgetting in few-shot classification problems. Nguyen et al. (2018) provide the alternative of using variational inference instead of Laplace approximation for approximating the posterior. It is a reasonable approach to adapt variational approximation methods to approximate the posterior of the meta-parameters by adjusting the KL-divergence objective.
176
+
177
+ # 6 EXPERIMENTS
178
+
179
+ # 6.1 OMNIGLOT: SEQUENTIAL TASKS
180
+
181
+ We run the sequential tasks experiment on the Omniglot dataset. To increase the difficulty level, we split the datasets based on the alphabets (super-classes) instead of the characters (classes). The goal of this experiment is to classify the 5-way 5-shot novel tasks sampled from the meta-evaluation alphabets. The experimental details and the alphabet splits can be found in Appendix C.1.
182
+
183
+ We compare our algorithms to the following baselines:
184
+
185
+ 1. Train-On-Everything (TOE): When a new task (or dataset) arrives for meta-training, we randomly re-initialise the meta-parameters and perform meta-training on all tasks (or datasets) encountered so far. Once meta-training is completed in this stage, we do not update the posterior of the meta-parameters like we would in BOMLA and BOMVI. 2. Train-From-Scratch (TFS): Upon the arrival of a new task (or dataset), we randomly reinitialise the meta-parameters and meta-train only on the newly-arrived task (or dataset). Similar to TOE, the posterior of the meta-parameters is not updated in TFS. 3. Follow The Meta-Leader (FTML): We introduce a slight modification to FTML (Finn et al., 2019) on its evaluation method, as FTML is not designed for few-shot learning on unseen tasks. In our experiment, we apply Update-Procedure in FTML to the data from unseen tasks, rather than the data from the same training task as in the original FTML.
186
+
187
+ As the tasks arrive sequentially for meta-training, Figure 1 shows that BOMLA and BOMVI can accumulate the few-shot classification ability on the novel tasks over time. The knowledge acquired from previous meta-training tasks are carried forward in the form of a posterior, which is then used as the prior when a new task arrives for meta-training. The baselines TOE and TFS have similar performances. Despite having access to all previous tasks, TOE shows no positive forward transfer in the meta-evaluation accuracy each time it encounters a new task. BOMLA with $\lambda = 0 . 1$ gives the best performance in this experiment.
188
+
189
+ ![](images/f1b81faadf230be434c4056a4a78621223884d73db008b674c0cea1f3e45bc91.jpg)
190
+ Figure 1: Meta-evaluation accuracy across 3 seed runs on the novel tasks along meta-training. Left: compares BOMLA to the baselines, centre: compares BOMVI to the baselines, right: compares BOMLA with different $\lambda$ values to BOMVI.
191
+
192
+ # 6.2 PENTATHLON: SEQUENTIAL DATASETS
193
+
194
+ We implement BOMLA and BOMVI to the pentathlon 5-way 1-shot classification sequence:
195
+
196
+ Omniglot CIFAR-FS miniImageNet VGG-Flowers Aircraft
197
+
198
+ The details of this experiment and the datasets can be found in Appendix C.2. We compare BOMLA and BOMVI to the baseline TOE, and running MAML continuously on the sequential datasets for meta-training.
199
+
200
+ Figure 2 shows that BOMLA and BOMVI are able to prevent few-shot catastrophic forgetting. TOE is also able to retain the few-shot performance as it has access to all datasets encountered so far. However, since it learns all datasets from random re-initialisation each time it encounters a new dataset, the meta-training time required to achieve a similarly good meta-evaluation performance is longer compared to other runs. The sequential MAML, on the other hand, catastrophically forgets the previously learned datasets but has the best performance on new datasets compared to other runs. TOE can be memory-intensive as the dataset sequence becomes longer. It takes the bruteforce approach to prevent forgetting by memorising all datasets. Unlike TOE, our BOML approach only takes the posterior of the meta-parameters into consideration during optimisation. This gives a framework with an algorithmic complexity independent of the length of the dataset sequence.
201
+
202
+ $@ \ @ \left( { \widehat { a } } \right)$ New2: errorband
203
+
204
+ Tuning the posterior regulariser $\lambda$ mentioned in Section 4.2 corresponds to balancing between a smaller performance trade-off on a new dataset and less forgetting on previous datasets. As shown in Appendix C.2 Figure 4, a larger $\lambda = 1 0 0 0$ results in a more concentrated Gaussian posterior and is therefore unable to learn new datasets well, but can better retain the performances on previous datasets. A smaller value $\lambda = 1$ on the other hand gives a widespread Gaussian posterior and learns better on new datasets by sacrificing the performance on the previous datasets. In this experiment, the value $\lambda = 1 0 0$ gives the best balance between old and new datasets. Ideally we seek for a good performance on both old and new datasets, but in reality there is a trade-off between retaining performance on old datasets and learning well on new datasets due to posterior approximation errors.
205
+
206
+ As shown in Figures 1 and 2, BOMLA with appropriate $\lambda$ is superior to BOMVI. This is due to BOMLA having a better posterior approximation than BOMVI. Whilst BOMLA has a Gaussian approximate posterior with block-diagonal precision, BOMVI uses a Gaussian mean-field approximate posterior. Trippe & Turner (2017) compared the performances of variational inference with different covariance structures, and discovered that variational inference with block-diagonal covariance performs worse than mean-field approximation. This is because the block-diagonal covariance in variational inference prohibits variance reduction methods such as local reparameterisation trick for Monte Carlo estimation. The variance of the Monte Carlo estimate has been proven problematic (Kingma et al., 2015; Trippe & Turner, 2017). We address this issue in Section 4.3 and Appendix B.2 specifically to the meta-learning setting by modifying the inner loop quick adaptation.
207
+
208
+ $@ \ @ \left( { \widehat { a } } \right)$ New2: $\lambda { \cdot }$ - comparing plot in App. C.2
209
+
210
+ ![](images/e2f5052bde38ab7aad480616153346453a41dffe2b36ad7c864932e1cf0d6269.jpg)
211
+ Figure 2: Meta-evaluation accuracy across 3 seed runs on each dataset along meta-training (refer to Figure 3 for the enlarged version). Higher accuracy values indicate better results with less forgetting as we proceed to new datasets. BOMLA with $\lambda = 1 0 0$ gives good performance in the offdiagonal plots (retains performances on previously learned datasets), and has a minor performance trade-off in the diagonal plots (learns less well on new datasets). Sequential MAML gives better performance in the diagonal plots (learns well on new datasets) but worse performance in the offdiagonal plots (forgets previously learned datasets). BOMVI is also able to retain performance on previous datasets, although it may be unable to perform as good as BOMLA due to sampling and estimator variance.
212
+
213
+ # 7 CONCLUSION
214
+
215
+ We introduced the Bayesian online meta-learning (BOML) framework with two algorithms: BOMLA and BOMVI. Our framework can overcome catastrophic forgetting in few-shot classification problems and can handle sequentially arriving few-shot tasks for online meta-learning. BOML merged the BOL framework and the MAML algorithm via Laplace approximation or variational continual learning. We proposed the necessary adjustments in the Hessian and Fisher approximation for BOMLA, as we are optimising the meta-parameters for few-shot classification instead of the usual model parameters in large-scale supervised classification. The experiments show that BOMLA and BOMVI are able to retain the few-shot classification ability when trained on sequential datasets with evident distributional shift, resulting in the ability to perform few-shot classification on multiple datasets with a single meta-learned model. BOMLA and BOMVI are also able to continually learn to few-shot classify novel tasks as the meta-training tasks arrive sequentially for learning.
216
+
217
+ # REFERENCES
218
+
219
+ A. Antoniou, H. Edwards, and A. Storkey. How to Train Your MAML. In International Conference on Learning Representations, 2019. L. Bertinetto, J. F. Henriques, P. Torr, and A. Vedaldi. Meta-Learning with Differentiable ClosedForm Solvers. In International Conference on Learning Representations, 2019.
220
+
221
+ A. Botev, H. Ritter, and D. Barber. Practical Gauss-Newton Optimisation for Deep Learning. In Proceedings of the 34th International Conference on Machine Learning, 2017.
222
+ G. Denevi, D. Stamos, C. Ciliberto, and M. Pontil. Online-Within-Online Meta-Learning. In Advances in Neural Information Processing Systems 32, 2019.
223
+ J. S. Denker and Y. LeCun. Transforming Neural-Net Output Levels to Probability Distributions. In Advances in Neural Information Processing Systems 3, 1991.
224
+ C. Finn, P. Abbeel, and S. Levine. Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks. In Proceedings of the 34th International Conference on Machine Learning, 2017.
225
+ C. Finn, K. Xu, and S. Levine. Probabilistic Model-Agnostic Meta-Learning. In Advances in Neural Information Processing Systems 31, 2018.
226
+ C. Finn, A. Rajeswaran, S. Kakade, and S. Levine. Online Meta-Learning. In Proceedings of the 36th International Conference on Machine Learning, 2019.
227
+ I. J. Goodfellow, M. Mirza, D. Xiao, A. Courville, and Y. Bengio. An Empirical Investigation of Catastrophic Forgetting in Gradient-Based Neural Networks. arXiv preprint, arXiv:1312.6211, 2013.
228
+ J. Gordon, J. Bronskill, M. Bauer, S. Nowozin, and R. Turner. Meta-Learning Probabilistic Inference for Prediction. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id ${ . } = { }$ HkxStoC5F7.
229
+ E. Grant, C. Finn, S. Levine, T. Darrell, and T. Griffiths. Recasting Gradient-Based Meta-Learning as Hierarchical Bayes. In International Conference on Learning Representations, 2018.
230
+ R. Grosse and J. Martens. A Kronecker-Factored Approximate Fisher Matrix for Convolution Layers. In Proceedings of the 33rd International Conference on Machine Learning, 2016.
231
+ J. Harrison, A. Sharma, C. Finn, and M. Pavone. Continuous Meta-Learning without Tasks. arXiv preprint, arXiv:1912.08866, 2019.
232
+ X. He, J. Sygnowski, A. Galashov, A. A. Rusu, Y. Teh, and R. Pascanu. Task Agnostic Continual Learning via Meta Learning. arXiv preprint, arXiv:1906.05201, 2019.
233
+ G. Jerfel, E. Grant, T. Griffiths, and K. A. Heller. Reconciling Meta-Learning and Continual Learning with Online Mixtures of Tasks. In Advances in Neural Information Processing Systems 32, 2019.
234
+ D. P. Kingma and J. Ba. Adam: A Method for Stochastic Optimization. In International Conference on Learning Representations, 2015.
235
+ D. P. Kingma, T. Salimans, and M. Welling. Variational Dropout and the Local Reparameterization Trick. In Advances in Neural Information Processing Systems 28, 2015.
236
+ J. Kirkpatrick, R. Pascanu, N. Rabinowitz, J. Veness, G. Desjardins, A. A. Rusu, K. Milan, J. Quan, T. Ramalho, A. Grabska-Barwinska, D. Hassabis, C. Clopath, D. Kumaran, and R. Hadsell. Overcoming Catastrophic Forgetting in Neural Networks. Proceedings of the National Academy of Sciences, 2017.
237
+ G. Koch, R. Zemel, and R. Salakhutdinov. Siamese Neural Networks for One-Shot Image Recognition. In 32th International Conference on Machine Learning Deep Learning Workshop, 2015.
238
+ B. Lake, R. Salakhutdinov, J. Gross, and J.B. Tenenbaum. One Shot Learning of Simple Visual Concepts. In Proceedings of the 33rd Annual Conference of the Cognitive Science Society, 2011.
239
+ 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 30, 2017.
240
+ F. Li, R. Fergus, and P. Perona. Learning Generative Visual Models from Few Training Examples: An Incremental Bayesian Approach Tested on 101 Object Categories. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition Workshops, 2004.
241
+ F. Li, R. Fergus, and P. Perona. One-Shot Learning of Object Categories. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2006.
242
+ Z. Li, F. Zhou, F. Chen, and H. Li. Meta-SGD: Learning to Learn Quickly for Few-Shot Learning. arXiv preprint, arXiv:1707.09835, 2017.
243
+ D. J. C. MacKay. A Practical Bayesian Framework for Backpropagation Networks. Neural Computation, 1992.
244
+ S. Maji, E. Rahtu, J. Kannala, M. Blaschko, and A. Vedaldi. Fine-Grained Visual Classification of Aircraft. arXiv preprint, arXiv:1306.5151, 2013.
245
+ J. Martens and R. Grosse. Optimizing Neural Networks with Kronecker-Factored Approximate Curvature. In Proceedings of the 32nd International Conference on Machine Learning, 2015.
246
+ E. G. Miller, N. E. Matsakis, and P. A. Viola. Learning from One Example Through Shared Densities on Transforms. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2000.
247
+ C. V. Nguyen, Y. Li, T. D. Bui, and R. E. Turner. Variational Continual Learning. In International Conference on Learning Representations, 2018.
248
+ A. Nichol, J. Achiam, and J. Schulman. On First-Order Meta-Learning Algorithms. arXiv preprint, arXiv:1803.02999, 2018.
249
+ M. Nilsback and A. Zisserman. Automated Flower Classification over a Large Number of Classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics and Image Processing, 2008.
250
+ M. Opper. A Bayesian Approach to Online Learning. Cambridge University Press, 1998.
251
+ S. Ravi and H. Larochelle. Optimization as a Model for Few-Shot Learning. In International Conference on Learning Representations, 2017.
252
+ H. Ritter, A. Botev, and D. Barber. Online Structured Laplace Approximations for Overcoming Catastrophic Forgetting. In Advances in Neural Information Processing Systems 31, 2018a.
253
+ H. Ritter, A. Botev, and D. Barber. A Scalable Laplace Approximation for Neural Networks. In International Conference on Learning Representations, 2018b.
254
+ H. Robbins and S. Monro. A Stochastic Approximation Method. The Annals of Mathematical Statistics, 1951.
255
+ A. A. Rusu, D. Rao, J. Sygnowski, O. Vinyals, R. Pascanu, S. Osindero, and R. Hadsell. MetaLearning with Latent Embedding Optimization. In International Conference on Learning Representations, 2019.
256
+ A. Santoro, S. Bartunov, M. Botvinick, D. Wierstra, and T. Lillicrap. Meta-Learning with MemoryAugmented Neural Networks. In Proceedings of the 33rd International Conference on Machine Learning, 2016.
257
+ J. Schmidhuber. Evolutionary Principles in Self-Referential Learning. On Learning How to Learn: The Meta-Meta-Meta...-Hook. Diploma thesis, Institut fur Informatik, Technische Universit ¨ at¨ Munchen, 1987. ¨
258
+ J. Snell, K. Swersky, and R. Zemel. Prototypical Networks for Few-Shot Learning. In Advances in Neural Information Processing Systems 30, 2017.
259
+ S. Thrun and L. Pratt. Learning to Learn: Introduction and Overview. Springer, Boston, MA, 1998.
260
+ B. L. Trippe and R. E. Turner. Overpruning in Variational Bayesian Neural Networks. In Advances in Neural Information Processing Systems 30 – Advances in Approximate Bayesian Inference Workshop, 2017.
261
+ O. Vinyals, C. Blundell, T. Lillicrap, K. Kavukcuoglu, and D. Wierstra. Matching Networks for One Shot Learning. In Advances in Neural Information Processing Systems 29, 2016.
262
+ J. Wen, Y. Cao, and R. Huang. Few-Shot Self Reminder to Overcome Catastrophic Forgetting. arXiv preprint, arXiv:1812.00543, 2018.
263
+ J. Yoon, T. Kim, O. Dia, S. Kim, Y. Bengio, and S. Ahn. Bayesian Model-Agnostic Meta-Learning. In Advances in Neural Information Processing Systems 31, 2018.
264
+ F. Zenke, B. Poole, and S. Ganguli. Continual Learning through Synaptic Intelligence. In Proceedings of the 34th International Conference on Machine Learning, 2017.
265
+ Z. Zhuang, Y. Wang, K. Yu, and S. Lu. No-Regret Non-Convex Online Meta-Learning. arXiv preprint, arXiv:1910.10196, 2019.
266
+
267
+ # A BACKGROUND
268
+
269
+ This section provides a background explanation of using BOL to find the posterior of a model parameters and overcome catastrophic forgetting, commonly for large-scale supervised classification. We will then apply this approach to our recursion in Eq. (5).
270
+
271
+ The posterior is typically intractable due to the enormous size of the modern neural network architectures. This leads to the requirement for a good approximation of the posterior of the metaparameters. A particularly suitable candidate for this purpose in meta-learning is the Laplace approximation (MacKay, 1992; Ritter et al., 2018b), as it simply adds a quadratic regulariser to the training objective. Variational inference is another possible method to obtain an approximation for the posterior of the meta-parameters.
272
+
273
+ # A.1 BAYESIAN ONLINE LEARNING
274
+
275
+ Upon the arrival of the new $\mathcal { D } _ { t + 1 }$ , we are interested in a MAP estimate $\theta ^ { * } = \arg \operatorname* { m a x } _ { \theta } p ( \theta | \mathcal { D } _ { 1 : t + 1 } )$ for the parameters $\theta$ of a neural network. Using Bayes’ rule on the posterior gives the recursive formula
276
+
277
+ $$
278
+ p ( \theta | \mathcal { D } _ { 1 : t + 1 } ) \propto p ( \mathcal { D } _ { t + 1 } | \theta ) p ( \theta | \mathcal { D } _ { 1 : t } )
279
+ $$
280
+
281
+ where Eq. (16) follows from the assumption that each dataset is independent given $\theta$ . As the normalised posterior $p ( \theta | \mathcal { D } _ { 1 : t } )$ is usually intractable, it may be approximated by a parametric distribution $q$ with parameter $\phi _ { t }$ . The BOL framework consists of the update step and the projection step (Opper, 1998). The update step uses the approximate posterior $q ( \theta | \phi _ { t } )$ obtained from the previous step for an update in the form of Eq. (16):
282
+
283
+ $$
284
+ p ( \theta | \mathcal { D } _ { 1 : t + 1 } , \phi _ { t } ) \propto p ( \mathcal { D } _ { t + 1 } | \theta ) q ( \theta | \phi _ { t } ) .
285
+ $$
286
+
287
+ The new posterior $p ( \theta | \mathcal { D } _ { 1 : t + 1 } , \phi _ { t } )$ might not belong to the same parametric family as $q ( \theta | \phi _ { t } )$ . In this case, the new posterior has to be projected into the same parametric family to obtain $q ( \theta | \phi _ { t + 1 } )$ . Opper (1998) performs this projection by minimising the KL-divergence between the new posterior and the parametric $q$ , while Ritter et al. (2018a) use the Laplace approximation and Nguyen et al. (2018) use variational inference.
288
+
289
+ # A.2 LAPLACE APPROXIMATION
290
+
291
+ We consider finding a MAP estimate following from Eq. (16):
292
+
293
+ $$
294
+ \theta _ { t + 1 } ^ { * } = \arg \operatorname* { m a x } _ { \theta } p ( \theta | \mathcal { D } _ { 1 : t + 1 } ) = \arg \operatorname* { m a x } _ { \theta } \{ \log p ( \mathcal { D } _ { t + 1 } | \theta ) + \log p ( \theta | \mathcal { D } _ { 1 : t } ) \} .
295
+ $$
296
+
297
+ Since the posterior $p ( \theta | \mathcal { D } _ { 1 : t } )$ of a neural network is intractable except for small architectures, the unnormalised posterior $\tilde { p } ( \theta | \mathcal { D } _ { 1 : t } )$ is considered instead. Performing Taylor expansion on the logarithm of the unnormalised posterior around a mode ${ \boldsymbol { \theta } } _ { t } ^ { * }$ gives
298
+
299
+ $$
300
+ \log \tilde { p } ( \theta | \mathcal { D } _ { 1 : t } ) \simeq \log \tilde { p } ( \theta | \mathcal { D } _ { 1 : t } ) \big | _ { \theta = \theta _ { t } ^ { * } } - \frac { 1 } { 2 } ( \theta - \theta _ { t } ^ { * } ) ^ { T } A _ { t } ( \theta - \theta _ { t } ^ { * } ) ,
301
+ $$
302
+
303
+ where $A _ { t }$ denotes the Hessian matrix of the negative log-posterior evaluated at $\theta _ { t } ^ { * }$ . The expansion in Eq. (19) suggests using a Gaussian approximate posterior. Given the parameter $\phi _ { t } = \{ \mu _ { t } , \Lambda _ { t } \}$ , a mean $\mu _ { t + 1 }$ for step $t + 1$ can be obtained by finding a mode of the approximate posterior as follows via standard gradient-based optimisation:
304
+
305
+ $$
306
+ \mu _ { t + 1 } = \arg \operatorname* { m a x } _ { \boldsymbol { \theta } } \log p ( \mathcal { D } _ { t + 1 } | \boldsymbol { \theta } ) - \frac { 1 } { 2 } ( \boldsymbol { \theta } - \boldsymbol { \mu } _ { t } ) ^ { T } \Lambda _ { t } ( \boldsymbol { \theta } - \boldsymbol { \mu } _ { t } ) .
307
+ $$
308
+
309
+ The precision matrix is updated as $\Lambda _ { t + 1 } = H _ { t + 1 } + \Lambda _ { t }$ , where $H _ { t + 1 }$ is the Hessian matrix of the negative log-likelihood for $\mathcal { D } _ { t + 1 }$ evaluated at $\mu _ { t + 1 }$ with entries
310
+
311
+ $$
312
+ H _ { t + 1 } ^ { i j } = - \frac { \partial ^ { 2 } } { \partial \theta ^ { ( i ) } \partial \theta ^ { ( j ) } } \log p ( \mathcal { D } _ { t + 1 } \vert \theta ) \bigg \vert _ { \theta = \mu _ { t + 1 } } .
313
+ $$
314
+
315
+ For a neural network model, gradient-based optimisation methods such as SGD (Robbins & Monro, 1951) and Adam (Kingma & Ba, 2015) are the standard gradient-based methods in finding a mode for the Laplace approximation in Eq. (20). We show in Section 4.1 that this provides a well-suited skeleton to implement Bayesian online meta-learning in Eq. (5) with the mode-seeking optimisation procedure.
316
+
317
+ # A.3 BLOCK-DIAGONAL HESSIAN APPROXIMATION
318
+
319
+ Since the full Hessian matrix in Eq. (21) is intractable for large neural networks, we seek for an efficient and relatively close approximation to the Hessian matrix. Diagonal approximations (Denker & LeCun, 1991; Kirkpatrick et al., 2017) are memory and computationally efficient, but sacrifice approximation accuracy as they ignore the interaction between parameters. Consider instead separating the Hessian matrix into blocks where different blocks are associated to different layers of a neural network. A particular diagonal block corresponds to the Hessian for a particular layer of the neural network. The block-diagonal Kronecker-factored approximation (Martens & Grosse, 2015; Grosse & Martens, 2016; Botev et al., 2017) utilises the fact that each diagonal block of the Hessian is Kronecker-factored for a single data point. This provides a better Hessian approximation as it takes the parameter interactions within a layer into consideration.
320
+
321
+ # A.3.1 KRONECKER-FACTORED APPROXIMATION
322
+
323
+ Consider a neural network with $L$ layers and parameter $\theta = [ \mathrm { v e c } ( W _ { 1 } ) ^ { T } , \dots , \mathrm { v e c } ( W _ { L } ) ^ { T } ] ^ { T }$ where $W _ { \ell }$ is the weight of layer $\ell$ for $\ell = \{ 1 , \dots , L \}$ and vec denotes stacking the columns of a matrix into a vector. We denote the input of the neural network as $a _ { 0 } = x$ and the output of the neural network as $h _ { L }$ . As the input passes through each layer of the neural network, we have the pre-activation for layer $\ell$ as $h _ { \ell } = W _ { \ell } a _ { \ell - 1 }$ and the activation as $a _ { \ell } = f _ { \ell } ( h _ { \ell } )$ where $f _ { \ell }$ is the activation function of layer $\ell$ . If a bias vector is applicable in calculating the pre-activation of a layer, we append the bias vector to the last column of the weight matrix and append a scalar one to the last element of the activation. The gradient $g _ { \ell }$ of loss $L _ { \theta } ( \dot { x _ { \star } } y ) = - \log p ( \bar { y } | \dot { x } , \theta )$ with respect to $h _ { \ell }$ for an input-target pair $( x , y )$ is the pre-activation gradient for layer $\ell$ .
324
+
325
+ Martens $\&$ Grosse (2015) show that the $\ell$ -th diagonal block $F _ { \ell }$ of the Fisher information matrix $F$ can be approximated by the Kronecker product between the expectation of the outer product of the $( \ell - 1 )$ -th layer activation and the $\ell$ -th layer pre-activation gradient:
326
+
327
+ $$
328
+ \begin{array} { r l } & { F _ { \ell } = \mathbb { E } _ { x , y } \bigl [ a _ { \ell - 1 } a _ { \ell - 1 } ^ { T } \otimes g _ { \ell } g _ { \ell } ^ { T } \bigr ] } \\ & { \qquad \approx \mathbb { E } _ { x } \bigl [ a _ { \ell - 1 } a _ { \ell - 1 } ^ { T } \bigr ] \otimes \mathbb { E } _ { y | x } \bigl [ g _ { \ell } g _ { \ell } ^ { T } \bigr ] } \\ & { \qquad = A _ { \ell - 1 } \otimes G _ { \ell } , } \end{array}
329
+ $$
330
+
331
+ where $A _ { \ell - 1 } = \mathbb { E } _ { x } [ a _ { \ell - 1 } a _ { \ell - 1 } ^ { T } ]$ and $G _ { \ell } = \mathbb { E } _ { y | x } [ g _ { \ell } g _ { \ell } ^ { T } ]$ . Grosse $\&$ Martens (2016) extend the blockdiagonal Kronecker-factored Fisher approximation for fully-connected layers to that for convolution layers. The Gaussian log-probability term can be calculated efficiently without expanding the Kronecker product using the identity
332
+
333
+ $$
334
+ \begin{array} { r } { ( A _ { \ell - 1 } \otimes G _ { \ell } ) \operatorname { v e c } ( W _ { \ell } - W _ { \ell } ^ { * } ) = \operatorname { v e c } ( G _ { \ell } ( W _ { \ell } - W _ { \ell } ^ { * } ) A _ { \ell - 1 } ^ { T } ) . } \end{array}
335
+ $$
336
+
337
+ As we mentioned in Section 4.2, approximating the Hessian with the one-step SGD inner loop assumption results in having terms that multiply two or more Kronecker products together. The $\ell$ -th diagonal block of $\widetilde { F }$ in Eq. (11) is
338
+
339
+ $$
340
+ \widetilde { F } _ { \ell } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } ( I - A _ { \ell - 1 } ^ { m } \otimes G _ { \ell } ^ { m } ) ( \widetilde { A } _ { \ell - 1 } ^ { m } \otimes \widetilde { G } _ { \ell } ^ { m } ) ( I - A _ { \ell - 1 } ^ { m } \otimes G _ { \ell } ^ { m } ) ^ { T } ,
341
+ $$
342
+
343
+ where $A _ { \ell - 1 } ^ { m } \otimes G _ { \ell } ^ { m }$ is the Kronecker product corresponding to the Hessian in Eq. (13) for task or batch $m$ . We expand $\widetilde { F } _ { \ell }$ using the Kronecker product property:
344
+
345
+ $$
346
+ \begin{array} { r } { ( A _ { \ell - 1 } ^ { m } \otimes G _ { \ell } ^ { m } ) ( \widetilde { A } _ { \ell - 1 } ^ { m } \otimes \widetilde { G } _ { \ell } ^ { m } ) = A _ { \ell - 1 } ^ { m } \widetilde { A } _ { \ell - 1 } ^ { m } \otimes G _ { \ell } ^ { m } \widetilde { G } _ { \ell } ^ { m } . } \end{array}
347
+ $$
348
+
349
+ This gives
350
+
351
+ $$
352
+ \begin{array} { r l r } { \widetilde { F } _ { \ell } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \Big \{ \widetilde { A } _ { \ell - 1 } ^ { m } \otimes \widetilde { G } _ { \ell } ^ { m } - A _ { \ell - 1 } ^ { m } \widetilde { A } _ { \ell - 1 } ^ { m } \otimes G _ { \ell } ^ { m } \widetilde { G } _ { \ell } ^ { m } - \widetilde { A } _ { \ell - 1 } ^ { m } ( A _ { \ell - 1 } ^ { m } ) ^ { T } \otimes \widetilde { G } _ { \ell } ^ { m } ( G _ { \ell } ^ { m } ) ^ { T } } \\ & { } & { + A _ { \ell - 1 } ^ { m } \widetilde { A } _ { \ell - 1 } ^ { m } ( A _ { \ell - 1 } ^ { m } ) ^ { T } \otimes G _ { \ell } ^ { m } \widetilde { G } _ { \ell } ^ { m } ( G _ { \ell } ^ { m } ) ^ { T } \Big \} . } \end{array}
353
+ $$
354
+
355
+ Finally, moving the meta-batch (or batch) averaging into the Kronecker factors gives the approximation:
356
+
357
+ $$
358
+ \begin{array} { r l } & { \widetilde { F } _ { \ell } \approx \widetilde { A } _ { \ell - 1 } \otimes \widetilde { G } _ { \ell } - A _ { \ell - 1 } \widetilde { A } _ { \ell - 1 } \otimes G _ { \ell } \widetilde { G } _ { \ell } - \widetilde { A } _ { \ell - 1 } ( A _ { \ell - 1 } ) ^ { T } \otimes \widetilde { G } _ { \ell } ( G _ { \ell } ) ^ { T } } \\ & { \qquad + A _ { \ell - 1 } \widetilde { A } _ { \ell - 1 } ( A _ { \ell - 1 } ) ^ { T } \otimes G _ { \ell } \widetilde { G } _ { \ell } ( G _ { \ell } ) ^ { T } , } \end{array}
359
+ $$
360
+
361
+ where $\begin{array} { r } { \tilde { A } _ { \ell - 1 } = \frac { 1 } { M } \sum _ { m } \tilde { A } _ { \ell - 1 } ^ { m } , \tilde { G } _ { \ell } = \frac { 1 } { M } \sum _ { m } \tilde { G } _ { \ell } ^ { m } , A _ { \ell - 1 } \tilde { A } _ { \ell - 1 } = \frac { 1 } { M } \sum _ { m } A _ { \ell - 1 } ^ { m } \tilde { A } _ { \ell - 1 } ^ { m } . } \end{array}$ and so on.
362
+
363
+ A.3.2 POSTERIOR REGULARISING HYPERPARAMETER FOR PRECISION UPDATE
364
+
365
+ Ritter et al. (2018a) use a hyperparameter $\lambda$ as a multiplier to the Hessian when updating the precision:
366
+
367
+ $$
368
+ \Lambda _ { t + 1 } = \lambda H _ { t + 1 } + \Lambda _ { t } .
369
+ $$
370
+
371
+ In the large-scale supervised classification setting, this hyperparameter has a regularising effect on the Gaussian posterior approximation for a balance between having a good performance on a new dataset and maintaining the performance on previous datasets (Ritter et al., 2018a). A large $\lambda$ results in a sharply peaked Gaussian posterior and is therefore unable to learn new datasets well, but can prevent forgetting previously learned datasets. A small $\lambda$ on the other hand gives a dispersed Gaussian posterior and allows better performance on new datasets by sacrificing the performance on the previous datasets.
372
+
373
+ # A.4 VARIATIONAL CONTINUAL LEARNING
374
+
375
+ The variational continual learning method (Nguyen et al., 2018) also provides a suitable metatraining framework for Bayesian online meta-learning in Eq. (5). Consider approximating the posterior $q$ by minimising the KL-divergence between the parametric $q$ and the new posterior as in the projection step in Eq. (17), where $q$ belongs to some pre-determined approximate posterior family $\mathcal { Q }$ with parameters $\phi _ { t }$ :
376
+
377
+ $$
378
+ \begin{array} { r l } & { q ( \theta | \phi _ { t + 1 } ) = \underset { q \in \mathcal { Q } } { \arg \operatorname* { m i n } } D _ { \mathrm { K L } } ( q ( \theta | \phi ) \| p ( \mathcal { D } _ { t + 1 } | \theta ) q ( \theta | \phi _ { t } ) ) } \\ & { \qquad = \underset { q \in \mathcal { Q } } { \arg \operatorname* { m i n } } \big \{ - \mathbb { E } _ { q ( \theta | \phi ) } [ \log p ( \mathcal { D } _ { t + 1 } | \theta ) ] + D _ { \mathrm { K L } } ( q ( \theta | \phi ) \| q ( \theta | \phi _ { t } ) ) \big \} . } \end{array}
379
+ $$
380
+
381
+ The optimisation in Eq. (32) leads to the objective
382
+
383
+ $$
384
+ \phi _ { t + 1 } = \underset { \phi } { \arg \operatorname* { m i n } } \big \{ - \mathbb { E } _ { q ( \theta | \phi ) } [ \log p ( \mathcal { D } _ { t + 1 } | \theta ) ] + D _ { \mathrm { K L } } ( q ( \theta | \phi ) \| q ( \theta | \phi _ { t } ) ) \big \} .
385
+ $$
386
+
387
+ One can use a Gaussian mean-field approximate posterior $\begin{array} { r } { q ( \theta | \phi _ { t } ) = \prod _ { d = 1 } ^ { D } N ( \mu _ { t , d } , \sigma _ { t , d } ^ { 2 } ) } \end{array}$ , where $\phi _ { t } = \{ \mu _ { t , d } , \sigma _ { t , d } \} _ { d = 1 } ^ { D }$ and $D = \dim ( \theta )$ . The first term in Eq. (33) can be estimated via Monte Carlo with local reparameterisation trick (Kingma et al., 2015), and the second KL-divergence term has a closed form for Gaussian distributions.
388
+
389
+ # B ALGORITHMS
390
+
391
+ # B.1 BOMLA AND BOMVI
392
+
393
+ Algorithm 1 gives the pseudo-code of the BOMLA algorithm for the sequential datasets setting, with the corresponding variation for the sequential tasks setting in brackets. The algorithm is formed of three main elements: meta-training on a specific dataset or task (line 4 – 11), updating the Gaussian mean (line 12) and updating the Gaussian precision (line 13 – 16). For the precision update, we approximate the Hessian using block-diagonal Kronecker-factored approximation (BD-KFA).
394
+
395
+ Algorithm 2 gives the pseudo-code of the BOMVI algorithm for the sequential datasets setting, with the corresponding variation for the sequential tasks setting in brackets. The algorithm is formed of two main elements: meta-training on a specific dataset or task (line 4 – 11) and updating the parameters of the Gaussian mean-field approximate posterior (line 12).
396
+
397
+ 1: Require: sequential datasets (or tasks) $\widetilde { \mathcal { D } } _ { 1 } , \ldots , \widetilde { \mathcal { D } } _ { T }$ , learning rate $\alpha$ , posterior regulariser $\lambda$ ,
398
+ number of meta-training iterations (or epochs) $J$ , meta-batch size (or number of batches) $M$
399
+ 2: Initialise: $\mu _ { 0 } , \Lambda _ { 0 }$ , $\theta$
400
+ 3: for $t = 1$ to $T$ do
401
+ 4: for $i = 1 , \dots , J$ do $\triangleright$ meta-training on dataset or task $\widetilde { \cal D } _ { t } \quad$ New: added $\cdot$
402
+ 5: for $m = 1$ to $M$ do
403
+ 6: Sample task (or split the batch) $\widetilde { \mathcal { D } } _ { t } ^ { m } = \widetilde { \mathcal { D } } _ { t } ^ { m , S } \cup \widetilde { \mathcal { D } } _ { t } ^ { m , Q }$
404
+ 7: Inner update $\tilde { \theta } ^ { m } = S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { D } _ { t } ^ { m , S } ) )$
405
+ 8: end for
406
+ 9: Evaluate loss $f _ { t } ^ { \mathrm { B o u L A } } ( \theta , \mu _ { t - 1 } , \Lambda _ { t - 1 } )$ in Eq. (8)
407
+ 10: Outer update $\theta \gets \theta - \alpha \nabla _ { \theta } f _ { t } ^ { \mathrm { B o M L A } } ( \theta , \mu _ { t - 1 } , \Lambda _ { t - 1 } )$
408
+ 11: end for
409
+ 12: Update mean $\mu _ { t } \gets \theta$ $\triangleright$ update posterior mean
410
+ 13: For sequential datasets, sample $M$ tasks for Hessian approximation
411
+ 14: Run inner update in line 7 for each task (or for each batch)
412
+ 15: Approximate $\widetilde { H } _ { t }$ with BD-KFA to $\widetilde { F }$ in Eq. (11)
413
+ 16: Update precision $\Lambda _ { t } \gets \lambda \widetilde { H } _ { t } + \Lambda _ { t - 1 }$ $\triangleright$ update posterior precision
414
+ 17: end for
415
+
416
+ # Algorithm 2 Bayesian online meta-learning with variational inference (BOMVI)
417
+
418
+ 1: Require: sequential datasets (or tasks) $\widetilde { \mathcal { D } } _ { 1 } , \ldots , \widetilde { \mathcal { D } } _ { T }$ , learning rate $\alpha$ , number of meta-training
419
+ iterations (or epochs) $J$ , meta-batch size (or number of batches) $M$
420
+ 2: Initialise: $\phi _ { 0 } = \{ \mu _ { 0 } , \sigma _ { 0 } \}$
421
+ 3: for $t = 1$ to $T$ do
422
+ 4: for $i = 1 , 2 , \dots , J$ do $\triangleright$ meta-training on dataset or task $\widetilde { \cal D } _ { t } \quad$ New: added $\cdot$
423
+ 5: for $m = 1$ to $M$ do
424
+ 6: Sample task (or split the batch) $\widetilde { \mathcal { D } } _ { t } ^ { m } = \widetilde { \mathcal { D } } _ { t } ^ { m , S } \cup \widetilde { \mathcal { D } } _ { t } ^ { m , Q }$
425
+ 7: Inner update $\tilde { \theta } ^ { m } = S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { D } _ { t } ^ { m , S } ) )$
426
+ 8: end for
427
+ 9: Evaluate loss $f _ { t } ^ { \mathrm { B o u V I } } ( \phi , \phi _ { t - 1 } )$ in Eq. (15)
428
+ 10: Outer update $\bar { \mu } \mu - \alpha \nabla _ { \mu } f _ { t } ^ { \mathrm { B o M V I } } ( \phi , \phi _ { t - 1 } )$ , and $\sigma \gets \sigma - \alpha \nabla _ { \sigma } f _ { t } ^ { \mathrm { B o M V I } } ( \phi , \phi _ { t - 1 } )$
429
+ 11: end for
430
+ 12: Update $\mu _ { t } \mu$ and $\sigma _ { t } \gets \sigma$ . update posterior parameters
431
+ 13: end for
432
+
433
+ # B.2 BOMVI MONTE CARLO ESTIMATOR
434
+
435
+ Recall that the BOMVI objective is:
436
+
437
+ $$
438
+ f _ { t + 1 } ^ { \mathrm { B o M V I } } ( \phi , \phi _ { t } ) = - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathbb { E } _ { q ( \theta | \phi ) } \big [ \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , Q } | \widetilde { \theta } ^ { m } ) \big ] - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathbb { E } _ { q ( \theta | \phi ) } \big [ \log p ( \widetilde { \mathcal { D } } _ { t + 1 } ^ { m , S } | \theta ) \big ]
439
+ $$
440
+
441
+ where term o $\tilde { \theta } ^ { m } = S G D _ { k } ( \mathcal { L } ( \theta , \widetilde { D } _ { t + 1 } ^ { m , S } ) )$ for diffic $m = 1 , \ldots , M$ . The Monte Carlo estimator for th as every sampled meta-parameters firstfor $\theta _ { r }$ $r = 1 , \ldots , R$ has to undergo a few-shot quick adaptation prior to the log-likelihood evaluation. As a consequence the estimator is prone to a large variance. Moreover, every quickly-adapted sample $\theta _ { r }$ contributes to the meta-learning gradients of the posterior mean and covariance, resulting in a high computational cost when taking the meta-gradients.
442
+
443
+ To solve these impediments, we introduce a slight modification to the SGD quick adaptation ${ \widetilde { \theta } } ^ { m }$ . Instead of taking the gradients with respect to the sampled meta-parameters, we consider the gradients with respect to the posterior mean. A one-step SGD quick adaptation, for instance, becomes:
444
+
445
+ $$
446
+ \tilde { \theta } ^ { m } = \theta - \alpha \nabla _ { \mu _ { t } } \mathcal { L } ( \mu _ { t } , \mathcal { \tilde { D } } _ { t + 1 } ^ { m , S } ) .
447
+ $$
448
+
449
+ This gives $\widetilde { \theta } ^ { m } \sim N ( \widetilde { \mu } _ { t } , \mathrm { d i a g } ( \sigma _ { t } ^ { 2 } ) )$ where
450
+
451
+ $$
452
+ \widetilde { \mu } _ { t } = \mu _ { t } - \alpha \nabla _ { \mu _ { t } } \mathcal { L } ( \mu _ { t } , \widetilde { D } _ { t + 1 } ^ { m , S } ) ,
453
+ $$
454
+
455
+ since $\theta \sim N ( \mu _ { t } , \mathrm { d i a g } ( \sigma _ { t } ^ { 2 } ) )$ . A quick adaptation with more steps works in a similar fashion. With this modification, we can calculate the Monte Carlo estimator for the first term using the local reparameterisation trick as usual.
456
+
457
+ # C EXPERIMENTS
458
+
459
+ # C.1 OMNIGLOT: SEQUENTIAL TASKS
460
+
461
+ In this experiment, we use the model architecture proposed by Vinyals et al. (2016) that takes 4 modules with 64 filters of size $3 \times 3$ , followed by a batch normalisation, a ReLU activation and a $2 \times 2$ max-pooling. A fully-connected layer is appended to the final module before getting the class probabilities with softmax. Table 1 shows the hyperparameters used in this experiment.
462
+
463
+ The Omniglot dataset comprises 50 alphabets (super-classes). Each alphabet has numerous characters (classes) and each character has 20 instances. As the meta-training alphabets arrive sequentially, we form non-overlapping sequential tasks from each arriving alphabet, and the tasks also do not overlap in the characters. We use 35 alphabets for meta-training, 7 alphabets for validation and 8 alphabets for meta-evaluation. The alphabet splits are as follows:
464
+
465
+ # 35 alphabets for meta-training:
466
+
467
+ Kannada, Burmese_(Myanmar), Malay_(Jawi_-_Arabic), Grantha, Atlantean, Ojibwe_(Canadian_Aboriginal_Syllabics), Balinese, Japanese_(katakana), Hebrew, Japanese_(hiragana), Keble, ’Old_Church_Slavonic_(Cyrillic), Asomtavruli_(Georgian), Tengwar, Aurek-Besh, Sanskrit, Manipuri, Early_Aramaic, Oriya, Mongolian, Avesta, Malayalam, Tifinagh, Angelic, Latin, Braille, Inuktitut_(Canadian_Aboriginal_Syllabics), Alphabet_of_the_Magi, Armenian, Korean, Gurmukhi, ULOG, Bengali, Gujarati, Sylheti
468
+
469
+ 7 alphabets for validation:
470
+
471
+ Ge_ez, Cyrillic, Glagolitic, N_Ko, Arcadian, Anglo-Saxon_Futhorc, Blackfoot_(Canadian_Aboriginal_Syllabics)
472
+
473
+ 8 alphabets for meta-evaluation:
474
+
475
+ Syriac_(Serto), Atemayar_Qelisayer, Tibetan, Futurama, Mkhedruli_(Georgian), Syriac_(Estrangelo), Tagalog, Greek
476
+
477
+ Table 1: Hyperparameters for the Omniglot sequential tasks experiment
478
+
479
+ <table><tr><td>Hyperparameter</td><td>BOMLA</td><td>BOMVI</td></tr><tr><td></td><td></td><td></td></tr><tr><td>Posterior regulariser 入</td><td>0.1</td><td></td></tr><tr><td>Precision initialisation values</td><td>10-4~10-2</td><td></td></tr><tr><td>Covariance initialisation values</td><td>1</td><td>exp(-10)</td></tr><tr><td>NumberofMonte Carlo samples</td><td>=</td><td>5</td></tr><tr><td>Number of batch M</td><td>1</td><td>1</td></tr><tr><td>Number of query samples per class (meta-evaluation)</td><td>15</td><td>15</td></tr><tr><td>Number of epochs per task</td><td>50</td><td>50</td></tr><tr><td>Number of inner SGD steps in meta-training (k)</td><td>5</td><td>5</td></tr><tr><td>Inner SGD learning rate (α)</td><td>0.1</td><td>0.1</td></tr><tr><td>Outer loop optimiser</td><td>Adam</td><td>Adam</td></tr><tr><td>Outer loop learning rate</td><td>0.001</td><td>0.001</td></tr><tr><td>Number of tasks sampled for meta-evaluation</td><td>100</td><td>100</td></tr><tr><td>Number of inner SGD steps in meta-evaluation (k)</td><td>10</td><td>10</td></tr></table>
480
+
481
+ # C.2 PENTATHLON: SEQUENTIAL DATASETS
482
+
483
+ We use the model architecture proposed by Vinyals et al. (2016) in this experiment, as we did for the sequential tasks experiment. Tables 2 and 3 are the hyperparameters used in this experiment.
484
+
485
+ Omniglot: The Omniglot dataset (Lake et al., 2011) comprises 1623 characters from 50 alphabets and each character has 20 instances. New classes with rotations in the multiples of $9 0 °$ are formed after splitting the classes for meta-training, validation and meta-evaluation. We use 1100 characters for meta-training, 100 characters for validation and the remaining for meta-evaluation.
486
+
487
+ CIFAR-FS: The CIFAR-FS dataset (Bertinetto et al., 2019) has 100 classes of objects and each class comprises 600 images. We use the same split as Bertinetto et al. (2019): 64 classes for metatraining, 16 classes for validation and 20 classes for meta-evaluation.
488
+
489
+ miniImageNet: The miniImageNet dataset (Vinyals et al., 2016) takes 100 classes and 600 instances in each class from the ImageNet dataset. We use the same split as Ravi & Larochelle (2017): 64 classes for meta-training, 16 classes for validation and 20 classes for meta-evaluation.
490
+
491
+ VGG-Flowers: The VGG-Flowers dataset (Nilsback & Zisserman, 2008) comprises 102 different types of flowers as the classes. This dataset has 8,189 instances in total. We randomly split 66 classes for meta-training, 16 classes for validation and 20 classes for meta-evaluation.
492
+
493
+ Aircraft: The Aircraft dataset (Maji et al., 2013) is a fine-grained dataset consisting of 100 different aircraft models as the classes and each class has 100 instances. We randomly split 64 classes for meta-training, 16 classes for validation and 20 classes for meta-evaluation.
494
+
495
+ Table 2: Hyperparameters for the pentathlon experiment (same value for all datasets)
496
+
497
+ <table><tr><td>Hyperparameter</td><td>BOMLA</td><td>BOMVI</td></tr><tr><td>Posterior regulariser 入</td><td>(various values)</td><td></td></tr><tr><td>Precision initialisation values</td><td>10-4~ 10-2</td><td></td></tr><tr><td>Number of tasks sampled for Hessian approx.</td><td>5000</td><td></td></tr><tr><td>Covariance initialisation values</td><td></td><td>exp(-5)</td></tr><tr><td>Number of Monte Carlo samples</td><td>=</td><td>20</td></tr><tr><td>Meta-batch size M</td><td>= 32</td><td>32</td></tr><tr><td>Number of query samples per class</td><td>15</td><td>15</td></tr><tr><td>Number of iterations per dataset</td><td>5000</td><td></td></tr><tr><td>Outer loop optimiser</td><td>Adam</td><td>5000</td></tr><tr><td>Outer loop learning rate</td><td></td><td>Adam</td></tr><tr><td>Number of tasks sampled for meta-evaluation</td><td>0.001 100</td><td>0.001 100</td></tr></table>
498
+
499
+ Table 3: Hyperparameters for the pentathlon sequential datasets experiment (individual datasets)
500
+
501
+ <table><tr><td>Hyperparameter</td><td>Omniglot</td><td>CIFAR-FS</td><td>miniImageNet</td><td>VGG-Flowers</td><td>Aircraft</td></tr><tr><td>Number of inner SGD steps in meta-training (k)</td><td>1</td><td>5</td><td>5</td><td>5</td><td>5</td></tr><tr><td>Inner SGD learning rate</td><td>0.4</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>(a) Outer learning rate decay</td><td>-</td><td>×0.1</td><td>×0.1 halfway</td><td>×0.1 per 1000</td><td>x0.1</td></tr><tr><td>schedule Number of inner SGD steps in meta-evaluation</td><td>3</td><td>halfway 10</td><td>10</td><td>iterations 10</td><td>halfway 10</td></tr></table>
502
+
503
+ ![](images/e4c0f6de57d020e55a0adba80739413b67359f38476dfa77ec263a2bdb85913e.jpg)
504
+ Figure 3: Meta-evaluation accuracy across 3 seed runs on each dataset along meta-training. Higher accuracy values indicate better results with less forgetting as we proceed to new datasets. BOMLA with $\lambda = 1 0 0$ gives better performance in the off-diagonal plots (retains performances on previously learned datasets), and has a minor performance trade-off in the diagonal plots (learns less well on new datasets). Sequential MAML gives better performance in the diagonal plots (learns well on new datasets) but worse performance in the off-diagonal plots (forgets previously learned datasets). BOMVI is also able to retain performance on previous datasets, although it may be unable to perform as good as BOMLA due to sampling and estimator variance.
505
+
506
+ ![](images/8b2b41f7bbda229777423d37569a5dc851b7bef2d0b560bb5db9e6b27a775de1.jpg)
507
+ Figure 4: Meta-evaluation accuracy across 3 seed runs on each dataset along meta-training. Higher accuracy values indicate better results with less forgetting as we proceed to new datasets. BOMLA with a large $\lambda = 1 0 0 0$ gives better performance in the off-diagonal plots (retains performances on previously learned datasets) but worse performance in the diagonal plots (does not learn well on new datasets). A small $\lambda = 1$ gives better performance in the diagonal plots (learns well on new datasets) but worse performance in the off-diagonal plots (forgets previously learned datasets). BOMVI is also able to retain performance on previous datasets, although it may be unable to learn new datasets as good as BOMLA due to sampling and estimator variance.
md/train/wXgk_iCiYGo/wXgk_iCiYGo.md ADDED
@@ -0,0 +1,639 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A DIFFUSION THEORY FOR DEEP LEARNING DYNAMICS: STOCHASTIC GRADIENT DESCENT EXPONENTIALLY FAVORS FLAT MINIMA
2
+
3
+ Zeke Xie1,2, Issei Sato 1,2, and Masashi Sugiyama2,1
4
+
5
+ 1The University of Tokyo 2RIKEN Center for AIP xie@ms.k.u-tokyo.ac.jp {sato,sugi}@k.u-tokyo.ac.jp
6
+
7
+ # ABSTRACT
8
+
9
+ Stochastic Gradient Descent (SGD) and its variants are mainstream methods for training deep networks in practice. SGD is known to find a flat minimum that often generalizes well. However, it is mathematically unclear how deep learning can select a flat minimum among so many minima. To answer the question quantitatively, we develop a density diffusion theory to reveal how minima selection quantitatively depends on the minima sharpness and the hyperparameters. To the best of our knowledge, we are the first to theoretically and empirically prove that, benefited from the Hessian-dependent covariance of stochastic gradient noise, SGD favors flat minima exponentially more than sharp minima, while Gradient Descent (GD) with injected white noise favors flat minima only polynomially more than sharp minima. We also reveal that either a small learning rate or large-batch training requires exponentially many iterations to escape from minima in terms of the ratio of the batch size and learning rate. Thus, large-batch training cannot search flat minima efficiently in a realistic computational time.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ In recent years, deep learning (LeCun et al., 2015) has achieved great empirical success in various application areas. Due to the over-parametrization and the highly complex loss landscape of deep networks, optimizing deep networks is a difficult task. Stochastic Gradient Descent (SGD) and its variants are mainstream methods for training deep networks. Empirically, SGD can usually find flat minima among a large number of sharp minima and local minima (Hochreiter & Schmidhuber, 1995; 1997). More papers reported that learning flat minima closely relate to generalization (Hardt et al., 2016; Zhang et al., 2017a; Arpit et al., 2017; Hoffer et al., 2017; Dinh et al., 2017; Neyshabur et al., 2017; Wu et al., 2017; Dziugaite & Roy, 2017; Kleinberg et al., 2018). Some researchers specifically study flatness itself. They try to measure flatness (Hochreiter & Schmidhuber, 1997; Keskar et al., 2017; Sagun et al., 2017; Yao et al., 2018), rescale flatness (Tsuzuku et al., 2019; Xie et al., 2020b), and find flatter minima (Hoffer et al., 2017; Chaudhari et al., 2017; He et al., 2019b; Xie et al., 2020a). However, we still lack a quantitative theory that answers why deep learning dynamics selects a flat minimum.
14
+
15
+ The diffusion theory is an important theoretical tool to understand how deep learning dynamics works. It helps us model the diffusion process of probability densities of parameters instead of model parameters themselves. The density diffusion process of Stochastic Gradient Langevin Dynamics (SGLD) under injected isotropic noise has been discussed by (Sato & Nakagawa, 2014; Raginsky et al., 2017; Zhang et al., 2017b; Xu et al., 2018). Zhu et al. (2019) revealed that anisotropic diffusion of SGD often leads to flatter minima than isotropic diffusion. A few papers has quantitatively studied the diffusion process of SGD under the isotropic gradient noise assumption. Jastrz˛ebski et al. (2017) first studied the minima selection probability of SGD. Smith & Le (2018) presented a Beyesian perspective on generalization of SGD. Wu et al. (2018) studied the escape problems of
16
+
17
+ SGD from a dynamical perspective, and obtained the qualitative conclusion on the effects of batch size, learning rate, and sharpness. Hu et al. (2019) quantitatively showed that the mean escape time of SGD exponentially depends on the inverse learning rate. Achille & Soatto (2019) also obtained a related proposition that describes the mean escape time in terms of a free energy that depends on the Fisher Information. Li et al. (2017) analyzed Stochastic Differential Equation (SDE) of adaptive gradient methods. Nguyen et al. (2019) mainly contributed to closing the theoretical gap between continuous-time dynamics and discrete-time dynamics under isotropic heavy-tailed noise.
18
+
19
+ However, the related papers mainly analyzed the diffusion process under parameter-independent and isotropic gradient noise, while stochastic gradient noise (SGN) is highly parameter-dependent and anisotropic in deep learning dynamics. Thus, they failed to quantitatively formulate how SGD selects flat minima, which closely depends on the Hessian-dependent structure of SGN. We try to bridge the gap between the qualitative knowledge and the quantitative theory for SGD in the presence of parameter-dependent and anisotropic SGN. Mainly based on Theorem 3.2 , we have four contributions:
20
+
21
+ • The proposed theory formulates the fundamental roles of gradient noise, batch size, the learning rate, and the Hessian in minima selection.
22
+ The SGN covariance is approximately proportional to the Hessian and inverse to batch size. Either a small learning rate or large-batch training requires exponentially many iterations to escape minima in terms of ratio of batch size and learning rate.
23
+ • To the best of our knowledge, we are the first to theoretically and empirically reveal that SGD favors flat minima exponentially more than sharp minima.
24
+
25
+ # 2 STOCHASTIC GRADIENT NOISE AND SGD DYNAMICS
26
+
27
+ We mainly introduce the necessary foundation for the proposed diffusion theory in this section. We denote the data samples as $\{ x _ { j } \} _ { j = 1 } ^ { m }$ , the model parameters as $\theta$ and the loss function over data samples $x$ as $L ( \theta , x )$ . For simplicity, we denote the training loss as $L ( \theta )$ . Following Mandt et al. (2017), we may write SGD dynamics as
28
+
29
+ $$
30
+ \theta _ { t + 1 } = \theta _ { t } - \eta \frac { \partial \hat { L } ( \theta _ { t } ) } { \partial \theta _ { t } } = \theta _ { t } - \eta \frac { \partial L ( \theta _ { t } ) } { \partial \theta _ { t } } + \eta C ( \theta _ { t } ) ^ { \frac { 1 } { 2 } } \zeta _ { t } ,
31
+ $$
32
+
33
+ where $\hat { L } ( \theta )$ is the loss of one minibatch, $\zeta _ { t } \sim \mathcal { N } ( 0 , I )$ , and $C ( \theta )$ represents the gradient noise covariance matrix. The classic approach is to model SGN by Gaussian noise, ${ \mathcal { N } } ( 0 , { \overline { { C } } } ( \theta ) )$ (Mandt et al., 2017; Smith & Le, 2018; Chaudhari & Soatto, 2018).
34
+
35
+ Stochastic Gradient Noise Analysis. We first note that the SGN we study is introduced by minibatch training, $\begin{array} { r } { C ( \theta _ { t } ) ^ { \frac { 1 } { 2 } } \zeta _ { t } = \frac { \partial L ( \theta _ { t } ) } { \partial \theta _ { t } } - \frac { \partial \hat { L } ( \theta _ { t } ) } { \partial \theta _ { t } } } \end{array}$ , which is the difference between gradient descent and stochastic gradient descent. According to Generalized Central Limit Theorem (Gnedenko et al., 1954), the mean of many infinite-variance random variables converges to a stable distribution, while the mean of many finite-variance random variables converges to a Gaussian distribution. As SGN is finite in practice, we believe the Gaussian approximation of SGN is reasonable.
36
+
37
+ Simsekli et al. (2019) argued that SGN is Lévy noise (stable variables), rather than Gaussian noise. They presented empirical evidence showing that SGN seems heavy-tailed, and the heavy-tailed distribution looks closer to a stable distribution than a Gaussian distribution. However, this research line (Simsekli et al., 2019; Nguyen et al., 2019) relies on a hidden strict assumption that SGN must be isotropic and obey the same distribution across dimensions. Simsekli et al. (2019) computed “SGN” across $n$ model parameters and regarded “SGN" as $n$ samples drawn from a single-variant distribution. This is why one tail-index for all parameters was studied in Simsekli et al. (2019). The arguments in Simsekli et al. (2019) did not necessarily hold for parameter-dependent and anisotropic Gaussian noise. In our paper, SGN computed over different minibatches obeys a $n$ -variant Gaussian distribution, which can be parameter-dependent and anisotropic.
38
+
39
+ In Figure 1, we empirically verify that SGN is highly similar to Gaussian noise instead of heavy-tailed Lévy noise. We recover the experiment of Simsekli et al. (2019) to show that gradient noise is approximately Lévy noise only if it is computed across parameters. Figure 1 actually suggests that the contradicted observations are from the different formulations of gradient noise. Simsekli et al. (2019) studied the distribution of SGN as a single-variant distribution, while we relax it as a $n$ -variant distribution. Our empirical analysis in Figure 1 holds well at least when the batch size $B$ is larger than 16, which is common in practice. Similar empirical evidence can be observed for training ResNet18 (He et al., 2016) on CIFAR-10 (Krizhevsky et al., 2009), seen in Appendix C.
40
+
41
+ ![](images/9f25e21da6eaf1f4dcc5fb4e55195174a32550f9f088693c21380f6b59439613.jpg)
42
+ Figure 1: The Stochastic Gradient Noise Analysis. The histogram of the norm of the gradient noises computed with the three-layer fully-connected network on MNIST (LeCun, 1998). (a) and (c): the histograms of the norms of two kinds of gradient noise: (a) “SGN” is computed over parameters, which is actually stochastic gradient rather than SGN; (c) SGN is computed over minibatches. (b) and (d): the histograms of the norms of (scaled) Gaussian noise and Lévy noise. Based on (a) and (b), Simsekli et al. (2019) argued that gradient noise across parameters is heavy-tailed Lévy noise. Based on (c) and (d), we show that SGN without the isotropic restriction is approximately Gaussian.
43
+
44
+ Panigrahi et al. (2019) also observed that for batch sizes 256 and above, the distribution of SGN is best described as Gaussian at-least in the early phases of training. Comparing our results with Panigrahi et al. (2019), we noticed that the Gaussianity of SGN may depend on more unknown factors. First, SGN on random models is more Gaussian than well-trained models. Second, the layer/network matters. Because SGN on some layers/networks is more Gaussian than other layers/networks.
45
+
46
+ The isotropic gradient noise assumption is too rough to capture the Hessian-dependent covariance structure of SGN, which we will study in Figure 2 later. Our theory that focuses on parameterdependent and anisotropic SGN brings a large improvement over existing parameter-independent and isotropic noise, although Simsekli et al. (2019) brought an improvement over more conventional parameter-independent and isotropic Gaussian noise. A more sophisticated theory is interesting under parameter-independent anisotropic heavy-tailed noise, when the batch size is too small $( B \sim 1 )$ to apply Central Limit Theorem. We will leave it as future work.
47
+
48
+ SGD Dynamics. Let us replace $\eta$ by $d t$ as unit time. Then the continuous-time dynamics of SGD (Coffey & Kalmykov, 2012) is written as
49
+
50
+ $$
51
+ d \theta = - \frac { \partial L ( \theta ) } { \partial \theta } d t + [ 2 D ( \theta ) ] ^ { \frac { 1 } { 2 } } d W _ { t } ,
52
+ $$
53
+
54
+ where $d W _ { t } \sim { \mathcal { N } } ( 0 , I d t )$ and $\begin{array} { r } { D ( \theta ) = \frac { \eta } { 2 } C ( \theta ) } \end{array}$ . We note that the dynamical time $t$ in the continuoustime dynamics is equal to the product of the number of iterations $T$ and the learning rate $\eta$ : $t = \eta T$ . The associated Fokker-Planck Equation is written as
55
+
56
+ $$
57
+ \begin{array} { r l r } { { \frac { \partial P ( \theta , t ) } { \partial t } = \nabla \cdot [ P ( \theta , t ) \nabla L ( \theta ) ] + \nabla \cdot \nabla D ( \theta ) P ( \theta , t ) } } \\ & { } & { = \sum _ { i } \frac { \partial } { \partial \theta _ { i } } [ P ( \theta , t ) \frac { \partial L ( \theta ) } { \partial \theta _ { i } } ] + \sum _ { i } \sum _ { j } \frac { \partial ^ { 2 } } { \partial \theta _ { i } \partial \theta _ { j } } D _ { i j } ( \theta ) P ( \theta , t ) , } \end{array}
58
+ $$
59
+
60
+ where $\nabla$ is a nabla operator, and $D _ { i j }$ is the element in the ith row and $j$ th column of $D$ . In standard SGLD, the injected gradient noise is fixed and isotropic Gaussian, $D = I$ .
61
+
62
+ ![](images/084198cb7082c38ce670ef6ab05aa9b80fc9eb6c2d5851d7717d8d63c4a5ddfd.jpg)
63
+ Figure 2: We empirically verified MNIST (LeCun, 1998). The pret $\begin{array} { r } { C ( \theta ) = \frac { H ( \theta ) } { B } } \end{array}$ by using three-layer fully-connected network ons are usually near critical points, while randomly Initialized Models are far from critical points. We display all elements $H _ { ( i , j ) } \in [ 1 e - 4 , 0 . 5 ]$ of the Hessian matrix and the corresponding elements $C _ { ( i , j ) }$ of gradient noise covariance matrix in the space spanned by the eigenvectors of Hessian. Another supplementary experiment on Avila Dataset (De Stefano et al., 2018) in Appendix C reports $\hat { C } _ { a v i l a } \approx 1 . 0 0 4 \frac { H } { B }$ . The small difference factor between the empirical result and the ideal Equation is mainly because the pretrained network is not perfectly located at a critical point.
64
+
65
+ The next question is how to formulate the SGN covariance $C ( \theta )$ for SGD? Based on Smith & Le (2018), we can express the SGN covariance as
66
+
67
+ $$
68
+ \boldsymbol { \Sigma } ( \theta ) = \frac { 1 } { B } \left[ \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \boldsymbol { \nabla } L ( \theta , x _ { j } ) \boldsymbol { \nabla } L ( \theta , x _ { j } ) ^ { \top } - \boldsymbol { \nabla } L ( \theta ) \boldsymbol { \nabla } L ( \theta ) ^ { \top } \right] \approx \frac { 1 } { B m } \sum _ { j = 1 } ^ { m } \boldsymbol { \nabla } L ( \theta , x _ { j } ) \boldsymbol { \nabla } L ( \theta , x _ { j } ) ^ { \top } .
69
+ $$
70
+
71
+ The approximation is true near critical points, due to the fact that the gradient noise variance dominates the gradient mean near critical points. We know the observed fisher information matrix satisfies $\operatorname { F I M } ( \theta ) \approx H ( \theta )$ near minima, referring to Chapter 8 of (Pawitan, 2001). Following Jastrz˛ebski et al. (2017); Zhu et al. (2019), we obtain
72
+
73
+ $$
74
+ C ( \theta ) \approx \frac { 1 } { B m } \sum _ { j = 1 } ^ { m } \nabla L ( \theta , x _ { j } ) \nabla L ( \theta , x _ { j } ) ^ { \top } = \frac { 1 } { B } \mathrm { F I M } ( \theta ) \approx \frac { 1 } { B } H ( \theta ) ,
75
+ $$
76
+
77
+ which approximately gives
78
+
79
+ $$
80
+ D ( \theta ) = \frac { \eta } { 2 } C ( \theta ) = \frac { \eta } { 2 B } H ( \theta )
81
+ $$
82
+
83
+ near minima. It indicates that the SGN covariance $C ( \theta )$ is approximately proportional to the Hessian $H ( \theta )$ and inverse to the batch size $B$ . Obviously, we can generalize Equation 7 by $\begin{array} { r } { D ( \theta ) ~ = ~ \frac { \eta C ( \theta ) } { 2 } ~ = ~ \frac { \eta } { 2 B } [ H ( \theta ) ] ^ { + } } \end{array}$ near critical points, when there exist negative eigenvalues in $H$ along some directions. We use $[ \cdot ] ^ { + }$ to denote the positive semidefinite transformation of a symmetric matrix: if we have the eigendecomposation $H = U \mathrm { d i a g } ( H _ { 1 } , \cdot \cdot \cdot , H _ { n - 1 } , H _ { n } ) U ^ { \top }$ , then $[ H ] ^ { + } = U \mathrm { d i a g } ( | H _ { 1 } | , \cdots , | H _ { n - 1 } | , | H _ { n } | ) U ^ { \dagger }$ .
84
+
85
+ We empirically verify this relation in Figure 2 for pretrained fully-connected networks, and a followup paper Xie et al. (2020c) first verified this relation for randomly initialized fully-connected networks on real-world datasets. The Pearson Correlation is up to 0.999 for pretrained networks. We note that, the relation still approximately holds for even the randomly network, which is far from critical points. The correlation is especially high along the flat directions with small-magnitude eigenvalues of the Hessian (Xie et al., 2020c). We emphasize that previous papers with the isotropic Lévy or Gaussian noise approximation all failed to capture this core relation in deep learning dynamics.
86
+
87
+ # 3 SGD DIFFUSION THEORY
88
+
89
+ We start the theoretical analysis from the classical Kramers Escape Problem (Kramers, 1940). We assume there are two valleys, Sharp Valley $a _ { 1 }$ and Flat Valley $a _ { 2 }$ , seen in Figure 3. Also Col b is the boundary between two valleys. What is the mean escape time for a particle governed by Equation 2 to escape from Sharp Valley $a _ { 1 }$ to Flat Valley $a _ { 2 }$ ? The mean escape time is widely used in related statistical physics and stochastic process (Van Kampen, 1992; Nguyen et al., 2019).
90
+
91
+ ![](images/73689560624558dfdf080463c0fd2eec0e7953c645f73e038906c281f99c7fba.jpg)
92
+ Figure 3: Kramers Escape Problem. $a _ { 1 }$ and $ { \boldsymbol { a } } _ { a }$ are minima of two neighboring valleys. $b$ is the saddle point separating the two valleys. $c$ locates outside of Valley $a _ { 1 }$ .
93
+
94
+ Gauss’s Divergence Theorem (Arfken & Weber, 1999; Lipschutz et al., 2009) states that the surface integral of a vector field over a closed surface, which is called the flux through the surface, is equal to the volume integral of the divergence over the region inside the surface. We respectively denote the mean escape time as $\tau$ , the escape rate as $\gamma$ , and the probability current as $J$ . We apply Gauss’s Divergence Theorem to the Fokker-Planck Equation resulting in
95
+
96
+ $$
97
+ \nabla \cdot \left[ P ( \theta , t ) \nabla L ( \theta ) \right] + \nabla \cdot \nabla D ( \theta ) P ( \theta , t ) = \frac { \partial P ( \theta , t ) } { \partial t } = - \nabla \cdot J ( \theta , t ) .
98
+ $$
99
+
100
+ The mean escape time is expressed (Van Kampen, 1992) as
101
+
102
+ $$
103
+ \tau = { \frac { 1 } { \gamma } } = { \frac { P ( \theta \in V _ { a } ) } { \int _ { S _ { a } } J \cdot d S } } ,
104
+ $$
105
+
106
+ where $\begin{array} { r } { P ( \theta \in V _ { a } ) = \int _ { V _ { a } } P ( \theta ) d V } \end{array}$ is the current probability inside Valley a, $J$ is the probability current produced by the probability source $P ( \theta \in V _ { a } )$ , $\begin{array} { r } { j = \int _ { S _ { a } } J \cdot d S } \end{array}$ is the probability flux (surface integrals of probability current), $S _ { a }$ is the surface (boundary) surrounding Valley a, and $V _ { a }$ is the volume surrounded by $S _ { a }$ . We have $j = J$ in the case of one-dimensional escape.
107
+
108
+ Classical Assumptions. We state three classical assumptions first for the density diffusion theory. Assumption 1 is the common second order Taylor approximation, which was also used by (Mandt et al., 2017; Zhang et al., 2019). Assumptions 2 and 3 are widely used in many fields’ Kramers Escape Problems, including statistical physics (Kramers, 1940; Hanggi, 1986), chemistry (Eyring, 1935; Hänggi et al., 1990), biology (Zhou, 2010), electrical engineering (Coffey & Kalmykov, 2012), and stochastic process (Van Kampen, 1992; Berglund, 2013). Related machine learning papers (Jastrz˛ebski et al., 2017) usually used Assumptions 2 and 3 as the background of Kramers Escape Problems.
109
+
110
+ Assumption 1 (The Second Order Taylor Approximation). The loss function around critical points $\theta ^ { \star }$ can be approximately written as
111
+
112
+ $$
113
+ L ( \theta ) = L ( \theta ^ { \star } ) + g ( \theta ^ { \star } ) ( \theta - \theta ^ { \star } ) + \frac { 1 } { 2 } ( \theta - \theta ^ { \star } ) ^ { \top } H ( \theta ^ { \star } ) ( \theta - \theta ^ { \star } ) .
114
+ $$
115
+
116
+ Assumption 2 (Quasi-Equilibrium Approximation). The system is in quasi-equilibrium near minima.
117
+ Assumption 3 (Low Temperature Approximation). The gradient noise is small (low temperature).
118
+
119
+ We will dive into these two assumptions deeper than previous papers for SGD dynamics. Assumptions 2 and 3 both mean that our diffusion theory can better describe the escape processes that cost more iterations. As this class of “slow” escape processes takes main computational time compared with “fast” escape processes, this class of “slow” escape process is more interesting for training of deep neural networks. Our empirical analysis in Section 4 supports that the escape processes in the wide range of iterations (50 to 100,000 iterations) can be modeled by our theory very well. Thus, Assumption 2 and 3 are reasonable in practice. More discussion can be found in Appendix B.
120
+
121
+ Escape paths. We generalize the concept of critical points into critical paths as the path where 1) the gradient perpendicular to the path direction must be zero, and 2) the second order directional derivatives perpendicular to the path direction must be nonnegative. The Most Possible Paths (MPPs) for escaping must be critical paths. The most possible escape direction at one point must be the direction of one eigenvector of the Hessian at the point. Under Assumption 3, the probability density far from critical points and MPPs is very small. Thus, the density diffusion will concentrate around MPPs. Draxler et al. (2018) reported that minima in the loss landscape of deep networks are connected by Minimum Energy Paths (MEPs) that are essentially flat and Local MEPs that have high-loss saddle points. Obviously, MPPs in our paper correspond to Local MEPs. The density diffusion along MEPs, which are strictly flat, is ignorable according to our following analysis.
122
+
123
+ The boundary between Sharp Valley $a _ { 1 }$ and Flat Valley $a _ { 2 }$ is the saddle point $b$ . The Hessian at $b$ , $H _ { b }$ , must have only one negative eigenvalue and the corresponding eigenvector is the escape direction. Without losing generality, we first assume that there is only one most possible path through $\operatorname { C o l } b$ existing between Sharp Valley $a _ { 1 }$ and Flat Valley $a _ { 2 }$ .
124
+
125
+ SGLD diffusion. We first analyze a simple case: how does SGLD escape sharp minima? Researchers are interested in SGLD, when the injected noise dominates SGN as $\eta 0$ in final epochs. Because SGLD may work as a Bayesian inference method in this limit (Welling & Teh, 2011). SGLD is usually simplified as Gradient Descent with injected white noise, whose behavior is identical to Kramers Escape Problem with thermo noise in statistical physics. We present Theorem 3.1. We leave the proof in Appendix A.1. We also note that more precise SGLD diffusion analysis should study a mixture of injected white noise and SGN.
126
+
127
+ Theorem 3.1 (SGLD Escapes Minima). The loss function $L ( \theta )$ is of class $C ^ { 2 }$ and $n$ -dimensional. Only one most possible path exists between Valley a and the outside of Valley a. If Assumption 1, 2, and 3 hold, and the dynamics is governed by SGLD, then the mean escape time from Valley a to the outside of Valley a is
128
+
129
+ $$
130
+ \tau = \frac { 1 } { \gamma } = 2 \pi \sqrt { \frac { - \operatorname * { d e t } ( H _ { b } ) } { \operatorname * { d e t } ( H _ { a } ) } } \frac { 1 } { | H _ { b e } | } \exp \left( \frac { \Delta L } { D } \right) .
131
+ $$
132
+
133
+ We denote that $H _ { a }$ and $H _ { b }$ are the Hessians of the loss function at the minimum a and the saddle point $b$ , $\Delta L = L ( b ) - L ( a )$ is the loss barrier height, e indicates the escape direction, and $H _ { b e }$ is the eigenvalue of the Hessian $H _ { b }$ corresponding to the escape direction. The diffusion coefficient $D$ is usually set to 1 in SGLD.
134
+
135
+ SGD diffusion. However, SGD diffusion is essentially different from SGLD diffusion in several aspects: 1) anisotropic noise, 2) parameter-dependent noise, and 3) the stationary distribution of SGD is far from the Gibs-Boltzmann distribution, $\begin{array} { r } { P ( \theta ) = \frac { 1 } { Z } \exp \left( - \frac { L ( \theta ) } { D } \right) } \end{array}$ . These different characteristics make SGD diffusion behave differently from known physical dynamical systems and much less studied than SGLD diffusion. We formulate Theorem 3.2 for SGD. We leave the proof in Appendix A.2.The theoretical analysis of SGD can be easily generalized to the dynamics with a mixture of SGN and injected white noise, as long as the eigenvectors of $D ( \theta )$ are closely aligned with the eigenvectors of $H ( \theta )$ .
136
+
137
+ Theorem 3.2 (SGD Escapes Minima). The loss function $L ( \theta )$ is of class $C ^ { 2 }$ and $n$ -dimensional. Only one most possible path exists between Valley a and the outside of Valley $^ { a }$ . If Assumption $I$ , 2, and 3 hold, and the dynamics is governed by $S G D$ , then the mean escape time from Valley a to the outside of Valley a is
138
+
139
+ $$
140
+ \tau = 2 \pi \frac { 1 } { | H _ { b e } | } \exp \left[ \frac { 2 B \Delta L } { \eta } \left( \frac { s } { H _ { a e } } + \frac { ( 1 - s ) } { | H _ { b e } | } \right) \right] ,
141
+ $$
142
+
143
+ where $s \in ( 0 , 1 )$ is a path-dependent parameter, and $H _ { a e }$ and $H _ { b e }$ are, respectively, the eigenvalues of the Hessians at the minimum a and the saddle point $b$ corresponding to the escape direction e.
144
+
145
+ Multiple-path escape. Each escape path contributes to the total escape rate. Multiple paths combined together have a total escape rate. If there are multiple parallel from the start valley to the end valley, we can compute the total escape rate easily based on the following computation rule. The computation rule is based on the fact that the probability flux integrals are additive. We can easily generalize the mean escape time analysis into the cases that there are multiple parallel escape paths indexed by $p$ As for multiple-valley escape problems, we can always reduce a multiple-valley escape problem into multiple two-valley escape problems. We also note that, while Theorem A.2 does not depend the dimensionality directly, higher dimensionality may increase the number of escape paths and loss valleys, and change the spectrum of the Hessians.
146
+
147
+ ![](images/40850afd82cda33fe28c5aa92bf1019fad755c726e83948318f7a64db61eaf3d.jpg)
148
+ Figure 4: The mean escape time analysis of SGD by using Styblinski-Tang Function. The Pearson Correlation is higher than 0.99. Left Column: Sharpness. Middle Column: Batch Size. Right Column: Learning Rate.
149
+
150
+ Rule 1. If there are multiple MPPs between the start valley and the end valley, then $\begin{array} { r } { \gamma _ { t o t a l } = \sum _ { p } \gamma _ { p } } \end{array}$
151
+
152
+ Thus, we only need to find the saddle points that connect two valleys as we analyzed in the paper and analyze the escape rates.
153
+
154
+ Minima selection. Now, we may formulate the probability of minima selection as Proposition 1. We leave the proof in Appendix A.3. In deep learning, one loss valley represents one mode and the landscape contain many good modes and bad modes. SGD transits from one mode to another mode during training. The mean escape time of one mode corresponds to the number of iterations which SGD spends on this mode during training, which is naturally proportional to the probability of selecting this mode after training.
155
+
156
+ Proposition 1. Suppose there are two valleys connected by an escape path. If all assumptions of Theorem 3.2 hold, then the stationary distribution of locating these valleys is given by
157
+
158
+ $$
159
+ P ( \theta \in V _ { a } ) = \frac { \tau _ { a } } { \sum _ { v } \tau _ { v } } ,
160
+ $$
161
+
162
+ where v is the index of valleys, and $\tau _ { v }$ is the mean escape time from Valley v to the outside of Valley $v$
163
+
164
+ # 4 EMPIRICAL ANALYSIS
165
+
166
+ In this section, we try to directly validate the escape formulas on real-world datasets. Each escape process, from the inside of loss valleys to the outside of loss valleys, are repeatedly simulated for 100 times under various gradient noise scales, batch sizes, learning rates, and sharpness.
167
+
168
+ How to compare the escape rates under the same settings with various minima sharpness? Our√ method is to multiply a rescaling factor $\sqrt { k }$ to each parameter, and the Hessian will be proportionally√ rescaled by a factor $k$ . If we let $L ( \theta ) = f ( \theta ) L ( \theta ) = f ( { \sqrt { k } } \theta )$ , then $H ( \theta ) = \nabla ^ { 2 } f ( \theta ) \to H ( \theta ) =$ $k \nabla ^ { 2 } f ( \theta )$ . Thus, we can use $k$ to indicate the minima sharpness. The theoretical relations of SGD we try to validate can be formulated as: $( 1 ) - \log ( \gamma ) = \bar { \mathcal { O } } ( \textstyle { \frac { 1 } { k } } )$ , $2 ) - \log ( \gamma ) = \mathcal { O } ( B )$ , and (3) $- \log ( \gamma ) = \mathcal { O } ( \textstyle { \frac { 1 } { \eta } } )$ .
169
+
170
+ The mean escape time analysis of SGD. Styblinski-Tang Function, which has multiple minima and saddle points, is a common test function for nonconvex optimization. We conduct an intuitional 10-dimensional experiment, where the simulations start from a given minimum and terminate when reaching the boundary of the loss valley. The number of iterations is recorded for calculating the escape rate. We also train fully connected networks on four real-world datasets, including a) Avila, b) Banknote Authentication, c) Cardiotocography, d) Dataset for Sensorless Drive Diagnosis (De Stefano et al., 2018; Dua & Graff, 2017). Figure 4 and Figure 5 clearly verifies that the escape rate exponentially depends on the minima sharpness (reflected by $k$ ), the batch size, and the learning rate on both test functions and real-world training, which fully supports our theoretical results.
171
+
172
+ ![](images/8bd372226d5c3c86bb1d2b2130b67041a3b2fb52d4924db07d0de0674e8493ba.jpg)
173
+ Figure 5: The mean escape time analysis of SGD by training neural networks on Avila Dataset. Left Column: Sharpness. Middle Column:Batch Size. Right Column: Learning Rate. We leave the results on Banknote Authentication, Cardiotocography, and Sensorless Drive Diagnosis in Appendix D.
174
+
175
+ ![](images/1f2c25c1998116a59e897d7ca8015655aad9a6ac9d7ea655f81156edacd74762.jpg)
176
+ Figure 6: The mean escape time analysis of SGLD. Subfigure (a) and (b): Styblinski-Tang Function. Subfigure (c) and (d): Neural Network.
177
+
178
+ Model architecture and details: We used fully-connected networks with the depth 2 and the width 10 in Figure 5. The experiments using Logistic Regression and Fully-connected networks with the depth 3 are presented in Appendix E. We leave more experimental details and results in Appendix D.1 and Appendix E.
179
+
180
+ The mean escape time analysis of SGLD. We try to validate $\gamma = \mathcal { O } ( k )$ and $- \log ( \gamma ) = \mathcal { O } ( \frac { 1 } { D } ) .$ for SGLD (dominated by injected Gaussian noise). Figure 6 shows that SGLD only favors flat minima polynomially more than sharp minima as Theorem 3.1 indicates. Figure 6 also verifies that the injected gradient noise scale exponentially affects flat minima selection.
181
+
182
+ # 5 DISCUSSION
183
+
184
+ SGD favors flat minima exponentially more than sharp minima. We can discover a few interesting insights about SGD by Theorem 3.2. Most importantly, the mean escape time exponentially depends on the eigenvalue of the Hessian at minima along the escape direction, $H _ { a e }$ . Thus, SGD favors flat minima exponentially more than sharp minima. We claim one main advantage of SGD comes from the exponential relation of the mean escape time and the minima sharpness. The measure of “sharpness” has reformed in contexts of SGLD and SGD. In the context of SGLD, the “sharpness” is quantified by the determinant of the Hessian. In the context of SGD, the “sharpness” is quantified by the top eigenvalues of the Hessian along the escape direction. Based on the proposed diffusion theory, recent work (Xie et al., 2020c) successfully proved that SGD favors flat minima significantly more than Adam.
185
+
186
+ The ratio of the batch size and the learning rate exponentially matters. Theorem 3.2 explains why large-batch training can easily get trapped near sharp minima, and increasing the learning rate proportionally is helpful for large-batch training (Krizhevsky, 2014; Keskar et al., 2017; Sagun et al., 2017; Smith et al., 2018; Yao et al., 2018; He et al., 2019a). We argue that the main cause is large-batch training expects exponentially longer time to escape minima. Note that, as the mean escape time in the theorems is equivalent to the product of the learning rate and the number of iterations, both the number of iterations and dynamical time exponentially depend on the ratio of the batch size and the learning rate. The practical computational time in large-batch training is usually too short to search many enough flat minima. We conjecture that exponentially increasing training iterations may be helpful for large batch training, while this is often too expensive in practice.
187
+
188
+ Low dimensional diffusion. Most eigenvalues of the Hessian at the loss landscape of overparametrized deep networks are close to zero, while only a small number of eigenvalues are large (Sagun et al., 2017; Li et al., 2018). Zero eigenvalues indicate zero diffusion along the corresponding directions. Thus, we may theoretically ignore these zero-eigenvalue directions. This also indicates that the density diffusion is ignorable along an essentially flat MEP in Draxler et al. (2018).
189
+
190
+ As the escape rate exponentially depends the corresponding eigenvalues, a small number of large eigenvalues means that the process of minima selection mainly happens in the relatively low dimensional subspace corresponding to top eigenvalues of the Hessian. Gur-Ari et al. (2018) also reported a similar finding. Although the parameter space is very high-dimensional, SGD dynamics hardly depends on those “meaningless” dimensions with small second order directional derivatives. This novel characteristic of SGD significantly reduces the explorable parameter space around one minimum into a much lower dimensional space.
191
+
192
+ High-order effects. As we have applied the second-order Taylor approximation near critical points, our SGD diffusion theory actually excludes the third-order and higher-order effect. The asymmetric valley in He et al. (2019b), which only appears in high-order analysis, is beyond the scope of this paper. However, we also argue that the third-order effect is much smaller than the second-order effect under the low temperature assumption in Kramers Escape Problems. We will leave the more refined high-order theory as future work.
193
+
194
+ # 6 CONCLUSION
195
+
196
+ In this paper, we demonstrate that one essential advantage of SGD is selecting flat minima with an exponentially higher probability than sharp minima. To the best of our knowledge, we are the first to formulate the exponential relation of minima selection to the minima sharpness, the batch size, and the learning rate. Our work bridges the gap between the qualitative knowledge and the quantitative theoretical knowledge on the minima selection mechanism of SGD. We believe the proposed theory not only helps us understand how SGD selects flat minima, but also will provide researchers a powerful theoretical tool to analyze more learning behaviors and design better optimizers in future.
197
+
198
+ # ACKNOWLEDGEMENT
199
+
200
+ We thanks Dr. Yuanqian Tang for helpful discussion. MS was supported by the International Research Center for Neurointelligence (WPI-IRCN) at The University of Tokyo Institutes for Advanced Study.
201
+
202
+ # REFERENCES
203
+
204
+ Alessandro Achille and Stefano Soatto. Where is the information in a deep neural network? arXiv preprint arXiv:1905.12213, 2019.
205
+
206
+ George B Arfken and Hans J Weber. Mathematical methods for physicists, 1999.
207
+
208
+ Devansh Arpit, Stanisław Jastrz˛ebski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, et al. A closer look at memorization in deep networks. In International Conference on Machine Learning, pp. 233–242, 2017.
209
+
210
+ Nils Berglund. Kramers’ law: Validity, derivations and generalisations. Markov Processes and Related Fields, 19(3):459–490, 2013.
211
+
212
+ Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. In 2018 Information Theory and Applications Workshop (ITA), pp. 1–10. IEEE, 2018.
213
+
214
+ 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. In International Conference on Learning Representations, 2017.
215
+
216
+ William Coffey and Yu P Kalmykov. The Langevin equation: with applications to stochastic problems in physics, chemistry and electrical engineering, volume 27. World Scientific, 2012.
217
+
218
+ Claudio De Stefano, Marilena Maniaci, Francesco Fontanella, and A Scotto di Freca. Reliable writer identification in medieval manuscripts through page layout features: The “avila” bible case. Engineering Applications of Artificial Intelligence, 72:99–110, 2018.
219
+
220
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In International Conference on Machine Learning, pp. 1019–1028, 2017.
221
+
222
+ Felix Draxler, Kambis Veschgini, Manfred Salmhofer, and Fred Hamprecht. Essentially no barriers in neural network energy landscape. In International Conference on Machine Learning, pp. 1309–1318, 2018.
223
+
224
+ Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
225
+
226
+ Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017.
227
+
228
+ Henry Eyring. The activated complex in chemical reactions. The Journal of Chemical Physics, 3(2): 107–115, 1935.
229
+
230
+ BV Gnedenko, AN Kolmogorov, BV Gnedenko, and AN Kolmogorov. Limit distributions for sums of independent. Am. J. Math, 105, 1954.
231
+
232
+ Guy Gur-Ari, Daniel A Roberts, and Ethan Dyer. Gradient descent happens in a tiny subspace. arXiv preprint arXiv:1812.04754, 2018.
233
+
234
+ Peter Hanggi. Escape from a metastable state. Journal of Statistical Physics, 42(1-2):105–148, 1986.
235
+
236
+ Peter Hänggi, Peter Talkner, and Michal Borkovec. Reaction-rate theory: fifty years after kramers. Reviews of modern physics, 62(2):251, 1990.
237
+
238
+ Moritz Hardt, Ben Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. In International Conference on Machine Learning, pp. 1225–1234, 2016.
239
+
240
+ Fengxiang He, Tongliang Liu, and Dacheng Tao. Control batch size and learning rate to generalize well: Theoretical and empirical evidence. In Advances in Neural Information Processing Systems, pp. 1141–1150, 2019a.
241
+
242
+ Haowei He, Gao Huang, and Yang Yuan. Asymmetric valleys: Beyond sharp and flat local minima. In Advances in Neural Information Processing Systems 32, pp. 2549–2560. 2019b.
243
+
244
+ 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.
245
+
246
+ Sepp Hochreiter and Jürgen Schmidhuber. Simplifying neural nets by discovering flat minima. In Advances in neural information processing systems, pp. 529–536, 1995.
247
+
248
+ Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
249
+
250
+ Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generalization gap in large batch training of neural networks. In Advances in Neural Information Processing Systems, pp. 1729–1739, 2017.
251
+
252
+ Wenqing Hu, Chris Junchi Li, Lei Li, and Jian-Guo Liu. On the diffusion approximation of nonconvex stochastic gradient descent. Annals of Mathematical Sciences and Applications, 4(1):3–32, 2019.
253
+
254
+ Stanisław Jastrz˛ebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in sgd. arXiv preprint arXiv:1711.04623, 2017.
255
+
256
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In International Conference on Learning Representations, 2017.
257
+
258
+ Robert Kleinberg, Yuanzhi Li, and Yang Yuan. An alternative view: When does sgd escape local minima? In International Conference on Machine Learning, pp. 2703–2712, 2018.
259
+
260
+ Hendrik Anthony Kramers. Brownian motion in a field of force and the diffusion model of chemical reactions. Physica, 7(4):284–304, 1940.
261
+
262
+ Alex Krizhevsky. One weird trick for parallelizing convolutional neural networks. arXiv preprint arXiv:1404.5997, 2014.
263
+
264
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
265
+
266
+ Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
267
+
268
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015.
269
+
270
+ Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In Advances in Neural Information Processing Systems, pp. 6389–6399, 2018.
271
+
272
+ Qianxiao Li, Cheng Tai, et al. Stochastic modified equations and adaptive stochastic gradient algorithms. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2101–2110. JMLR. org, 2017.
273
+
274
+ Seymour Lipschutz, Murray R Spiegel, and Dennis Spellman. Vector analysis and an introduction to tensor analysis. McGraw-Hill, 2009.
275
+
276
+ Stephan Mandt, Matthew D Hoffman, and David M Blei. Stochastic gradient descent as approximate bayesian inference. The Journal of Machine Learning Research, 18(1):4873–4907, 2017.
277
+
278
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pp. 5949–5958, 2017.
279
+
280
+ Thanh Huy Nguyen, Umut Simsekli, Mert Gurbuzbalaban, and Gaël Richard. First exit time analysis of stochastic gradient descent under heavy-tailed gradient noise. In Advances in Neural Information Processing Systems, pp. 273–283, 2019.
281
+
282
+ Abhishek Panigrahi, Raghav Somani, Navin Goyal, and Praneeth Netrapalli. Non-gaussianity of stochastic gradient noise. arXiv preprint arXiv:1910.09626, 2019.
283
+
284
+ Yudi Pawitan. In all likelihood: statistical modelling and inference using likelihood. Oxford University Press, 2001.
285
+
286
+ Maxim Raginsky, Alexander Rakhlin, and Matus Telgarsky. Non-convex learning via stochastic gradient langevin dynamics: a nonasymptotic analysis. In Conference on Learning Theory, pp. 1674–1703, 2017.
287
+
288
+ Levent Sagun, Utku Evci, V Ugur Guney, Yann Dauphin, and Leon Bottou. Empirical analysis of the hessian of over-parametrized neural networks. arXiv preprint arXiv:1706.04454, 2017.
289
+
290
+ Issei Sato and Hiroshi Nakagawa. Approximation analysis of stochastic gradient langevin dynamics by using fokker-planck equation and ito process. In International Conference on Machine Learning, pp. 982–990, 2014.
291
+
292
+ Umut Simsekli, Levent Sagun, and Mert Gurbuzbalaban. A tail-index analysis of stochastic gradient noise in deep neural networks. In International Conference on Machine Learning, pp. 5827–5837, 2019.
293
+
294
+ Samuel L Smith and Quoc V Le. A bayesian perspective on generalization and stochastic gradient descent. In International Conference on Learning Representations, 2018.
295
+
296
+ Samuel L Smith, Pieter-Jan Kindermans, and Quoc V Le. Don’t decay the learning rate, increase the batch size. In International Conference on Learning Representations, 2018.
297
+
298
+ Yusuke Tsuzuku, Issei Sato, and Masashi Sugiyama. Normalized flat minima: Exploring scale invariant definition of flat minima for neural networks using pac-bayesian analysis. arXiv preprint arXiv:1901.04653, 2019.
299
+
300
+ Nicolaas Godfried Van Kampen. Stochastic processes in physics and chemistry, volume 1. Elsevier, 1992.
301
+
302
+ Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 681–688, 2011.
303
+
304
+ Lei Wu, Zhanxing Zhu, et al. Towards understanding generalization of deep learning: Perspective of loss landscapes. arXiv preprint arXiv:1706.10239, 2017.
305
+
306
+ Lei Wu, Chao Ma, and E Weinan. How sgd selects the global minima in over-parameterized learning: A dynamical stability perspective. In Advances in Neural Information Processing Systems, pp. 8279–8288, 2018.
307
+
308
+ Zeke Xie, Fengxiang He, Shaopeng Fu, Issei Sato, Dacheng Tao, and Masashi Sugiyama. Artificial neural variability for deep learning: On overfitting, noise memorization, and catastrophic forgetting. arXiv preprint arXiv:2011.06220, 2020a.
309
+
310
+ Zeke Xie, Issei Sato, and Masashi Sugiyama. Stable weight decay regularization. arXiv preprint arXiv:2011.11152, 2020b.
311
+
312
+ Zeke Xie, Xinrui Wang, Huishuai Zhang, Issei Sato, and Masashi Sugiyama. Adai: Separating the effects of adaptive learning rate and momentum inertia. arXiv preprint arXiv:2006.15815, 2020c.
313
+
314
+ Pan Xu, Jinghui Chen, Difan Zou, and Quanquan Gu. Global convergence of langevin dynamics based algorithms for nonconvex optimization. In Advances in Neural Information Processing Systems, pp. 3122–3133, 2018.
315
+
316
+ Zhewei Yao, Amir Gholami, Qi Lei, Kurt Keutzer, and Michael W Mahoney. Hessian-based analysis of large batch training and robustness to adversaries. In Advances in Neural Information Processing Systems, pp. 4949–4959, 2018.
317
+
318
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Machine Learning, 2017a.
319
+
320
+ Guodong Zhang, Lala Li, Zachary Nado, James Martens, Sushant Sachdeva, George Dahl, Chris Shallue, and Roger B Grosse. Which algorithmic choices matter at which batch sizes? insights from a noisy quadratic model. In Advances in Neural Information Processing Systems, pp. 8196–8207, 2019.
321
+
322
+ Yuchen Zhang, Percy Liang, and Moses Charikar. A hitting time analysis of stochastic gradient langevin dynamics. In Conference on Learning Theory, pp. 1980–2022, 2017b.
323
+
324
+ Huan-Xiang Zhou. Rate theories for biologists. Quarterly reviews of biophysics, 43(2):219–293, 2010.
325
+
326
+ Zhanxing Zhu, Jingfeng Wu, Bing Yu, Lei Wu, and Jinwen Ma. The anisotropic noise in stochastic gradient descent: Its behavior of escaping from sharp minima and regularization effects. In ICML, pp. 7654–7663, 2019.
327
+
328
+ # A PROOFS
329
+
330
+ # A.1 PROOF OF THEOREM 3.1
331
+
332
+ Proof. This proposition is a well known conclusion in statistical physics under Assumption 1, 2 and 3. We still provide an intuitional proof here, and the following proof of SGD Diffusion will closely relate to this proof. We decompose the proof into two steps: 1) compute the probability of locating in valley a, $P ( \theta \in V _ { a } )$ , and 2) compute the probability flux $\begin{array} { r } { j = \int _ { S _ { a } } \bar { \boldsymbol { J } } \cdot d \boldsymbol { S } } \end{array}$ .
333
+
334
+ Without losing generality, we first prove the one-dimensional case.
335
+
336
+ Step 1: Under Assumption 1, the stationary distribution around minimum a is $\begin{array} { r l } { P ( \theta ) } & { { } = } \end{array}$ $\begin{array} { r } { P ( a ) \exp [ - \frac { L ( \theta ) - L ( a ) } { T } ] } \end{array}$ , where $T = D$ . Under Assumption 3, we may only consider the second order Taylor approximation of the density function around critical points. We use the $T$ notation as the temperature parameter in the stationary distribution, and use the $D$ notation as the diffusion coefficient in the dynamics, for their different roles.
337
+
338
+ $$
339
+ \begin{array} { r l } & { \quad P ( \theta \in V _ { a } ) } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( \theta ) d V } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( a ) \exp \left[ - \frac { L ( \theta ) - L ( a ) } { T } \right] d \theta } \\ & { = P ( a ) \displaystyle \int _ { \theta \in V _ { a } } \exp \left[ - \frac { \frac { 1 } { 2 } ( \theta - a ) ^ { \top } H _ { a } ( \theta - a ) + \mathcal { O } ( \Delta \theta ^ { 3 } ) } { T } \right] d \theta } \\ & { = P ( a ) \displaystyle \frac { ( 2 \pi T ) ^ { \frac { 1 } { 2 } } } { H ^ { \frac { 1 } { 2 } } } . } \end{array}
340
+ $$
341
+
342
+ Step 2:
343
+
344
+ $$
345
+ \begin{array} { l } { \displaystyle J = P ( \theta ) \nabla L ( \theta ) + P ( \theta ) \nabla D + D \nabla P ( \theta ) } \\ { \displaystyle J = P ( \theta ) \left( \nabla L ( \theta ) + \nabla D - \displaystyle \frac { D } { T } \nabla L ( \theta ) \right) } \\ { \displaystyle \nabla D = \left( \displaystyle \frac { D } { T } - 1 \right) \nabla L } \end{array}
346
+ $$
347
+
348
+ Apply this result to the Fokker-Planck Equation 4, we have
349
+
350
+ $$
351
+ \begin{array} { r l } & { \nabla \cdot \nabla [ D ( \theta ) P ( \theta , t ) ] } \\ & { = \nabla \cdot D \nabla P ( \theta , t ) + \nabla \cdot \left[ \left( \displaystyle \frac { D } { T } - 1 \right) \nabla L ( \theta ) \right] P ( \theta , t ) } \end{array}
352
+ $$
353
+
354
+ And thus we obtain the Smoluchowski equation and a new form of J
355
+
356
+ $$
357
+ \begin{array} { r l r } & { } & { \displaystyle { \frac { \partial P ( \theta , t ) } { \partial t } = \nabla \cdot \left[ D \left( \frac { 1 } { T } \nabla L ( \theta ) + \nabla \right) P ( \theta , t ) \right] = - \nabla \cdot J ( \theta , t ) , } } \\ & { } & { \displaystyle { J ( \theta ) = D \exp \left( \frac { - L ( \theta ) } { T } \right) \nabla \left[ \exp \left( \frac { L ( \theta ) } { T } \right) P ( \theta ) \right] . } } \end{array}
358
+ $$
359
+
360
+ We note that the probability density outside Valley a must be zero, $P ( c ) = 0$ . As we want to compute the probability flux escaping from Valley a in the proof, the probability flux escaping from other valleys into Valley a should be ignored. Under Assumption 2, we integrate the equation from Valley a to the outside of Valley a along the most possible escape path
361
+
362
+ $$
363
+ \begin{array} { r } { \displaystyle \int _ { a } ^ { c } \frac { \partial } { \partial \theta } \left[ \exp \left( \frac { L ( \theta ) } { T } \right) P ( \theta ) \right] d \theta = \int _ { a } ^ { c } - \frac { J } { D } \exp \left( \frac { L ( \theta ) } { T } \right) d \theta } \\ { \displaystyle \exp \left( \frac { L ( \theta ) } { T } \right) P ( \theta ) | _ { a } ^ { c } = - \frac { J } { D } \int _ { a } ^ { c } \exp \left( \frac { L ( \theta ) } { T } \right) d \theta } \\ { \displaystyle 0 - \exp \left( \frac { L ( a ) } { T } \right) P ( a ) = - \frac { J } { D } \int _ { a } ^ { c } \exp \left( \frac { L ( \theta ) } { T } \right) d \theta } \\ { \displaystyle J = \frac { D \exp \left( \frac { L ( a ) } { T } \right) P ( a ) } { \int _ { a } ^ { c } \exp \left( \frac { L ( \theta ) } { T } \right) d \theta } . } \end{array}
364
+ $$
365
+
366
+ We move $J$ to the outside of integral based on Gauss’s Divergence Theorem, because $J$ is fixed on the escape path from one minimum to another. As there is no field source on the escape path, $\begin{array} { r } { \int _ { V } \nabla \cdot \boldsymbol { J } ( \boldsymbol { \theta } ) d \boldsymbol { \dot { V } } = \boldsymbol { 0 } } \end{array}$ . Then $\nabla J ( \theta ) = 0$ . Obviously, only minima are probability sources in deep learning. Under Assumption 3 and the second-order Taylor approximation, we have
367
+
368
+ $$
369
+ \begin{array} { r l } & { \quad \displaystyle \int _ { a } ^ { c } \exp \left( \frac { L ( \theta ) } { T } \right) d \theta } \\ & { = \displaystyle \int _ { a } ^ { c } \exp \left[ \frac { L ( b ) + \frac { 1 } { 2 } ( \theta - b ) ^ { \top } H _ { b } ( \theta - b ) + \mathcal { O } ( \Delta \theta ^ { 3 } ) } { T } \right] d \theta } \\ & { \approx \exp \left( \frac { L ( b ) } { T } \right) \displaystyle \int _ { - \infty } ^ { + \infty } \exp \left[ \frac { \frac { 1 } { 2 } ( \theta - b ) ^ { \top } H _ { b } ( \theta - b ) } { T } \right] d \theta } \\ & { = \exp \left( \frac { L ( b ) } { T } \right) \sqrt { \frac { 2 \pi T } { | H _ { b } | } } . } \end{array}
370
+ $$
371
+
372
+ Based on the results of Step 1 and Step 2, we obtain
373
+
374
+ $$
375
+ \begin{array} { r l } & { \gamma = \frac { \displaystyle \int _ { S _ { a } } J \cdot d S } { \displaystyle P ( \theta \in V _ { a } ) } = \frac { J } { P \left( \theta \in V _ { a } \right) } } \\ & { \quad = \frac { \displaystyle P P \left( a \right) \exp \left( \frac { L ( a ) } { T } \right) } { \displaystyle \exp \left( \frac { L ( b ) } { T } \right) \sqrt { \frac { 2 \pi T } { | R _ { b } | } } } \frac { 1 } { P \left( a \right) \sqrt { \frac { 2 \pi T } { H _ { a } } } } } \\ & { \quad = \frac { \displaystyle \frac { D \sqrt { H _ { a } } \| H _ { b } \| } { 2 \pi T } } { \displaystyle 2 \pi T } \exp \left( - \frac { \Delta L _ { a b } } { T } \right) } \\ & { \quad = \frac { \displaystyle \sqrt { H _ { a } } | H _ { b } | } { \displaystyle 2 \pi } \exp \left( - \frac { \Delta L _ { a b } } { D } \right) } \end{array}
376
+ $$
377
+
378
+ We generalize the proof of one-dimensional diffusion to high-dimensional diffusion
379
+
380
+ Step 1:
381
+
382
+ $$
383
+ \begin{array} { r l } & { \quad P ( \theta \in V _ { a } ) } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( \theta ) d V } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( a ) \exp \left[ - \frac { L ( \theta ) - L ( a ) } { T } \right] d V } \\ & { = P ( a ) \displaystyle \int _ { \theta \in V _ { a } } \exp \left[ - \frac { \frac { 1 } { 2 } ( \theta - a ) ^ { \top } H _ { a } ( \theta - a ) + \mathcal { O } ( \Delta \theta ^ { 3 } ) } { T } \right] d V } \\ & { = P ( a ) \displaystyle \frac { ( 2 \pi T ) ^ { \frac { n } { 2 } } } { \mathrm { d e t } ( H _ { a } ) ^ { \frac { 1 } { 2 } } } } \end{array}
384
+ $$
385
+
386
+ Step 2: Based on the formula of the one-dimensional probability current and flux, we obtain
387
+
388
+ So we have
389
+
390
+ $$
391
+ \begin{array} { r l } & { \quad \displaystyle \int _ { S _ { b } } J \cdot d S } \\ & { = \displaystyle J _ { b } \int _ { S _ { b } } \exp \left[ - \frac { \frac { 1 } { 2 } ( \theta - b ) ^ { \top } H _ { b } ^ { + } ( \theta - b ) } { T } \right] d S } \\ & { = \displaystyle J _ { b } \frac { ( 2 \pi T ) ^ { \frac { n - 1 } { 2 } } } { ( \prod _ { i = 1 } ^ { n - 1 } H _ { b i } ) ^ { \frac { 1 } { 2 } } } } \end{array}
392
+ $$
393
+
394
+ $$
395
+ \begin{array} { c } { { \tau = 2 \pi \sqrt { \displaystyle \frac { \prod _ { i = 1 } ^ { n - 1 } H _ { b i } } { \operatorname * { d e t } ( H _ { a } ) | H _ { b e } | } } \exp \left( \displaystyle \frac { \Delta L } { T } \right) } } \\ { { = 2 \pi \sqrt { \displaystyle \frac { - \operatorname * { d e t } ( H _ { b } ) } { \operatorname * { d e t } ( H _ { a } ) } } \displaystyle \frac { 1 } { | H _ { b e } | } \exp \left( \displaystyle \frac { \Delta L } { D } \right) . } } \end{array}
396
+ $$
397
+
398
+ # A.2 PROOF OF THEOREM 3.2
399
+
400
+ Proof. We decompose the proof into two steps and analyze the one-dimensional case like before. The following proof is similar to the proof of SGLD except that we make $T _ { a }$ the temperature near the minimum a and $T _ { b }$ the temperature near the saddle point b.
401
+
402
+ One-dimensional SGD Diffusion:
403
+
404
+ Step 1: Under Assumption 3, we may only consider the second order Taylor approximation of the density function around critical points.
405
+
406
+ $$
407
+ \begin{array} { r l } & { \quad P ( \theta \in V _ { a } ) } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( \theta ) d V } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( a ) \exp \left[ - \frac { L ( \theta ) - L ( a ) } { T _ { a } } \right] d V } \\ & { = P ( a ) \displaystyle \int _ { \theta \in V _ { a } } \exp \left[ - \frac { \frac { 1 } { 2 } ( \theta - a ) ^ { \top } H _ { a } ( \theta - a ) + \mathcal { O } ( \Delta \theta ^ { 3 } ) } { T _ { a } } \right] d \theta } \\ & { = P ( a ) \displaystyle \frac { ( 2 \pi T _ { a } ) ^ { \frac { 1 } { 2 } } } { H ^ { \frac { 1 } { 2 } } } } \end{array}
408
+ $$
409
+
410
+ Step 2:
411
+
412
+ $$
413
+ \begin{array} { l } { \displaystyle J = P ( \boldsymbol { \theta } ) \nabla L ( \boldsymbol { \theta } ) + P ( \boldsymbol { \theta } ) \nabla D + D \nabla P ( \boldsymbol { \theta } ) } \\ { \displaystyle J = P ( \boldsymbol { \theta } ) \left[ \nabla L ( \boldsymbol { \theta } ) + \nabla D - \frac { D } { T } \nabla L ( \boldsymbol { \theta } ) - D L ( \boldsymbol { \theta } ) \nabla \left( \frac { 1 } { T } \right) \right] } \end{array}
414
+ $$
415
+
416
+ According to Equation 7, $\nabla \left( { \frac { 1 } { T } } \right)$ is ignorable near the minimum a and the col $\mathbf { b }$ , thus
417
+
418
+ $$
419
+ \nabla D = \left( \frac { D } { T } - 1 \right) \nabla L .
420
+ $$
421
+
422
+ Apply this result to the Fokker-Planck Equation 4, we have
423
+
424
+ $$
425
+ \begin{array} { r l } & { \nabla \cdot \nabla [ D ( \theta ) P ( \theta , t ) ] } \\ & { = \nabla \cdot D \nabla P ( \theta , t ) + \nabla \cdot \left[ \left( \displaystyle \frac { D } { T } - 1 \right) \nabla L ( \theta ) \right] P ( \theta , t ) } \end{array}
426
+ $$
427
+
428
+ And thus we obtain the Smoluchowski equation and a new form of J
429
+
430
+ $$
431
+ \begin{array} { r } { \frac { \partial P ( \theta , t ) } { \partial t } = \nabla \cdot \left[ D \left( \frac { 1 } { T } \nabla L ( \theta ) + \nabla \right) P ( \theta , t ) \right] = - \nabla \cdot J , } \\ { J = D \exp \left( \frac { - L ( \theta ) } { T } \right) \nabla \left[ \exp \left( \frac { L ( \theta ) } { T } \right) P ( \theta ) \right] . } \end{array}
432
+ $$
433
+
434
+ We note that the Smoluchowski equation is true only near critical points. We assume the point s is the midpoint on the most possible path between a and $\mathbf { b }$ , where $L ( \bar { s } ) = ( 1 - s ) L ( a ) + s \bar { L } ( b )$ . The temperature $T _ { a }$ dominates the path $a s$ , while temperature $T _ { b }$ dominates the path $s \to b$ . So we have
435
+
436
+ $$
437
+ \nabla \left[ \exp \left( \frac { L ( \theta ) - L ( s ) } { T } \right) P ( \theta ) \right] = J D ^ { - 1 } \exp \left( \frac { L ( \theta ) - L ( s ) } { T } \right) .
438
+ $$
439
+
440
+ Under Assumption 2, we integrate the equation from Valley a to the outside of Valley a along the most possible escape path
441
+
442
+ $$
443
+ \begin{array} { l } { { L e f t = \int _ { a } ^ { c } \frac { \partial } { \partial \theta } [ \exp \left( \displaystyle \frac { L ( \theta ) - L ( s ) } { T } \right) P ( \theta ) ] d \theta } } \\ { { \ = \int _ { a } ^ { s } \frac { \partial } { \partial \theta } \left[ \exp \left( \displaystyle \frac { L ( \theta ) - L ( s ) } { T _ { a } } \right) P ( \theta ) \right] d \theta } } \\ { { \ ~ + \int _ { s } ^ { c } \frac { \partial } { \partial \theta } \left[ \exp \left( \displaystyle \frac { L ( \theta ) - L ( s ) } { T _ { b } } \right) P ( \theta ) \right] d \theta } } \\ { { \ = [ P ( s ) - \exp \left( \displaystyle \frac { L ( a ) - L ( s ) } { T _ { a } } \right) P ( a ) ] + [ 0 - P ( s ) ] } } \\ { { \ ~ } } \\ { { \ = - \exp \left( \displaystyle \frac { L ( a ) - L ( s ) } { T _ { a } } \right) P ( a ) } } \end{array}
444
+ $$
445
+
446
+ $$
447
+ R i g h t = - \ J \int _ { a } ^ { c } D ^ { - 1 } \exp \left( \frac { L ( \theta ) - L ( s ) } { T } \right) d \theta
448
+ $$
449
+
450
+ We move $J$ to the outside of integral based on Gauss’s Divergence Theorem, because $J$ is fixed on the escape path from one minimum to another. As there is no field source on the escape path, $\begin{array} { r } { \int _ { V } \nabla \cdot \boldsymbol { J } ( \boldsymbol { \theta } ) \dot { d V } = 0 } \end{array}$ and $\nabla J ( \theta ) = 0$ . Obviously, only minima are probability sources in deep learning. So we obtain
451
+
452
+ $$
453
+ J = \frac { \exp \left( \frac { L ( a ) - L ( s ) } { T _ { a } } \right) P ( a ) } { \int _ { a } ^ { c } D ^ { - 1 } \exp \left( \frac { L ( \theta ) - L ( s ) } { T } \right) d \theta } .
454
+ $$
455
+
456
+ Under Assumption 3, we have
457
+
458
+ $$
459
+ \begin{array} { r l } & { \quad \displaystyle \int _ { a } ^ { c } D ^ { - 1 } \exp \left( \frac { L ( \theta ) - L ( s ) } { T } \right) d \theta } \\ & { \approx \displaystyle \int _ { a } ^ { c } D ^ { - 1 } \exp \left[ \frac { L ( b ) - L ( s ) + \frac { 1 } { 2 } ( \theta - b ) ^ { \top } H _ { b } ( \theta - b ) } { T b } \right] d \theta } \\ & { \approx D _ { b } ^ { - 1 } \displaystyle \int _ { - \infty } ^ { + \infty } \exp \left[ \frac { L ( b ) - L ( s ) + \frac { 1 } { 2 } ( \theta - b ) ^ { \top } H _ { b } ( \theta - b ) } { T b } \right] d \theta } \\ & { = D _ { b } ^ { - 1 } \exp \left( \frac { L ( b ) - L ( s ) } { T _ { b } } \right) \sqrt { \frac { 2 \pi T _ { b } } { | H _ { b } | } } . } \end{array}
460
+ $$
461
+
462
+ Based on the results of Step 1 and Step 2, we have
463
+
464
+ $$
465
+ \begin{array} { r l } & { \gamma = \frac { \displaystyle \int _ { S _ { a } } J \cdot d S } { \displaystyle P ( \theta \in V _ { a } ) } = \frac { J } { \displaystyle P ( \theta \in V _ { a } ) } } \\ & { \quad = \frac { \displaystyle P ( a ) \exp \Big ( \frac { L ( a ) - L ( s ) } { T _ { a } } \Big ) } { \displaystyle D _ { b } ^ { - 1 } \exp \Big ( \frac { L ( b ) - L ( s ) } { T _ { b } } \Big ) \sqrt { \frac { 2 \pi T _ { b } } { | t _ { b } | } } P ( a ) \sqrt { \frac { 2 \pi T _ { a } } { H _ { a } } } } } \\ & { \quad = \frac { \displaystyle \sqrt { T _ { b } H _ { a } } \big | H _ { b } \big | } { \displaystyle 2 \pi \sqrt { T _ { a } } } \exp \left( - \frac { L ( s ) - L ( a ) } { T _ { a } } - \frac { L ( b ) - L ( s ) } { T _ { b } } \right) } \\ & { \quad = \frac { \displaystyle \sqrt { T _ { b } H _ { a } } \big | H _ { b } \big | } { \displaystyle 2 \pi \sqrt { T _ { a } } } \exp \left( - \frac { s \Delta L } { T _ { a } } - \frac { ( 1 - s ) \Delta L } { T _ { b } } \right) } \end{array}
466
+ $$
467
+
468
+ So we have
469
+
470
+ $$
471
+ \tau = \frac { 1 } { \gamma } = 2 \pi \sqrt { \frac { T _ { a } } { T _ { b } H _ { a } | H _ { b } | } } \exp \left( { \frac { s \Delta L } { T _ { a } } + \frac { ( 1 - s ) \Delta L } { T _ { b } } } \right) .
472
+ $$
473
+
474
+ In the case of pure SGN, $\begin{array} { r } { T _ { a } = \frac { \eta } { 2 B } H _ { a } } \end{array}$ and $\begin{array} { r } { T _ { b } = - \frac { \eta } { 2 B } H _ { b } } \end{array}$ gives
475
+
476
+ $$
477
+ \tau = \frac { 1 } { \gamma } = 2 \pi \frac { 1 } { | H _ { b } | } \exp \left[ \frac { 2 B \Delta L } { \eta } ( \frac { s } { H _ { a } } + \frac { ( 1 - s ) } { | H _ { b } | } ) \right] .
478
+ $$
479
+
480
+ We generalize the proof above into the high-dimensional SGD diffusion.
481
+
482
+ Step 1:
483
+
484
+ $$
485
+ \begin{array} { r l } & { \quad P ( \theta \in V _ { a } ) } \\ & { = \displaystyle \int _ { \theta \in V _ { a } } P ( \theta ) d V } \\ & { = P ( a ) \int _ { \theta \in V _ { a } } \exp \left[ - \frac { 1 } { 2 } ( \theta - a ) ^ { \top } ( D _ { a } ^ { - \frac { 1 } { 2 } } H _ { a } D _ { a } ^ { - \frac { 1 } { 2 } } ) ( \theta - a ) \right] d V } \\ & { = P ( a ) \frac { ( 2 \pi ) ^ { \frac { n } { 2 } } } { \operatorname* { d e t } ( D _ { a } ^ { - 1 } H _ { a } ) ^ { \frac { 1 } { 2 } } } } \end{array}
486
+ $$
487
+
488
+ Step 2: Based on the formula of the one-dimensional probability current and flux, we obtain the high-dimensional flux escaping through Col b:
489
+
490
+ $$
491
+ \begin{array} { r l } & { \quad \displaystyle \int _ { S _ { b } } J \cdot d S } \\ & { = J _ { 1 d } \int _ { S _ { b } } \exp \left[ - \frac { 1 } { 2 } ( \theta - b ) ^ { \top } [ D _ { b } ^ { - \frac { 1 } { 2 } } H _ { b } D _ { b } ^ { - \frac { 1 } { 2 } } ] ^ { \perp e } ( \theta - b ) \right] d S } \\ & { = J _ { 1 d } \frac { ( 2 \pi ) ^ { \frac { n - 1 } { 2 } } } { ( \prod _ { i \neq e } ( D _ { b i } ^ { - 1 } H _ { b i } ) ) ^ { \frac { 1 } { 2 } } } , } \end{array}
492
+ $$
493
+
494
+ where $[ \cdot ] ^ { \perp e }$ indicates the directions perpendicular to the escape direction $e$ . So we have
495
+
496
+ $$
497
+ \gamma = { \frac { 1 } { 2 \pi } } { \sqrt { \frac { \operatorname* { d e t } ( H _ { a } D _ { a } ^ { - 1 } ) } { - \operatorname* { d e t } ( H _ { b } D _ { b } ^ { - 1 } ) } } } | H _ { b e } | \exp \left( - { \frac { s \Delta L } { T _ { a } } } - { \frac { ( 1 - s ) \Delta L } { T _ { b } } } \right)
498
+ $$
499
+
500
+ $T _ { a }$ and $T _ { b }$ are the eigenvalues of $H _ { a } ^ { - 1 } D _ { a }$ and $H _ { b } ^ { - 1 } D _ { b }$ corresponding to the escape direction. We know $\begin{array} { r } { D _ { a } \ = \ \frac { \eta } { 2 B } \mathbf { \bar { { H } } } _ { a } } \end{array}$ and $\begin{array} { r } { D _ { b } ~ = ~ \frac { \eta } { 2 B } [ H _ { b } ] ^ { + } } \end{array}$ . As $D$ must be positive semidefinite, we replace $H _ { b } \ = \ U _ { b } ^ { \top } d i a g ( H _ { b 1 } , \cdot \cdot \cdot , H _ { b ( n - 1 ) } , H _ { b e } ) U _ { b }$ by its positive semidefinite analog $[ H _ { b } ] ^ { + } =$ $U _ { b } ^ { \top } d i a g ( H _ { b 1 } , \cdot \cdot \cdot , H _ { b ( n - 1 ) } , | H _ { b e } | ) U _ { b }$ . Thus, we have
501
+
502
+ $$
503
+ \tau = \frac { 1 } { \gamma } = 2 \pi \frac { 1 } { \left| H _ { b e } \right| } \exp \left[ \frac { 2 B \Delta L } { \eta } \left( \frac { s } { H _ { a e } } + \frac { \left( 1 - s \right) } { \left| H _ { b e } \right| } \right) \right] .
504
+ $$
505
+
506
+ # A.3 PROOF OF PROPOSITION 1
507
+
508
+ Proof. A stationary distribution must have a balanced probability flux between valleys. So the probability flux of each valley must be equivalent,
509
+
510
+ $$
511
+ P ( \theta \in V _ { 1 } ) \gamma _ { 1 2 } = P ( \theta \in V _ { 2 } ) \gamma _ { 2 1 }
512
+ $$
513
+
514
+ As $\tau = \gamma ^ { - 1 }$ , it leads to $P ( \theta \in V _ { v } ) \propto \tau _ { v }$ . We normalize the total probability to 1, then we obtain the result. □
515
+
516
+ # B ASSUMPTIONS
517
+
518
+ Assumption 2 indicates that the dynamical system is in equilibrium near minima but not necessarily near saddle points. It means that $\begin{array} { r } { \frac { \partial P ( \theta , t ) } { \partial t } = - \nabla \cdot J ( \theta , t ) \approx 0 } \end{array}$ holds near minima $a _ { 1 }$ and $a _ { 2 }$ , but not necessarily holds near saddle point $b$ . Quasi-Equilibrium Assumption is actually weaker but more useful than the conventional stationary assumption for deep learning (Welling & Teh, 2011; Mandt et al., 2017). Under Assumption 2, the probability density $P$ can behave like a stationary distribution only inside valleys, but density transportation through saddle points can be busy. Quasi-Equilibrium is more like: stable lakes (loss valleys) is connected by rapid Rivers (escape paths). In contrast, the stationary assumption requires strictly zero flux between lakes (loss valleys). Little knowledge about density motion can be obtained under the stationary assumption.
519
+
520
+ Low Temperature Assumption is common (Van Kampen, 1992; Zhou, 2010; Berglund, 2013; Jastrz˛ebski et al., 2017), and is always justified when $\frac { \eta } { B }$ is small. Under Assumption 3, the probability densities will concentrate around minima and MPPs. Numerically, the 6-sigma rule may often provide good approximation for a Gaussian distribution. Assumption 3 will make the second order Taylor approximation, Assumption 1, even more reasonable in SGD diffusion.
521
+
522
+ Here, we try to provide a more intuitive explanation about Low Temperature Assumption in the domain of deep learning. Without loss of generality, we discuss it in one-dimensional dynamics. The temperature can be interpreted as a real number $D$ . In SGD, we have the temperature as $\begin{array} { r } { D = \frac { \eta } { 2 B } H } \end{array}$ In statistical physics, if $\scriptstyle { \frac { \Delta L } { D } }$ is large, then we call it Low Temperature Approximation. Note that $\scriptstyle { \frac { \Delta L } { D } }$ appears insides an exponential function in the theoretical analysis. People usually believe that, numerically, $\begin{array} { r } { \frac { \Delta L } { D } > 6 } \end{array}$ can make a good approximation, for a similar reason of the 6-sigma rule in statistics. In the final training phase of deep networks, a common setting is $\eta = 0 . 0 1$ and $B = 1 2 8$ . $\textstyle { \frac { \Delta L } { H } } > 2 . 3 \times \mathbf { \dot { 1 } } 0 ^ { - 4 }$ ly apply Assumption 3 to th. Empirically, the condition $\begin{array} { r } { \frac { \Delta L } { H } > 2 . 3 \times 1 0 ^ { - 4 } } \end{array}$ h satisfy the very mild conditionholds well in SGD dynamics. It also suggests that, we can adjust the learning rate to let SGD search among loss valleys with certain barrier heights.
523
+
524
+ # C THE STOCHASTIC GRADIENT NOISE ANALYSIS
525
+
526
+ Figure 7 demonstrates that the SGN is also approximately Gaussian on a randomly initialized ResNet with $B = 5 0$ on CIFAR-10. We also note that the SGN on ResNet seems less Gaussian than SGN on
527
+
528
+ ![](images/6304cb3730f61ed48a4694c4774da457ddc5e526dfda5ae7dfe6a42b50aee709.jpg)
529
+ Figure 7: The Gradient Noise Analysis. The histogram of the norm of the gradient noises computed with ResNet18 (He et al., 2016) on CIFAR-10 (Krizhevsky et al., 2009).
530
+
531
+ ![](images/c79c12433ca079002710133471885496c0dcf563a1d82028bab379f639344eb0.jpg)
532
+ Figure 8: The plot of the SGN covariance and the Hessian by training fully-connected network on MNIST. We display all elements $H _ { ( i , j ) } \in [ - 0 . 0 3 , 0 . 0 3 ]$ of the Hessian matrix and the corresponding elements in gradient noise covariance matrix in the original coordinates.
533
+
534
+ ![](images/8d5acc2b749c95f09c4f662adbdfc17fc43a0921f1406e52bdae5c7bae9ae0f4.jpg)
535
+ Figure 9: The plot of the SGN covariance and the Hessian by training fully-connected network on Avila. We display all elements $H _ { ( i , j ) } \in [ 1 e - 4 , 0 . 5 ]$ of the Hessian matrix and the corresponding elements in gradient noise covariance matrix in the space spanned by the eigenvectors of Hessians.
536
+
537
+ fully-connected networks with the same batch size. Panigrahi et al. (2019) presented more results on the Gaussianity of SGN under various conditions.
538
+
539
+ By Figure 8, we validate $\begin{array} { r } { C = \frac { H } { B } } \end{array}$ in the original coordinates on MNIST. By Figure 9, we also validate $\begin{array} { r } { C = \frac { H } { B } } \end{array}$ on another dataset, Avila, in the space spanned by the eigenvectors of Hessian. The relationcan still be observed in these two cases. $\begin{array} { r } { C = \frac { H } { B } } \end{array}$
540
+
541
+ Data Precessing: We perform the usual per-pixel zero-mean and unit-variance normalization on MNIST. We leave the preprocessing of Avila in D. Model: Fully-connected networks.
542
+
543
+ # D MAIN EXPERIMENTS
544
+
545
+ Figure 10, 11, and 12 respectively validate that the exponential relation of the escape rate with the Hessian, the batch size and the learning rate.
546
+
547
+ # D.1 EXPERIMENTAL SETTINGS
548
+
549
+ Datasets: a) Avila, b) Banknote Authentication, c) Cardiotocography, d) Dataset for Sensorless Drive Diagnosis.
550
+
551
+ Data Precessing: We perform per-pixel zero-mean and unit-variance normalization on input data. For simplicity, we also transform multi-class problems into binary-class problems by grouping labels, although this is unnecessary.
552
+
553
+ Model: Two-layer fully-connected networks with one hidden layer and 10 neurons per hidden layer.
554
+
555
+ Initializations: To ensure the initialized models are near minima, we first pretrain models with 200-1000 epochs to fit each data set as well as possible. We set the pretrained models’ parameters as the initialized $\theta _ { t = 0 }$ .
556
+
557
+ Valleys’ Boundary: In principle, any small neighborhood around $\theta _ { t = 0 }$ can be regarded as the inside of the start valleys. In our experiments, we set each dimension’s distance from $\theta _ { t = 0 }$ should be less than 0.05, namely $| \Delta \theta _ { i } | \le 0 . 0 5$ for each dimension $i$ . If we rescale the landscape by a factor $k$ , the neighborhood will also be rescaled by $k$ . Although we don’t know which loss valleys exist inside the neighborhood, we know the landscape of the neighborhood is invariant in each simulation.
558
+
559
+ Hyperparameters: In Figure 10: (a) $\eta = 0 . 0 0 1 , B = 1$ , (b) $\eta = 0 . 0 1 5 , B = 1 .$ , (c) $\eta = 0 . 0 0 5 , B =$ 1, (d) $\eta = 0 . 0 0 0 5 , B = 1$ . In Figure 11: (a) $\eta = 0 . 0 2$ , (b) $\eta = 0 . 6$ , (c) $\eta = 0 . 1 8$ , (d) $\eta = 0 . 0 1$ . In Figure 12: (a) $B = 1$ , (b) $B = 1$ , (c) $B = 1$ , (d) $B = 1$ . In Figure 13: (a) $\eta = 0 . 0 0 0 2 , B = 1 0 0$ , (b) $\eta = 0 . 0 0 1 , B = 1 0 0$ , (c) $\eta = 0 . 0 0 0 2 , B = 1 0 0$ , (d) $\eta = 0 . 0 0 0 1 , B = 1 0 0$ . In Figure 14: (a) $\eta = 0 . 0 0 0 2$ , $B = 1 0 0 , D = 0 . 0 0 0 2$ , (b) $\eta = 0 . 0 0 1 , B = 1 0 0 , D = 0 . 0 0 0 1$ , (c) $\eta = 0 . 0 0 0 2 , B =$ $1 0 0 , D = 0 . 0 0 0 5$ , (d) $\eta = 0 . 0 0 0 1 , B = 1 0 0 , D = 0 . 0 0 0 3$ . We note that the hyperparameters need be tuned for each initialized pretrained models, due to the stochastic property of deep learning.
560
+
561
+ ![](images/e611bd5ee1c1627c6eebbe465cd800ad1aa2a077166549a38354ad6ff51c8c74.jpg)
562
+ Figure 10: The escape rate exponentially depends on the “path Hessians” in the dynamics of SGD. $- \log ( \gamma )$ is linear with $\textstyle { \frac { 1 } { k } }$ . The “path Hessians” indicates the eigenvalues of Hessians corresponding to the escape directions.
563
+
564
+ ![](images/cc24938c36d0e50a1712f00debfae83e0ef961a9118b02da5c6b68dace8eb7b0.jpg)
565
+ Figure 11: The escape rate exponentially depends on the batch size in the dynamics of SGD. $- \log ( \gamma )$ is linear with $B$ .
566
+
567
+ ![](images/95d8cee65da16f84618d2949f3e4ec958b0cee119bbb90092d89784746e231aa.jpg)
568
+ Figure 12: The escape rate exponentially depends on the learning rate in the dynamics of SGD. $- \log ( \gamma )$ is linear with $\frac { 1 } { \eta }$ . The estimated escape rate has incorporated $\eta$ as the time unit.
569
+
570
+ ![](images/32b28be96d16487646694dc86dedef57fef4d0cb3660ae3df14106d0d9ee0727.jpg)
571
+ Figure 13: The relation of the escape rate and the isotropic diffusion coefficient D. The escape formula that − $\log ( \gamma )$ is linear with $\dot { \frac { 1 } { D } }$ is validated.
572
+
573
+ According to our experience, we can always find the hyperparameters to discover the quantitative relations as long as the pretrained model fits the data set well enough. The fined-tuned requirement can be avoided in Section E, because the models in Section E are artificially initialized.
574
+
575
+ Observation: we observe the number of iterations from the initialized position to the terminated position. We repeat experiments 100 times to estimate the escape rate $\gamma$ and the mean escape time $\tau$ . As the escape time is a random variable obeying an exponential distribution, $t \sim E x p o n e n t i a l ( \gamma )$ , the estimated escape rate can be written as
576
+
577
+ $$
578
+ \hat { \gamma } = \frac { 1 0 0 - 2 } { \sum _ { i = 1 } ^ { 1 0 0 } t _ { i } } .
579
+ $$
580
+
581
+ The $9 5 \%$ confidence interval of this estimator is
582
+
583
+ $$
584
+ \hat { \gamma } ( 1 - \frac { 1 . 9 6 } { \sqrt { 1 0 0 } } ) \leq \hat { \gamma } \leq \hat { \gamma } ( 1 + \frac { 1 . 9 6 } { \sqrt { 1 0 0 } } ) .
585
+ $$
586
+
587
+ # D.2 EXPERIMENTS ON SGLD
588
+
589
+ Experimental Results: Figure 13 shows a highly precise exponential relation of the escape rate and the diffusion coefficient in the figure. Figure 14 shows a proportional relation of the escape rate and the Hessian determinant in the figure. Overall, the empirical results support the density diffusion theory in the dynamics of white noise. In experiments on SGLD, we carefully adjust the injected gradient noise scale in experiment to ensure that $D$ is significantly smaller than the loss barrier’ height and large enough to dominate SGN scale. If $D$ is too large, learning dynamics will be reduced to Free Brownian Motion.
590
+
591
+ ![](images/83ef704670a42a8d7638e9a3a2075a495a934d06c96343b2f88bb6398afe7b0c.jpg)
592
+ Figure 14: The relation of the escape rate and the Hessian determinant in the dynamics of white noise.The escape formula that $\gamma$ is linear with $k$ is validated.
593
+
594
+ # E EXPERIMENTS ON MORE MODELS
595
+
596
+ We supply experiments of training three models on artificial Gaussian datasets. In these experiments, we can analytically know the locations of the minima, Hessians and loss barriers, as each input feature is Gaussian noise.
597
+
598
+ # E.1 EXPERIMENTS SETTINGS
599
+
600
+ Data Set: We generate 50000 Gaussian samples and random two-class labels as the training data set, $\{ ( x ^ { ( i ) } , y ^ { ( i ) } ) | x ^ { ( \bar { i } ) } \sim \mathcal { N } ( 0 , I ) , y ^ { ( i ) } \in \{ 0 , 1 \} , i \stackrel { \cdot } { \in } \{ 1 , 2 , \cdot \cdot , 5 0 0 0 0 \} \}$
601
+
602
+ Hyperparameters: In Figure 15: (a) $\eta = 0 . 0 0 0 1 , B = 1 0 0$ , (b) $\eta = 0 . 0 0 1 , B = 1 0 0$ , (c) $\eta =$ 0.0003, $B = 1 0 0$ . In Figure 16: (a) $\eta = 0 . 0 0 0 1 , B = 5 0 , D = 0 . 2$ , (b) $\eta = 0 . 0 0 1 , B = 5 0 , D =$ 0.0005, (c) $\eta = 0 . 0 0 0 3 , B = 1 , D = 0 . 0 0 0 3$ . In Figure 17: (a) $\eta = 0 . 0 0 6 , B = 5 0$ , (b) $\eta =$ 0.05, $, B = 5 0$ , (c) $\eta = 0 . 0 0 5 , B = 1$ . In Figure 18: (a) $\eta = 0 . 0 0 6$ , (b) $\eta = 0 . 0 6$ , (c) $\eta = 0 . 1$ . In Figure 19: (a) $B = 1$ , (b) $B = 1$ , (c) $B = 1$ . We note that the hyperparameters are recommended and needn’t be fine tuned again. The artificially initialized parameters avoids the stochastic property of the initial states.
603
+
604
+ Experiment Setting 1: Styblinski-Tang Function is a commonly used function in nonconvex optimization, written as
605
+
606
+ $$
607
+ f ( \theta ) = \frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } ( \theta _ { i } ^ { 4 } - 1 6 \theta _ { i } ^ { 2 } + 5 \theta _ { i } ) .
608
+ $$
609
+
610
+ We use high-dimensional Styblinski-Tang Function as the test function, and Gaussian samples as training data.
611
+
612
+ $$
613
+ L ( \theta ) = f ( \theta - x ) ,
614
+ $$
615
+
616
+ where data samples $x \sim \mathcal { N } ( 0 , I )$ . The one-dimensional Styblinski-Tang Function has one global minimum located at $a = - 2 . 9 0 3 5 3 4$ , one local minimum located at $d$ , and one saddle point $b =$ 0.156731 as the boundary separating Valley $a _ { 1 }$ and Valley $a _ { 2 }$ . For a $\mathbf { n }$ -dimensional Styblinski-Tang Function, we initialize parameters $\theta _ { t = 0 } = \textstyle { \frac { 1 } { \sqrt { k } } } ( - 2 . 9 0 3 5 3 4 , \cdot \cdot \cdot , - 2 . 9 0 3 5 3 4 )$ , and set the valley’s boundary as $\begin{array} { r } { \theta _ { i } < \frac { 1 } { \sqrt { k } } 0 . 1 5 6 7 3 1 } \end{array}$ , where $i$ is the dimension index. We record the number of iterations required to escape from the valley to the outside of valley. The setting 1 does not need labels.
617
+
618
+ Experiment Setting 2: We study the learning dynamics of Logistic Regression. Parameters Initialization: $\theta _ { t = 0 } = ( 0 , \cdot \cdot \cdot , 0 )$ . Valley Boundary: $- 0 . 1 < \theta _ { i } < 0 . 1$ . Due to the randomness of training data and the symmetry of dimension, the origin must be a minimum and there are a lot unknown valleys neighboring the origin valley. And we can set an arbitrary boundary surrounding the origin valley group, and study the mean escape time from the group of valleys.
619
+
620
+ Experiment Setting 3: We study the learning dynamics of MLP with ReLu activations, cross entropy losses, depth as 3, and hidden layers’ width as 10. Parameters Initialization: $\theta _ { t = 0 } = ( 0 . 1 , \cdot \cdot \cdot , 0 . 1 )$ with a small Gaussian noise $\epsilon = ( 0 , 0 . 0 1 I )$ . Valley Boundary: $0 . 0 5 < \theta _ { i } < 0 . 1 5$ . To prevent the gradient disappearance problem of deep learning, we move the starting point from the origin. For symmetry breaking of deep learning, we add a small Gaussian noise to each parameter’s initial value. Due to the complex loss landscape of deep networks, we can hardly know the exact information about valleys and cols. However, the escape formula can still approximately hold even if an arbitrary boundary surrounding an arbitrary group of valleys. We set the batch size as 1 in this setting. When the batch size is small, the gradient noise is more like a heavy-tailed noise. We can validate whether or not the propositions can hold with very-small-batch gradient noise in practice.
621
+
622
+ # E.2 EXPERIMENTS RESULTS
623
+
624
+ Figure 15 shows the relation of the escape rate and the isotropic diffusion coefficient D. Figure 16 shows the relation of the escape rate and the Hessian determinant in the dynamics of white noise. Figure 17 shows the relation of the escape rate and the second order directional derivative in the dynamics of SGD. Figure 18 shows the relation of the escape rate and the batch size in the dynamics of SGD. Figure 19 shows the relation of the escape rate and the learning rate in the dynamics of SGD.
625
+
626
+ ![](images/a3af91f70dd76a14cfbf68c4af33655d6324c430f4d0a0f672fcb25cb4546d66.jpg)
627
+ Figure 15: The relation of the escape rate and the diffusion coefficient D in the dynamics of SGLD. The escape formula that $- \log ( \gamma )$ is linear with $\textstyle { \frac { 1 } { D } }$ is validated in the setting of Styblinski-Tang Function, Logistic Regression and MLP.
628
+
629
+ ![](images/9bdfc4ba7eacbef971e2839103509719b827e0264c02b872459d91774f4fc065.jpg)
630
+ Figure 16: The relation of the escape rate and the Hessian determinants in the dynamics of SGLD. The escape formula that $\gamma$ is linear with $k$ is validated in the setting of Styblinski-Tang Function, Logistic Regression and MLP.
631
+
632
+ ![](images/72037af24de8ea4733e366a2c5e96d4046e24eab734ab0312a61c39283d69b88.jpg)
633
+ Figure 17: The escape rate exponentially depends on the sharpness in the dynamics of SGD. The escape formula that $- \log ( \gamma )$ is linear with $\frac { 1 } { k }$ is validated in the setting of Styblinski-Tang Function, Logistic Regression and MLP.
634
+
635
+ ![](images/6ee2fb941d89c488a872f7dd33c40187fc2f3f42d856655122e3c48cc20c441a.jpg)
636
+ Figure 18: The escape rate exponentially depends on the batch size in the dynamics of SGD. The escape formula that $\bar { - } \log ( \gamma )$ is linear with $B$ is validated in the setting of Styblinski-Tang Function, Logistic Regression and MLP.
637
+
638
+ ![](images/f24a88bb49321f7d8fee99556f21f5bdc68661b8c4d02b911e13f9652bb6df38.jpg)
639
+ Figure 19: The escape rate exponentially depends on the learning rate in the dynamics of SGD. The escape formula that $- \log ( \gamma )$ is linear with $\frac { \mathbf { i } } { \eta }$ is validated in the setting of Styblinski-Tang Function, Logistic Regression and MLP.