Datasets:
Tasks:
Question Answering
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Add files using upload-large-folder tool
Browse filesFiles changed (50)
- md/train/-iu9-C_lan/-iu9-C_lan.mdAdded+373
- md/train/33TBJachvOX/33TBJachvOX.mdAdded+322
- md/train/5Ya8PbvpZ9/5Ya8PbvpZ9.mdAdded+314
- md/train/6UdQLhqJyFD/6UdQLhqJyFD.mdAdded+412
- md/train/AuVKs6JmBtY/AuVKs6JmBtY.mdAdded+240
- md/train/B1e9Y2NYvS/B1e9Y2NYvS.mdAdded+318
- md/train/B1lKS2AqtX/B1lKS2AqtX.mdAdded+299
- md/train/BklSv34KvB/BklSv34KvB.mdAdded+275
- md/train/BydrOIcle/BydrOIcle.mdAdded+463
- md/train/GvqjmSwUxkY/GvqjmSwUxkY.mdAdded+359
- md/train/H1exf64KwH/H1exf64KwH.mdAdded+426
- md/train/H1lJJnR5Ym/H1lJJnR5Ym.mdAdded+386
- md/train/H1xSNiRcF7/H1xSNiRcF7.mdAdded+385
- md/train/HJIoJWZCZ/HJIoJWZCZ.mdAdded+342
- md/train/HJfQrs0qt7/HJfQrs0qt7.mdAdded+691
- md/train/Hk8N3Sclg/Hk8N3Sclg.mdAdded+238
- md/train/HkepKG-Rb/HkepKG-Rb.mdAdded
- md/train/Hyl7ygStwB/Hyl7ygStwB.mdAdded
- md/train/Hyx4knR9Ym/Hyx4knR9Ym.mdAdded
- md/train/J28lNO4p3ki/J28lNO4p3ki.mdAdded
- md/train/J4gRj6d5Qm/J4gRj6d5Qm.mdAdded
- md/train/JHcqXGaqiGn/JHcqXGaqiGn.mdAdded
- md/train/K9uApq7iyyI/K9uApq7iyyI.mdAdded
- md/train/KBnXrODoBW/KBnXrODoBW.mdAdded
- md/train/OJiM1R3jAtZ/OJiM1R3jAtZ.mdAdded
- md/train/Oa9RlXNggGy/Oa9RlXNggGy.mdAdded
- md/train/S1ejj64YvS/S1ejj64YvS.mdAdded
- md/train/S1m6h21Cb/S1m6h21Cb.mdAdded
- md/train/SJlJSaEFwS/SJlJSaEFwS.mdAdded
- md/train/Sk9yuql0Z/Sk9yuql0Z.mdAdded
- md/train/SkaPsfZ0W/SkaPsfZ0W.mdAdded
- md/train/SkeAaJrKDS/SkeAaJrKDS.mdAdded
- md/train/Sy0GnUxCb/Sy0GnUxCb.mdAdded
- md/train/Syx79eBKwr/Syx79eBKwr.mdAdded
- md/train/SyxtJh0qYm/SyxtJh0qYm.mdAdded
- md/train/UVH3Ucewd-IXZ/UVH3Ucewd-IXZ.mdAdded
- md/train/ZUvaSolQZh3/ZUvaSolQZh3.mdAdded
- md/train/b4YiFnQH3gN/b4YiFnQH3gN.mdAdded
- md/train/hbHkvGBZB9/hbHkvGBZB9.mdAdded
- md/train/jCxDyge46t2/jCxDyge46t2.mdAdded
- md/train/r1gIdySFPH/r1gIdySFPH.mdAdded
- md/train/r1gzoaNtvr/r1gzoaNtvr.mdAdded
- md/train/r1lZ7AEKvB/r1lZ7AEKvB.mdAdded
- md/train/rJlEojAqFm/rJlEojAqFm.mdAdded
- md/train/rJzIBfZAb/rJzIBfZAb.mdAdded
- md/train/rkQkBnJAb/rkQkBnJAb.mdAdded
- md/train/ryfz73C9KQ/ryfz73C9KQ.mdAdded
- md/train/ryxwJhC9YX/ryxwJhC9YX.mdAdded
- md/train/ucEXZQncukK/ucEXZQncukK.mdAdded
- md/train/wXgk_iCiYGo/wXgk_iCiYGo.mdAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373# Cycle Self-Training for Domain Adaptation
Hong Liu Dept of Electronic Engineering Tsinghua University hongliu9903@gmail.com
Jianmin Wang School of Software, BNRist Tsinghua University jimwang@tsinghua.edu.cn Mingsheng Long⇤ School of Software, BNRist Tsinghua University mingsheng@tsinghua.edu.cn
# Abstract
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.
# 1 Introduction
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].
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].
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.
 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.
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.
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.
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.
# 2 Preliminaries
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 }$ .
We discuss two mainstream UDA methods and their formulations: feature adaptation and self-training.
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 } )$ :
$$\operatorname* { m i n } _ { \theta , \phi } L _ { \widehat { P } } ( \theta , \phi ) + d ( h _ { \sharp } \widehat { P } , h _ { \sharp } \widehat { Q } ) .$$
 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.
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].
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:
$$\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 ] } \} ) .$$
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.
# 2.1 Limitations of Standard Self-Training
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.
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.
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.
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 }$ ).
# 3 Approach
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.
# 3.1 Cycle Self-Training
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
$$y ^ { \prime } = \arg \operatorname* { m a x } _ { i } \{ f _ { \theta _ { s } , \phi } ( x ) _ { [ i ] } \} ,$$
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.
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.
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 }$
$$\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 } ) .$$
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:
$$\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 ) .$$
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.
# 3.2 Tsallis Entropy Minimization
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
$$S _ { \alpha } ( y ) = \frac { 1 } { \alpha - 1 } \left( 1 - \sum y _ { [ i ] } ^ { \alpha } \right) ,$$
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 }$ .
We propose to control the uncertainty of target pseudo-labels based on Tsallis entropy minimization:
$$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 } ) ) .$$
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.
 Figure 3: Tsallis entropy vs. entropic-index $\alpha$
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:
$$\hat { \alpha } = \underset { \alpha \in [ 1 , 2 ] } { \arg \operatorname* { m i n } } L _ { \widehat { P } } ( \widehat { \theta } _ { t , \alpha } , \phi )$$
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
# Algorithm 1 Cycle Self-Training (CST)
1: Input: source dataset $\widehat { P }$ and target dataset $\widehat { Q }$ . 2: for epoch $= 0$ to MaxEpoch do 3: Select $\hat { \alpha }$ as equation 10 at the start of each epoch. 4: for $t = 0$ to MaxIter do 5: Forward Step 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 ] } \}$ . 7: Reverse Step 8: Train a target head $\hat { \theta } _ { t } ( \phi )$ with target pseudo-labels $y ^ { \prime }$ on the feature extractor $\phi$ : $\hat { \theta } _ { t } ( \phi ) = \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { x \sim \hat { Q } } \ell ( f _ { \theta , \phi } ( x ) , y ^ { \prime } ) .$ 9: Update the feature extractor $\phi$ and the source head $\theta _ { s }$ to make $\hat { \theta } _ { t } ( \phi )$ perform well on the source dataset and minimize the $\hat { \alpha }$ -Tsallis entropy on the target dataset:
$$\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}$$
10: end for 11: end for
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:
$$\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 ) .$$
In summary, Algorithm 1 depicts the complete training procedure of Cycle Self-Training (CST).
# 4 Theoretical Analysis
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$ .
# 4.1 CST Provably Works under the Expansion Assumption
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 )$ .
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.
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 ) \} .$ .
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$ .
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,
$$\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 \} } .$$
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.
$$\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 } .$$
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$ .
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$ ,
$\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 } \} _ { }$ .
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.
# 4.2 Hard Case for Feature Adaptation and Standard Self-Training
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.
Table 1: The design of $p$ and $q$ .
<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>
 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 }$
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.
Theorem 3. For $\epsilon \in ( 0 , 0 . 5 )$ , the following statements hold for feature adaptation and self-training:
• 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
$$\mathrm { E r r } _ { Q } ( \hat { \theta } _ { \mathrm { F A } } , \hat { \phi } _ { \mathrm { F A } } ) \geq \epsilon .$$
• 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
$$\mathrm { E r r } _ { Q } ( \hat { \theta } _ { \mathrm { S T } } , \hat { \phi } _ { \mathrm { S T } } ) \geq \epsilon .$$
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:
$$\mathrm { E r r } _ { Q } ( \hat { \theta } _ { \mathrm { C S T } } , \hat { \phi } _ { \mathrm { C S T } } ) = 0 .$$
# 5 Experiments
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.
# 5.1 Setup
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 } )$ .
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.
# 5.2 Baselines
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.
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).
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.
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.
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.
# 5.3 Results
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.
Table 2: Accuracy $( \% )$ on Office-Home for unsupervised domain adaptation (ResNet-50).
<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>
Table 3: Accuracy $( \% )$ on Multi-Domain Sentiment Dataset for domain adaptation with BERT.
<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>
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.
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.
# 5.4 Analysis
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.
Table 5: Ablation on VisDA-2017.
<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>
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.
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.
Table 4: Mean Class Accuracy $( \% )$ for unsupervised domain adaptation on VisDA-2017.
<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>
 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.
# 6 Related Work
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.
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.
# 7 Conclusion
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.
# Acknowledgements
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.
# References
[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. [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. [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. [4] Bachman, P., Alsharif, O., and Precup, D. Learning with pseudo-ensembles. In NeurIPS, volume 27, pp. 3365–3373, 2014. [5] Bartlett, P. L. and Mendelson, S. Rademacher and gaussian complexities: Risk bounds and structural results. JMLR, 3(Nov):463–482, 2002. [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. [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. [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. [9] Bertinetto, L., Henriques, J. F., Torr, P., and Vedaldi, A. Meta-learning with differentiable closed-form solvers. In ICLR, 2019. [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. [11] Cai, T., Gao, R., Lee, J. D., and Lei, Q. A theory of label propagation for subpopulation shift, 2021. [12] Carlini, N. Poisoning the unlabeled dataset of semi-supervised learning, 2021. [13] Chapelle, O., Scholkopf, B., and Zien, A. ¨ Semi-supervised learning. MIT press Cambridge, 2006. [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. [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. [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. [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. [18] Finn, C., Abbeel, P., and Levine, S. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, pp. 1126–1135, 2017. [19] Foret, P., Kleiner, A., Mobahi, H., and Neyshabur, B. Sharpness-aware minimization for efficiently improving generalization. In ICLR, 2021. [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. [21] French, G., Mackiewicz, M., and Fisher, M. Self-ensembling for visual domain adaptation. In ICLR, 2018. [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. [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. [24] Grandvalet, Y. and Bengio, Y. Semi-supervised learning by entropy minimization. In NeurIPS, pp. 529–536, 2004. [25] Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. On calibration of modern neural networks. In ICML, pp. 1321–1330, 2017. [26] He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016. [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. [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. [29] Johansson, F. D., Sontag, D., and Ranganath, R. Support and invertibility in domain-invariant representations. In AISTATS, pp. 527–536, 2019. [30] Kumar, A., Ma, T., and Liang, P. Understanding self-training for gradual domain adaptation. In ICML, pp. 5468–5479, 2020. [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. [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. [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. [34] Long, M., Cao, Y., Wang, J., and Jordan, M. I. Learning transferable features with deep adaptation networks. In ICML, pp. 97–105, 2015. [35] Long, M., Zhu, H., Wang, J., and Jordan, M. I. Unsupervised domain adaptation with residual transfer networks. In NeurIPS, pp. 136–144, 2016. [36] Long, M., Zhu, H., Wang, J., and Jordan, M. I. Deep transfer learning with joint adaptation networks. In ICML, pp. 2208–2217, 2017. [37] Long, M., Cao, Z., Wang, J., and Jordan, M. I. Conditional adversarial domain adaptation. In NeurIPS, pp. 1640–1650. 2018. [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. [39] Mey, A. and Loog, M. A soft-labeled self-training approach. In ICPR, 2016. [40] Miyato, T., Maeda, S., Ishii, S., and Koyama, M. Virtual adversarial training: A regularization method for supervised and semi-supervised learning. TPAMI, 2018. [41] Mohri, M., Rostamizadeh, A., and Talwalkar, A. Foundations of machine learning. MIT press, 2018. [42] Mukherjee, S. and Awadallah, A. Uncertainty-aware self-training for few-shot text classification. In NeurIPS, volume 33, pp. 21199–21212, 2020. [43] Pan, S. J. and Yang, Q. A survey on transfer learning. TKDE, 22(10):1345–1359, 2010. [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. [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. [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. [47] Prabhu, V., Khare, S., Kartik, D., and Hoffman, J. Sentry: Selective entropy optimization via committee consistency for unsupervised domain adaptation, 2020. [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. [49] Qu, X., Zou, Z., Cheng, Y., Yang, Y., and Zhou, P. Adversarial category alignment network for cross-domain sentiment classification. In NAACL, 2019. [50] Quionero-Candela, J., Sugiyama, M., Schwaighofer, A., and Lawrence, N. D. Dataset Shift in Machine Learning. The MIT Press, 2009. [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. [52] Rosenberg, C., Hebert, M., and Schneiderman, H. Semi-supervised self-training of object detection models. In WACV, volume 1, pp. 29–36, 2005. [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. [54] Saito, K., Watanabe, K., Ushiku, Y., and Harada, T. Maximum classifier discrepancy for unsupervised domain adaptation. In CVPR, pp. 3723–3732, 2018. [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. [56] Shu, R., Bui, H., Narui, H., and Ermon, S. A DIRT-t approach to unsupervised domain adaptation. In ICLR, 2018. [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. [58] Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., and Fergus, R. Intriguing properties of neural networks. In ICLR, 2014. [59] Talagrand, M. Upper and lower bounds for stochastic processes: modern methods and classical problems, volume 60. Springer Science & Business Media, 2014. [60] Tan, S., Peng, X., and Saenko, K. Class-imbalanced domain adaptation: An empirical odyssey. In ECCV Workshop, 2020. [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. [62] Tsallis, C. Possible generalization of boltzmann-gibbs statistics. Journal of Statistical Physics, 52(1-2):479–487, 1988. [63] Tzeng, E., Hoffman, J., Saenko, K., and Darrell, T. Adversarial discriminative domain adaptation. In CVPR, pp. 7167–7176, 2017. [64] Venkateswara, H., Eusebio, J., Chakraborty, S., and Panchanathan, S. Deep hashing network for unsupervised domain adaptation. In CVPR, pp. 5018–5027, 2017. [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. [66] Wei, C., Shen, K., Yining, C., and Ma, T. Theoretical analysis of self-training with deep networks on unlabeled data. In ICLR, 2021. [67] Xie, Q., Luong, M. T., Hovy, E., and Le, Q. V. Self-training with noisy student improves imagenet classification. In CVPR, 2020. [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. [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. [70] Yosinski, J., Clune, J., Bengio, Y., and Lipson, H. How transferable are features in deep neural networks? In NeurIPS, pp. 3320–3328. 2014. [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. [72] Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. mixup: Beyond empirical risk minimization. In ICLR, 2018. [73] Zhang, Y., Liu, T., Long, M., and Jordan, M. Bridging theory and algorithm for domain adaptation. In ICML, pp. 7404–7413, 2019. [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. [75] Ziser, Y. and Reichart, R. Pivot based language modeling for improved neural domain adaptation. In NAACL, pp. 1241–1251, 2018. [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. [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. [78] Zou, Y., Yu, Z., Liu, X., Kumar, B. V., and Wang, J. Confidence regularized self-training. In ICCV, October 2019.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322# 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
Anonymous authors Paper under double-blind review
# A B S T R A C T
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.
# 1 I N T R O D U C T I O N
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.
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.
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).
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.
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.
# 2 M E T H O D S
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.
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:
 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.
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
$${ 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)$$
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.
# 3 E X P E R I M E N T S
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.
# 3 . 1 E X P E R I M E N T A L S E T U P
We evaluate and compare the robustness of models obtained using the following training methods:
1. Standard training (ST), i. e., training without specific robustness considerations. 2. Adversarial training (AT) (Madry et al. 2018). 3. Training with robust loss (KW) (Wong and Kolter 2018). 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). 5. Maximum margin regularization simultaneously for $\ell _ { \infty }$ and $\ell _ { 1 }$ margins (MMR-UNIV) (Croce and Hein 2020).
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.
<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>
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.
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.
# 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
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.
 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.
# 3 . 2 . 1 A G L O B A L P E R S P E C T I V E
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.
# . 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
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.
# . 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
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.
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.
 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.
 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.
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.
We also emphasize that in general, robustness curves across various distance functions may be qualitatively dissimilar. In particular:
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. 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.
 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.
# 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
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.
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.
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.
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.
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.
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.
<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>
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.
# 4 D I S C U S S I O N
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.
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.
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.
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.
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.
# R E F E R E N C E S
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.
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.
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.
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.
Nicholas Carlini, Anish Athalye, et al. (2019). On Evaluating Adversarial Robustness. arXiv: 1902.06705.
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.
Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C. Duchi (2019). Unlabeled Data Improves Adversarial Robustness. arXiv: 1905.13736.
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.
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.
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.
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.
Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy (2015). “Explaining and Harnessing Adversarial Examples”. In: 3rd International Conference on Learning Representations. arXiv: 1412.6572.
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.
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.
Chuan Guo, Mayank Rana, Moustapha Cisse, and Laurens van der Maaten (2017). Countering Adversarial Images using Input Transformations. arXiv: 1711.00117.
Matthias Hein and Maksym Andriushchenko (2017). Formal Guarantees on the Robustness of a Classifier against Adversarial Manipulation. arXiv: 1705.08475.
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.
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.
Diederik P. Kingma and Jimmy Ba (2014). Adam: A Method for Stochastic Optimization. arXiv: 1412.6980.
Alex Krizhevsky (2009). Learning multiple layers of features from tiny images. Tech. rep.
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.
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.
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. 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. 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. 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. 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. 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. 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. 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. Chongli Qin et al. (2019). “Adversarial Robustness through Local Linearization”. In: Advances in Neural Information Processing Systems 32, pp. 13847–13856. Jonas Rauber, Wieland Brendel, and Matthias Bethge (2017). Foolbox: A Python toolbox to benchmark the robustness of machine learning models. arXiv: 1707.04131. 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. Vikash Sehwag, Shiqi Wang, Prateek Mittal, and Suman Jana (2020). HYDRA: Pruning Adversarially Robust Neural Networks. arXiv: 2002.10509 [cs.CV]. Sahil Singla and Soheil Feizi (2020). “Second-Order Provable Defenses against Adversarial Attacks”. en. In: Proceedings of the International Conference on Machine Learning 1. 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. 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. Florian Tramer and Dan Boneh (2019). “Adversarial Training and Robustness for Multiple Perturbations”. In: Advances in Neural Information Processing Systems 32, pp. 5866–5876. Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu (Apr. 2020). “Improving Adversarial Robustness Requires Revisiting Misclassified Examples”. en. In. 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. Eric Wong, Leslie Rice, and J. Zico Kolter (Apr. 2020). “Fast is better than free: Revisiting adversarial training”. en. In. 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. Dongxian Wu, Shu-tao Xia, and Yisen Wang (2020). Adversarial Weight Perturbation Helps Robust Generalization. arXiv: 2004.05884. Han Xiao, Kashif Rasul, and Roland Vollgraf (2017). Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms. arXiv: 1708.07747.
 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.
Cihang Xie and Alan Yuille (Apr. 2020). “Intriguing Properties of Adversarial Training at Scale”. en. In.
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.
# 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
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 }$ .
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
$$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 }$$
and
$$P \left( - d - \frac { t _ { 1 } } { 2 } , 0 \right) = \frac { 1 } { 4 n + 1 } .$$
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. □
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.
# 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
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
$$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 } .$$
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
$$\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 } }$$
and the minimum is attained by
$$\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.$$
where $x ^ { \frac { 1 } { \infty - 1 } } = x ^ { 0 } = 1$ and $e _ { j }$ is the $j$ -th unit vector.
Proof of Theorem 2. By Hölder’s inequality, for any $\delta$ ,
$$\sum _ { i = 1 } ^ { m } | w _ { i } \delta _ { i } | \leqslant \| \delta \| _ { p } \| w \| _ { q } .$$
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
$$\| \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 } } .$$
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),
1. $w ^ { T } \delta = - w ^ { T } x - b$ , so that $\boldsymbol { w } ^ { T } ( \boldsymbol { x } + \boldsymbol { \delta } ) + \boldsymbol { b } = \boldsymbol { 0 }$ , and 2. $\begin{array} { r } { \| \delta \| _ { p } = \frac { | \boldsymbol { w } ^ { T } \boldsymbol { x } + b | } { \| \boldsymbol { w } \| _ { q } } } \end{array}$
Item 1 shows that $\delta$ is a feasible point, while Item 2 in combination with Equation (5) shows that $\| \delta \| _ { p }$ is minimal. □
Using Lemma 1, we are ready to prove Theorem 2.
Proof. By definition,
$$\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}$$
We can split $\mathcal { R } _ { p _ { 1 } } ( \varepsilon )$ into the disjoint sets
$$\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}$$
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 )$
$$\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}$$
This shows that
$$\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}$$
# C E X P E R I M E N T A L D E T A I L S
# C . 1 M O D E L T R A I N I N G
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 }$ .
# 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
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.
# 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
# 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.
 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.
 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.
# 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
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.
# 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
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
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.
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. 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. 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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314# BARTSCORE: Evaluating Generated Text as Text Generation
Weizhe Yuan Carnegie Mellon University weizhey@cs.cmu.edu
Graham Neubig Carnegie Mellon University gneubig@cs.cmu.edu
Pengfei Liu ∗ Carnegie Mellon University pliu3@cs.cmu.edu
# Abstract
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.
# 1 Introduction
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.
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.
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).
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.
# 2 Preliminaries
# 2.1 Problem Formulation
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.
# 2.2 Gold-standard Human Evaluation
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$ ):
1. Informativeness (INFO): How well the generated hypothesis captures the key ideas of the source text [18]. 2. Relevance (REL): How consistent the generated hypothesis is with respect to the source text [19]. 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]. 4. Coherence (COH): Whether the text builds from sentence to sentence to a coherent body of information about a topic [7]. 5. Factuality (FAC): Whether the generated hypothesis contains only statements entailed by the source text [30]. 6. Semantic Coverage (COV): How many semantic content units from reference texts are covered by the generated hypothesis [49]. 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].
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].
 Figure 1: Evaluation metrics as different tasks, where $s _ { i }$ , $h _ { i }$ and $r _ { j }$ represent source, hypothesis and reference words respectively.
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.
# s r2.3 Evaluation as Different Tasks
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.
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).
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].
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.
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.
# 3 BARTScore
# 3.1 Sequence-to-Sequence Pre-trained Models
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
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.
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:
$$p ( \mathbf { y } | \mathbf { x } , \theta ) = \prod _ { t = 1 } ^ { m } p ( \mathbf { y } _ { t } | \mathbf { y } _ { < t } , \mathbf { x } , \theta )$$
By exploring these probabilities, we design metrics that can gauge the quality of the generated text.
# 3.2 BARTScore
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
$$\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 )$$
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,
• 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 )$ . • 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 precision-focused scenario. • 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. • $\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.
# 3.3 BARTScore Variants
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.
# 3.3.1 Prompt
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.
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.
# 3.3.2 Fine-tuning Task
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.
# 4 Experiment
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).
# 4.1 Baselines and Datasets
# 4.1.1 Evaluation Metrics
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.
# 4.1.2 Measures for Meta Evaluation
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.
# 4.1.3 Datasets
The datasets we use are summarized in Tab. 1. We consider three different tasks: summarization (SUM), machine translation (MT), and data-to-text (D2T).
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.
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
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$ .
<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>
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.
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.
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.
# 4.2 Setup
# 4.2.1 Prompt Design
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.
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.
<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>
# 4.2.2 Settings
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.
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.
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.
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.
<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>
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.
<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>
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.
# 4.3 Experimental Results
# 4.3.1 Machine Translation
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].
# 4.3.2 Text Summarization
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).
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.
Table 5: Results on Rank19 and QAGS datasets. where “Q” represents QAGS. Metrics achieve highest correlation are bold.
<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>
# 4.3.3 Data-to-text
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.
Table 6: Results on data-to-text datasets. We report Spearman correlation. Metrics achieve highest correlation are bold.
<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>
# 4.4 Analysis
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?
 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.
# 4.4.1 Fine-grained Analysis
To answer Q1, we choose the MT task and break down the performance of each metric into different buckets based on different axes.
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.
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.
# 4.4.2 Prompt Analysis
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$ .
# 4.4.3 Bias Analysis
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.
 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.
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].
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].
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.
# 5 Implications and Future Directions
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.
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.
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.
# Acknowledgments
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.
References [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. [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. [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. [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. [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. [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. [7] Hoa Trang Dang. Overview of duc 2005. In Proceedings of the document understanding conference, volume 2005, pages 1–12, 2005. [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. [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. [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. [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. [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. [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. [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. [15] David Freedman, Robert Pisani, and Roger Purves. Statistics (international student edition). Pisani, R. Purves, 4th edn. WW Norton & Company, New York, 2007. [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. [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. [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. [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. [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. [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. [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. [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. [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. [25] Karen Sparck Jones. A statistical interpretation of term specificity and its application in retrieval. Journal of documentation, 1972. [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. [27] M. G. Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81–93, 1938. [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. [29] Philipp Koehn. Statistical machine translation. Cambridge University Press, 2009. [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. [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. [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. [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. [34] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. ArXiv, abs/2101.00190, 2021. [35] Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. Text Summarization Branches Out, 2004. [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. [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. [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. [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. [40] Yang Liu and Mirella Lapata. Text summarization with pretrained encoders. arXiv preprint arXiv:1908.08345, 2019. [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. [42] Yixin Liu and Pengfei Liu. Simcls: A simple framework for contrastive learning of abstractive summarization. arXiv preprint arXiv:2106.01890, 2021. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [59] Timo Schick and Hinrich Schütze. Few-shot text generation with pattern-exploiting training. arXiv preprint arXiv:2012.11926, 2020. [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. [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. [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. [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. [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. [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. [66] Alex Wang, Kyunghyun Cho, and M. Lewis. Asking and answering questions to evaluate the factual consistency of summaries. In ACL, 2020. [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. [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. [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. [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. [71] Weizhe Yuan, Pengfei Liu, and Graham Neubig. Can we automate scientific reviewing? arXiv preprint arXiv:2102.00176, 2021. [72] Jerrold H Zar. Spearman rank correlation. Encyclopedia of Biostatistics, 7, 2005. [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. [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. [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. [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. [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. [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. [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. [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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412# PARAMETER EFFICIENT MULTIMODAL TRANSFORMERS FOR VIDEO REPRESENTATION LEARNING
Sangho Lee, Youngjae Yu, Gunhee Kim Seoul National University {sangho.lee,yj.yu}@vision.snu.ac.kr, gunhee@snu.ac.kr
Thomas Breuel, Jan Kautz NVIDIA Research {tbreuel,jkautz}@nvidia.com
Yale Song Microsoft Research yalesong@microsoft.com
# ABSTRACT
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.
# 1 INTRODUCTION
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).
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.
 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.
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.
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.
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.
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.
# 2 APPROACH
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.
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.
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.
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
$${ \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 }$$
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.
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,
$$\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}$$
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.
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.
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.
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,
$$\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 ]$$
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.
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.
# 2.1 SELF-SUPERVISED PRETRAINING OBJECTIVES
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.
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
$$\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] ,$$
where $\mathrm { n e g } ( t )$ are negative sample indices and the compatibility function $\mathbf { I } ( \mathbf { x } _ { t } , \tilde { \mathbf { o } } _ { t } )$ is,
$$\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}$$
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 } )$ .
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.
 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.
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).
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.
Finally, our MEP loss is the InfoNCE loss computed on all three Transformers,
$$\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 } } )$$
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,
$$\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}$$
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.
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$ .
# 2.2 PARAMETER REDUCTION
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)).
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).
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.
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.
# 3 EXPERIMENTS
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.
# 3.1 RESULTS AND DISCUSSION
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.
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.
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.
<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>
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.
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.
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.
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.
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
<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>
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)
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.
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.
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.
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.
# 4 RELATED WORK
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.
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.
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.
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.
# 5 CONCLUSION
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.
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).
# REFERENCES
Chris Alberti, Jeffrey Ling, Michael Collins, and David Reitter. Fusion of Detected Objects in Text for Visual Question Answering. In EMNLP-IJCNLP, 2019.
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.
Relja Arandjelovic and Andrew Zisserman. Look, Listen and Learn. In ICCV, 2017.
Relja Arandjelovic and Andrew Zisserman. Objects that Sound. In ECCV, 2018.
Yusuf Aytar, Carl Vondrick, and Antonio Torralba. SoundNet: Learning Sound Representations from Unlabeled Video. In NeurIPS, 2016.
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer Normalization. In NeurIPS Deep Learning Symposium, 2016.
Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep Equilibrium Models. In NeurIPS, 2019a.
Shaojie Bai, J Zico Kolter, and Vladlen Koltun. Trellis Networks for Sequence Modeling. In ICLR, 2019b.
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.
Wim Boes and Hugo Van hamme. Audiovisual Transformer Architectures for Large-Scale Classification and Synchronization of Weakly Labeled Audio Events. In ACM MM, 2019.
Mathilde Caron, Ari Morcos, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Pruning Convolutional Neural Networks with Self-Supervision. arXiv preprint arXiv:2001.03554, 2020.
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.
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.
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A Simple Framework for Contrastive Learning of Visual Representations. arXiv preprint arXiv:2002.05709, 2020.
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.
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.
Raj Dabre and Atsushi Fujita. Recurrent Stacking of Layers for Compact Neural Machine Translation Models. In AAAI, 2019.
Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal Transformers. In ICLR, 2019.
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In NAACL-HLT, 2019.
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.
Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. SlowFast Networks for Video Recognition. In ICCV, 2019.
Ruohan Gao and Kristen Grauman. 2.5D Visual Sound. In CVPR, 2019.
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.
Gene H Golub and Charles F Van Loan. Matrix Computations, volume 3. JHU press, 2012.
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.
Michael Gutmann and Aapo Hyvärinen. Noise-Contrastive Estimation: A New Estimation Principle for Unnormalized Statistical Models. In AISTATS, 2010.
Tengda Han, Weidi Xie, and Andrew Zisserman. Video Representation Learning by Dense Predictive Coding. In ICCV Workshop on Large Scale Holistic Video Understanding, 2019.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In CVPR, 2016.
Dan Hendrycks and Kevin Gimpel. Gaussian Error Linear Units (GELUs). arXiv preprint arXiv:1606.08415, 2016.
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.
Sepp Hochreiter and Jürgen Schmidhuber. Long Short-Term Memory. Neural computation, 9(8): 1735–1780, 1997.
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.
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.
Jeremy Howard and Sebastian Ruder. Universal Language Model Fine-tuning for Text Classification. In ACL, 2018.
Di Hu, Feiping Nie, and Xuelong Li. Deep Multimodal Clustering for Unsupervised Audiovisual Learning. In CVPR, 2019.
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.
Longlong Jing, Xiaodong Yang, Jingen Liu, and Yingli Tian. Self-Supervised Spatiotemporal Feature Learning via Video Rotation Prediction. arXiv preprint arXiv:1811.11387, 2018.
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.
Evangelos Kazakos, Arsha Nagrani, Andrew Zisserman, and Dima Damen. EPIC-Fusion: AudioVisual Temporal Binding for Egocentric Action Recognition. In ICCV, 2019.
Dahun Kim, Donghyeon Cho, and In So Kweon. Self-Supervised Video Representation Learning with Space-Time Cubic Puzzles. In AAAI, 2019.
Bruno Korbar, Du Tran, and Lorenzo Torresani. Cooperative Learning of Audio and Video Models from Self-Supervised Synchronization. In NeurIPS, 2018.
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.
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.
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.
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.
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.
Ilya Loshchilov and Frank Hutter. Decoupled Weight Decay Regularization. In ICLR, 2019.
Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks. In NeurIPS, 2019.
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.
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.
Pedro Morgado, Nuno Vasconcelos, and Ishan Misra. Audio-Visual Instance Discrimination with Cross-Modal Agreement. arXiv preprint arXiv:2004.12943, 2020.
Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew Y Ng. Multimodal Deep Learning. In ICML, 2011.
Jorge Nocedal and Stephen Wright. Numerical Optimization. Springer Science & Business Media, 2006.
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation Learning with Contrastive Predictive Coding. arXiv preprint arXiv:1807.03748, 2018.
Andrew Owens and Alexei A Efros. Audio-Visual Scene Analysis with Self-Supervised Multisensory Features. In ECCV, 2018.
Andrew Owens, Phillip Isola, Josh McDermott, Antonio Torralba, Edward H Adelson, and William T Freeman. Visually Indicated Sounds. In CVPR, 2016.
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.
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.
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.
Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep Contextualized Word Representations. In NAACL-HLT, 2018.
Karol J. Piczak. ESC: Dataset for Environmental Sound Classification. In ACM-MM, 2015a.
Karol J. Piczak. Environmental Sound Classification with Convolutional Neural Networks. In MLSP, 2015b.
AJ Piergiovanni, Anelia Angelova, and Michael S Ryoo. Evolving Losses for Unsupervised Video Representation Learning. In CVPR, 2020.
Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving Language Understanding by Generative Pre-Training. Techincal Report, OpenAI, 2018.
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. OpenAI Blog, 1(8), 2019.
Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks. In ECCV, 2016.
Sashank J Reddi, Satyen Kale, and Sanjiv Kumar. On the Convergence of Adam and Beyond. In ICLR, 2018.
Russell Reed. Pruning Algorithms-A Survey. IEEE Transactions on Neural Networks, 4(5):740–747, 1993.
Florian Schroff, Dmitry Kalenichenko, and James Philbin. FaceNet: A Unified Embedding for Face Recognition and Clustering. In CVPR, 2015.
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.
Gunnar A Sigurdsson, Santosh Divvala, Ali Farhadi, and Abhinav Gupta. Asynchronous Temporal Fields for Action Recognition. In CVPR, 2017.
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.
Nitish Srivastava and Russ R Salakhutdinov. Multimodal Learning with Deep Boltzmann Machines. In NeurIPS, 2012.
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.
Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. Learning Video Representations using Contrastive Bidirectional Transformer. arXiv preprint arXiv:1906.05743, 2019a.
Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. VideoBERT: A Joint Model for Video and Language Representation Learning. In ICCV, 2019b.
Hao Tan and Mohit Bansal. LXMERT: Learning Cross-Modality Encoder Representations from Transformers. In EMNLP-IJCNLP, 2019.
Yapeng Tian, Dingzeyu Li, and Chenliang Xu. Unified Multisensory Perception: Weakly-Supervised Audio-Visual Video Parsing. In ECCV, 2020.
Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Deep Image Prior. In CVPR, 2018.
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.
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.
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.
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.
Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices. In CVPR, 2018.
Hang Zhao, Chuang Gan, Andrew Rouditchenko, Carl Vondrick, Josh McDermott, and Antonio Torralba. The Sound of Pixels. In ECCV, 2018.
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.
Linchao Zhu and Yi Yang. ActBERT: Learning Global-Local Video-Text Representations. In CVPR, 2020.
Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local Aggregation for Unsupervised Learning of Visual Embeddings. In ICCV, 2019.
# A IMPLEMENTATION DETAILS
# A.1 ARCHITECTURES OF VISUAL/AUDIO CNNS
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.
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}.
<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>
# A.2 DATA PREPROCESSING
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).
 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.
# A.3 DOWNSTREAM EVALUATION
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.
# A.4 OPTIMIZATION
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.
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.
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.
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.
# B EXTRA RESULTS FROM THE ABLATION STUDY
# B.1 NEGATIVE SAMPLING STRATEGIES
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).
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).
# B.2 PARAMETER SHARING SCHEMES
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).
# B.3 JUSTIFICATION FOR THE MEP LOSS FORMULATION
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.
# B.4 JUSTIFICATION FOR THE CPP LOSS FORMULATION
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.
# B.5 USE OF MODALITY EMBEDDINGS IN THE MULTIMODAL TRANSFORMER
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.
# B.6 ON THE IMPORTANCE OF END-TO-END PRETRAINING
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).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240# Towards Robust and Reliable Algorithmic Recourse
Sohini Upadhyay∗ Harvard University supadhyay@g.harvard.edu
Shalmali Joshi∗ Harvard University shalmali@seas.harvard.edu
Himabindu Lakkaraju Harvard University hlakkaraju@hbs.harvard.edu
# Abstract
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.
# 1 Introduction
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].
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].
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.
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.
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.
# 2 Related Work
Our work lies at the intersection of algorithmic recourse and adversarial robustness. Below, we discuss related work pertaining to each of these topics.
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.
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.
# 3 Our Framework: RObust Algorithmic Recourse
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.
# 3.1 Preliminaries
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$ .
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.
Putting it all together, the problem of finding a recourse for instance $x$ for which $\mathcal { M } ( x ) = 0$ can be formalized as:
$$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$$
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:
$$\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 } )$$
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.
# 3.2 Formulating Our Objective
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)
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).
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:
$$\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 } )$$
where cost function $c$ and loss function $l$ are as defined in Section 3.1.
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$ :
$$\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}$$
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.
# 3.3 Optimizing Our Objective
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:
$$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 } )$$
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.
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.
# Algorithm 1 Our Optimization Procedure
<table><tr><td>Input:x s.t. fω(x)=O,fw,λ>O,△,learning rate α >0. Initialize x" =x,g =0</td></tr><tr><td>repeat = arg maxs∈△ l(fw+8(x"),1)</td></tr><tr><td>g =∀[e(fw+8(x"),1)+ λc(x",x)]</td></tr><tr><td>x" -=ag</td></tr><tr><td>until convergence</td></tr><tr><td>Return x"</td></tr></table>
# 4 Theoretical Analysis
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.
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.
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.
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:
$$\Omega = \{ x ^ { \prime } \colon w ^ { T } x ^ { \prime } > 0 \cap ( w + \delta ) ^ { T } x ^ { \prime } \leq 0 \}$$
The probability that $x ^ { \prime }$ is invalidated can be obtained by integrating over $\Omega$ under the PDF of $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ .
We can then transform $x ^ { \prime }$ and correspondingly $\Omega$ , to simplify this integration over a 1-dimensional Gaussian random variable. That is,
$$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$$
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. □
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.
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:
$$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 )$$
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).
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):
$$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\}$$
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. □
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.
# 5 Experiments
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.
# 5.1 Experimental Setup
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.
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:
 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
(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$ .
(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$ .
(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.
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.
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.
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.
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).
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.
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.
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.
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.
# 5.2 Robustness to real world shifts
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.
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
<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>
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.
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.
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.
 5.3 Impact of the degree of data distribution shift on recourses 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.
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.
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.
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.
# 6 Conclusions & Future Work
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].
# Acknowledgements
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.
# References
[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. [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. [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. [4] Anirban Chakraborty, Manaar Alam, Vishal Dey, Anupam Chattopadhyay, and Debdeep Mukhopadhyay. Adversarial attacks and defences: A survey. arXiv preprint arXiv:1810.00069, 2018. [5] Seok-Ho Chang, Pamela C Cosman, and Laurence B Milstein. Chernoff-type bounds for the gaussian error function. IEEE Transactions on Communications, 2011. [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. [7] Amit Dhurandhar, Tejaswini Pedapati, Avinash Balakrishnan, Pin-Yu Chen, Karthikeyan Shanmugam, and Ruchir Puri. Model agnostic contrastive explanations for structured data, 2019. [8] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml. [9] JWL Glaisher. Liv. on a class of definite integrals.—part ii. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 1871. [10] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. [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. [12] Amir-Hossein Karimi, Gilles Barthe, Borja Balle, and Isabel Valera. Model-agnostic counterfactual explanations for consequential decisions, 2019. [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. [14] Amir-Hossein Karimi, Bernhard Schölkopf, and Isabel Valera. Algorithmic recourse: from counterfactual explanations to interventions. arXiv preprint arXiv:2002.06278, 2020. [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. [16] Himabindu Lakkaraju, Nino Arsov, and Osbert Bastani. Robust and stable black box explanations, 2020. [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. [18] Arnaud Van Looveren and Janis Klaise. Interpretable counterfactual explanations guided by prototypes, 2019. [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. [20] Martin Pawelczyk, Klaus Broelemann, and Gjergji Kasneci. On counterfactual explanations under predictive multiplicity, 2020. [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. [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. [23] Kaivalya Rawal and Himabindu Lakkaraju. Beyond individualized recourse: Interpretable and interactive summaries of actionable recourses. Advances in Neural Information Processing Systems, 33, 2020. [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. [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. [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. [27] Ramon van Handel. Probability in high dimension. Technical report, PRINCETON UNIV NJ, 2014. [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. [29] Sahil Verma, John Dickerson, and Keegan Hines. Counterfactual explanations for machine learning: A review. arXiv preprint arXiv:2010.10596, 2020. [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. [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. [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. [33] Xingyu Zhao, Xiaowei Huang, V. Robu, and D. Flynn. Baylime: Bayesian local interpretable model-agnostic explanations. UAI, abs/2012.03058, 2021.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318# ON ROBUSTNESS OF NEURAL ORDINARY DIFFERENTIAL EQUATIONS
Hanshu YAN\*, Jiawei DU\*, Vincent Y. F. TAN & Jiashi FENG
Department of Electrical and Computer Engineering National University of Singapore {hanshu.yan, dujiawei}@u.nus.edu, {vtan, elefjia}@nus.edu.sg
# ABSTRACT
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.
# 1 INTRODUCTION
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.
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.
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.
 Figure 1: The architecture of an ODENet. The neural ODE block serves as a dimension-preserving nonlinear mapping.
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.
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.
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.
# 2 PRELIMINARIES ON NEURAL ODE
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:
$$\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 ) ,$$
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.
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.,
$$\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 } ) .$$
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.
# 3 AN EMPIRICAL STUDY ON THE ROBUSTNESS OF ODENETS
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.
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.
# 3.1 EXPERIMENTAL SETTINGS
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$ .
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.
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.
# 3.2 ROBUSTNESS OF ODENETS TRAINED ONLY ON NON-PERTURBED IMAGES
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.
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.
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.
<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>
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 \%$ .
# 3.3 ROBUSTNESS OF ODENETS TRAINED ON ORIGINAL IMAGES TOGETHER WITH GAUSSIAN PERTURBATIONS
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.
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.
<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>
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.
# 3.4 INSIGHTS ON THE ROBUSTNESS OF ODENETS
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.
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 )$ .
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 )$ .
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.
 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 }$ .
# 4 TISODE: BOOSTING THE ROBUSTNESS OF NEURAL ODES
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).
# 4.1 TIME-INVARIANT STEADY NEURAL ODES
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.
 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 )$ .
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
$$\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.$$
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
$$\widetilde { { \mathbf z } } _ { 1 } ( t ) = { \mathbf z } _ { 1 } ( t + T ^ { \prime } )$$
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).
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,
$$\| \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\| ,$$
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).
Therefore, we propose to add an additional term $L _ { \mathrm { s s } }$ to the loss function when training the timeinvariant neural ODE:
$$L _ { \mathrm { s s } } = \sum _ { i = 1 } ^ { N } \left\| \int _ { T } ^ { 2 T } | f _ { \theta } ( \mathbf { z } _ { i } ( t ) ) | \mathrm { d } t \right\| ,$$
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$ .
# 4.2 EVALUATING ROBUSTNESS OF TISODE-BASED CLASSIFIERS
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.
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.
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.
<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>
4.3 TISODE - A GENERALLY APPLICABLE DROP-IN TECHNIQUE FOR IMPROVING THE ROBUSTNESS OF DEEP NETWORKS
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.
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.
<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>
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.
# 5 RELATED WORKS
In this section, we briefly review related works on the neural ODE and works concerning improving the robustness of deep neural networks.
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).
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.
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.
# 6 CONCLUSION
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.
# ACKNOWLEDGEMENT
This work is funded by a Singapore National Research Foundation (NRF) Fellowship (R-263-000- D02-281).
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
# REFERENCES
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.
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.
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.
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.
Earl A Coddington and Norman Levinson. Theory of ordinary differential equations. Tata McGrawHill Education, 1955.
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.
Emilien Dupont, Arnaud Doucet, and Yee Whye Teh. Augmented neural odes. arXiv preprint arXiv:1904.01681, 2019.
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.
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
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.
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.
Ralph Howard. The gronwall inequality. lecture notes, 1998.
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. arXiv preprint arXiv:1605.07648, 2016.
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.
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.
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.
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.
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
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.
Lev Semenovich Pontryagin. Mathematical theory of optimal processes. Routledge, 2018.
Alessio Quaglino, Marco Gallieri, Jonathan Masci, and Jan Koutn´ık. Accelerating neural odes with spectral elements. arXiv preprint arXiv:1906.07038, 2019.
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.
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.
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.
Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. arXiv preprint arXiv:1805.12152, 2018.
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.
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.
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.
E Weinan. A proposal on machine learning via dynamical systems. Communications in Mathematics and Statistics, 5(1):1–11, 2017.
Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. arXiv preprint arXiv:1711.01991, 2017.
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.
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.
Laurent Younes. Shapes and diffeomorphisms, volume 171. Springer, 2010.
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.
# 7 APPENDIX
7.1 NETWORKS USED ON THE MNIST, THE SVHN, AND THE IMGNET10 DATASETS
Table 5: The architectures of the ODENets on different datasets.
<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>
<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>
<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>
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.
# 7.2 THE CONSTRUCTION OF IMGNET10 DATASET
Table 6: The corresponding indexes to each class in the original ImageNet dataset
<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>
# 7.3 GRONWALL’S INEQUALITY
We formally state the Gronwall’s Inequality here, following the version in (Howard, 1998).
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:
$$\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}$$
Assume there is a constant $C \geq 0$ such that, for all $t \in [ 0 , T ]$ ,
$$\| f ( \mathbf { z } _ { 2 } ( t ) , t ) - f ( \mathbf { z } _ { 1 } ( t ) , t ) ) \| \leq C \| \mathbf { z } _ { 2 } ( t ) - \mathbf { z } _ { 1 } ( t ) \|$$
Then, for any $t \in [ 0 , T ]$ ,
$$\begin{array} { r } { \| \mathbf { z } _ { 1 } ( t ) - \mathbf { z } _ { 2 } ( t ) \| \leq \| \mathbf { x } _ { 2 } - \mathbf { x } _ { 1 } \| \cdot e ^ { C t } . } \end{array}$$
# 7.4 MORE EXPERIMENTAL RESULTS
# 7.4.1 COMPARISON IN THE SETTING OF ADVERSARIAL TRAINING
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.
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.
<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>
# 7.4.2 EXPERIMENTS ON THE CIFAR10 DATASET
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.
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.
<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>
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.
Table 9: The architecture of the ODENet on CIFAR10.
<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>
# 7.4.3 AN EXTENSION ON THE COMPARISON BETWEEN CNNS AND ODENETS
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.
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 \%$ ).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299# EIDETIC 3D LSTM: A MODEL FOR VIDEO PREDICTION AND BEYOND
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
# ABSTRACT
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.
# 1 INTRODUCTION
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.
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.
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.
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.
# 2 RELATED WORK AND PROBLEM CONTEXT
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.
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.
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.
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).
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.
 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.
# 3 EIDETIC 3D LSTM
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.
# 3.1 3D CONVOLUTIONS IN RECURRENT NETWORK
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.
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.
# 3.2 EIDETIC MEMORY TRANSITION
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
 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.
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.
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.
To capture the long-term frame interactions, we improve the recurrent transition function of the memory states by proposing a new memory RECALL mechanism:
$$\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}$$
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.
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:
$$\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}$$
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.
# 3.3 SELF-SUPERVISED AUXILIARY LEARNING
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.
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:
$$\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 } ,$$
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:
$$\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 } } ) ,$$
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.
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$ :
$$\lambda ( i ) = \operatorname* { m a x } ( \eta , \lambda ( 0 ) - \epsilon \cdot i ) ,$$
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.
# 4 EXPERIMENTS
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.
 Figure 3: Video prediction examples on the Moving MNIST dataset.
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.
<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>
# 4.1 FUTURE VIDEO PREDICTION: MOVING MNIST
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.
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.
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.
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).
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.
Table 2: Ablation study on the Moving MNIST dataset $( 1 0 1 0 )$ ).
<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>
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.
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.
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.
# 4.2 FUTURE VIDEO PREDICTION: KTH ACTION
We evaluate the proposed E3D-LSTM model on video prediction of real-world datasets.
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.
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.
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.
 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.
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.
<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>
# 4.3 A REAL VIDEO PREDICTION APPLICATION: TRAFFIC FLOW PREDICTION
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.
Table 4: Experimental results on the TaxiBJ dataset. We report MSE at every time stamp.
<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>
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.
 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.
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.
# 4.4 EARLY ACTIVITY RECOGNITION: SOMETHING-SOMETHING
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.
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.
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$ .
 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.
Table 5: Early activity recognition accuracy on the 41-category subset of Something-Something.
<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>
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.
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.
Table 6: Ablation study of early activity recognition on the Something-Something dataset.
<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>
Table 7: Accuracy comparisons of different training strategies on the Something-Something dataset.
<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>
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.
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.
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.
Table 8: Online early recognition accuracy: the classifier is built on the last 5 recurrent output states.
<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>
# 5 CONCLUSION
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.
# ACKNOWLEDGMENTS
We would like to thank anonymous reviewers for useful comments. Mingsheng Long was supported by National Natural Science Foundation of China (61772299, 71690231).
# REFERENCES
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.
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In NIPS, 2015.
Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML, 2009.
Prateep Bhattacharjee and Sukhendu Das. Temporal coherency based criteria for predicting video frames using deep multi-stage generative adversarial networks. In NIPS, 2017.
Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017.
Bert De Brabandere, Xu Jia, Tinne Tuytelaars, and Luc Van Gool. Dynamic filter networks. In NIPS, 2016.
Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, 2018.
Ali Diba, Ali Mohammad Pazandeh, and Luc Van Gool. Efficient two-stream motion and appearance 3d cnns for video classification. In ECCV Workshop, 2016.
Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In NIPS, 2016.
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.
Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computaiton, 9(8): 1735–1780, 1997.
Shuiwang Ji, Wei Xu, Ming Yang, and Kai Yu. 3d convolutional neural networks for human action recognition. TPAMI, 35(1):221–231, 2013.
Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. In ICML, 2017.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
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.
Chaochao Lu, Michael Hirsch, and Bernhard Schölkopf. Flexible spatio-temporal networks for video prediction. In CVPR, 2017.
Shugao Ma, Leonid Sigal, and Stan Sclaroff. Learning activity progression in lstms for activity detection and early detection. In CVPR, 2016.
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. In ICLR, 2016.
Marc Oliu, Javier Selva, and Sergio Escalera. Folded recurrent neural networks for future video prediction. In ECCV, 2018.
Zhaofan Qiu, Ting Yao, and Tao Mei. Learning spatio-temporal representation with pseudo-3d residual networks. In ICCV, 2017.
Christian Schuldt, Ivan Laptev, and Barbara Caputo. Recognizing human actions: a local svm approach. In ICPR, 2004.
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.
Nitish Srivastava, Elman Mansimov, and Ruslan Salakhutdinov. Unsupervised learning of video representations using lstms. In ICML, 2015.
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In ICCV, 2015.
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.
Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In CVPR, 2018.
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.
Ruben Villegas, Jimei Yang, Seunghoon Hong, Xunyu Lin, and Honglak Lee. Decomposing motion and content for natural video sequence prediction. In ICLR, 2017.
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In NIPS, 2016.
Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018a.
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.
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.
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.
Nevan Wichers, Ruben Villegas, Dumitru Erhan, and Honglak Lee. Hierarchical long-term video prediction without supervision. In ICML, 2018.
Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. Rethinking spatiotemporal feature learning for video understanding. In ECCV, 2018.
Jingwei Xu, Bingbing Ni, Zefan Li, Shuo Cheng, and Xiaokang Yang. Structure preserving video prediction. In CVPR, 2018.
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.
Junbo Zhang, Yu Zheng, and Dekang Qi. Deep spatio-temporal residual networks for citywide crowd flows prediction. In AAAI, 2017.
Bolei Zhou, Alex Andonian, and Antonio Torralba. Temporal relational reasoning in videos. In ECCV, 2018.
# A KEY EQUATIONS OF SPATIOTEMPORAL LSTM
Operations inside a Spatiotemporal LSTM unit at time stamp $t$ and layer $k$ are shown as follows:
$$\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}$$
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275# CARPE DIEM, SEIZE THE SAMPLES UNCERTAIN “AT THE MOMENT” FOR ADAPTIVE BATCH SELECTION
Anonymous authors Paper under double-blind review
# ABSTRACT
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.
# 1 INTRODUCTION
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).
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.
 Figure 1: Two forms of handling the time-series observations.
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.
 Figure 2: The difference in sample uncertainty estimated by Active Bias and Recency Bias.
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.
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.
# 2 RELATED WORK
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 }$ .
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).
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).
$$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 } }$$
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.
$$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 } | } }$$
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.
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.
# 3 Recency Bias COMPONENTS
# 3.1 CRITERION OF AN UNCERTAIN SAMPLE
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.
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.
$$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 ) | }$$
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$ .
$$\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}$$
# 3.2 SAMPLING PROBABILITY FOR MINI-BATCH CONSTRUCTION
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).
$$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$$
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).
$$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 ) ) } }$$
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.
$$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 } }$$
# 4 Recency Bias ALGORITHM
# Algorithm 1 Recency Bias Algorithm
INPUT: $\mathcal { D }$ : data, epochs, b: batch size, $q$ : window size, $s _ { e _ { 0 } }$ : initial selection pressure, $\gamma$ : warm-u OUTPUT: $\theta _ { t }$ : model parameter 1: $t \gets 1$ ; 2: ${ \theta _ { t } } \gets$ Initialize the model parameter; 3: for $i = 1$ to epochs do 4: $/ { ^ * }$ Sampling Probability Derivation $^ { * }$ 5: if $i > \gamma$ then 6: $s _ { e } \gets$ Decay_Selection_Pressure $( s _ { e _ { 0 } } , i )$ ; $/ { * }$ Decaying $s _ { e }$ by Eq. (7) \*/ 7: for $m = 1$ to $N$ do $/ { } ^ { * }$ Updating the index and the sampling probability in a batch $^ { * }$ 8: $q _ { - } d i c t [ x _ { m } ] = Q \bigl ( F ( x _ { m } ; q ) \bigr )$ ; $/ { } ^ { * }$ By Eq. (5) $^ { * }$ 9: $p \_ t a b l e \mathrm { C o } \mathrm { _ { } }$ mpute_Prob(q_dict, $s _ { e . }$ ); $/ { } ^ { * }$ By Eq. (6) $^ { * }$ 10: /\* Network Training $^ { * }$ 11: for $j = 1$ to $N / b$ do $/ { * }$ Mini-batch $^ { * }$ 12: if $i \leq \gamma$ then $/ { * }$ Warm-up $^ { * }$ 13: $\{ ( x _ { 1 } , y _ { 1 } ) , \dotsc , ( x _ { b } , y _ { b } ) \} $ Randomly select next mini-batch samples; 14: else $/ { * }$ Adaptive batch selection $^ { * }$ 15: $\{ ( x _ { 1 } , y _ { 1 } ) , \dotsc , ( x _ { b } , y _ { b } ) \} $ Select next mini-batch samples based on $p \_ t a b l e$ ; 16: losses, ${ l a b e l s }$ Inference_Step $\cdot ( \{ ( x _ { 1 } , y _ { 1 } ) , \dots , ( x _ { b } , y _ { b } ) \} , \theta _ { t } )$ ; $/ { } ^ { * }$ Forward $^ { * }$ 17: $\theta _ { t + 1 } \gets \mathrm { S G D } \_ { \mathrm { S t e p } } ( l o s s e s , \theta _ { t } )$ ; $/ { * }$ Backward $^ { * }$ 18: Update_Label_History(labels); $/ { * }$ By Definition $3 . 1 ~ ^ { * } /$ 19: $t \gets t + 1$ ; 20: return $\theta _ { t }$ ;
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).
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.
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.
# 5 EVALUATION
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.
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).
# 5.1 ANALYSIS ON SELECTED MINI-BATCH SAMPLES
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.
 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.
# 5.2 TASK I: IMAGE CLASSIFICATION
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.
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.
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.
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.
Table 1: The best test errors $( \% )$ of four batch selection strategies using DenseNet.
<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>
Table 2: The best test errors $( \% )$ of four batch selection strategies using ResNet.
<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>
 Figure 4: Convergence curves of four batch selection strategies using DenseNet with momentum.
# 5.3 TASK II: FINE-TUNING
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.
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.
 Figure 5: Convergence curves for fine-tuning on two benchmark datasets.
Table 3: Recency Bias’s reduction in training time over other batch selection strategies.
<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>
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.
# 5.4 ABLATION STUDY ON SELECTION PRESSURE
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.
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.
 0 80 10Figure 6: Ablation study on the effect of the selection pressure.
# 6 CONCLUSION
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.
# REFERENCES
Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML, pp. 41–48, 2009.
David Chandler. Introduction to modern statistical mechanics. Oxford University Press, 1987.
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.
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.
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.
Yang Fan, Fei Tian, Tao Qin, and Tie-Yan Liu. Neural data filter for bootstrapping stochastic gradient descent. In ICLR, 2017.
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.
KJ Joseph, Krishnakant Singh, Vineeth N Balasubramanian, et al. Submodular batch selection for training deep neural networks. In IJCAI, pp. 2677–3683, 2019.
Angelos Katharopoulos and François Fleuret. Not all samples are created equal: Deep learning with importance sampling. In ICML, pp. 2525–2534, 2018.
Y. Kawano and K. Yanai. Food image recognition with deep convolutional features. In UbiComp, 2014.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet classification with deep convolutional neural networks. In NeurIPS, pp. 1097–1105, 2012.
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. CIFAR-10 and CIFAR-100 datasets, 2014. https://www.cs.toronto.edu/\~kriz/cifar.html.
M Pawan Kumar, Benjamin Packer, and Daphne Koller. Self-paced learning for latent variable models. In NeurIPS, pp. 1189–1197, 2010.
Yann LeCun. The MNIST database of handwritten digits, 1998. http://yann.lecun.com/ exdb/mnist.
Ilya Loshchilov and Frank Hutter. Online batch selection for faster training of neural networks. In ICLR, 2016.
Ariadna Quattoni and Antonio Torralba. Recognizing indoor scenes. In CVPR, pp. 413–420, 2009.
Mrinmaya Sachan and Eric Xing. Easy questions first? A case study on curriculum learning for question answering. In ACL, pp. 453–463, 2016.
Abhinav Shrivastava, Abhinav Gupta, and Ross Girshick. Training region-based object detectors with online hard example mining. In CVPR, pp. 761–769, 2016.
Hwanjun Song, Minseok Kim, and Jae-Gil Lee. SELFIE: Refurbishing unclean samples for robust deep learning. In ICML, pp. 5907–5915, 2019.
Luis Torgo. Data mining with R: learning with case studies. Chapman and Hall/CRC, 2011.
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.
Shengjie Wang, Wenruo Bai, Chandrashekhar Lavania, and Jeff Bilmes. Fixing mini-batch sequences with hierarchical robust partitioning. In AISTATS, pp. 3352–3361, 2019.
Bernard Widrow, Istvan Kollar, and Ming-Chang Liu. Statistical theory of quantization. IEEE Transactions on instrumentation and measurement, 45(2):353–361, 1996.
Tianyi Zhou and Jeff Bilmes. Minimax curriculum learning: Machine teaching with desirable difficulties and scheduled diversity. In ICLR, 2018.
# A HYPERPARAMETER SELECTION
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 \}$ .
 Figure 7: Grid search on CIFAR-10 and CIFAR-100 datasets using ResNet.
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.
# B EXPERIMENT USING TINY-IMAGENET DATASET
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.
 1 20 40 60 80 10Figure 8: Convergence curves of four batch selection strategies using DenseNet with momentum.
Table 4: The best test errors $( \% )$ of four batch selection strategies using DenseNet.
<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>
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.
# C GENERALIZATION OF Recency Bias
# C.1 CONVERGENCE CURVES USING DENSENET WITH SGD
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.
 Figure 9: Convergence curves of four batch selection strategies using DenseNet with SGD.
# C.2 CONVERGENCE CURVES USING RESNET WITH MOMENTUM
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.
 Figure 10: Convergence curves of four batch selection strategies using ResNet with momentum.
# C.3 CONVERGENCE CURVES USING RESNET WITH SGD
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.
 Figure 11: Convergence curves of four batch selection strategies using ResNet with SGD.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463# UNROLLED GENERATIVE ADVERSARIAL NETWORKS
Luke Metz∗ Google Brain lmetz@google.com Ben Poole† Stanford University poole@cs.stanford.edu
David Pfau Google DeepMind pfau@google.com
Jascha Sohl-Dickstein Google Brain jaschasd@google.com
# ABSTRACT
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.
# 1 INTRODUCTION
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).
# 1.1 GENERATIVE ADVERSARIAL NETWORKS
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).
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).
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.
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.
# 1.2 DIFFERENTIATING THROUGH OPTIMIZATION
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.
In this work we address the challenges of unstable optimization and mode collapse in GANs by unrolling optimization of the discriminator objective during training.
# 2 METHOD
# 2.1 GENERATIVE ADVERSARIAL NETWORKS
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,
$$\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}$$
where $f$ is commonly chosen to be
$$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] .$$
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.
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),
$$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) } .$$
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.
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 }$ .
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)$ .
# 2.2 UNROLLING GANS
A local optimum of the discriminator parameters $\theta _ { D } ^ { * }$ can be expressed as the fixed point of an iterative optimization procedure,
$$\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}$$
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).
By unrolling for $K$ steps, we create a surrogate objective for the update of the generator,
$$f _ { K } \left( \theta _ { G } , \theta _ { D } \right) = f \left( \theta _ { G } , \theta _ { D } ^ { K } \left( \theta _ { G } , \theta _ { D } \right) \right) .$$
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.
# 2.3 PARAMETER UPDATES
The generator and discriminator parameter updates using this surrogate loss are
$$\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}$$
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.
 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).
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.
# 2.4 THE MISSING GRADIENT TERM
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 }$ ,
$$\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 } } .$$
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.
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.
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.
# 2.5 CONSEQUENCES OF THE SURROGATE LOSS
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.
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).
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.
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.
# 3 EXPERIMENTS
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.
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.
We provide a reference implementation of this technique at github.com/poolio/unrolled gan.
# 3.1 MIXTURE OF GAUSSIANS DATASET
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.
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.
 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.
 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.
# 3.2 PATHOLOGICAL MODEL WITH MISMATCHED GENERATOR AND DISCRIMINATOR
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.
<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>
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.
# 3.3 MODE AND MANIFOLD COLLAPSE USING AUGMENTED MNIST
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.
# 3.3.1 DISCRETE MODE COLLAPSE
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.
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.
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.
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.
# 3.3.2 MANIFOLD COLLAPSE
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.
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.
<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>
 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.
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.
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.
# 3.4 IMAGE MODELING OF CIFAR10
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.
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.
<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>
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.
# 3.4.1 INFERENCE VIA OPTIMIZATION
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,
$$\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}$$
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).
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.
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.
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.
# 3.4.2 PAIRWISE DISTANCES
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.
 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.
# 4 DISCUSSION
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.
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.
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.
# ACKNOWLEDGMENTS
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,
 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.
Colin Raffel, Sam Schoenholz, Ayush Sekhari, Jon Shlens, and Dale Schuurmans for insightful conversation, as well as the rest of the Google Brain Team.
# REFERENCES
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.
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.
David Belanger and Andrew McCallum. Structured prediction energy networks. arXiv preprint arXiv:1511.06350, 2015.
Jorg Bornschein, Samira Shabanian, Asja Fischer, and Yoshua Bengio. Bidirectional helmholtz machines. arXiv preprint arXiv:1506.03877, 2015.
Michael Bowling and Manuela Veloso. Multiagent learning using a variable learning rate. Artificial Intelligence, 136(2):215–250, 2002.
Yuri Burda, Roger B. Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
Alex J. Champandard. Semantic style transfer and turning two-bit doodles into fine artworks. arXiv preprint arXiv:1603.01768, 2016.
Tong Che, Yanran Li, Athul Paul Jacob, Yoshua Bengio, and Wenjie Li. Mode regularized generative adversarial networks. arXiv preprint arXiv: 1612.02136, 2016.
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.
John M Danskin. The theory of max-min and its application to weapons allocation problems, volume 5. Springer Science & Business Media, 1967.
Peter Dayan, Geoffrey E Hinton, Radford M Neal, and Richard S Zemel. The helmholtz machine. Neural computation, 7(5):889–904, 1995.
Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real NVP. arXiv preprint arXiv:1605.08803, 2016.
Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
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.
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.
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.
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.
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.
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.
Justin Johnson, Alexandre Alahi, and Fei-Fei Li. Perceptual losses for real-time style transfer and super-resolution. arXiv preprint arXiv:1603.08155, 2016.
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.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Diederik P Kingma and Max Welling. Auto-encoding variational bayes, 2013. URL https: //arxiv.org/abs/1312.6114.
Diederik P. Kingma, Tim Salimans, and Max Welling. Improving variational inference with inverse autoregressive flow. 2016.
Tejas D. Kulkarni, Will Whitney, Pushmeet Kohli, and Joshua B. Tenenbaum. Deep convolutional inverse graphics network. arXiv preprint arXiv:1503.03167, 2015.
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.
Dougal Maclaurin, David Duvenaud, and Ryan P. Adams. Gradient-based hyperparameter optimization through reversible learning, 2015.
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.
Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. arXiv preprint arXiv:1606.00709, 2016.
Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier gans. arXiv preprint arXiv:1610.09585, 2016.
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.
Ben Poole, Alexander A Alemi, Jascha Sohl-Dickstein, and Anelia Angelova. Improved generator objectives for gans. arXiv preprint arXiv:1612.02780, 2016.
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
Scott Reed, Zeynep Akata, Santosh Mohan, Samuel Tenka, Bernt Schiele, and Honglak Lee. Learning what and where to draw. In NIPS, 2016a.
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.
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.
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.
Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
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.
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.
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.
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 /$ .
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.
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.
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.
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.
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.
Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015.
Chongjie Zhang and Victor R Lesser. Multi-agent learning with policy prediction. In Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, 2010.
Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
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.
# Appendix
# A 2D GAUSSIAN TRAINING DETAILS
Network architecture and experimental details for the experiment in Section 3.1 are as follows:
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.
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.
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.
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$ .
The network is trained by alternating updates of the generator and the discriminator. One step consists of either $\mathbf { G }$ or $\mathbf { D }$ updating.
# B MORE MIXTURE OF GAUSSIAN EXPERIMENTS
# B.1 EFFECTS OF TIME DELAY / HISTORICAL AVERAGING
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.
First, we looked at taking an ensemble of the last N steps, as shown in Figure App.1.
 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.
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.
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.
 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.
# B.2 EFFECTS OF THE SECOND GRADIENT
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.
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.
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.
# C RNN MNIST TRAINING DETAILS
The network architecture for the experiment in Section 3.2 is as follows:
The MNIST dataset is scaled to [-1, 1).
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.
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.
 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.
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.
# D CIFAR10/MNIST TRAINING DETAILS
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.
The generator network is defined as:
<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>
 Unrolled GAN with 5 G Steps per D without second gradient
Unrolled GAN with 5 G Steps per D
<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>
 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.
The discriminator network is defined as:
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.
# E 1000 CLASS MNIST
<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>
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.
<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>
# F COLORED MNIST DATASET
# F.1 DATASET
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.
 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).
# F.2 MODELS
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.
The generator network is defined as:
<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>
The discriminator network is defined as:
<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>
# G OPTIMIZATION BASED VISUALIZATIONS
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.
 Figure App.6: Samples from 1/5 with different random seeds.
 Figure App.7: Samples from 2/5 with different random seeds.
 Figure App.8: Samples from 3/5 with different random seeds.
 Figure App.9: Samples from 4/5 with different random seeds.
 Figure App.10: Samples from 5/5 with different random seeds.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359# RETHINKING THE TRULY UNSUPERVISED IMAGE-TOIMAGE TRANSLATION
Anonymous authors Paper under double-blind review
# ABSTRACT
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.
# 1 INTRODUCTION
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.
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.
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.
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.
 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.
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.
Our contributions are summarized as follows:
• 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. • 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. • We show the effectiveness of our model through the extensive experiments on various datasets. • 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.
# 2 TRULY UNSUPERVISED IMAGE-TO-IMAGE TRANSLATION (TUNIT)
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).
# 2.1 LEARNING TO PRODUCE DOMAIN LABELS AND ENCODE STYLE FEATURES
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.
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.
 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.
Formally, $E _ { C }$ maximizes the mutual information:
$$\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 } } ,$$
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).
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:
$$\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 ) } ,$$
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).
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.
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:
$$\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 } } ) ) ) ] ,$$
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.
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:
$$\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] .$$
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.
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:
$$\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 } ] .$$
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 }$ .
Overall objective. Finally, we train the three networks jointly as follows:
$$\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}$$
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.
# 3 EXPERIMENTS
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
<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&C</td><td>Acc.</td><td>mFID</td><td>D&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&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>
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.
 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.
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.
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.
 Figure 4: Reference-guided image translation results on unlabeled datasets.
 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.
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.
# 3.1 COMPARATIVE EVALUATION ON LABELED DATASETS
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

<table><tr><td>K</td><td>AnimalFaces-10 mFID D&C</td><td>Food-10 mFID</td><td>D&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>
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.
 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.
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.
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).
Table 3: Quantitative evaluation (mFID) when few labels are available during training.
<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>
<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>
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 }$ .
# 3.2 VALIDATION ON UNLABELED DATASET
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.
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.
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.
# 3.3 ANALYSIS ON GENERALIZABILITY
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.
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.
# 4 CONCLUSION
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.
# REFERENCES
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.
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020a.
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
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.
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.
Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In International Conference on Learning Representations, 2018.
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.
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.
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.
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.
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.
Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learning lecture 6a overview of mini-batch gradient descent. 2012.
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.
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.
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.
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.
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.
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.
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.
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.
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
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.
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.
Jae Hyun Lim and Jong Chul Ye. Geometric gan. arXiv preprint arXiv:1705.02894, 2017.
Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. arXiv preprint arXiv:1312.4400, 2013.
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.
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.
Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Which training methods for gans do actually converge? In ICML, 2018.
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
Muhammad Ferjad Naeem, Seong Joon Oh, Youngjung Uh, Yunjey Choi, and Jaejun Yoo. Reliable fidelity and diversity metrics for generative models. 2020.
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In CVPR, 2019.
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.
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.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
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.
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.
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.
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.
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.
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.
Dingdong Yang, Seunghoon Hong, Yunseok Jang, Tiangchen Zhao, and Honglak Lee. Diversitysensitive conditional generative adversarial networks. In International Conference on Learning Representations, 2019.
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.
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.
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.
# APPENDIX
# A RELATED WORK
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.
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.
# B TRAINING DETAILS
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.
# C EVALUATION PROTOCOL
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.
# D ARCHITECTURE DETAILS
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.
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.
<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>
<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>
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.
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).
<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>
# E T-SNE VISUALIZATION & CLUSTER EXAMPLE IMAGES
# E.1 AFHQ CAT
 Figure 7: t-SNE visualization and representative images of each domain.
# E.2 AFHQ DOG
 Figure 8: t-SNE visualization and representative images of each domain.
# E.3 FFHQ
 Figure 9: t-SNE visualization and representative images of each domain.
 Figure 10: t-SNE visualization and representative images of each domain.
# F ADDITIONAL COMPARISON WITH FUNIT: AFHQ, LSUN CAR AND FFHQ
 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.
 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.
 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.
 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.
# G ADDITIONAL RESULTS OF TUNIT: AFHQ, LSUN CAR, FFHQ, ANIMALFACES-10, AND S2W
# G.1 ANIMALFACES-10
 Figure 15: AnimalFaces-10, unsupervised image-to-image translation results.
# G.2 AFHQ CAT
 Figure 16: AFHQ Cat, unsupervised image-to-image translation results.
# G.3 AFHQ DOG
 Figure 17: AFHQ Dogs, unsupervised image-to-image translation results.
 Figure 18: AFHQ Wild, unsupervised image-to-image translation results.
# G.5 FFHQ
 Figure 19: FFHQ, unsupervised image-to-image translation results.
 Figure 20: LSUN Car, unsupervised image-to-image translation results.
# G.7 SUMMER2WINTER (S2W)
 (b) Results guided by reference images Figure 21: Summer2Winter (S2W), unsupervised image-to-image translation results.
# H DIFFERENCE BETWEEN EQUATION (2) AND EQUATION (4)
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.
# I FID AND LPIPS ON UNLABELED DATASET
 Figure 22: LPIPS and FID of models and their status.
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426# EXPLORING MODEL-BASED PLANNING WITH POLICY NETWORKS
Tingwu Wang1,2& Jimmy $\mathbf { B a } ^ { 1 , 2 }$ 1 Department of Computer Science, University of Toronto 2 Vector Institute {tingwuwang,jba}@cs.toronto.edu
# ABSTRACT
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.
# 1 INTRODUCTION
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).
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.
 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.
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:
• We apply policy networks to generate proposals for MPC in high dimensional locomotion control problems with unknown dynamics. • 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). • 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.
# 2 RELATED WORK
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).
# 3 BACKGROUND
# 3.1 REINFORCEMENT LEARNING
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.
# 3.2 RANDOM SHOOTING ALGORITHM AND PETS
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.
# 4 MODEL-BASED POLICY PLANNING
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:
<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>
$$\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 } ) .$$
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.
# 4.1 MODEL-BASED POLICY PLANNING IN ACTION SPACE
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.
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.,
$$\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 } \} ) .$$
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.
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:
$$\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 } ) .$$
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
$$\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 } ) .$$
# 4.2 MODEL-BASED POLICY PLANNING IN PARAMETER SPACE
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.
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).
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
$$\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 } ) ) .$$
Similarly, we update the CEM distribution towards the following elite distribution:
$$\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 } \} ) .$$
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.
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.
# 4.3 MODEL-PREDICTIVE CONTROL AND POLICY CONTROL
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.
# 4.4 POLICY DISTILLATION SCHEMES
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.
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.
$$\operatorname* { m i n } _ { \theta } \mathbb { E } _ { s , a \in \mathcal { D } } | | \pi _ { \theta } ( s ) - a | | ^ { 2 } .$$
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:
$$\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 ) ) ) ,$$
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 } )$ .
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$ .

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.
<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>
Table 1: The training time-step varies from 50,000 to 200,000 depending on the difficulty of the tasks. The performance is averaged across four random seeds with the last 3 episodes.
# 5 EXPERIMENTS
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.
# 5.1 MUJOCO BENCHMARKING PERFORMANCE
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.
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.
 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).
 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.
# 5.2 POLICY CONTROL PERFORMANCE
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.
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.
# 5.3 SEARCH EFFECTIVENESS AND REWARD SURFACE
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.
 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.
 Figure 7: The ablation study of of POPLIN-A, POPLIN-P-BC, POPLIN-P-Avg, POPLIN-P-GAN.
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.
 x x Figure 6: Projected action distribution.
# 5.4 ABLATION STUDY
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,
# 6 CONCLUSIONS
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.
# REFERENCES
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.
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
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.
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.
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.
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.
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.
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.
Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018.
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.
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.
David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. In Advances in Neural Information Processing Systems, pp. 2450–2462, 2018a.
David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018b.
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.
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.
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.
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.
Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. arXiv preprint arXiv:1906.08253, 2019.
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.
Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018.
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.
Sergey Levine and Vladlen Koltun. Guided policy search. In International Conference on Machine Learning, pp. 1–9, 2013.
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.
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.
Weiwei Li and Emanuel Todorov. Iterative linear quadratic regulator design for nonlinear biological movement systems. In ICINCO (1), pp. 222–229, 2004.
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.
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.
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.
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.
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.
Arthur George Richards. Robust constrained model predictive control. PhD thesis, Massachusetts Institute of Technology, 2005.
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.
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.
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
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.
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.
Daniel Soudry and Elad Hoffer. Exponentially vanishing sub-optimal local minima in multilayer neural networks. arXiv preprint arXiv:1702.05777, 2017.
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.
Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM SIGART Bulletin, 2(4):160–163, 1991.
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.
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.
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.
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.
# A APPENDIX
# A.1 ALGORITHM DIAGRAMS
To better illustrate the algorithm variants of our proposed methods, we summarize them in Algorithm 2, 3, 4.
# Algorithm 2 POPLIN-A-Init
1: Initialize policy network parameters $\theta$ , dynamics network parameters $\phi$ , data-set $\mathcal { D }$ 2: while Training iterations not Finished do 3: for $i ^ { t h }$ time-step of the agent do . Sampling Data 4: Initialize reference action sequence $\{ \hat { a } _ { i } , \hat { a } _ { i + 1 } , . . . , \hat { a } _ { i + \tau } \}$ . . Using Equation 3 5: Initialize action-sequence noise distribution. $\mu = \mu _ { 0 }$ , $\dot { \Sigma } = \sigma _ { 0 } ^ { 2 } { \cal I }$ 6: for $j ^ { t h }$ CEM Update do . CEM Planning 7: Sample action noise sequences $\{ \delta _ { i } \}$ from $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ . 8: for Every candidate $\delta _ { i }$ do $\triangleright$ Trajectory Predicting 9: for $t = i$ to $i + \tau$ , $s _ { t + 1 } = f _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } = \hat { a } _ { t } + \delta _ { t } )$ 10: Evaluate expected reward of this candidate. 11: end for 12: Fit distribution of the elite candidates as $\mu ^ { \prime } , \Sigma ^ { \prime }$ . 13: Update noise distribution $\mu = ( 1 - \alpha ) \mu + \alpha \mu ^ { \prime }$ , $\Sigma = ( 1 - \alpha ) \Sigma + \alpha \Sigma ^ { \prime }$ 14: end for 15: Execute the first action from the optimal candidate action sequence. 16: end for 17: Update $\phi$ using data-set $\mathcal { D }$ $\triangleright$ Dynamics Update 18: Update $\theta$ using data-set $\mathcal { D }$ . Policy Distillation 19: end while
# Algorithm 3 POPLIN-A-Replan
1: Initialize policy network parameters $\theta$ , dynamics network parameters $\phi$ , data-set $\mathcal { D }$ 2: while Training iterations not Finished do 3: for $i ^ { t h }$ time-step of the agent do . Sampling Data 4: Initialize action-sequence noise distribution. $\mu = \mu _ { 0 }$ , $\Sigma = \sigma _ { 0 } ^ { 2 } I$ 5: for $j ^ { t h }$ CEM Update do . CEM Planning 6: Sample action noise sequences $\{ \delta _ { i } \}$ from $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ . 7: for Every candidate $\delta _ { i }$ do . Trajectory Predicting 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 } )$ 9: Evaluate expected reward of this candidate. 10: end for 11: Fit distribution of the elite candidates as $\mu ^ { \prime } , \Sigma ^ { \prime }$ . 12: Update noise distribution $\mu = ( 1 - \alpha ) \mu + \alpha \mu ^ { \prime }$ , $\Sigma = ( 1 - \alpha ) \Sigma + \alpha \Sigma ^ { \prime }$ 13: end for 14: Execute the first action from the optimal candidate action sequence. 15: end for 16: Update $\phi$ using data-set $\mathcal { D }$ $\triangleright$ Dynamics Update 17: Update $\theta$ using data-set $\mathcal { D }$ . Policy Distillation 18: end while
# A.2 BENCH-MARKING ENVIRONMENTS
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
# Algorithm 4 POPLIN-P
<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 > 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 μ',∑'.</td></tr><tr><td>12:</td><td>Update noise distribution μ= (1-α)μ + αμ',∑= (1-α)Σ+αΣ'</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>
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.
<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>
Table 3: The normalized performance of Table 2.
<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>
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.
 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.
# A.2.1 FIXING THE SWIMMER ENVIRONMENTS
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.
<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>
Table 4: Performance of each algorithm on environments based on OpenAI Gym Brockman et al. (2016) classic control environments. In the table, we record the performance at 50000 time-step.
# A.3 FULL RESULTS OF BENCH-MARKING PERFORMANCE
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.
# A.3.1 HYPER-PARAMETERS
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.
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.
Table 5: Hyper-parameter grid search options for PETS.
<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>
Table 6: Hyper-parameter grid search options for POPLIN-A.
<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>
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.
<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>
# A.4 FULL RESULTS OF POLICY CONTROL
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.
 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).
# A.5 ABLATION STUDY FOR DIFFERENT VARIANT OF POPLIN
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.
# A.6 POPULATION SIZE
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
 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.
 Figure 11: The performance of POPLIN-A, POPLIN-P, and PETS of different random seeds on Cheetah environment.
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.
# A.7 THE REWARD SURFACE OF DIFFERENT ALGORITHM
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.
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
 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.
 Figure 13: Reward surface in solution space (action space) for PETS algorithm.
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.
 Figure 14: Reward surface in solution space (action space) for POPLIN-A-Replan.
 Figure 15: Reward surface in solution space (action space) for POPLIN-A-Init.
 Figure 16: Reward surface in solution space (parameter space) for POPLIN-P with 0 hidden layer.
 Figure 17: Reward surface in solution space (parameter space) for POPLIN-P using 1 hidden layer.
 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.
 Figure 19: The figures are the planned trajectories of PETS.
 Figure 20: The figures are the planned trajectories of POPLIN-P using 1 hidden layer MLP.
 Figure 21: The figures are the planned trajectories of POPLIN-P using 0 hidden layer MLP.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386# EXPLORATION BY RANDOM NETWORK DISTILLATION
Anonymous authors Paper under double-blind review
# ABSTRACT
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.
# 1 INTRODUCTION
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.
 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.
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.
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.
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.
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.
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.
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.
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.
# 2 METHOD
# 2.1 EXPLORATION BONUSES
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$ .
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.
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.
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).
# 2.2 RANDOM NETWORK DISTILLATION
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.
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.
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.
# 2.2.1 SOURCES OF PREDICTION ERRORS
In general, prediction errors can be attributed to a number of factors:
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.
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.
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.
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.
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.
# 2.2.2 RELATION TO UNCERTAINTY QUANTIFICATION
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.
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
$$\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 ) ,$$
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.
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).
# 2.3 COMBINING INTRINSIC AND EXTRINSIC RETURNS
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.
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).
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.
 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.
 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.
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.
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.
# 3 EXPERIMENTS
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.
# 3.1 PURE EXPLORATION
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.
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.
 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.
 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.
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.
# 3.2 COMBINING EPISODIC AND NON-EPISODIC RETURNS
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$ .
 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.
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.
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.
# 3.3 DISCOUNT FACTORS
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.
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 }$ .
# 3.4 RECURRENCE
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.
# 3.5 SCALING UP RNN TRAINING
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$ .
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.
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.
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.
# 3.6 COMPARISON TO BASELINES
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.
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.
 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.
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.
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.
# 3.7 QUALITATIVE ANALYSIS: DANCING WITH SKULLS
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.
# 4 RELATED WORK
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).
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).
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).
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).
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.
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.
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.
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.
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).
# 5 DISCUSSION
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.
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.
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.
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.
Solving this and similar problems that require high level exploration is an important direction for future work.
# REFERENCES
Joshua Achiam and Shankar Sastry. Surprise-based intrinsic motivation for deep reinforcement learning. arXiv:1703.01732, 2017.
Joshua Achiam, Harrison Edwards, Dario Amodei, and Pieter Abbeel. Variational option discovery algorithms. arXiv preprint arXiv:1807.10299, 2018.
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.
Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In NIPS, 2016.
Marc G Bellemare, Will Dabney, and Remi Munos. A distributional perspective on reinforcement ´ learning. arXiv preprint arXiv:1707.06887, 2017.
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.
Richard Y Chen, John Schulman, Pieter Abbeel, and Szymon Sidor. UCB and infogain exploration via $q$ -ensembles. arXiv:1706.01502, 2017.
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.
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.
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.
Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint, 2018.
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.
Lior Fox, Leshem Choshen, and Yonatan Loewenstein. Dora the explorer: Directed outreaching reinforcement action-selection. International Conference on Learning Representations, 2018.
Justin Fu, John D Co-Reyes, and Sergey Levine. EX2: Exploration with exemplar models for deep reinforcement learning. NIPS, 2017.
Michał Garmulewicz, Henryk Michalewski, and Piotr Miłos. Expert-augmented actor-critic for ´ vizdoom and montezumas revenge. arXiv preprint arXiv:1809.03447, 2018.
Karol Gregor, Danilo Jimenez Rezende, and Daan Wierstra. Variational intrinsic control. ICLR Workshop, 2017.
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.
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.
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.
Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. VIME: Variational information maximizing exploration. In NIPS, 2016.
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.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015.
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.
Manuel Lopes, Tobias Lang, Marc Toussaint, and Pierre-Yves Oudeyer. Exploration in model-based reinforcement learning by empirically estimating learning progress. In NIPS, 2012.
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.
Marlos C Machado, Marc G Bellemare, and Michael Bowling. Count-based exploration with the successor representation. arXiv preprint arXiv:1807.11622, 2018.
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.
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.
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.
Brendan O’Donoghue, Ian Osband, Remi Munos, and Volodymyr Mnih. The uncertainty Bellman equation and exploration. arXiv preprint arXiv:1709.05380, 2017.
Junhyuk Oh, Yijie Guo, Satinder Singh, and Honglak Lee. Self-imitation learning. arXiv preprint arXiv:1806.05635, 2018.
OpenAI. OpenAI Five. https://blog.openai.com/openai-five/, 2018.
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.
Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped DQN. In NIPS, 2016.
Ian Osband, John Aslanides, and Albin Cassirer. Randomized prior functions for deep reinforcement learning. arXiv preprint arXiv:1806.03335, 2018.
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.
Pierre-Yves Oudeyer, Frdric Kaplan, and Verena V Hafner. Intrinsic motivation systems for autonomous mental development. Evolutionary Computation, 2007.
Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In ICML, 2017.
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.
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.
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.
Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pp. 1177–1184, 2008.
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.
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.
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.
Jurgen Schmidhuber. Curious model-building control systems. In ¨ Neural Networks, 1991. 1991 IEEE International Joint Conference on, pp. 1458–1463. IEEE, 1991a.
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.
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
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.
Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. NIPS Workshop, 2015.
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.
Susanne Still and Doina Precup. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, 2012.
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.
Sainbayar Sukhbaatar, Ilya Kostrikov, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. In ICLR, 2018.
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.
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.
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
# A APPENDIX
A.1 ADDITIONAL METHODOLOGICAL DETAILS
# A.1.1 REWARD AND OBSERVATION NORMALIZATION
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.
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.
# A.1.2 REINFORCEMENT LEARNING ALGORITHM
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.
# A.2 RND PSEUDO-CODE
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).
# Algorithm 1 RND pseudo-code
<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>
# A.3 PREPROCESSING DETAILS
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.
Table 1: Preprocessing details for the environments for all experiments.
<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>
Table 2: Preprocessing details for policy and value network for all experiments.
<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>
Table 3: Preprocessing details for target and predictor networks for all experiments.
<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>
# A.4 PPO AND RND HYPERPARAMETERS
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.
Table 4: Default hyperparameters for PPO and RND algorithms for experiments where applicable. Any differences to these defaults are detailed in the main text.
<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& 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>
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.
# A.5 ARCHITECTURES
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).
# A.6 ADDITIONAL EXPERIMENTAL RESULTS
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.
 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.
 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.
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.
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.
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)
<table><tr><td></td><td>Gravitar</td><td>Montezuma'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>
# A.7 ADDITIONAL EXPERIMENTAL DETAILS
In Table 6 we show the number of seeds used for each experiment, indexed by figure.
<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>
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385# SMOOTHING THE GEOMETRY OF PROBABILISTIC BOX EMBEDDINGS
Xiang $\mathbf { L i } ^ { * }$ , Luke Vilnis∗, Dongxu Zhang, Michael Boratko & Andrew McCallum College of Information and Computer Sciences University of Massachusetts Amherst
# ABSTRACT
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.
# 1 INTRODUCTION
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.
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.
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).
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.
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.
# 2 RELATED WORK
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.
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.
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).
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.
# 3 BACKGROUND
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.
 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.
# 3.1 PARTIAL ORDERS AND LATTICES
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$ ,
Reflexivity: $a \preceq a$ Antisymmetry: $a \preceq b \preceq a$ implies $a = b$ Transitivity: $a \preceq b \preceq c$ implies $a \preceq c$
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.
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.
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:
Idempotency: $a \wedge a = a \vee a = a$ Commutativity: $a \wedge b = b \wedge a$ and $a \vee b = b \vee a$ Associativity: $a \wedge b \wedge c = a \wedge ( b \wedge c )$ and $( a \lor b \lor c ) = a \lor ( b \lor c )$ Absorption: $a \vee ( a \wedge b ) = a$ and $a \wedge ( a \vee b ) = a$ Bounded: $\perp \preceq a \preceq \top$
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.
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.
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.
# 3.2 VECTOR LATTICE
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.
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 }$
$$\mathbf { x } \preceq \mathbf { y } \iff \forall i \in \{ 1 . . n \} , \ x _ { i } \leq y _ { i }$$
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.
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).
# 3.3 BOX LATTICE
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).
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
$$\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}$$
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 }$ .
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).
Figure 1c demonstrates a toy, two-dimensional example of the Box Embedding lattice representation of a simple ontology.
# 4 METHOD
# 4.1 MOTIVATION: OPTIMIZATION AND SPARSE DATA
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
$$p ( \mathbf { x } \wedge \mathbf { y } ) = m _ { h } ( \operatorname* { m i n } ( x _ { M } , y _ { M } ) - \operatorname* { m a x } ( x _ { m } , y _ { m } ) )$$
where $m _ { h }$ is the standard hinge function, $m _ { h } ( x ) = 0 \lor x = \operatorname* { m a x } ( 0 , x )$ .
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.
# 4.2 RELAXED GEOMETRY
 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.
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.
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:
$$p ( \mathbf { x } \wedge \mathbf { y } ) = \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( x ) \mathbb { 1 } _ { [ c , d ] } ( x ) d x$$
since the product has support (and is equal to 1) only in the areas where the two intervals overlap.
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.
Specifically, given $\mathbf { x } = [ a , b ]$ , we associate the smoothed indicator function
$$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$$
We then wish to evaluate, for two lattice elements $\mathbf { x }$ and $\mathbf { y }$ with associated smoothed indicators $f$ and $g$ ,
$$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$$
This integral admits a closed form solution.
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,
$$\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}$$
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 .
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). □
Note that, in the zero-temperature limit, as $\rho$ goes to zero, we recover the formula
$${ \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} }$$
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.
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.
More importantly, for practical considerations, if we are to treat the outputs of $p _ { \phi }$ as probabilities, the consequence is
$$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$$
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.
Recall that for the hinge function $m _ { h }$ and two intervals $( a , b )$ and $( c , d )$ , we have
$$\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 )$$
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.
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
$${ \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 )$$
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.
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
$$\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}$$
which satisfies the idempotency requirement, $p ( \mathbf { x } ) = p ( \mathbf { x } , \mathbf { x } )$
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
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
$$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 } ) }$$
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
$$\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}$$
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.
 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.
# 5 EXPERIMENTS
# 5.1 WORDNET
Table 4: Classification accuracy on WordNet test set.
<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>
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.
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.
# 5.2 IMBALANCED WORDNET
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.
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.
<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>
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.
# 5.3 FLICKR
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.
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.
# 5.4 MOVIELENS
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.
Table 6: KL and Pearson correlation between model and gold probability.
<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>
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.
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.
<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>
Table 7: Performance of the smoothed model, the original box model, and several baselines on MovieLens.
# 6 CONCLUSION AND FUTURE WORK
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.
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.
# 7 ACKNOWLEDGMENTS
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.
# REFERENCES
Ben Athiwaratkun and Andrew Gordon Wilson. Multimodal word distributions. In ACL, 2017.
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.
Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
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.
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.
Octavian-Eugen Ganea, Gary Becigneul, and Thomas Hofmann. Hyperbolic entailment cones for ´ learning hierarchical embeddings. ICML, 2018.
Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016a.
Caglar Gulcehre, Marcin Moczulski, Francesco Visin, and Yoshua Bengio. Mollifying networks. arXiv preprint arXiv:1608.04980, 2016b.
Tony Jebara, Risi Kondor, and Andrew Howard. Probability product kernels. Journal of Machine Learning Research, 5(Jul):819–844, 2004.
Alice Lai and Julia Hockenmaier. Learning to predict denotational probabilities for modeling entailment. In EACL, 2017.
Solomon Leader. Measures on semilattices. Pacific Journal of Mathematics, 39(2):407–423, 1971.
Xiang Li, Luke Vilnis, and Andrew McCallum. Improved representation learning for predicting commonsense ontologies. NIPS Workshop on Structured Prediction, 2017.
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2013.
Andriy Mnih and Geoffrey E Hinton. A scalable hierarchical distributed language model. In Advances in neural information processing systems, pp. 1081–1088, 2009.
Hossein Mobahi. Training recurrent neural networks by diffusion. arXiv preprint arXiv:1601.04114, 2016.
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.
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.
Gerard Salton, Anita Wong, and Chung-Shu Yang. A vector space model for automatic indexing. Communications of the ACM, 18(11):613–620, 1975.
Sandeep Subramanian and Soumen Chakrabarti. New embedded representations and evaluation protocols for inferring transitive relations. SIGIR 2018, 2018.
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.
Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. In ICLR, 2016.
Luke Vilnis and Andrew McCallum. Word representations via gaussian embedding. In ICLR, 2015.
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.
Adriaan C. Zaanen. Introduction to Operator Theory in Riesz Spaces. Springer Berlin Heidelberg, 1997. ISBN 9783642644870.
# Supplementary Material
# A PROOF OF GAUSSIAN OVERLAP FORMULA
We wish to evaluate, for two lattice elements $\mathbf { x }$ and $\mathbf { y }$ , with associated smoothed indicators $f$ and $g$
$$\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}$$
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
$$\phi ( z ; \sigma ^ { 2 } ) = { \frac { 1 } { \sigma { \sqrt { 2 \pi } } } } e ^ { { \frac { - z ^ { 2 } } { 2 \sigma ^ { 2 } } } }$$
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.
To evaluate equation 8, recall the identity (Jebara et al., 2004; Vilnis & McCallum, 2015)
$$\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 } )$$
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
$$\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}$$
and therefore, with $\sigma = \tau ^ { - 1 }$
$$\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}$$
as desired.
# B MOVIELENS PSEUDOSPARSITY
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.
# C MOVIELENS INITIALIZATION SENSITIVITY
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.
 Figure 1: Distribution of probabilities in MovieLens Dataset.
<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>
Table 8: Performance of the original box model and smoothed box model on MovieLens, as a function of different degrees of disjointness upon initialization.
# D MODEL PARAMETERS
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.
# D.1 WORDNET PARAMETERS
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.
# D.2 IMBALANCED WORDNET PARAMETERS
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.
# D.3 FLICKR PARAMETERS
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.
# D.4 MOVIELENS PARAMETERS
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342# ADVERSARIAL DROPOUT REGULARIZATION
Kuniaki Saito1, Yoshitaka Ushiku1, Tatsuya Harada1,2, and Kate Saenko3
1The University of Tokyo, 2RIKEN, 3Boston University {k-saito,ushiku,harada}@mi.t.u-tokyo.ac.jp, saenko@bu.edu
# ABSTRACT
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.
# 1 INTRODUCTION
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.
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.
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.
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).
 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.
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.
# 2 RELATED WORK
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.
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.
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.
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.
# 3 METHOD
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 }$ .
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.
# 3.1 CLASSIFIER SELECTION VIA DROPOUT
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.
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.
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
$$d ( p _ { 1 } , p _ { 2 } ) = { \frac { 1 } { 2 } } ( D _ { k l } ( p _ { 1 } | p _ { 2 } ) + D _ { k l } ( p _ { 2 } | p _ { 1 } ) )$$
 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.
where KL divergence between $p$ and $q$ is denoted as $D _ { k l } ( p | q )$ .
# 3.2 TRAINING PROCEDURE
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.
The training within the same mini-batch consists of the following three steps.
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
$$\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 }$$
$C ( G ( \mathbf { x _ { s } } ) ) _ { k }$ returns the probability that the sample $\mathbf { x _ { s } }$ is assigned to class $k$
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.
$$\operatorname* { m i n } _ { C } L ( X _ { s } , Y _ { s } ) - L _ { a d v } ( X _ { t } )$$
$$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 } } ) ) ) ]$$
$C _ { 1 }$ and $C _ { 2 }$ are sampled from $C$ randomly.
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.
$$\operatorname* { m i n } _ { G } L _ { a d v } ( X _ { t } )$$
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.
 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.
# 3.3 INSIGHT AND IMPROVEMENT
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.
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.
# 4 EXPERIMENTS
# 4.1 EXPERIMENT ON TOY DATA
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.
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 \%$ .
 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.
# 4.2 UNSUPERVISED DOMAIN ADAPTATION FOR CLASSIFICATION
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.
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.
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.
 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.
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.
<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 & 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 & 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>
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.
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.
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.
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.
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.
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.
<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>
 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.
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)).
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.
# 5 CONCLUSION
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.
<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>
 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. 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.
We also show how to apply our method to train Generative Adversarial Networks for semisupervised learning in the appendix.
# 6 ACKNOWLEDGEMENTS
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.
# REFERENCES
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.
Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks. In NIPS, 2016.
Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. In CVPR, 2017.
Olivier Chapelle and Alexander Zien. Semi-supervised classification by low density separation. In AISTATS, 2005.
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.
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.
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.
Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, 2014.
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.
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.
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2014b.
Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In NIPS, 2005.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
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.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
Thorsten Joachims. Transductive inference for text classification using support vector machines. In ICML, 1999.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
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.
Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS, 2016.
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015a.
Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. In ICML, 2015b.
Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Unsupervised domain adaptation with residual transfer networks. In NIPS, 2016.
Mingsheng Long, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In ICML, 2017.
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.
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(Nov):2579– 2605, 2008.
Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. 2016.
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.
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.
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.
Stephan R Richter, Vibhav Vineet, Stefan Roth, and Vladlen Koltun. Playing for data: Ground truth from computer games. In ECCV, 2016.
Kuniaki Saito, Yoshitaka Ushiku, and Tatsuya Harada. Asymmetric tri-training for unsupervised domain adaptation. In ICML, 2017.
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016.
Ozan Sener, Hyun Oh Song, Ashutosh Saxena, and Silvio Savarese. Learning transferrable representations for unsupervised domain adaptation. In NIPS, 2016.
Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
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.
Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In ECCV 2016 Workshops, 2016.
Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In AAAI, 2016.
Yaniv Taigman, Adam Polyak, and Lior Wolf. Unsupervised cross-domain image generation. In ICLR, 2016.
Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In CVPR, 2017.
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.
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.
Fisher Yu, Vladlen Koltun, and Thomas Funkhouser. Dilated residual networks. In CVPR, 2017.
# APPENDIX
# A ENTROPY BASED METHOD FOR DOMAIN ADAPTATION (ENT)
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.
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.
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.
$$\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}$$
$$H [ p ( y | x ) ] = - \sum _ { k = 1 } ^ { K } p ( y = k | x ) \log p ( y = k | x )$$
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.
# B DIGITS CLASSIFICATION TRAINING DETAIL
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.
# C OBJECT CLASSIFICATION TRAINING DETAIL
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:
$$\sigma = [ 0 . 1 , 0 . 0 5 , 0 . 0 1 , 0 . 0 0 0 1 , 0 . 0 0 0 0 1 ]$$
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.
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.
 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.
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.
# D SEGMENTATION EXPERIMENTS
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.
 Figure 8: Overview of architecture for semantic segmentation
# E SEMI-SUPERVISED LEARNING USING GANS
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.
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:
$$\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 ) ]$$
$$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 } } ) ) ) ]$$
 Figure 10: Examples of generated images.
<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>
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.
$$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 } } ) ) ) ]$$
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.
The objective of $G$ is as follows,
$$\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 }$$
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.
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.
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.
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691# Convergence Properties of Deep Neural Networks on Separable Data
Anonymous authors Paper under double-blind review
# Abstract
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.
# 1 Introduction
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.
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.
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.
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:
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?
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.
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.
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.
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.
# 2 Setup and notations
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).
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
$$P _ { t } ( x ) : = o ( u _ { t } ( x ) ) : = o ( Z _ { t } ^ { T } ( W _ { t } x ) _ { + } ) ,$$
 Figure 1: Network Architecture
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).
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
(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$
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.
# 3 Learning dynamics for binary cross-entropy
In this section, we focus on the case of the binary cross-entropy loss
$$\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}$$
and train our network using stochastic gradient descent to minimize $L _ { B C E }$
# 3.1 Independent modes of learning
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 \}$
(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$ .
(H3) The $i$ -th coordinate of $Z _ { 0 }$ is positive if $i \in \mathcal { Z } _ { 1 }$ , negative otherwise.
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.
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.
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.
# 3.2 Learning dynamics
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).
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 }$ ):
$$\begin{array} { r l r } { P _ { t } ( x _ { k } \in D _ { k } ) } & { { } = } & { \sigma ( u ( \| x _ { k } \| p _ { k } t ) ) , } \end{array}$$
where u is defined below. The classification curves are sigmoidal and can be found on Fig. 2 Right.
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
$$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 } } } } .$$
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 } |$ .
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
 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$ .
$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):
$$u ( t ) = ( \log + E i ) ^ { < - 1 > } ( 2 \| x \| t + \log ( u _ { 0 } ) + E i ( u _ { 0 } ) ) ,$$
where $E i$ is the exponential integral (Wiki., 2018) and ${ < - 1 > }$ denotes the inverse function.
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$ :
$$\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.$$
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). □
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.
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$ .
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.
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.
# 3.3 Phase diagram
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.
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)).
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.
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).
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.
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.
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.
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).
# 3.4 Relaxing Assumption (H2)
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):
$$\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 } } } .$$
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.
 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).
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).
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 }$
$$\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 .$$
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.
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.
# 4 On the hinge loss
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:
$$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 } } ) ) .$$
 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.
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:
Theorem 4.1. For $x \in D _ { 1 }$ (for $D _ { 2 }$ it is simply the opposite), the output $u ( t )$ of the network verifies
$$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 ) ) ,$$
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$
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. □
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.
# 5 Gradient Starvation
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
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.
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:
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,
$$P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } ) \le \frac { 1 } { 1 + e ^ { - \lambda \log ( \frac { 1 - \delta } { \delta } ) } } .$$
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
$$\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 } ) } } .$$
From $z _ { t } > 0$ , we see that $\beta _ { t }$ is an increasing function of time, which guarantees $\beta _ { t } > 0$ , and
$$\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 } .$$
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
$$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 } ) } } .$$
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. □
 Figure 5: Upper bound on $P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \ \in \ D _ { 1 } )$ as a function of $1 - \delta$ for different values of $\lambda$ .
Table 1: Gradient starvation
<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>
Table 2: Accuracy on the cats and dogs dataset (Real means the untouched test set)
<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>
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.
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.
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.
# 6 Related work
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.
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.
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.
# 7 Discussion
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.
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.
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.
# References
Madhu S. Advani and Andrew M. Saxe. High-dimensional dynamics of generalization error in neural networks. CoRR, abs/1710.03667, 2017.
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.
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.
P. Baldi and K. Hornik. Neural networks and principal component analysis: Learning from examples without local minima. Neural Networks, 2:53–58, 1989.
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.
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.
Tom M. Heskes and Bert Kappen. On-line learning processes in artificial neural networks, 1993.
S. Hochreiter and J. Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
Kaggle. Dogs vs. cats, 2018. URL https://www.kaggle.com/c/dogs-vs-cats.
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.
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.
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.
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.
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral Normalization for Generative Adversarial Networks, 2018. arXiv:1802.05957v1.
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.
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.
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.
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.
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.
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.
Tomaso Poggio, Ryan Rifkin, Sayan Mukherjee, and Partha Niyogi. General conditions for predictivity in learning theory. Nature, 428(6981):419–422, 2004.
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.
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.
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.
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.
Andrew Michael Saxe. Deep Linear Neural Networks: A Theory of Learning in the Brain and Mind. PhD thesis, Stanford University, 2015.
K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014.
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.
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.
Vladimir Naumovich Vapnik. Statistical Learning Theory. Wiley-Interscience, September 1998.
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.
Wiki. Exponential integral, 2018. URL https://en.wikipedia.org/wiki/Exponential_ integral.
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.
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.
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.
# Appendix A.
A.1 Proof of Lemma 3.1
In this section, we prove the following lemma:
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.
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:
$$\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 } ,$$
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). □
# A.2 Extension of Lemma 3.1 to multi-class classification
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
$$P _ { t } ( x ) : = \sigma ( F _ { t } ( x ) ) : = \sigma ( Z _ { t } ( W _ { t } x ) _ { + } ) ,$$
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.
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
(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$ . (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 }$ . (H6) $Z _ { 0 }$ is initialized randomly to positive numbers on the diagonal, and non-positive elsewhere.
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.
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).
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:
$$\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 } ,$$
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). □
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:
(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$ . (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$ .
The lemma then translates to those inequalities remaining true at any time $t \geq 0$ .
# A.3 Proofs for Theorem 3.2
In this section we develop the proof of Theorem 3.2 of the main text.
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
$$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 } } } } .$$
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
$$\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}$$
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
$$u ^ { \prime } ( t ) = { \frac { 2 \| x \| u ( t ) } { 1 + e ^ { u ( t ) } } } .$$
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
$$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 } ) ) ,$$
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
$$u _ { f } = u ( t ) = ( \log + E i ) ^ { < - 1 > } ( 2 \| x \| t + \log ( u _ { 0 } ) + E i ( u _ { 0 } ) ) .$$
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
$$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 } } } } ,$$
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$ .
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$
$$\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.$$
which concludes the proof for $c = 0$ .
From Eq. 14, we also see that
$$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 ) ,$$
where we used the inequality $\forall y \geq 0 , e ^ { \frac { y } { 2 } } > y$ . It eventually gives us
$$u ( t ) \leq 2 \log ( \| x \| t + e ^ { \frac { u _ { 0 } } { 2 } } ) ,$$
a result in line with convergence rates obtained in Soudry et al. (2017).
Let us now study the non-degenerate case. We apply the classic change of coordinates
$$\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}$$
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
$$( 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 } } ,$$
where the first equality used the system of equations Eq. 11. This gives us the dynamics of $\theta$ as
$$\theta ^ { \prime } = \frac { 2 \| x \| } { 1 + e ^ { c \sinh ( \theta ) / 2 \| x \| } } ,$$
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
$$t = \int _ { \theta _ { 0 } } ^ { \theta _ { f } } \frac { 1 + e ^ { c \sinh ( \theta ) / 2 \| x \| } } { 2 \| x \| } d \theta .$$
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. □
# A.4 Extension to h hidden neurons
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:
$$( 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 } } .$$
We similarly define $y _ { t } ^ { i } = w _ { t } ^ { i } x$ which brings
$$( 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 } } } .$$
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
$$( u _ { t } ^ { i } ) ^ { \prime } = \frac { 2 \| x \| u _ { t } ^ { i } } { 1 + e ^ { \sum _ { j \in \mathcal { T } _ { 1 } } u _ { t } ^ { j } } } ,$$
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.
# A.5 Proof of Corollary 3.3
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$ .
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
$$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 } ) ) ,$$
$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
$$\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}$$
$$\begin{array} { l } { \operatorname { i f } x \in D _ { 1 } , } \\ { \quad } \\ { \operatorname { i f } x \in D _ { 2 } . } \end{array}$$
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 }$ . □
# A.6 Top-left quadrant initialization
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
$$u ^ { \prime } ( t ) = \frac { - 2 \| x \| u ( t ) } { 1 + e ^ { u ( t ) } }$$
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
$$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 } ) .$$
$t$ diverges to $+ \infty$ as $\boldsymbol { u } _ { f }$ tends to 0 from below. The logit converges to 0 without ever reaching it.
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:
$$( 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 } } } .$$
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:
$$( 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 } } } .$$
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:
$$u ^ { \prime } ( t ) = \frac { 2 \sqrt { m } \lVert x \rVert u ( t ) } { 1 + e ^ { u ( t ) } } .$$
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.
# A.8 Relaxing assumption (H2)
Let us first recall that the assumption states:
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
$$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 } } } .$$
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
$$\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 } } } .$$
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.
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).
 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$ .
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 }$ :
$$\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 .$$
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.
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.
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.
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.
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.
# Appendix B: Deeper Neural Networks
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
$$P _ { t } ( x ) : = \sigma ( Z _ { t } ^ { T } ( Z _ { t } ^ { N - 2 } \cdot \cdot \cdot ( Z _ { t } ^ { 1 } ( W _ { t } x ) _ { + } ) _ { + } \cdot \cdot \cdot ) _ { + } ) ,$$
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:
$$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 ) } } ,$$
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
$$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 \| .$$
Combining those equations gives us the ODE verified by the logit of our system
$$u ^ { \prime } ( t ) = \frac { N \| x \| ^ { 2 / N } u ^ { 2 - 2 / N } ( t ) } { 1 + e ^ { u ( t ) } } .$$
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.
 Figure 7: Logit $u ( t )$ and confidence $P _ { t }$ for different number of layers and values of $\lVert x \rVert$ .
# Appendix C: Hinge Loss
# C.1 Proof of Theorem 4.1
In this section we prove Theorem 4.1 from the main text on the dynamics of learning in the case of the Hinge loss:
$$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 } } ) ) .$$
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:
$$y _ { t } ^ { \prime } = \| x \| ^ { 2 } z _ { t } , \qquad z _ { t } ^ { \prime } = y _ { t } .$$
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
$$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 } ) ,$$
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.
# C.2 General treatment
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:
$$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 } .$$
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
$$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 .$$
# Appendix D: Gradient Starvation
In this section, we prove a relaxed version of Theorem 5.1 from the main text:
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
$$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 } ) } } .$$
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. □
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.
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 ^ { * } }$ ).
 Figure 8: Solution of Eq.26.
 Figure 9: Upper bound on $P _ { t ^ { * } } ( ( 0 , x _ { 2 } ) \in D _ { 1 } )$ as a function of $1 - \delta$ for different values of $\lambda$ .
Appendix E: Experimental Details
# E.1 Mixture of Gaussian experiment
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.
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.
# E.2 Dogs vs. Cats classification with light effect
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238# MULTI-AGENT COOPERATIONAND THE EMERGENCE OF (NATURAL) LANGUAGE
Angeliki Lazaridou1∗, Alexander Peysakhovich2, Marco Baroni2,3 1Google DeepMind, 2Facebook AI Research, 3University of Trento angeliki@google.com, {alexpeys,mbaroni}@fb.com
# ABSTRACT
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.
# 1 INTRODUCTION
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.
Ted Chiang, Story of Your Life
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.
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).
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.
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)?
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.
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.
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.
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.
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.
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.
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.
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.
# 2 GENERAL FRAMEWORK
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.
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 \}$ 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 )$ 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$ 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 } \}$ 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).
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.
# 3 EXPERIMENTAL SETUP
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 )$ .
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).
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.
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).
 Figure 1: Architectures of agent players.
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.
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.
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.
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.
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.
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.
# 4 LEARNING TO COMMUNICATE
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).
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
 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.
<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>
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.
converge to coordination quite fast, but the informed sender reaches higher levels more quickly than the agnostic one.
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).
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.
 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.
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.
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.
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).
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.
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.
# 4.1 OBJECT-LEVEL REFERENCE
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
<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>
Table 2: Playing the referential game with image-level targets: test results after 50K training plays. Columns as in Table 1. All purity values significant at $p < 0 . 0 0 1$ .
turn now to a simple way to tweak the game setup in order to encourage the agents to further pursue high-level semantics.
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).
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.
# 5 GROUNDING AGENTS’ COMMUNICATION IN HUMAN LANGUAGE
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.
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.
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.
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.
 Figure 4: Example pairs from the ReferItGame set, with word produced by sender. Target images framed in green.
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 \%$ ).
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 \%$ ).
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.
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.
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.
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.
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.
# 6 DISCUSSION
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.
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.
# REFERENCES
John Langshaw Austin. How to do things with words. Harvard University Press, Cambridge, MA, 1962.
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.
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.
Ted Briscoe (ed.). Linguistic evolution through language acquisition. Cambridge University Press, Cambridge, UK, 2002.
Angelo Cangelosi and Domenico Parisi (eds.). Simulating the evolution of language. Springer, New York, 2002.
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.
Herbert H Clark. Using language. 1996. Cambridge University Press: Cambridge), 952:274–296, 1996.
Vincent Crawford. A survey of experiments on communication via cheap talk. Journal of Economic theory, 78(2):286–298, 1998.
Vincent P Crawford and Joel Sobel. Strategic information transmission. Econometrica: Journal of the Econometric Society, pp. 1431–1451, 1982.
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.
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.
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.
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.
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.
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.
David Lewis. Convention. Harvard University Press, Cambridge, MA, 1969.
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.
Tomas Mikolov, Armand Joulin, and Marco Baroni. A roadmap towards machine intelligence. arXiv preprint arXiv:1511.08130, 2015.
James Pustejovsky. The Generative Lexicon. MIT Press, Cambridge, MA, 1995.
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.
Ariel Rubinstein. The electronic mail game: Strategic behavior under ‘almost common knowledge’. The American Economic Review, pp. 385–391, 1989.
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.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Brian Skyrms. Signals: Evolution, learning, and information. Oxford University Press, 2010.
Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. Cognitive Science, 2016. In press.
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.
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.
Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. arXiv preprint arXiv:1605.07736, 2016.
Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to sequence learning with neural networks. In Proceedings of NIPS, pp. 3104–3112, Montreal, Canada, 2014.
Richard Sutton and Andrew Barto. Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA, 1998.
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research, 9(2579-2605), 2008.
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.
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.
S. I. Wang, P. Liang, and C. Manning. Learning language games through interaction. In Association for Computational Linguistics (ACL), 2016.
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
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.
Ludwig Wittgenstein. Philosophical Investigations. Blackwell, Oxford, UK, 1953. Translated by G.E.M. Anscombe.
Michael Wooldridge. An introduction to multiagent systems. John Wiley & Sons, 2009.
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.
Matthew Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Proceedings of ECCV (Part 1), pp. 818–833, Zurich, Switzerland, 2014.
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/-iu9-C_lan/-iu9-C_lan.mdAdded+373
md/train/33TBJachvOX/33TBJachvOX.mdAdded+322
md/train/5Ya8PbvpZ9/5Ya8PbvpZ9.mdAdded+314
md/train/6UdQLhqJyFD/6UdQLhqJyFD.mdAdded+412
md/train/AuVKs6JmBtY/AuVKs6JmBtY.mdAdded+240
md/train/B1e9Y2NYvS/B1e9Y2NYvS.mdAdded+318
md/train/B1lKS2AqtX/B1lKS2AqtX.mdAdded+299
md/train/BklSv34KvB/BklSv34KvB.mdAdded+275
md/train/BydrOIcle/BydrOIcle.mdAdded+463
md/train/GvqjmSwUxkY/GvqjmSwUxkY.mdAdded+359
md/train/H1exf64KwH/H1exf64KwH.mdAdded+426
md/train/H1lJJnR5Ym/H1lJJnR5Ym.mdAdded+386
md/train/H1xSNiRcF7/H1xSNiRcF7.mdAdded+385
md/train/HJIoJWZCZ/HJIoJWZCZ.mdAdded+342
md/train/HJfQrs0qt7/HJfQrs0qt7.mdAdded+691
md/train/Hk8N3Sclg/Hk8N3Sclg.mdAdded+238
md/train/HkepKG-Rb/HkepKG-Rb.mdAdded
md/train/Hyl7ygStwB/Hyl7ygStwB.mdAdded
md/train/Hyx4knR9Ym/Hyx4knR9Ym.mdAdded
md/train/J28lNO4p3ki/J28lNO4p3ki.mdAdded
md/train/J4gRj6d5Qm/J4gRj6d5Qm.mdAdded
md/train/JHcqXGaqiGn/JHcqXGaqiGn.mdAdded
md/train/K9uApq7iyyI/K9uApq7iyyI.mdAdded
md/train/KBnXrODoBW/KBnXrODoBW.mdAdded
md/train/OJiM1R3jAtZ/OJiM1R3jAtZ.mdAdded
md/train/Oa9RlXNggGy/Oa9RlXNggGy.mdAdded
md/train/S1ejj64YvS/S1ejj64YvS.mdAdded
md/train/S1m6h21Cb/S1m6h21Cb.mdAdded
md/train/SJlJSaEFwS/SJlJSaEFwS.mdAdded
md/train/Sk9yuql0Z/Sk9yuql0Z.mdAdded
md/train/SkaPsfZ0W/SkaPsfZ0W.mdAdded
md/train/SkeAaJrKDS/SkeAaJrKDS.mdAdded
md/train/Sy0GnUxCb/Sy0GnUxCb.mdAdded
md/train/Syx79eBKwr/Syx79eBKwr.mdAdded
md/train/SyxtJh0qYm/SyxtJh0qYm.mdAdded
md/train/UVH3Ucewd-IXZ/UVH3Ucewd-IXZ.mdAdded
md/train/ZUvaSolQZh3/ZUvaSolQZh3.mdAdded
md/train/b4YiFnQH3gN/b4YiFnQH3gN.mdAdded
md/train/hbHkvGBZB9/hbHkvGBZB9.mdAdded
md/train/jCxDyge46t2/jCxDyge46t2.mdAdded
md/train/r1gIdySFPH/r1gIdySFPH.mdAdded
md/train/r1gzoaNtvr/r1gzoaNtvr.mdAdded
md/train/r1lZ7AEKvB/r1lZ7AEKvB.mdAdded
md/train/rJlEojAqFm/rJlEojAqFm.mdAdded
md/train/rJzIBfZAb/rJzIBfZAb.mdAdded
md/train/rkQkBnJAb/rkQkBnJAb.mdAdded
md/train/ryfz73C9KQ/ryfz73C9KQ.mdAdded
md/train/ryxwJhC9YX/ryxwJhC9YX.mdAdded
md/train/ucEXZQncukK/ucEXZQncukK.mdAdded
md/train/wXgk_iCiYGo/wXgk_iCiYGo.mdAdded