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/0-EYBhgw80y/0-EYBhgw80y.mdAdded+332
- md/train/3SV-ZePhnZM/3SV-ZePhnZM.mdAdded+317
- md/train/519VBzfEaKW/519VBzfEaKW.mdAdded+219
- md/train/6xHJ37MVxxp/6xHJ37MVxxp.mdAdded+331
- md/train/AAes_3W-2z/AAes_3W-2z.mdAdded+487
- md/train/AYAgKFl78z/AYAgKFl78z.mdAdded+359
- md/train/B14rPj0qY7/B14rPj0qY7.mdAdded+206
- md/train/B1xwcyHFDr/B1xwcyHFDr.mdAdded
- md/train/BJMvBjC5YQ/BJMvBjC5YQ.mdAdded+428
- md/train/BJgPCveAW/BJgPCveAW.mdAdded+163
- md/train/Byk-VI9eg/Byk-VI9eg.mdAdded+345
- md/train/DHSNrGhAY7W/DHSNrGhAY7W.mdAdded
- md/train/H1gDNyrKDS/H1gDNyrKDS.mdAdded+496
- md/train/H1ldzA4tPr/H1ldzA4tPr.mdAdded+329
- md/train/H1xQSjCqFQ/H1xQSjCqFQ.mdAdded+264
- md/train/Hke12T4KPS/Hke12T4KPS.mdAdded+385
- md/train/Hkla1eHFvS/Hkla1eHFvS.mdAdded+519
- md/train/HkxStoC5F7/HkxStoC5F7.mdAdded+443
- md/train/HwGNkx1WcIs/HwGNkx1WcIs.mdAdded
- md/train/Hyewf3AqYX/Hyewf3AqYX.mdAdded
- md/train/JUgC3lqn6r2/JUgC3lqn6r2.mdAdded
- md/train/KJSC_AsN14/KJSC_AsN14.mdAdded
- md/train/S1X7nhsxl/S1X7nhsxl.mdAdded
- md/train/S1xh5sYgx/S1xh5sYgx.mdAdded
- md/train/SkFEGHx0Z/SkFEGHx0Z.mdAdded
- md/train/Svfh1_hYEtF/Svfh1_hYEtF.mdAdded
- md/train/Sy4lojC9tm/Sy4lojC9tm.mdAdded
- md/train/SyGjjsC5tQ/SyGjjsC5tQ.mdAdded
- md/train/SyMDXnCcF7/SyMDXnCcF7.mdAdded
- md/train/Syx7A3NFvH/Syx7A3NFvH.mdAdded
- md/train/aLE2sEtMNXv/aLE2sEtMNXv.mdAdded
- md/train/auGY2UQfhSu/auGY2UQfhSu.mdAdded
- md/train/dvSExzhjG9D/dvSExzhjG9D.mdAdded
- md/train/iktA2PtTRsK/iktA2PtTRsK.mdAdded
- md/train/jLHWRxwc7_f/jLHWRxwc7_f.mdAdded
- md/train/jQSBcVURlpW/jQSBcVURlpW.mdAdded
- md/train/ks5nebunVn_/ks5nebunVn_.mdAdded
- md/train/mEdwVCRJuX4/mEdwVCRJuX4.mdAdded
- md/train/r1gR2sC9FX/r1gR2sC9FX.mdAdded
- md/train/r1kGbydxg/r1kGbydxg.mdAdded
- md/train/r1xwKoR9Y7/r1xwKoR9Y7.mdAdded
- md/train/rJVorjCcKQ/rJVorjCcKQ.mdAdded
- md/train/rJbbOLcex/rJbbOLcex.mdAdded
- md/train/rkxoh24FPH/rkxoh24FPH.mdAdded
- md/train/rkzfuiA9F7/rkzfuiA9F7.mdAdded
- md/train/rkzjUoAcFX/rkzjUoAcFX.mdAdded
- md/train/rqfq0CYIekd/rqfq0CYIekd.mdAdded
- md/train/ryxhB3CcK7/ryxhB3CcK7.mdAdded
- md/train/vQTYEUtSUr/vQTYEUtSUr.mdAdded
- md/train/vujTf_I8Kmc/vujTf_I8Kmc.mdAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332# MOPRO: WEBLY SUPERVISED LEARNING WITHMOMENTUM PROTOTYPES
Junnan Li, Caiming Xiong, Steven C.H. Hoi Salesforce Research {junnan.li,cxiong,shoi}@salesforce.com
# ABSTRACT
We propose a webly-supervised representation learning method that does not suffer from the annotation unscalability of supervised learning, nor the computation unscalability of self-supervised learning. Most existing works on weblysupervised representation learning adopt a vanilla supervised learning method without accounting for the prevalent noise in the training data, whereas most prior methods in learning with label noise are less effective for real-world large-scale noisy data. We propose momentum prototypes (MoPro), a simple contrastive learning method that achieves online label noise correction, out-of-distribution sample removal, and representation learning. MoPro achieves state-of-the-art performance on WebVision, a weakly-labeled noisy dataset. MoPro also shows superior performance when the pretrained model is transferred to down-stream image classification and detection tasks. It outperforms the ImageNet supervised pretrained model by $+ 1 0 . 5$ on 1-shot classification on VOC, and outperforms the best self-supervised pretrained model by $+ 1 7 . 3$ when finetuned on $1 \%$ of ImageNet labeled samples. Furthermore, MoPro is more robust to distribution shifts. Code and pretrained models are available at https://github.com/ salesforce/MoPro.
# 1 INTRODUCTION
Large-scale datasets with human-annotated labels have revolutionized computer vision. Supervised pretraining on ImageNet (Deng et al., 2009) has been the de facto formula of success for almost all state-of-the-art visual perception models. However, it is extremely labor intensive to manually annotate millions of images, which makes it a non-scalable solution. One alternative to reduce annotation cost is self-supervised representation learning, which leverages unlabeled data. However, self-supervised learning methods (Goyal et al., 2019; He et al., 2019; Chen et al., 2020a; Li et al., 2020b) have yet consistently shown superior performance compared to supervised learning, especially when transferred to downstream tasks with limited labels.
With the help of commercial search engines, photo-sharing websites, and social media platforms, there is near-infinite amount of weakly-labeled images available on the web. Several works have exploited the scalable source of web images and demonstrated promising results with weblysupervised representation learning (Mahajan et al., 2018; Sun et al., 2017; Li et al., 2017; Kolesnikov et al., 2020). However, there exists two competing claims on whether weakly-labeled noisy datasets lead to worse generalization performance. One claim argues that the effect of noise can be overpowered by the scale of data, and simply applies standard supervised learning method on web datasets (Mahajan et al., 2018; Sun et al., 2017; Li et al., 2017; Kolesnikov et al., 2020). The other claim argues that deep models can easily memorize noisy labels, resulting in worse generalization (Zhang et al., 2017; Ma et al., 2018). In this paper, we show that both claims are partially true. While increasing the size of data does improve the model’s robustness to noise, our method can substantially boost the representation learning performance by addressing noise.
There exists a large body of literature on learning with label noise (Jiang et al., 2018; Han et al., 2018; Guo et al., 2018; Tanaka et al., 2018; Arazo et al., 2019; Li et al., 2020a). However, existing methods have several limitations that make them less effective for webly-supervised representation learning. First, most methods do not consider out-of-distribution (OOD) samples, which is a major source of noise in real-world web datasets. Second, many methods perform computation-heavy procedures for noise cleaning (Jiang et al., 2018; Li et al., 2019; 2020a), or require access to a set of samples with clean labels (Vahdat, 2017; Veit et al., 2017; Lee et al., 2018), which limit their scalability in practice.
 Figure 1: Illustration of the normalized embedding space learned with MoPro. Samples from the same class gather around their class prototype, whereas OOD samples are separated from in-distribution samples. Label correction and OOD removal are achieved based on a sample’s distance with the prototypes.
We propose a new method for efficient representation learning from weakly-labeled web images. Our method is inspired by recent developments in contrastive learning for self-supervised learning (He et al., 2019; Chen et al., 2020a; Li et al., 2020b) We introduce Momentum Prototypes (MoPro), a simple component which is effective in label noise correction, OOD sample removal, and representation learning. A visual explanation of our method is shown in Figure 1. We use a deep network to project images into normalized low-dimensional embeddings, and calculate the prototype for a class as the moving-average embedding for clean samples in that class. We train the network such that embeddings are pulled closer to their corresponding prototypes, while pushed away from other prototypes. Images with corrupted labels are corrected either as another class or as an OOD sample based on their distance to the momentum prototypes.
We experimentally show that:
• MoPro achieves state-of-the-art performance on the upstream weakly-supervised learning task. • MoPro substantially improves representation learning performance when the pretrained model is transferred to downstream image classification and object detection tasks. For the first time, we show that weakly-supervised representation learning achieves similar performance as supervised representation learning, under the same data and computation budget. With a larger web dataset, MoPro outperforms ImageNet supervised learning by a large margin. • MoPro learns a more robust and calibrated model that generalizes better to distribution variations.
# 2 RELATED WORK
# 2.1 WEBLY-SUPERVISED REPRESENTATION LEARNING
A number of prior works exploit large web datasets for visual representation learning (Divvala et al., 2014; Chen & Gupta, 2015; Joulin et al., 2016; Mahajan et al., 2018; Sun et al., 2017; Li et al., 2017; Kolesnikov et al., 2020). These datasets contain a considerable amount of noise. Approximately $20 \%$ of the labels in the JMT-300M dataset (Sun et al., 2017) are noisy, whereas $34 \%$ of images in the WebVision dataset (Li et al., 2017) are considered outliers. Surprisingly, most prior works have chosen to ignore the noise and applied vanilla supervised method, with the claim that the scale of data can overpower the noise (Mahajan et al., 2018; Sun et al., 2017; Li et al., 2017). However, we show that supervised method cannot fully harvest the power of large-scale weakly-labeled datasets.
Our method achieves substantial improvement by addressing noise, and advances the potential of webly-supervised representation learning.
# 2.2 LEARNING WITH LABEL NOISE
Learning with label noise has been widely studied. Some methods require access to a small set of clean samples (Xiao et al., 2015; Vahdat, 2017; Veit et al., 2017; Lee et al., 2018; Zhang et al., 2020), and other methods assume that no clean labels are available. There exist two major types of approaches. The first type performs label correction using predictions from the network (Reed et al., 2015; Ma et al., 2018; Tanaka et al., 2018; Yi & Wu, 2019; Yang et al., 2020). The second type separates clean samples from corrupted samples, and trains the model on clean samples (Han et al., 2018; Arazo et al., 2019; Jiang et al., 2018; Wang et al., 2018; Chen et al., 2019; Li et al., 2020a). However, existing methods have yet shown promising results for large-scale weakly-supervised representation learning. The main reasons include: (1) most methods do not consider OOD samples, which commonly occur in real-world web datasets; (2) most methods are computational-heavy due to co-training (Han et al., 2018; Li et al., 2020a; Jiang et al., 2018; 2020), iterative training (Tanaka et al., 2018; Yi & Wu, 2019; Wang et al., 2018; Chen et al., 2019), or meta-learning (Li et al., 2019; Zhang et al., 2019).
Different from existing methods, MoPro achieves both label correction and OOD sample removal on-the-fly with a single step, based on the similarity between an image embedding and the momentum prototypes. MoPro also leverages contrastive learning to learn a robust embedding space.
# 2.3 SELF-SUPERVISED REPRESENTATION LEARNING
Self-supervised methods have been proposed for representation learning using unlabeled data. The recent developments in self-supervised representation learning can be attributed to contrastive learning. Most methods (He et al., 2019; Chen et al., 2020a; Oord et al., 2018; Wu et al., 2018) leverage the task of instance discrimination, where augmented crops from the same source image are enforced to have similar embeddings. Prototypical contrastive learning (PCL) (Li et al., 2020b) performs clustering to find prototypical embeddings, and enforces an image embedding to be similar to its assigned prototypes. Different from PCL, we update prototypes on-the-fly in a weakly-supervised setting, where the momentum prototype of a class is the moving average of clean samples’ embeddings. Furthermore, we jointly optimize two contrastive losses and a cross-entropy loss.
Current self-supervised representation learning methods are limited in (1) inferior performance in low-shot task adaptation, (2) huge computation cost, and (3) inadequate to harvest larger datasets. We show that weakly-supervised learning with MoPro addresses these limitations.
# 3 METHOD
In this section, we delineate the details of our method. First, we introduce the components in our representation learning framework. Then, we describe the loss functions. Finally, we explain the noise correction procedure for label correction and OOD sample removal. A pseudo-code of MoPro is provided in appendix B.
# 3.1 REPRESENTATION LEARNING FRAMEWORK
Our proposed framework consists of the following components. Figure 2 gives an illustration.
• A noisy training dataset $\{ ( \pmb { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , where $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ is an image and $y _ { i } \in \{ 1 , . . . , K \}$ is its class label. • A pseudo-label $\hat { y } _ { i }$ for each image $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , which is its corrected label. Details for generating the pseudo-label is explained in Sec 3.3. • An encoder network, which maps an augmented image $\tilde { \mathbf { x } } _ { i }$ to a representation vector $\pmb { v } _ { i } \in \mathbb { R } ^ { d _ { e } }$ . We experiment with ResNet-50 (He et al., 2016) as the encoder, where the activations of the final global pooling layer $\langle d _ { e } = 2 0 4 8 \rangle$ ) are used as the representation vector. • A classifier (a fully-connected layer followed by softmax) which receives the representation ${ \mathbf { } } v _ { i }$ as input and outputs class predictions $\mathbf { \nabla } p _ { i }$ .
 Figure 2: Proposed weakly-supervised learning framework. We jointly optimize a prototypical contrastive loss using momentum prototypes, an instance contrastive loss using momentum embeddings, and a cross-entropy loss using pseudo-labels. The pseudo-label for a sample is generated based on its original training label, the model’s prediction, and the sample’s distance to the prototypes.
• A projection network, which maps the representation ${ \mathbf { } } v _ { i }$ into a low-dimensional embedding $z _ { i } \in$ $\mathbb { R } ^ { \hat { d } _ { p } }$ $\bar { \boldsymbol { d } } _ { p } = 1 2 8 )$ . $z _ { i }$ is always normalized to the unit sphere. Following SimCLR (Chen et al., 2020a), we use a MLP with one hidden layer as the projection network. • Momentum embeddings $ { \boldsymbol { z } } _ { i } ^ { \prime }$ generated by a momentum encoder. The momentum encoder has the same architecture as the encoder followed by the projection network, and its parameters are the moving-average of the encoder’s and the projection network’s parameters. Same as in MoCo (He et al., 2019), we maintain a queue of momentum embeddings of past samples. • Momentum prototypes $C \in \mathbb { R } ^ { d _ { p } \times K }$ . The momentum prototype of the $k$ -th class, $\scriptstyle c _ { k }$ , is the normalized moving-average embedding for samples with pseudo-label ${ \hat { y } } _ { i } = k$ .
# 3.2 CONTRASTIVE LOSS
As illustrated in Figure 1, we aim to learn an embedding space where samples from the same class gather around its class prototype, while samples from different classes are seperated. We achieve it with two contrastive losses: (1) a prototypical contrastive loss $\mathcal { L } _ { \mathrm { { p r o } } }$ which increases the similarity between an embedding and its corresponding class prototype, $( z _ { i } , c _ { \hat { y } _ { i } } )$ , in contrast to other prototypes; (2) an instance contrastive loss ${ \mathcal { L } } _ { \mathrm { i n s } }$ which increases the similarity between two embeddings of the same source image, $( z _ { i } , z _ { i } ^ { \prime } )$ , in contrast to embeddings of other images. Specifically, the contrastive losses are defined as:
$$\mathcal { L } _ { \mathrm { p r o } } ^ { i } = - \log \frac { \exp ( z _ { i } \cdot c _ { \hat { y } _ { i } } / \tau ) } { \sum _ { k = 1 } ^ { K } \exp ( z _ { i } \cdot c _ { k } / \tau ) } , ~ \mathcal { L } _ { \mathrm { i n s } } ^ { i } = - \log \frac { \exp ( z _ { i } \cdot z _ { i } ^ { \prime } / \tau ) } { \sum _ { r = 0 } ^ { R } \exp ( z _ { i } \cdot z _ { r } ^ { \prime } / \tau ) } ,$$
where $\tau$ is a temperature parameter, and $\hat { y } _ { i }$ is the pseudo-label. We use $R$ negative momentum embeddings to construct the denominator of the instance contrastive loss.
We train the classifier with cross-entropy loss, using pseudo-labels as targets.
$$\mathcal { L } _ { \mathrm { c e } } ^ { i } = - \log ( p _ { i } ^ { \hat { y } _ { i } } )$$
We jointly optimize the contrastive losses and the classification loss. The training objective is:
$${ \mathcal { L } } = \sum _ { i = 1 } ^ { n } ( { \mathcal { L } } _ { \mathrm { c e } } ^ { i } + \lambda _ { \mathrm { p r o } } { \mathcal { L } } _ { \mathrm { p r o } } ^ { i } + \lambda _ { \mathrm { i n s } } { \mathcal { L } } _ { \mathrm { i n s } } ^ { i } )$$
For simplicity, we set $\lambda _ { \mathrm { p r o } } = \lambda _ { \mathrm { i n s } } = 1$ for all experiments.
# 3.3 NOISE CORRECTION
We propose a simple yet effective method for online noise correction during training, which cleans label noise and removes OOD samples. For each sample, we generate a soft pseudo-label $\pmb { q } _ { i }$ by
combining the classifier’s output probability $\mathbf { \nabla } _ { \mathbf { p } _ { i } }$ with $\mathbf { \boldsymbol { s } } _ { i }$ , a class probability distribution calculated using the sample’s similarity $w . r . t$ the momentum prototypes:
$$\begin{array} { l } { q _ { i } = \alpha { { p } _ { i } } + ( 1 - \alpha ) { { s } _ { i } } , } \\ { s _ { i } ^ { k } = \displaystyle \frac { \exp ( z _ { i } \cdot { { c } _ { k } } / \tau ) } { \sum _ { k = 1 } ^ { K } \exp ( z _ { i } \cdot { { c } _ { k } } / \tau ) } . } \end{array}$$
where the combination weight is simply set as $\alpha = 0 . 5$ in all experiments.
We convert $\pmb q _ { i }$ into a hard pseudo-label $\hat { y } _ { i }$ based on the following rules: (1) if the highest score of $\pmb q _ { i }$ is above certain threshold $T$ , use the class with the highest score as the pseudo-label; (2) otherwise, if the score for the original label $y _ { i }$ is higher than uniform probability, use $y _ { i }$ as the pseudo-label; (3) otherwise, label it as an OOD sample.
$$\begin{array} { r } { \hat { y } _ { i } = \left\{ \begin{array} { l l } { \mathrm { a r g } \operatorname* { m a x } _ { k } q _ { i } ^ { k } } & { \mathrm { i f } \operatorname* { m a x } _ { k } q _ { i } ^ { k } > T , } \\ { y _ { i } } & { \mathrm { e l s e i f } q _ { i } ^ { y _ { i } } > 1 / K , } \\ { \mathrm { O O D } } & { \mathrm { o t h e r w i s e } . } \end{array} \right. } \end{array}$$
We remove OOD samples from both the cross-entropy loss and the prototypical contrastive loss so that they do not affect class-specific learning, but include them in the instance contrastive loss to further separate them from in-distribution samples. Examples of OOD images and corrected pseudo-labels are shown in the appendices.
# 3.4 MOMENTUM PROTOTYPES
For each class $k$ , we calculate its momentum prototype as a moving-average of the normalized embeddings for samples with pseudo-label $k$ . Specifically, we update $c _ { k }$ by:
$$\begin{array} { r } { \boldsymbol { c } _ { k } \gets \mathrm { N o r m a l i z e } ( m \boldsymbol { c } _ { k } + ( 1 - m ) \boldsymbol { z } _ { i } ) , \forall i \in \{ i \mid \hat { y } _ { i } = k \} , } \end{array}$$
where ${ \mathrm { N o r m a l i z e } } ( c ) = c / \left\| c \right\| _ { 2 }$ . The momentum coefficient $m$ is set 0.999 in our experiments.
# 4 EXPERIMENTS
# 4.1 DATASET FOR UPSTREAM TRAINING
We use the WebVision (Li et al., 2017) dataset as the noisy training data. It consists of images automatically crawled from Google and Flickr, using visual concepts from ImageNet as queries. We experiment with three versions of WebVision with different sizes: (1) WebVision-V1.0 contains $2 . 4 4 \mathrm { m }$ images with the same classes as the ImageNet-1k (ILSVRC 2012) dataset; (2) WebVisionV0.5 is a randomly sampled subset of WebVision-V1.0, which contains the same number of images $( 1 . 2 8 \mathrm { m } )$ as ImageNet-1k; (3) WebVision- $. \mathrm { V } 2 . 0$ contains $1 6 \mathrm m$ images with 5k classes.
# 4.2 IMPLEMENTATION DETAILS
We follow standard settings for ImageNet training: batch size is 256; total number of epochs is 90; optimizer is SGD with a momentum of 0.9; initial learning rate is 0.1, decayed at 40 and 80 epochs; weight decay is 0.0001. We use ResNet-50 (He et al., 2016) as the encoder. For MoProspecific hyperparameters, we set $\tau = 0 . 1 , \alpha = 0 . 5 , T = 0 . 8$ $T = 0 . 6$ for WebVision-V2.0). The momentum for both the momentum encoder and momentum prototypes is set as 0.999. The queue to store momentum embeddings has a size of 8192. We apply standard data augmentation (crop and horizontal flip) to the encoder’s input, and stronger data augmentation (color changes in MoCo (He et al., 2019)) to the momentum encoder’s input. We warm-up the model for 10 epochs by training on all samples with original labels, before applying noise correction.
# 4.3 UPSTREAM TASK PERFORMANCE
In Table 1, we compare MoPro with existing weakly-supervised learning methods trained on WebVision-V1.0, where MoPro achieves state-of-the-art performance. Since the training dataset has imbalanced number of samples per-class, inspired by Kang et al. (2020), we perform the following decoupled training steps to re-balance the classifier: (1) pretrain the model with MoPro; (2) perform noise correction on the training data using the pretrained model, following the method in Section 3.3; (3) keep the pretrained encoder fixed and finetune the classifier on the cleaned dataset, using square-root data sampling (Mahajan et al., 2018) which balances the classes. We retrain the classifier for 15 epochs, using a learning rate of 0.01 which is decayed at 5 and 10 epochs. Surprisingly, we also find that a vanilla cross-entropy method with decoupled classifier re-balancing can also achieve competitive performance, outperforming most existing baselines.
Table 1: Comparison with state-of-the-art methods on WebVision-V1.0. Numbers denote accuracy $( \% )$ on the clean WebVision-V1.0 validation set and the ILSVRC 2012 validation set. CleanNet (Lee et al., 2018) and Distill (Zhang et al., 2020) require data with clean annotations.
<table><tr><td rowspan="2"></td><td rowspan="2">Architecture</td><td colspan="2">WebVision</td><td colspan="2">ImageNet</td></tr><tr><td>top-1</td><td>top-5</td><td>top-1</td><td>top-5</td></tr><tr><td>Cross-Entropy (Tu et al., 2020)</td><td>ResNet-50</td><td>66.4</td><td>83.4</td><td>57.7</td><td>78.4</td></tr><tr><td>MentorNet (Jiang et al.,2018)</td><td>InceptionResNet-V2</td><td>70.8</td><td>88.0</td><td>62.5</td><td>83.0</td></tr><tr><td>CurriculumNet (Guo et al., 2018)</td><td>Inception-V2</td><td>72.1</td><td>89.1</td><td>64.8</td><td>84.9</td></tr><tr><td>CleanNet (Lee et al.,2018)</td><td>ResNet-50</td><td>70.3</td><td>87.8</td><td>63.4</td><td>84.6</td></tr><tr><td>CurriculumNet (Guo et al., 2018; Tu et al., 2020)</td><td>ResNet-50</td><td>70.7</td><td>88.6</td><td>62.7</td><td>83.4</td></tr><tr><td>SOM (Tu et al., 2020)</td><td>ResNet-50</td><td>72.2</td><td>89.5</td><td>65.0</td><td>85.1</td></tr><tr><td>Distill (Zhang et al.,2020)</td><td>ResNet-50</td><td>1</td><td>-</td><td>65.8</td><td>85.8</td></tr><tr><td>Cross-Entropy (decoupled)</td><td>ResNet-50</td><td>72.4</td><td>89.0</td><td>65.7</td><td>85.1</td></tr><tr><td>MoPro (ours)</td><td>ResNet-50</td><td>73.9</td><td>90.0</td><td>67.8</td><td>87.0</td></tr></table>
# 5 TRANSFER LEARNING
In this section, we transfer weakly-supervised learned models to a variety of downstream tasks. We show that MoPro yields superior performance in image classification, object detection, instance segmentation, and obtains better robustness to domain shifts. Implementation details for the transfer learning experiments are described in appendix C.
# 5.1 LOW-SHOT IMAGE CLASSIFICATION ON FIXED REPRESENTATION
First, we transfer the learned representation to downstream tasks with few training samples. We perform low-shot classification on two datasets: PASCAL VOC2007 (Everingham et al., 2010) for object classification and Places205 (Zhou et al., 2014) for scene recognition. Following the setup by Goyal et al. (2019); Li et al. (2020b), we train linear SVMs using fixed representations from pretrained models. We vary the number $k$ of samples per-class and report the average result across 5 independent runs. Table 2 shows the results. When pretrained on weakly-labeled datasets, MoPro consistently outperforms the vanilla CE method. The improvement of MoPro becomes less significant when the number of web images increases from $2 . 4 \mathrm { m }$ to $1 6 \mathrm m$ , suggesting that increasing dataset size is a viable solution to combat noise.
Table 2: Low-shot image classification on VOC07 and Places205 using linear SVMs trained on fixed representations. We vary the number of labeled examples per-class $( k )$ , and report the average mAP (for VOC) and accuracy (for Places) across 5 independent runs. WebVision-V0.5 has the same number of training samples as ImageNet. The self-supervised learning methods∗ are trained for 200 epochs, while other methods are trained for 90 epochs. MoPro outperforms vanilla CE pretrained on Web datasets, as well as self-supervised learning and supervised learning methods pretrained on ImageNet.
<table><tr><td rowspan="2">Method</td><td rowspan="2">Pretrain dataset</td><td colspan="5">vOC07</td><td colspan="5">Places205</td></tr><tr><td>k=1</td><td>k=2</td><td>k=4</td><td>k=8</td><td>k=16|</td><td>k=1</td><td>k=2</td><td>k=4</td><td>k=8</td><td>k=16</td></tr><tr><td>MoCo v2* PCL v2*</td><td>ImageNet ImageNet</td><td>46.3 47.9</td><td>58.4 59.6</td><td>64.9 66.2</td><td>72.5 74.5</td><td>76.1 78.3</td><td>11.9 12.5</td><td>17.0 17.5</td><td>22.6 23.2</td><td>28.1 28.1</td><td>32.4 32.3</td></tr><tr><td>CE (Sup.)</td><td>ImageNet</td><td>54.3</td><td>67.8</td><td>73.9</td><td>79.6</td><td>82.3</td><td>14.9</td><td>21.0</td><td>26.9</td><td>32.1</td><td>36.0</td></tr><tr><td>CE MoPro (ours)</td><td>WebVision-V0.5</td><td>49.8 54.3</td><td>63.9 67.8</td><td>69.9</td><td>76.1</td><td>79.2</td><td>13.5</td><td>19.3</td><td>24.7</td><td>29.5</td><td>33.8</td></tr><tr><td>CE MoPro (ours)</td><td>WebVision-V1.0</td><td>54.5</td><td>67.1</td><td>73.5 72.8</td><td>79.2 78.4</td><td>81.8 81.4</td><td>15.0 15.1</td><td>21.2 21.5</td><td>26.6 27.2</td><td>31.8 32.1</td><td>36.0 36.4</td></tr><tr><td>CE MoPro (ours)</td><td>WebVision-V2.0</td><td>59.5 63.0 64.8 74.8</td><td>71.3 73.8 79.9</td><td>76.5 78.7</td><td>81.4 83.0</td><td>83.7 85.4</td><td>16.9 21.8 22.2</td><td>23.2 28.6</td><td>29.2 35.1</td><td>34.5 40.0</td><td>38.7 43.6</td></tr></table>
When compared with ImageNet pretrained models, MoPro substantially outperforms self-supervised learning (MoCo v2 (Chen et al., 2020b) and PCL v2 (Li et al., 2020b)), and achieves comparable performance with supervised learning when the same amount of web images (i.e. WebVision-V0.5) is used. Our results for the first time show that weakly-supervised representation learning can be as powerful as supervised representation learning under the same data and computation budget.
# 5.2 LOW-RESOURCE TRANSFER WITH FINETUNING
Next, we perform experiment to evaluate whether the pretrained model provides a good basis for finetuning when the downstream task has limited training data. Following the setup by Chen et al. (2020a), we finetune the pretrained model on $1 \%$ or $1 0 \%$ of ImageNet training samples. Table 3 shows the results. MoPro consistently outperforms CE when pretrained on Web datasets. Compared to self-supervised learning methods pretrained on ImageNet, weakly-supervised learning achieves significantly better performance with fewer number of epochs.
Surprisingly, pretraining on the larger WebVision-V2 leads to worse performance compared to ${ \mathrm { V } } 0 . 5$ and V1.0. This is because WebVision- $. \mathrm { V } 0 . 5$ and $\mathrm { V } 1 . 0$ contain the same 1k class as ImageNet, whereas V2 also contains $4 \mathrm { k }$ extra classes. Hence, the representations learned from V2 are less task-specific and more difficult to adapt to ImageNet, especially with only $1 \%$ of samples for finetuning. This suggests that if the classes for a downstream task are known a priori, it is more effective to curate a task-specific weakly-labeled dataset with the same classes.
Table 3: Low-resource finetuning on ImageNet. A pretrained model is finetuned with $1 \%$ or $10 \%$ of ImageNet training data. Weakly-supervised learning with MoPro substantially outperforms self-supervised learning methods: PCL (Li et al., 2020b), SimCLR (Chen et al., 2020a), BYOL (Grill et al., 2020), and SwAV (Caron et al., 2020). Result for random init. is from Zhai et al. (2019).
<table><tr><td></td><td>Pretrain Method</td><td>Pretrain dataset</td><td>#Pretrain epochs</td><td>Top-1 1% 10%</td><td>Top-5 1%</td><td>10%</td></tr><tr><td>Random init.</td><td>None</td><td>None</td><td>None</td><td>25.4 56.4</td><td>48.4</td><td>80.4</td></tr><tr><td rowspan="3">Self-supervised</td><td>PCL SimCLR</td><td>ImageNet</td><td>200 1000</td><td>48.8 48.3</td><td>62.9 75.3 65.6 75.5</td><td>85.6 87.8</td></tr><tr><td>BYOL</td><td></td><td>1000</td><td>53.2</td><td>68.8 78.4</td><td>89.0</td></tr><tr><td>SwAV</td><td></td><td>800</td><td>53.9</td><td>70.2 78.5</td><td>89.9</td></tr><tr><td rowspan="4">Weakly-supervised</td><td>CE MoPro (ours)</td><td>WebVision-V0.5</td><td>90</td><td>65.9 69.3</td><td>72.4 73.3</td><td>87.0 90.9 91.7</td></tr><tr><td>CE MoPro (ours)</td><td>WebVision-V1.0</td><td>90</td><td>67.6 73.5</td><td>89.1 88.3</td><td>91.7</td></tr><tr><td>CE</td><td></td><td></td><td>71.2 74.8 62.1 72.9</td><td>90.5 86.9</td><td>92.4</td></tr><tr><td>MoPro (ours)</td><td>WebVision-V2.0</td><td>90</td><td>65.3 73.7</td><td>88.2</td><td>91.4 92.1</td></tr></table>
# 5.3 OBJECT DETECTION AND INSTANCE SEGMENTATION
We further transfer the pretrained model to object detection and instance segmentation tasks on COCO (Lin et al., 2014). Following the setup by He et al. (2019), we use the pretrained ResNet-50 as the backbone for a Mask-RCNN (He et al., 2017) with FPN (Lin et al., 2017). We finetune all layers end-to-end, including BN. The schedule is the default $1 \times$ or $2 \times$ in Girshick et al. (2018) Table 4 shows the results. Weakly-supervised learning with MoPro outperforms both supervised learning on ImageNet and self-supervised learning on one billion Instagram images.
# 5.4 ROBUSTNESS
It has been shown that deep models trained on ImageNet lack robustness to out-of-distribution samples, often falsely producing over-confident predictions. Hendricks et al. have curated two benchmark datasets to evaluate models’ robustness to real-world distribution variation: (1) ImageNetR (Hendrycks et al., 2020) which contains various artistic renditions of object classes from the original ImageNet dataset, and (2) ImageNet-A (Hendrycks et al., 2019) which contains natural images where ImageNet-pretrained models consistently fail due to variations in background elements, color, or texture. Both datasets contain 200 classes, a subset of ImageNet’s 1,000 classes.
<table><tr><td>Method</td><td>Pretrain dataset</td><td>Apbb AP</td><td>AP</td><td>Apmk</td><td>AP</td><td>AP</td></tr><tr><td>random</td><td>None</td><td>31.0 49.5</td><td>33.2</td><td>28.5</td><td>46.8</td><td>30.4</td></tr><tr><td>CE (Sup.)</td><td>ImageNet</td><td>38.9 59.6</td><td>42.7</td><td>35.4</td><td>56.5</td><td>38.1</td></tr><tr><td>MoCo</td><td>Instagram-1B</td><td>38.9 59.4</td><td>42.3</td><td>35.4</td><td>56.5</td><td>37.9</td></tr><tr><td>CE</td><td>WebVision-V1.0</td><td>39.2 60.0</td><td>42.9</td><td>35.6</td><td>56.8</td><td>38.0</td></tr><tr><td>MoPro MoPro</td><td>WebVision-V2.0</td><td>39.7 (+0.8) 40.7 (+1.8)</td><td>60.9 (+1.3) 43.1 (+0.4)</td><td>36.1 (+0.7) 36.8 (+1.4)</td><td>57.5 (+1.0) 58.4 (+1.9)</td><td>38.6 (+0.5) )39.6 (+1.5)</td></tr><tr><td colspan="7">61.7 (+2.1) 44.5 (+1.8) (a) 1× schedule</td></tr><tr><td>Method</td><td>Pretrain dataset</td><td>Apbb AP</td><td>AP</td><td>Apmk</td><td></td><td></td></tr><tr><td>random</td><td>None</td><td>36.7</td><td>40.0</td><td>33.7</td><td>AP 53.8</td><td>AP 35.9</td></tr><tr><td>CE (Sup.)</td><td>ImageNet</td><td>40.6</td><td>44.4</td><td>36.8</td><td>58.1</td><td>39.5</td></tr><tr><td>MoCo</td><td>Instagram-1B</td><td>41.1</td><td>45.1</td><td>37.4</td><td>59.1</td><td>40.2</td></tr><tr><td>CE MoPro</td><td>WebVision-V1.0</td><td>40.9</td><td>44.7</td><td>37.2</td><td>58.7</td><td>40.1</td></tr><tr><td>MoPro</td><td>WebVision-V2.0</td><td>41.2 (+0.6) 41.8 (+1.2)</td><td>62.2 (+0.9) 45.0 (+0.6) 62.6 (+1.3) 45.6 (+1.2)</td><td>37.4 (+0.6) 37.8 (+1.0)</td><td>58.9 (+0.8) 59.5 (+1.4)</td><td>40.3 (+0.8) 40.6 (+1.1)</td></tr></table>
(a) $2 \times$ schedule
Table 4: Object detection and instance segmentation using Mask-RCNN with R50-FPN fine-tuned on COCO train2017. We evaluate bounding-box AP $( \mathsf { A P } ^ { \mathsf { b b } } )$ and mask AP $( \mathbf { A P } ^ { \mathrm { m k } } )$ on $\mathtt { v a l } 2 0 1 7$ . Weaklysupervised learning with MoPro outperforms both supervised learning on ImageNet and self-supervised learning (MoCo (He et al., 2019)) on one billion Instagram images. Table 5: Evaluation of model robustness on images with artistic and natural distribution shifts. Weakly supervised learning with MoPro leads to a more robust and well-calibrated model.
<table><tr><td rowspan="2">Method</td><td rowspan="2">Pretrain dataset</td><td colspan="2">ImageNet-R</td><td colspan="2">ImageNet-A</td></tr><tr><td>Accuracy (↑)</td><td>Calib. Error(↓)</td><td>Accuracy (↑)</td><td>Calib. Error (↓)</td></tr><tr><td>CE (Sup.)</td><td>ImageNet</td><td>36.14</td><td>19.66</td><td>0.03</td><td>62.50</td></tr><tr><td>CE</td><td rowspan="2">WebVision-V1.0</td><td>49.56</td><td>10.05</td><td>10.24</td><td>37.84</td></tr><tr><td>MoPro</td><td> 54.87</td><td> 5.73</td><td>11.93</td><td>35.85</td></tr></table>
We evaluate weakly-supervised trained models on these two robustness benchmarks. We report both accuracy and the $\ell _ { 2 }$ calibration error (Kumar et al., 2019). The calibration error measures the misalignment between a model’s confidence and its accuracy. Concretely, a well-calibrated classifier which give examples $80 \%$ confidence should be correct $80 \%$ of the time. Results are shown in Table 5. Webly-supervised learning show significantly higher accuracy and lower calibration error. The robustness to distribution shift could come from the higher diversity of samples in Web images. Compared to vanilla CE, MoPro further improves the model’s robustness on both datasets. Note that we made sure that the training data of WebVision does not overlap with the test data.
# 6 ABLATION STUDY
We perform ablation study to verify the effectiveness of three important components in MoPro: (1) prototypical contrastive loss ${ \mathcal { L } } _ { \mathrm { p r o } }$ , (2) instance contrastive loss ${ \mathcal { L } } _ { \mathrm { i n s } }$ , (3) prototypical similarity $\mathbf { \boldsymbol { s } } _ { i }$ used for noise correction (equation 4). We choose low-resource finetuning on $1 \%$ of ImageNet training data as the benchmark, and report the top-1 accuracy for models pretrained on WebVisionV0.5. As shown in Table 6, all of the three components contribute to the efficacy of MoPro.
# 7 CONCLUSION
This paper introduces a new contrastive learning framework for webly-supervised representation learning. We propose momentum prototypes, a simple component that is effective in label noise
<table><tr><td></td><td>MoPro</td><td>w/oLpro</td><td></td><td></td><td>w/o Linst |w/o si (i.e.α =1) | w/o Lpro & Linst &si</td><td>CE</td></tr><tr><td>ImageNet acc.</td><td>69.3</td><td>68.0</td><td>68.2 一</td><td>68.4</td><td>一 66.9</td><td>65.9</td></tr></table>
Table 6: Ablation study where different components are removed from MoPro. Models are pre-trained on WebVision-V0.5 and finetuned on $1 \%$ of ImageNet data.
correction, OOD sample removal, and representation learning. MoPro achieves state-of-the-art performance on the upstream task of learning from real-world noisy data, and superior representation learning performance on multiple down-stream tasks. Webly-supervised learning with MoPro does not require the expensive annotation cost in supervised learning, nor the huge computation budget in self-supervised learning. For future work, MoPro could be extended to utilize other sources of free Web data, such as weakly-labeled videos, for representation learning in other domains.
# REFERENCES
Eric Arazo, Diego Ortego, Paul Albert, Noel E. O’Connor, and Kevin McGuinness. Unsupervised label noise modeling and loss correction. In ICML, pp. 312–321, 2019. Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020. Pengfei Chen, Benben Liao, Guangyong Chen, and Shengyu Zhang. Understanding and utilizing deep neural networks trained with noisy labels. In ICML, pp. 1062–1070, 2019. Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020a. Xinlei Chen and Abhinav Gupta. Webly supervised learning of convolutional networks. In ICCV, pp. 1431–1439, 2015. Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b. Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Fei-Fei Li. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248–255, 2009. Santosh Kumar Divvala, Ali Farhadi, and Carlos Guestrin. Learning everything about anything: Webly-supervised visual concept learning. In CVPR, pp. 3270–3277, 2014. Mark Everingham, Luc Van Gool, Christopher K. I. Williams, John M. Winn, and Andrew Zisserman. The pascal visual object classes (VOC) challenge. International Journal of Computer Vision, 88(2):303–338, 2010. Rong-En Fan, Kai-Wei Chang, Cho-Jui Hsieh, Xiang-Rui Wang, and Chih-Jen Lin. LIBLINEAR: A library for large linear classification. JMLR, 9:1871–1874, 2008. Ross Girshick, Ilija Radosavovic, Georgia Gkioxari, Piotr Dollar, and Kaiming He. Detectron. ´ https://github.com/facebookresearch/detectron, 2018. Priya Goyal, Dhruv Mahajan, Abhinav Gupta, and Ishan Misra. Scaling and benchmarking selfsupervised visual representation learning. In ICCV, pp. 6391–6400, 2019. Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H. Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Remi Munos, and Michal Valko. Bootstrap your own ´ latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020. Sheng Guo, Weilin Huang, Haozhi Zhang, Chenfan Zhuang, Dengke Dong, Matthew R. Scott, and Dinglong Huang. Curriculumnet: Weakly supervised learning from large-scale web images. In ECCV, pp. 139–154, 2018.
Bo Han, Quanming Yao, Xingrui Yu, Gang Niu, Miao Xu, Weihua Hu, Ivor W. Tsang, and Masashi Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, pp. 8536–8546, 2018.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016.
Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross B. Girshick. Mask R-CNN. In ´ ICCV, pp. 2980–2988, 2017.
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722, 2019.
Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019.
Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020.
Lu Jiang, Zhengyuan Zhou, Thomas Leung, Li-Jia Li, and Li Fei-Fei. Mentornet: Learning datadriven curriculum for very deep neural networks on corrupted labels. In ICML, pp. 2309–2318, 2018.
Lu Jiang, Di Huang, Mason Liu, and Weilong Yang. Beyond synthetic noise: Deep learning on controlled noisy labels. In ICML, 2020.
Armand Joulin, Laurens van der Maaten, Allan Jabri, and Nicolas Vasilache. Learning visual features from large weakly supervised data. In Bastian Leibe, Jiri Matas, Nicu Sebe, and Max Welling (eds.), ECCV, 2016.
Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In ICLR, 2020.
Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Large scale learning of general visual representations for transfer. In ECCV, 2020.
Ananya Kumar, Percy Liang, and Tengyu Ma. Verified uncertainty calibration. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d’Alche-Buc, Emily B. Fox, and Roman ´ Garnett (eds.), NeurIPS, pp. 3787–3798, 2019.
Kuang-Huei Lee, Xiaodong He, Lei Zhang, and Linjun Yang. Cleannet: Transfer learning for scalable image classifier training with label noise. In CVPR, pp. 5447–5456, 2018.
Junnan Li, Yongkang Wong, Qi Zhao, and Mohan S. Kankanhalli. Learning to learn from noisy labeled data. In CVPR, pp. 5051–5059, 2019.
Junnan Li, Richard Socher, and Steven C.H. Hoi. Dividemix: Learning with noisy labels as semisupervised learning. In ICLR, 2020a.
Junnan Li, Pan Zhou, Caiming Xiong, Richard Socher, and Steven C.H. Hoi. Prototypical contrastive learning of unsupervised representations. arXiv preprint arXiv:2005.04966, 2020b.
Wen Li, Limin Wang, Wei Li, Eirikur Agustsson, and Luc Van Gool. Webvision database: Visual learning and understanding from web data. arXiv preprint arXiv:1708.02862, 2017.
Tsung-Yi Lin, Michael Maire, Serge J. Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C. Lawrence Zitnick. Microsoft COCO: common objects in context. In ´ ECCV, pp. 740–755, 2014.
Tsung-Yi Lin, Piotr Dollar, Ross B. Girshick, Kaiming He, Bharath Hariharan, and Serge J. Be-´ longie. Feature pyramid networks for object detection. In CVPR, pp. 936–944, 2017.
Xingjun Ma, Yisen Wang, Michael E. Houle, Shuo Zhou, Sarah M. Erfani, Shu-Tao Xia, Sudanthi N. R. Wijewickrema, and James Bailey. Dimensionality-driven learning with noisy labels. In ICML, pp. 3361–3370, 2018. Dhruv Mahajan, Ross B. Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In ECCV, pp. 185–201, 2018. Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. Scott E. Reed, Honglak Lee, Dragomir Anguelov, Christian Szegedy, Dumitru Erhan, and Andrew Rabinovich. Training deep neural networks on noisy labels with bootstrapping. In ICLR, 2015. Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, pp. 843–852, 2017. Daiki Tanaka, Daiki Ikami, Toshihiko Yamasaki, and Kiyoharu Aizawa. Joint optimization framework for learning with noisy labels. In CVPR, pp. 5552–5560, 2018. Yi Tu, Li Niu, Dawei Cheng, and Liqing Zhang. Protonet: Learning from web data with memory. In CVPR, 2020. Arash Vahdat. Toward robustness against label noise in training deep discriminative neural networks. In NIPS, pp. 5601–5610, 2017. Andreas Veit, Neil Alldrin, Gal Chechik, Ivan Krasin, Abhinav Gupta, and Serge J. Belongie. Learning from noisy large-scale datasets with minimal supervision. In CVPR, pp. 6575–6583, 2017. Yisen Wang, Weiyang Liu, Xingjun Ma, James Bailey, Hongyuan Zha, Le Song, and Shu-Tao Xia. Iterative learning with open-set noisy labels. In CVPR, pp. 8688–8696, 2018. Zhirong Wu, Yuanjun Xiong, Stella X. Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In CVPR, pp. 3733–3742, 2018. Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In CVPR, pp. 2691–2699, 2015. Jingkang Yang, Litong Feng, Weirong Chen, Xiaopeng Yan, Huabin Zheng, Ping Luo, and Wayne Zhang. Webly supervised image classification with self-contained confidence. In ECCV, 2020. Kun Yi and Jianxin Wu. Probabilistic end-to-end noise correction for learning with noisy labels. In CVPR, 2019. Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. S4l: Self-supervised semisupervised learning. In ICCV, pp. 1476–1485, 2019. Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017. Weihe Zhang, Yali Wang, and Yu Qiao. Metacleaner: Learning to hallucinate clean representations for noisy-labeled visual recognition. In CVPR, 2019. Zizhao Zhang, Han Zhang, Sercan Omer Arik, Honglak Lee, and Tomas Pfister. Distilling effective ¨ supervision from severe label noise. In CVPR, pp. 9291–9300, 2020. Bolei Zhou, Agata Lapedriza, Jianxiong Xiao, Antonio Torralba, and Aude Oliva. Learning deep \` features for scene recognition using places database. In NIPS, pp. 487–495, 2014.
# APPENDIX A NOISY SAMPLE VISUALIZATION
In Figure 3, we show example images randomly chosen from the out-of-distribution samples filtered out by our method. In Figure 4, we show random examples where their pseudo-labels are different from the original training labels. By visual examination, we observe that our method can remove OOD samples and correct noisy labels at a high success rate.
 Figure 3: Examples of randomly selected out-of-distribution samples filtered out by our method. The original training labels are shown below the images.
 Figure 4: Examples of randomly selected samples with noisy labels corrected by our method. The original training labels are shown in red and corrected pseudo-labels are shown in green.
# APPENDIX B PSEUDO-CODE OF MOPRO
Algorithm 1 summarizes the proposed method.
Algorithm 1: MoPro’s main algorithm.
1 Input: number of classes $K$ , temperature $\tau$ , threshold $T$ , momentum $m$ , encoder network $f ( \cdot )$ , projection network $g ( \cdot )$ , classifier $h ( \cdot )$ , momentum encoder $g ^ { \prime } ( f ^ { \prime } ( \cdot ) )$ .
2 for $\bar { \{ ( x _ { i } , y _ { i } ) \} } _ { i = 1 } ^ { b }$ in loader do // load a minibatch of noisy training data 3 for $i \in \{ 1 , . . . , b \}$ do 4 $\tilde { \mathbf { x } } _ { i } = \mathrm { w e a k . a u g } ( \mathbf { \mathbf { x } } _ { i } )$ // weak augmentation 5 $\tilde { \pmb { x } } _ { i } ^ { \prime } = \mathrm { s t r o n g . a u g } ( \pmb { x } _ { i } )$ // strong augmentation 6 vi = f (x˜i) // representation 7 zi = g(vi) // normalized low-dimensional embedding 8 zi = g 0 (f 0 (x˜ 0i )) // momentum embedding 10 9 si = {ski }Kk=1 , ski = pi = h(vi) P exp(zi·ck/τ)Kk=1 exp(zi·ck/τ) // prototypical score // class prediction // noise correction 11 $\pmb { q } _ { i } = ( \pmb { p } _ { i } + \pmb { s } _ { i } ) / 2$ // soft pseudo-label 12 if maxk $q _ { i } ^ { k } > T$ then 13 $\hat { y } _ { i } = \arg \operatorname* { m a x } _ { k } q _ { i } ^ { k }$ 14 else if $q _ { i } ^ { y _ { i } } > 1 / K$ then 15 $\hat { y } _ { i } = y _ { i }$ 16 else 17 $\mathbf { \Pi } _ { \mathbf { e n d } } ^ { | \mathbf { \Pi } _ { \hat { y } _ { i } } = \operatorname { O O D } }$ 18 // calculate losses 19 $\begin{array} { r } { \mathcal { L } _ { \mathrm { i n s } } ^ { i } = - \log \frac { \exp ( z _ { i } \cdot z _ { i } ^ { \prime } / \tau ) } { \sum _ { r = 0 } ^ { R } \exp ( z _ { i } \cdot z _ { r } ^ { \prime } / \tau ) } } \end{array}$ // instance contrastive loss 20 if $\hat { y } _ { i }$ is not OOD then 21 $\begin{array} { r l } & { \dot { \mathcal { L } } _ { \mathrm { p r o } } ^ { i } = - \log \frac { \exp ( z _ { i } \cdot c _ { \hat { y } _ { i } } / \tau ) } { \sum _ { k = 1 } ^ { K } \exp ( z _ { i } \cdot c _ { k } / \tau ) } } \\ & { \dot { \mathcal { L } } _ { \mathrm { c e } } ^ { i } = - \log ( p _ { i } ^ { \hat { y } _ { i } } ) } \end{array}$ // prototypical contrastive loss 22 // cross entropy loss 23 else 24 Lipr o = L ice = 0 25 end / update momentum prototypes 26 $\pmb { c } _ { \hat { y } _ { i } } \gets \mathrm { N o r m a l i z e } ( m \pmb { c } _ { \hat { y } _ { i } } + ( 1 - m ) \pmb { z } _ { i } )$ 27 end 28 $\begin{array} { r } { \mathcal { L } = \sum _ { i = 1 } ^ { b } ( \mathcal { L } _ { \mathrm { c e } } ^ { i } + \mathcal { L } _ { \mathrm { p r o } } ^ { i } + \mathcal { L } _ { \mathrm { i n s } } ^ { i } ) } \end{array}$ // total loss 29 update networks $f , g , h$ to minimize $\mathcal { L }$ . 30 end
# APPENDIX C TRANSFER LEARNING IMPLEMENTATION DETAILS
For low-shot image classification on Places and VOC, we follow the procedure in Li et al. (2020b) and train linear SVMs on the global average pooling features of ResNet-50. We preprocess all images by resizing to 256 pixels along the shorter side and taking a $2 2 4 \times 2 2 4$ center crop. The SVMs are implemented in the LIBLINEAR (Fan et al., 2008) package.
For low-resource finetuning on ImageNet, we adopt different finetuning strategy for different versions of WebVision pretrained models. For WebVision V0.5 and V1.0, since they contain the same 1000 classes as ImageNet, we finetune the entire model including the classification layer. We train with SGD, using a batch size of 256, a momentum of 0.9, a weight decay of 0, and a learning rate of 0.005. We train for 40 epochs, and drop the learning rate by 0.2 at 15 and 30 epochs. For WebVision 2.0, since it contains 5000 classes, we randomly initialize a new classification layer with 1000 output dimension, and finetune the model end-to-end. We train for 50 epochs, using a learning rate of 0.01, which is dropped by 0.1 at 20 and 40 epochs.
For object detection and instance segmentation on COCO, we adopt the same setup in MoCo (He et al., 2019), using Detectron2 (Girshick et al., 2018) codebase. The image scale is in [640, 800] pixels during training and is 800 at inference. We fine-tune all layers end-to-end. We finetune on the train2017 set $\mathord { \sim } 1 1 8 \mathrm { k }$ images) and evaluate on val2017.
# APPENDIX D STANDARD DEVIATION FOR LOW-SHOT CLASSIFICATION
Table 7 reports the standard deviation for the low-shot image classification experiment in Section 5.1.
<table><tr><td rowspan="2">Method</td><td rowspan="2">Pretrain dataset</td><td colspan="4">VOC07</td><td colspan="4">Places205</td></tr><tr><td>k=1</td><td>k=2</td><td>k=4</td><td>k=8</td><td>k=1</td><td>k=2</td><td>k=4</td><td>k=8</td></tr><tr><td>CE(Sup.)]</td><td>)ImageNet</td><td>[54.3±4.8 67.8±4.4 73.9±0.9 79.6±0.8|</td><td></td><td></td><td></td><td></td><td>14.9±1.3 21.0±0.3 26.9±0.6 32.1±0.4</td><td></td><td></td></tr><tr><td>MoPro</td><td>WebVision-V1.0</td><td></td><td>59.5±5.2 71.3±2.2</td><td>76.5±1.18</td><td>181.4±0.6</td><td></td><td>16.9±1.3 23.2±0.31</td><td>29.2±0.6 34.5±0.3</td><td></td></tr><tr><td>MoPro</td><td>WebVision-V2.0</td><td></td><td>64.8±6.7 74.8±2.6 79.9±1.4 83.9±1.0</td><td></td><td></td><td></td><td>22.2±1.329.2±0.5</td><td>35.6±0.7 40.9±0.3</td><td></td></tr></table>
Table 7: Low-shot image classification experiments. Mean and standard deviation are calculated across 5 runs.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317# INCREMENTAL FEW-SHOT LEARNING VIA VECTOR QUANTIZATION IN DEEP EMBEDDED SPACE
# Kuilin Chen
# Chi-Guhn Lee
Department of Mechanical and Industrial Engineering University of Toronto Toronto, Ontario, Canada kuilin.chen@mail.utoronto.ca Department of Mechanical and Industrial Engineering University of Toronto Toronto, Ontario, Canada cglee@mie.utoronto.ca
# ABSTRACT
The capability of incrementally learning new tasks without forgetting old ones is a challenging problem due to catastrophic forgetting. This challenge becomes greater when novel tasks contain very few labelled training samples. Currently, most methods are dedicated to class-incremental learning and rely on sufficient training data to learn additional weights for newly added classes. Those methods cannot be easily extended to incremental regression tasks and could suffer from severe overfitting when learning few-shot novel tasks. In this study, we propose a nonparametric method in deep embedded space to tackle incremental few-shot learning problems. The knowledge about the learned tasks is compressed into a small number of quantized reference vectors. The proposed method learns new tasks sequentially by adding more reference vectors to the model using few-shot samples in each novel task. For classification problems, we employ the nearest neighbor scheme to make classification on sparsely available data and incorporate intra-class variation, less forgetting regularization and calibration of reference vectors to mitigate catastrophic forgetting. In addition, the proposed learning vector quantization (LVQ) in deep embedded space can be customized as a kernel smoother to handle incremental few-shot regression tasks. Experimental results demonstrate that the proposed method outperforms other state-of-the-art methods in incremental learning.
# 1 INTRODUCTION
Incremental learning is a learning paradigm that allows the model to continually learn new tasks on novel data, without forgetting how to perform previously learned tasks (Cauwenberghs & Poggio, 2001; Kuzborskij et al., 2013; Mensink et al., 2013). The capability of incremental learning becomes more important in real-world applications, in which the deployed models are exposed to possible out-of-sample data. Typically, hundreds of thousands of labelled samples in new tasks are required to re-train or fine-tune the model (Rebuffi et al., 2017). Unfortunately, it is impractical to gather sufficient samples of new tasks in real applications. In contrast, humans can learn new concepts from just one or a few examples, without losing old knowledge. Therefore, it is desirable to develop algorithms to support incremental learning from very few samples.
While a natural approach for incremental few-shot learning is to fine-tune part of the base model using novel training data (Donahue et al., 2014; Girshick et al., 2014), the model could suffer from severe over-fitting on new tasks due to a limited number of training samples. Moreover, simple fine-tuning also leads to significant performance drop on previously learned tasks, termed as catastrophic forgetting (Goodfellow et al., 2014). Recent attempts to mitigate the catastrophic forgetting are generally categorized into two streams: memory relay of old training samples (Rebuffi et al., 2017; Shin et al., 2017; Kemker & Kanan, 2018) and regularization on important model parameters (Kirkpatrick et al., 2017; Zenke et al., 2017). However, those incremental learning approaches are developed and tested on unrealistic scenarios where sufficient training samples are available in novel tasks. They may not work well when the training samples in novel tasks are few (Tao et al., 2020b).
To the best of our knowledge, the majority of incremental learning methodologies focus on classification problems and they cannot be extended to regression problems easily. In class-incremental learning, the model has to expand output dimensions to learn $N ^ { \prime }$ novel classes while keeping the knowledge of existing $N$ classes. Parametric models estimate additional classification weights for novel classes, while nonparametric methods compute the class centroids for novel classes. In comparison, output dimensions in regression problems do not change in incremental learning as neither additional weights nor class centroids are applicable to regression problems.
Besides, we find that catastrophic forgetting in incremental few-shot classification can be attributed to three reasons. First, the model is biased towards new classes and forgets old classes because the model is fine-tuned on new data only (Hou et al., 2019; Zhao et al., 2020). Meanwhile, the prediction accuracy on novel classes is not good due to over-fitting on few-shot training samples. Second, features of novel samples could overlap with those of old classes in the feature space, leading to ambiguity among classes in the feature space. Finally, features of old classes and classification weights are no longer compatible after the model is fine-tuned with new data.
In this paper, we investigate the problem of incremental few-shot learning, where only a few training samples are available in new tasks. A unified model is learned sequentially to jointly recognize all classes or regression targets that have been encountered in previous tasks (Rebuffi et al., 2017; Wu et al., 2019). To tackle aforementioned problems, we propose a nonparametric method to handle incremental few-shot learning based on learning vector quantization (LVQ) (Sato & Yamada, 1996) in deep embedded space. As such, the adverse effects of imbalanced weights in a parametric classifier can be completely avoided (Mensink et al., 2013; Snell et al., 2017; Yu et al., 2020). Our contributions are three fold. First, a unified framework is developed, termed as incremental deep learning vector quantization (IDLVQ), to handle both incremental classification (IDLVQ-C) and regression (IDLVQ-R) problems. Second, we develop intra-class variance regularization, less forgetting constraints and calibration factors to mitigate catastrophic forgetting in class-incremental learning. Finally, the proposed methods achieve state-of-the-art performance on incremental fewshot classification and regression datasets.
# 2 RELATED WORK
Incremental learning: Some incremental learning approaches rely on memory replay of old exemplars to prevent forgetting previously learned knowledge. Old exemplars can be saved in memory (Rebuffi et al., 2017; Castro et al., 2018; Prabhu et al., 2020) or sampled from generative models (Shin et al., 2017; Kemker & Kanan, 2018; van de Ven et al., 2020). However, explicit storage of training samples is not scalable if the number of classes is large. Furthermore, it is difficult to train a reliable generative model for all classes from very few training samples. In parallel, regularization approaches do not require old exemplars and impose regularization on network weights or outputs to minimize the change of parameters that are important to old tasks (Kirkpatrick et al., 2017; Zenke et al., 2017). To avoid quick performance deterioration after learning a sequence of novel tasks in regularization approaches, semantic drift compensation (SDC) is developed by learning an embedding network via triplet loss (Schroff et al., 2015) and compensates the drift of class centroids using novel data only (Yu et al., 2020). In comparison, IDLVQ-C saves only one exemplar per class and uses saved exemplars to regularize the change in feature extractor and calibrate the change in reference vectors.
Few-shot learning: Few-shot learning attempts to obtain models for classification or regression tasks with only a few labelled samples. Few-shot models are trained on widely-varying episodes of fake few-shot tasks with labelled samples drawn from a large-scale meta-training dataset (Vinyals et al., 2016; Finn et al., 2017; Ravi & Larochelle, 2017; Snell et al., 2017; Sung et al., 2018). Meanwhile, recent works attempt to handle novel few-shot tasks while retraining the knowledge of the base task. These methods are referred to as dynamic few-shot learning (Gidaris & Komodakis, 2018; Ren et al., 2019a; Gidaris & Komodakis, 2019). However, dynamic few-shot learning is different from incremental few-shot learning, because they rely on the entire base training dataset and an extra meta-training dataset during meta-training. In addition, dynamic few-shot learning does not accumulate knowledge for multiple novel tasks sequentially.
Incremental few-shot learning: Prior works on incremental few-shot learning focus on classification problems by computing the weights for novel classes in parametric classifiers, without iterative gradient descent. For instance, the weights of novel classes can be imprinted by normalized prototypes of novel classes, while keeping the feature extractor fixed (Qi et al., 2018). Since novel weights are computed only with the samples of novel classes, the fixed feature extractor may not be compatible with novel classification weights. More recently, neural gas network is employed to construct an undirected graph to represent knowledge of old classes (Tao et al., 2020b;a). The vertices in the graph are constructed in an unsupervised manner using competitive Hebbian learning (Fritzke, 1995), while the feature embedding is fixed. In contrast, IDLVQ learns both feature extractor and reference vectors concurrently in a supervised manner.
# 3 BACKGROUND
# 3.1 INCREMENTAL FEW-SHOT LEARNING
In this paper, incremental few-shot learning is studied for both classification and regression tasks. For classification tasks, we consider the standard class-incremental setup in literature. After the model is trained on a base task $\mathit { t } = 1$ ) with sufficient data, the model learns novel tasks sequentially. Each novel task contains a number of novel classes with only a few training samples per class. Learning a novel task $( t > 1 )$ ) is referred to as an incremental learning session. In task $t$ , we have access only to training data $\mathcal { D } ^ { t }$ in the current task and previously saved exemplars (one exemplar per class in this study). Each task has a set of classes $\hat { C } ^ { t } = \{ c _ { 1 } ^ { t } , . . . , c _ { n ^ { t } } ^ { t } \}$ , where $n _ { t }$ is the number of classes in task $t$ . In addition, it is assumed that there is no overlap between classes in different tasks $C ^ { t } \bigcap C ^ { s } = \emptyset$ for $t \neq s$ . After an incremental learning session, the performance of the model is evaluated on a test set that contains all previously seen classes $C = \cap _ { i } { \bar { C } } ^ { i }$ . Note that our focus is not multi-task scenario, where a task ID is exposed to the model during test phase and the model is only required to perform a given task one time (van de Ven & Tolias, 2019). Our model is evaluated in a task-agnostic setting, where task ID is not exposed to the model at test time.
For regression tasks, we follow a similar setting with a notable difference that the target is realvalued $y \in \mathbb { R }$ . In addition, the target values in different tasks do not have to be mutually exclusive, unlike the class-incremental setup.
# 3.2 LEARNING VECTOR QUANTIZATION
Traditional nonparametric methods, such as nearest neighbors, represent knowledge and make predictions by storing the entire training set. Despite the simplicity and effectiveness, they are not scalable to a large-scale base dataset. Typically, incremental learning methods are only allowed to store a small number of exemplars to preserve the knowledge of previously learned tasks. However, randomly selected exemplars may not well present the knowledge in old tasks. LVQ is a classical data compression method that represents the knowledge through a few learned reference vectors (Sato & Yamada, 1996; Seo & Obermayer, 2003; Biehl et al., 2007). A new sample is classified to the same label as the nearest reference vector in the input space. LVQ has been combined with deep feature extractors as an alternative to standard neural networks for better interpretability (De Vries et al., 2016; Villmann et al., 2017; Saralajew et al., 2018). The combinations of LVQ and deep feature extractors have been applied to natural language processing (NLP), facial recognition and biometrics (Variani et al., 2015; Wang et al., 2016; Ren et al., 2019b; Leng et al., 2015). We notice that LVQ is a nonparametric method which is well suited for incremental few-shot learning because the model capacity grows by incorporating more reference vectors to learn new knowledge. For example, incremental learning vector quantization (ILVQ) has been developed to learn classification models adaptively from raw features (Xu et al., 2012). In this study, we present the knowledge by learning reference vectors in the feature space through LVQ and adapt them in incremental few-shot learning. Compared with ILVQ by Xu et al. (2012), our method does not rely on predefined rules to update reference vectors and can be learned along with deep neural networks in an end-to-end fashion. Besides, our method uses a single reference vector for each class, while ILVQ automatically assigns different numbers of prototypes for different classes.
# 4 METHODOLOGY
# 4.1 INCREMENTAL DEEP LEARNING VECTOR QUANTIZATION
The general framework of IDLVQ for both classification and regression can be derived from a Gaussian mixture perspective (Ghahramani $\&$ Jordan, 1994), with a simplified covariance structure and supervised deep representation learning. In the base dataset $( t = 1 )$ ), a raw input $\mathbf { x }$ is projected into a feature space ${ \bar { \mathcal { F } } } ^ { 1 }$ by a deep neural network $f _ { \theta ^ { 1 } }$ , where $\theta ^ { 1 }$ denotes the parameters in neural networks. In addition, $N ^ { 1 }$ reference vectors $\mathbf { M } ^ { 1 } = \{ \mathbf { m } _ { 1 } ^ { 1 } , . . . , \mathbf { m } _ { N ^ { 1 } } ^ { 1 } \}$ are placed in the feature space ${ \mathcal { F } } ^ { 1 }$ , which can be learned to capture the representation of the base dataset. More reference vectors will be added incrementally while learning novel tasks. The marginal distribution $p ( f _ { \theta ^ { 1 } } ( \mathbf { x } ) )$ of feature vector can be described by a Gaussian mixture model $\begin{array} { r } { p ( f _ { \theta ^ { 1 } } ( \mathbf { x } ) ) = \sum _ { i = 1 } ^ { N ^ { 1 } } p ( i ) p ( f _ { \theta ^ { 1 } } ( \mathbf { x } ) | i ) } \end{array}$ of $N ^ { 1 }$ components, where the prior $p ( i ) = 1 / N ^ { 1 }$ and the component distribution $p ( f _ { \boldsymbol { \theta } ^ { 1 } } ( \mathbf { x } ) | i )$ is Gaussian. By assuming that each component distribution $p ( f _ { \boldsymbol { \theta } ^ { 1 } } ( \mathbf { x } ) | i )$ is isotropic Gaussian centered at $\mathbf { m } _ { i } ^ { 1 }$ with the same covariance, the posterior distribution of a component given the input is
$$p ^ { 1 } ( i | \mathbf { x } ) = \frac { \kappa ( f _ { \theta ^ { 1 } } ( \mathbf { x } ) , \mathbf { m } _ { i } ^ { 1 } ) } { \sum _ { j = 1 } ^ { N ^ { 1 } } \kappa ( f _ { \theta ^ { 1 } } ( \mathbf { x } ) , \mathbf { m } _ { j } ^ { 1 } ) } ,$$
where $\kappa ( f _ { \theta ^ { 1 } } ( \mathbf { x } ) , \mathbf { m } _ { i } ^ { 1 } ) = \exp ( - \| f _ { \theta ^ { 1 } } ( \mathbf { x } ) - \mathbf { m } _ { i } ^ { 1 } \| ^ { 2 } / \gamma )$ is a Gaussian kernel and $\gamma$ is a scale factor. The conditional expectation of the output from a Gaussian mixture is $\begin{array} { r } { \hat { y } = \sum _ { i = 1 } ^ { N ^ { 1 } } p ^ { 1 } ( i | \mathbf { x } ) q _ { i } ^ { 1 } } \end{array}$ , where $q _ { i } ^ { 1 }$ is the reference target associated with reference vector $\mathbf { m } _ { i } ^ { 1 }$ . In classification problems, $q _ { i } ^ { 1 }$ is either 0 or 1 indicating whether $\mathbf { m } _ { i } ^ { 1 }$ and $\mathbf { x }$ have the same label. Since each reference vector is assigned to a class at initialization, $q _ { i } ^ { 1 }$ is fixed and does not require learning. Meanwhile, $q _ { i } ^ { 1 }$ in regression problems is real-valued and has to be learned. The weights in neural networks $\theta ^ { \mathrm { { I } } }$ , reference vectors ${ \bf { M } } ^ { 1 }$ , reference targets $q _ { i } ^ { 1 }$ (in regression problems only) and the scale factor $\gamma$ are learned concurrently by minimizing a loss function between the true label $y$ and the predicted label $\hat { y }$ .
The proposed IDLVQ is a nonparametric method as it makes prediction based on similarity to reference vectors, instead of using any regression or classification weights. The capacity of the model grows naturally by adding more reference vectors to learn novel tasks, while the old knowledge is preserved in existing reference vectors.
# 4.2 INCREMENTAL DEEP LEARNING VECTOR QUANTIZATION FOR CLASSIFICATION
For classification problems, one reference vector is assigned to each class in our study. Thus, $\hat { y }$ represents the predicted probability that an input belongs to a class. The model can be trained to classify data correctly by minimizing the cross-entropy loss $\mathcal { L } _ { C E }$ between the predicted probability $\hat { y }$ and the true label $y$ . Although the cross-entropy loss encourages separability of features in base classes, it does not guarantee compact intra-class variation in the feature space. Specifically, in an incremental learning session, features of novel classes could overlap with those of previously learned classes. As a result, the overall classification accuracy could deteriorate after incremental learning sessions. A desirable feature embedding leaves large margin between classes to mitigate overlap in features across old and new classes. Inspired by center loss (Wen et al., 2016) to enhance discriminative capability in facial recognition, a regularization term on intra-class distance to reference vectors is added to get compact intra-class variation.
$$\mathcal { L } _ { i n t r a } = \sum _ { \forall ( \mathbf { x } , y ) , y = i } \left\| f _ { \theta ^ { 1 } } ( \mathbf { x } ) - \mathbf { m } _ { i } ^ { 1 } \right\| ^ { 2 }$$
As such, $f _ { \theta ^ { 1 } } ( \mathbf { x } )$ is forced to stay close to the reference vector with the same label and naturally moves away from other reference vectors. Consequently, features of new classes are more likely to lie in the margin between old classes to mitigate ambiguity in features across different classes. The total loss in training the base task is given by $\mathcal { L } = \mathcal { L } _ { C E } + \lambda _ { i n t r a } \mathcal { L } _ { i n t r a }$ , where $\lambda _ { i n t r a }$ is a hyper-parameter to control the weight for intra-class variation loss. The total loss is differentiable w.r.t. neural network parameters $\theta ^ { \mathrm { { i } } }$ , reference vectors $\mathbf { M } ^ { 1 } = \{ \mathbf { m } _ { 1 } ^ { 1 } , . . . , \mathbf { m } _ { n ^ { 1 } } ^ { 1 } \}$ and scaling factor $\gamma$ . All parameters in the model can be trained jointly in an end-to-end fashion.
In an incremental session $( t > 1 )$ ), a novel dataset $\mathcal { D } ^ { t }$ contains $n ^ { t }$ classes and $K ^ { t }$ samples per class ( $\cdot \boldsymbol { n } ^ { t }$ -way $K ^ { t }$ -shot). $n ^ { t }$ new reference vectors are added and each reference vector is initialized as the centroid of features in a class mti = 1Kt PKtk=1 fθt (xk). The new reference vectors along with the neural network parameters are fine-tuned on $\mathcal { D } ^ { t }$ to learn new knowledge in task $t$ . To preserve the knowledge from the old tasks during incremental learning, the model should be updated only when necessary. Therefore, cross-entropy loss is not used in incremental learning sessions because it always updates model parameters even if the sample is correctly classified. Let $\mathbf { m } _ { + } ^ { t }$ be the reference vector with the correct label and $\mathbf { m } _ { - } ^ { t }$ be the nearest reference vector with a wrong label. For a training sample $\left( \mathbf { x } , y \right)$ in $\mathcal { D } ^ { t }$ , the sample is classified correctly if $\left\| f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { + } ^ { t } \right\| ^ { 2 } <$ $\left\| f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { - } ^ { t } \right\| ^ { 2 }$ . In this case, the loss should be 0. When $\left\| f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { + } ^ { t } \right\| ^ { 2 } > \left\| f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { - } ^ { t } \right\| ^ { 2 }$ , the sample is misclassified. We adapt the margin based loss function ${ \mathcal { L } } _ { M }$ from De Vries et al. (2016) with a minor modification
$$\mathcal { L } _ { M } = \mathrm { R e L U } \left( \frac { \left. f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { + } ^ { t } \right. ^ { 2 } - \left. f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { - } ^ { t } \right. ^ { 2 } } { \left. f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { + } ^ { t } \right. ^ { 2 } + \left. f _ { \theta ^ { t } } ( \mathbf { x } ) - \mathbf { m } _ { - } ^ { t } \right. ^ { 2 } } \right) ,$$
where $\mathrm { R e L U } ( \cdot )$ stands for the rectified linear unit function. The margin based loss leads to slow training convergence because it only updates two reference vectors one time. However, the adapted margin based loss is well suited in learning from few-shot samples while avoids unnecessary parameter updates.
Features for an old class could deviate away from the corresponding reference vector due to changes in $\theta ^ { t }$ during incremental learning, leading to catastrophic forgetting. A forgetting loss $\mathcal { L } _ { F }$ is developed to regularize the drift in the feature space
$$\mathcal { L } _ { F } = \sum _ { i = 1 } ^ { N ^ { t - 1 } } \| f _ { \theta ^ { t } } ( \mathbf { x } _ { i } ^ { ' } ) - f _ { \theta ^ { t - 1 } } ( \mathbf { x } _ { i } ^ { ' } ) \| ^ { 2 } ,$$
where $\mathbf { x } _ { i } ^ { ' }$ is the selected exemplar for class $i$ and $N ^ { t - 1 }$ denotes the total number of classes in the base task and all previous novel tasks. Note that the exemplar $\mathbf { x } _ { i } ^ { ' }$ for class $i \in [ N ^ { t - 1 } , N ^ { t } ]$ is picked from $\mathcal { D } ^ { t }$ whose feature is nearest to $\mathbf { m } _ { i } ^ { t }$ at the end of each learning session. The total loss in the incremental learning session $t$ is $\mathcal { L } = \mathcal { L } _ { M } + \lambda _ { F } \mathcal { L } _ { F } + \lambda _ { i n t r a } \mathcal { L } _ { i n t r a }$ , where $\lambda _ { F }$ and $\lambda _ { i n t r a }$ are weights for forgetting loss and intra-class variation loss, respectively. The total loss is optimized w.r.t. neural network parameters $\theta ^ { t }$ and new reference vectors $\{ \mathbf { m } _ { N ^ { t - 1 } + 1 } ^ { t } , . . . , \mathbf { m } _ { N ^ { t } } ^ { t } \}$ .
The reference vectors for previously learned tasks are not updated by novel data to prevent catastrophic forgetting. However, they may not be well suited to represent knowledge and make classification in the new feature space $\mathcal { F } ^ { t }$ as feature embedding is changed with updated $\theta ^ { t }$ . Although the true optimal location of those reference vectors are difficult to estimate without using the entire data from all tasks, they can be calculated approximately using the shift in features of exemplars. Considering that features of an exemplar $\mathbf { x } _ { i } ^ { ' }$ are close to $\mathbf { m } _ { i }$ in the feature space, the shift of a reference vector $\delta _ { i } ^ { t }$ in the new feature space can be approximated by the shift of the exemplar’s features $\delta _ { i } ^ { t } = f _ { \theta ^ { t } } ( \mathbf { x } _ { i } ^ { ' } ) { - } f _ { \theta ^ { t - 1 } } ( \mathbf { x } _ { i } ^ { ' } )$ . Therefore, the reference vectors for previously learned tasks are calibrated $\mathbf { m } _ { i } ^ { t } = \mathbf { m } _ { i } ^ { t - 1 } + \delta _ { i } ^ { t }$ , where $\mathbf { m } _ { i } ^ { t - 1 }$ is the uncalibrated reference vector for class $i \in [ 1 , N ^ { t - 1 } ]$ . A test sample, which could be from any seen classes, is classified according to the distance to reference vectors $\{ \mathbf { m } _ { 1 } ^ { t } , . . . , \mathbf { m } _ { N ^ { t } } ^ { t } \}$ . The pseudo code for IDLVQ-C is presented in the appendix.
# 4.3 INCREMENTAL DEEP LEARNING VECTOR QUANTIZATION FOR REGRESSION
For regression problems, the model is trained to recognize regression targets by the minimizing mean squared error (MSE) loss $\mathcal { L } _ { M S E } = ( y - \hat { y } ) ^ { 2 }$ , where $y$ is the real-valued target in training dataset. The MSE loss function is differentiable w.r.t. neural network weights, reference vectors and targets, and scale factor. Therefore, all parameters can be trained jointly in an end-to-end manner. The proposed IDLVQ-R can also be interpreted as a kernel smoother in deep embedded space. Compared with traditional kernel smoother, such as Nadaraya-Watson estimator (Nadaraya, 1964), IDLVQ-R is sparse and hence more scalable as it only relies on a few reference vectors and targets.
In an incremental learning session $( t > 1 )$ ), we have access to data $\mathcal { D } ^ { t }$ that contains $K ^ { t }$ pairs of training samples $( \mathbf { x } _ { i } ^ { t } , y _ { i } ^ { t } )$ . ${ \bar { n } } ^ { t }$ new reference vectors $( n ^ { t } \leq K ^ { t } )$ along with corresponding targets are added to the model to learn new knowledge in the novel task $t$ . We randomly select $n ^ { t }$ samples from $\mathcal { D } ^ { t }$ to initialize reference vectors and targets as follows
$$\begin{array} { c } { { { \bf m } _ { i + N ^ { t - 1 } } = f _ { \theta } ( { \bf x } _ { i } ^ { t } ) , } } \\ { { { \bf \ q } _ { i + N ^ { t - 1 } } = y _ { i } ^ { t } , } } \end{array}$$
where $N ^ { t - 1 }$ is the total number of reference vectors in all previous tasks. The new reference vectors and targets are fine-tuned by minimizing MSE on $\mathcal { D } ^ { t }$ while keeping other parameters frozen. After new reference vectors and targets are fine-tuned with novel data $\mathcal { D } ^ { t }$ , the model makes prediction by smoothing targets of all reference vectors
$$\hat { y } = \frac { \sum _ { i = 1 } ^ { N ^ { t } } \kappa ( f _ { \theta } ( \mathbf { x } ) , \mathbf { m } _ { i } ) q _ { i } } { \sum _ { i = 1 } ^ { N ^ { t } } \kappa ( f _ { \theta } ( \mathbf { x } ) , \mathbf { m } _ { i } ) } ,$$
where $N ^ { t }$ is the current total number of reference vectors.
# 5 EXPERIMENTS
We first describe the overall protocols, then we present the results on incremental few-shot classification and regression problems.
# 5.1 INCREMENTAL FEW-SHOT CLASSIFICATION
We empirically evaluate the performance of IDLVQ-C on incremental few-shot classification on CUB200-2011 (Welinder et al., 2010) and miniImageNet datasets (Vinyals et al., 2016). The dataset is split into base classes and multiple groups of novel classes. We apply standard data augmentation, including random crop, horizontal flip and color jitter, on all training images. After each training session, the model performance is evaluated on a test set, which contains all classes that the model has been trained on.
CUB dataset is composed of 200 fine-grained bird species with 11,788 images. We split the dataset into 5894 training images, 2947 validation images and 2947 test images. All images are resized to $2 2 4 \times 2 2 4$ . In addition, the first 100 classes are chosen as base classes, where all training samples in base classes are used to train the base model. The remaining 100 classes are treated as novel categories and split into 10 incremental learning sessions. Each incremental learning session contains 10 novel classes and 5 randomly selected training samples per class (10-way 5-shot).
miniImageNet dataset is a 100-class subset of the original ImageNet dataset (Deng et al., 2009). Each class contains 500 training images, 50 validation images, and 50 test images. The images are in RGB format of the size $8 4 \times 8 4$ . We choose 60 and 40 classes for base and novel classes, respectfully. The 40 novel classes are divided into 8 sessions and each session contains 5 novel classes with 5 randomly selected training samples per class (5-way 5-shot).
ResNet18 (He et al., 2016) is used as the feature extractor for incremental classification problems. The learning process for each dataset is repeated 10 times and the average test accuracy is reported. The proposed method is compared with six methods for few-shot class-incremental learning: fineturning using $\mathcal { D } ^ { t }$ , joint training using the entire training set from all encountered classes, iCaRL (Rebuffi et al., 2017), Rebalancing (Hou et al., 2019), ProtoNet (Snell et al., 2017), incremental learning vector quantization (ILVQ) (Xu et al., 2012), SDC (Yu et al., 2020), and Imprint (Qi et al., 2018). Note that ILVQ is applied to the features extracted by neural networks in our experiment.
The incremental few-shot learning results on CUB and miniImageNet are shown in Table 1 and 2, respectively. Our method outperforms fine-tuning, iCaRL (Rebuffi et al., 2017), and ProtoNet (Snell et al., 2017) by a large margin. Simply fine-tuning the weights in classifier with few-shot training samples for novel classes significantly deteriorates the prediction accuracy. Although iCaRL alleviates catastrophic forgetting by tuning the model with a mix of old exemplars and novel few-shot data, the prediction accuracy still drops quickly because iCaRL requires sufficient samples per class to achieve satisfactory performance. The ProtoNet relies on distance to prototypes (the mean of features within a class) to make classification but the fixed feature extractor may not be able to well separate novel classes. ILVQ is slightly better than ProtoNet because prototypes can be learned adaptively when more classes are available in incremental learning sessions. Some prototypes in
ILVQ are close to the border of a class, which are more effective than class centroids in ProtoNet. However, ILVQ does not achieve the best performance because the feature extractor is fixed and cannot be learned along with the prototypes. IDLVQ-C has a small gain in the first couple of incremental few-shot learning sessions compared with SDC (Yu et al., 2020) and Imprint (Qi et al., 2018). Similar to ProtoNet, SDC also relies on prototypes to make classification. The performance of SDC is better than that of ProtoNet because SDC fine-tunes the feature extractor with novel dataset and compensates the drift in prototypes. However, the compensation for the drift of old-class prototypes can be less accurate in SDC because it is approximated by samples in novel classes. In parallel, the imprint method directly computes the normalized classification weights from the average of normalized features within a novel class. The imprint method avoids imbalanced classification weights and circumvents the overfitting in few-shot class-incremental learning through weight normalization. Nevertheless, the fixed feature extractor in the imprint method may not be well suited for novel classes. In contrast, IDLVQ-C updates the feature extractor only when necessary and compensates the shift of old reference vectors more accurately using exemplars from old classes. That is why the gain of IDLVQ-C increases with more incremental few-shot learning sessions. The performance of SDC, Imprint and IDLVQ-C is better than offline joint training in early sessions of incremental few-shot learning. Offline joint training may not result in oracle performance due to extremely imbalanced samples between base classes and novel classes.
Table 1: Prediction accuracy on CUB all classes using the 10-way 5-shot incremental setting.
<table><tr><td rowspan="2">Method</td><td colspan="10">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr><tr><td>Fine-tune</td><td>77.30</td><td>46.23</td><td>34.71</td><td>25.35</td><td>23.16</td><td>20.65</td><td>16.21</td><td>13.32</td><td>11.98</td><td>11.17</td><td>10.76</td></tr><tr><td>Joint train</td><td>77.30</td><td>73.28</td><td>68.80</td><td>65.34</td><td>63.75</td><td>62.00</td><td>60.81</td><td>59.71</td><td>59.06</td><td>58.69</td><td>58.23</td></tr><tr><td>iCaRL (Rebuffi et al.,2017)</td><td>77.30</td><td>57.18</td><td>54.67</td><td>48.11</td><td>40.76</td><td>36.85</td><td>33.12</td><td>30.42</td><td>28.22</td><td>26.84</td><td>25.23</td></tr><tr><td>Rebalancing (Hou et al., 2019)</td><td>77.30</td><td>64.53</td><td>56.14</td><td>47.29</td><td>38.92</td><td>34.39</td><td>31.04</td><td>27.93</td><td>27.12</td><td>24.46</td><td>23.61</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>77.30</td><td>69.76</td><td>66.01</td><td>62.29</td><td>59.58</td><td>57.10</td><td>55.13</td><td>54.09</td><td>52.40</td><td>51.65</td><td>50.36</td></tr><tr><td>ILVQ (Xu et al., 2012)</td><td>77.30</td><td>71.50</td><td>66.79</td><td>62.71</td><td>60.20</td><td>57.84</td><td>55.27</td><td>55.06</td><td>52.42</td><td>51.72</td><td>50.47</td></tr><tr><td>SDC (Yu et al., 2020)</td><td>77.34</td><td>74.45</td><td>69.45</td><td>65.27</td><td>61.81</td><td>58.26</td><td>56.14</td><td>55.71</td><td>53.31</td><td>52.79</td><td>51.52</td></tr><tr><td>Imprint (Qi et al., 2018)</td><td>77.02</td><td>73.39</td><td>69.50</td><td>65.61</td><td>62.81</td><td>60.74</td><td>59.39</td><td>58.61</td><td>56.85</td><td>55.93</td><td>54.82</td></tr><tr><td>IDLVQ-C</td><td>77.37</td><td>74.72</td><td>70.28</td><td>67.13</td><td>65.34</td><td>63.52</td><td>62.10</td><td>61.54</td><td>59.04</td><td>58.68</td><td>57.81</td></tr></table>
Table 2: Prediction accuracy on miniImageNet all classes using the 5-way 5-shot incremental setting.
<table><tr><td rowspan="2">Method</td><td colspan="9">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr><tr><td>Fine-tune</td><td>64.25</td><td>30.11</td><td>18.53</td><td>6.31</td><td>2.86</td><td>2.68</td><td>1.87</td><td>1.56</td><td>1.42</td></tr><tr><td>Joint train</td><td>64.25</td><td>58.80</td><td>55.26</td><td>52.38</td><td>49.71</td><td>48.37</td><td>45.91</td><td>44.68</td><td>43.38</td></tr><tr><td>iCaRL (Rebuffi et al., 2017)</td><td>64.25</td><td>48.04</td><td>43.13</td><td>38.28</td><td>30.01</td><td>24.46</td><td>21.85</td><td>19.84</td><td>17.76</td></tr><tr><td>Rebalancing (Hou et al.,2019)</td><td>64.25</td><td>49.21</td><td>44.17</td><td>37.71</td><td>30.11</td><td>22.92</td><td>19.99</td><td>17.96</td><td>16.25</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>64.25</td><td>55.12</td><td>51.67</td><td>48.91</td><td>46.52</td><td>44.25</td><td>41.91</td><td>40.07</td><td>38.42</td></tr><tr><td>ILVQ (Xu et al., 2012)</td><td>64.25</td><td>56.01</td><td>52.43</td><td>49.31</td><td>46.98</td><td>44.37</td><td>42.06</td><td>40.11</td><td>38.43</td></tr><tr><td>SDC (Yu et al., 2020)</td><td>64.62</td><td>59.63</td><td>55.39</td><td>50.92</td><td>48.30</td><td>45.28</td><td>42.97</td><td>42.51</td><td>41.24</td></tr><tr><td>Imprint (Qi et al., 2018)</td><td>64.71</td><td>59.85</td><td>55.71</td><td>52.47</td><td>49.90</td><td>47.31</td><td>44.57</td><td>42.57</td><td>41.26</td></tr><tr><td>IDLVQ-C</td><td>64.77</td><td>59.87</td><td>55.93</td><td>52.62</td><td>49.88</td><td>47.55</td><td>44.83</td><td>43.14</td><td>41.84</td></tr></table>
Ablation studies are conducted to analyze how individual components affect the performance of incremental few-shot learning. We study five variants of our methods: (a) new reference vectors are initialized as class centroids and no tuning is done for feature extractor or old reference vectors; (b) $\mathcal { L } _ { i n t r a }$ is not used in incremental learning sessions; (c) $\mathcal { L } _ { F }$ is not used in the incremental learning sessions; (d) shift in old reference vectors are not compensated; (e) replace the margin based loss ${ \mathcal { L } } _ { M }$ with the cross entropy loss $\mathcal { L } _ { C E }$ . Table 3 shows the results of our ablation studies on CUB dataset. Without any fine-tuning, the initial reference vectors for novel classes lead to descent accuracy in incremental few-shot classification. It demonstrates the robustness of nonparametric classifier. $\mathcal { L } _ { i n t r a }$ leads to $0 . 5 7 \%$ gain due to tight intra-class variation. The less forgetting regularization $\mathcal { L } _ { F }$ is proved to prevent forgetting old classes and achieves a performance boost by $2 . 3 5 \%$ . The shift compensation for reference vectors effectively adapts old reference vector in new embedding spaces with a gain round of $1 \%$ . The margin based loss is more effective in preventing forgetting in early sessions of incremental learning.
The effect of the number of training samples per class. The proposed method is evaluated under different few-shot settings on CUB dataset to investigate the effect of different numbers of training samples in novel classes, including 5-shot, 10-shot and 20-shot settings. One reference vector is assigned to each class in all few-shot settings. As shown in Fig. 2 in the appendix, the performance of incremental learning improves as the number of samples per class increases. When the training samples are scarce, the training samples may not well present the generative distribution of training data. Therefore, the learned reference vectors could be biased and classification accuracy is low. With more training samples, the learned reference vectors could well present the center of the distribution and classification accuracy is improved. The gap in performance becomes more obvious as the number of incremental learning sessions grows. The detailed results are reported in Table 7 and 8.
Table 3: Ablation study on CUB using the 10-way 5-shot incremental setting.
<table><tr><td rowspan="2">Method</td><td colspan="10">sessions</td></tr><tr><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr><tr><td>No tuning</td><td>71.93</td><td>67.14</td><td>64.21</td><td>62.61</td><td>60.13</td><td>59.04</td><td>58.47</td><td>55.64</td><td>54.25</td><td>53.66</td></tr><tr><td>W.o.Lintra</td><td>74.75</td><td>70.26</td><td>66.89</td><td>65.05</td><td>63.18</td><td>61.84</td><td>61.36</td><td>58.61</td><td>58.14</td><td>57.24</td></tr><tr><td>w.0. LF</td><td>73.85</td><td>69.54</td><td>66.21</td><td>64.02</td><td>62.74</td><td>60.28</td><td>59.49</td><td>56.97</td><td>56.38</td><td>55.46</td></tr><tr><td>w.o. δ</td><td>74.67</td><td>70.01</td><td>66.74</td><td>64.81</td><td>63.90</td><td>61.42</td><td>60.73</td><td>58.16</td><td>57.62</td><td>56.79</td></tr><tr><td>LM→LCE</td><td>73.22</td><td>69.41</td><td>66.03</td><td>63.93</td><td>63.07</td><td>61.14</td><td>60.98</td><td>58.67</td><td>58.11</td><td>57.32</td></tr><tr><td>IDLVQ-C</td><td>74.72</td><td>70.28</td><td>67.13</td><td>65.34</td><td>63.52</td><td>62.10</td><td>61.54</td><td>59.04</td><td>58.68</td><td>57.81</td></tr></table>
# 5.2 INCREMENTAL FEW-SHOT REGRESSION
IDLVQ-R is tested on two regression datasets: sinusoidal wave and 3D spatial data. Considering that there is no state-of-the-art method for incremental few-shot regression, we compare IDLVQ-R against three alternative methods: fine-tuning using novel task data only, fine-tuning using novel task data along with exemplars and offline training using the entire training dataset from all tasks.
Sinusoidal wave is defined by a function $y = \sin ( 3 \pi x ) + 0 . 3 \cos ( 9 \pi x ) + 0 . 5 \sin ( 7 \pi x ) + \epsilon ,$ , where $\epsilon$ is white noise with a standard deviation of 0.1. 1000 training samples in the first task (bas task) are generated by sampling $x \in [ - 1 . 0 , 1 . 0 ]$ uniformly. 5-shot training samples in two novel tasks are generated by sampling $x \in [ 1 . 0 , 1 . 5 ]$ and $x \in [ 1 . 5 , 2 . 0 ]$ , respectively.
As shown in Fig. 1(a), IDLVQ-R achieves comparable performance to offline neural networks in Fig. 1(d) which are trained using the entire training set from all tasks. In comparison, neural networks trained sequentially with few-shot training samples show catastrophic forgetting on old tasks in Fig. 1(b). With the addition of exemplars during training, the networks perform better but still suffer from catastrophic forgetting on the base task in Fig. 1(c). In conclusion, IDLVQ-R preserves old knowledge and adapts to new knowledge quickly using a few reference vectors and achieves satisfactory performance on incremental few-shot regression tasks. The experiment details can be found in the appendix.
 Figure 1: Comparison of performance for incremental few-shot regression. Red dots denote test samples for base task, purple dots denotes test sample for novel tasks, grey lines denote model predictions, and black crosses denotes few-shot training samples in novel tasks. (a) IDLVQ-R; (b) neural networks incrementally fine-tuned with novel data only in each session; (c) neural networks incrementally fine-tuned with exemplars and novel training samples; (d) offline neural networks trained with training samples from all tasks.
3D spatial data1 is collected in North Jutland, Denmark. The inputs are longitude $x _ { 1 }$ and latitude $x _ { 2 }$ , and the output is altitude y. 2482 training samples in the 1st task are collected in the area where $x _ { 1 } \in [ 9 . 9 8 , 9 . 9 9 5 ]$ and $x _ { 2 } \in [ 5 7 . 0 , 5 7 . 0 5 ] .$ 20 training samples in the 2nd task are collected in the area where $x _ { 1 } \ \in \ [ 9 . 9 9 5 , 1 0 . 0 ]$ and $x _ { 2 } ~ \in ~ [ 5 7 . 0 2$ , 57.03]. 20 training samples in the 3rd task are collected in the area where $x _ { 1 } \in [ 9 . 9 9 5 , 1 0 . 0 ]$ and $x _ { 2 } ~ \overset { \cdot } { \in } ~ [ 5 7 . 0 3 , 5 7 . 0 4 ]$ . Approximately 300 test samples are collected for each task.
Table 4: Normalized RMSE of incremental few-shot regression on 3D spatial data
<table><tr><td rowspan="2">Method</td><td colspan="3">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>Joint train offline</td><td>0.02174(2e-4)</td><td>0.02232(2e-4)</td><td>0.02296(2e-4)</td></tr><tr><td>Fine-tune w.novel data</td><td>0.02174(2e-4)</td><td>0.08462(4e-4)</td><td>0.11870(6e-4)</td></tr><tr><td>Fine-tune w. exemplars</td><td>0.02174(2e-4)</td><td>0.02988(2e-4)</td><td>0.03128(2e-4)</td></tr><tr><td>IDLVQ-R</td><td>0.02181(2e-4)</td><td>0.02641(2e-4)</td><td>0.02817(2e-4)</td></tr></table>
The normalized root mean squared errors (RMSE) between actual and predicted altitude in the test set are listed in Table 4. The prediction accuracy drops significantly when the model is finetuned with novel data only. Catastrophic forgetting can be alleviated using exemplars from previous tasks. IDLVQ-R achieves better results than fine tuning with exemplars. The good performance of IDLVQ-R can be attributed to two reasons. First, IDLVQ-R learns a number of reference vectors and targets to preserve the knowledge in encountered tasks. Compared with a linear layer on top of neural networks, a number of reference vectors represent richer information about the training data. Second, IDLVQ-R is nonparametric and can represent local and nonlinear relationship without learning any regression coefficient from few-shot data.
# 6 CONCLUSIONS
A new incremental few-shot learning approach is developed to harmonize old knowledge preserving and new knowledge adaptation through quantized vector in deep embedded space. Prediction is made in a nonparametric way using similarity to learned reference vectors, which circumvents biased weights in a parametric classification layer during incremental few-shot learning. For classification problems, additional mechanisms are developed to mitigate the forgetting in old classes and improve representation learning for few-shot novel classes. For regression problems, the proposed approach has been reinterpreted as a kernel smoother to predict real-valued target over novel domain.
# REFERENCES
Michael Biehl, Anarta Ghosh, and Barbara Hammer. Dynamics and generalization ability of lvq algorithms. Journal of Machine Learning Research, 8(Feb):323–360, 2007. Francisco M Castro, Manuel J Mar´ın-Jimenez, Nicol ´ as Guil, Cordelia Schmid, and Karteek Alahari. ´ End-to-end incremental learning. In Proceedings of the European conference on computer vision (ECCV), pp. 233–248, 2018. Gert Cauwenberghs and Tomaso Poggio. Incremental and decremental support vector machine learning. In Advances in neural information processing systems, pp. 409–415, 2001. Harm De Vries, Roland Memisevic, and Aaron C Courville. Deep learning vector quantization. In ESANN, 2016. 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. Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pp. 647–655, 2014. Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine LearningVolume 70, pp. 1126–1135. JMLR. org, 2017.
Bernd Fritzke. A growing neural gas network learns topologies. In Advances in neural information processing systems, pp. 625–632, 1995.
Zoubin Ghahramani and Michael I Jordan. Supervised learning from incomplete data via an em approach. In Advances in neural information processing systems, pp. 120–127, 1994.
Spyros Gidaris and Nikos Komodakis. Dynamic few-shot visual learning without forgetting. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4367– 4375, 2018.
Spyros Gidaris and Nikos Komodakis. Generating classification weights with gnn denoising autoencoders for few-shot learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 21–30, 2019.
Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580–587, 2014.
Ian J Goodfellow, Mehdi Mirza, Aaron Courville Da Xiao, and Yoshua Bengio. An empirical investigation of catastrophic forgeting in gradient based neural networks. In In Proceedings of International Conference on Learning Representations ICLR, 2014.
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.
Saihui Hou, Xinyu Pan, Chen Change Loy, Zilei Wang, and Dahua Lin. Learning a unified classifier incrementally via rebalancing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 831–839, 2019.
Ronald Kemker and Christopher Kanan. Fearnet: Brain-inspired model for incremental learning. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018.
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
Ilja Kuzborskij, Francesco Orabona, and Barbara Caputo. From n to $\mathrm { n + \ 1 }$ : Multiclass transfer incremental learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3358–3365, 2013.
Mengjun Leng, Panagiotis Moutafis, and Ioannis A Kakadiaris. Joint prototype and metric learning for set-to-set matching: Application to biometrics. In 2015 IEEE 7th International Conference on Biometrics Theory, Applications and Systems (BTAS), pp. 1–8. IEEE, 2015.
Thomas Mensink, Jakob Verbeek, Florent Perronnin, and Gabriela Csurka. Distance-based image classification: Generalizing to new classes at near-zero cost. IEEE transactions on pattern analysis and machine intelligence, 35(11):2624–2637, 2013.
Elizbar A Nadaraya. On estimating regression. Theory of Probability & Its Applications, 9(1): 141–142, 1964.
Ameya Prabhu, Philip HS Torr, and Puneet K Dokania. Gdumb: A simple approach that questions our progress in continual learning. In European Conference on Computer Vision, pp. 524–540. Springer, 2020.
Hang Qi, Matthew Brown, and David G Lowe. Low-shot learning with imprinted weights. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5822–5830, 2018.
Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In 5th International Conference on Learning Representations, ICLR 2017, 2017.
Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. icarl: Incremental classifier and representation learning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 2001–2010, 2017.
Mengye Ren, Renjie Liao, Ethan Fetaya, and Richard Zemel. Incremental few-shot learning with attention attractor networks. In Advances in Neural Information Processing Systems, pp. 5275– 5285, 2019a.
Zhenwen Ren, Bin Wu, Quansen Sun, and Mingna Wu. Simultaneous learning of reduced prototypes and local metric for image set classification. Expert Systems with Applications, 134:102–111, 2019b.
Sascha Saralajew, Lars Holdijk, Maike Rees, and Thomas Villmann. Prototype-based neural network layers: incorporating vector quantization. In Advances in neural information processing systems - workshop poster, 2018.
Atsushi Sato and Keiji Yamada. Generalized learning vector quantization. In Advances in neural information processing systems, pp. 423–429, 1996.
Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 815–823, 2015.
Sambu Seo and Klaus Obermayer. Soft learning vector quantization. Neural computation, 15(7): 1589–1604, 2003.
Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In Advances in Neural Information Processing Systems, pp. 2990–2999, 2017.
Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pp. 4077–4087, 2017.
Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1199–1208, 2018.
Xiaoyu Tao, Xinyuan Chang, Xiaopeng Hong, Xing Wei, and Yihong Gong. Topology-preserving class-incremental learning. In European Conference on Computer Vision. Springer, 2020a.
Xiaoyu Tao, Xiaopeng Hong, Xinyuan Chang, Songlin Dong, Xing Wei, and Yihong Gong. Fewshot class-incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12183–12192, 2020b.
Gido M van de Ven and Andreas S Tolias. Three scenarios for continual learning. In Advances in Neural Information Processing Systems - Continual Learning workshop, 2019.
Gido M van de Ven, Hava T Siegelmann, and Andreas S Tolias. Brain-inspired replay for continual learning with artificial neural networks. Nature Communications, 11:4069, 2020.
Ehsan Variani, Erik McDermott, and Georg Heigold. A gaussian mixture model layer jointly optimized with discriminative features within a deep neural network architecture. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4270–4274. IEEE, 2015.
Thomas Villmann, Michael Biehl, Andrea Villmann, and Sascha Saralajew. Fusion of deep learning architectures, multilayer feedforward networks and learning vector quantizers for deep classification learning. In 2017 12th international workshop on self-organizing maps and learning vector quantization, clustering and data visualization (WSOM), pp. 1–8. IEEE, 2017.
Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in neural information processing systems, pp. 3630–3638, 2016.
Wen Wang, Ruiping Wang, Shiguang Shan, and Xilin Chen. Prototype discriminative learning for face image set classification. In Asian Conference on Computer Vision, pp. 344–360. Springer, 2016.
P. Welinder, S. Branson, T. Mita, C. Wah, F. Schroff, S. Belongie, and P. Perona. Caltech-UCSD Birds 200. Technical Report CNS-TR-2010-001, California Institute of Technology, 2010.
Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In European conference on computer vision, pp. 499–515. Springer, 2016.
Yue Wu, Yinpeng Chen, Lijuan Wang, Yuancheng Ye, Zicheng Liu, Yandong Guo, and Yun Fu. Large scale incremental learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 374–382, 2019.
Ye Xu, Furao Shen, and Jinxi Zhao. An incremental learning vector quantization algorithm for pattern classification. Neural Computing and Applications, 21(6):1205–1215, 2012.
Lu Yu, Bartlomiej Twardowski, Xialei Liu, Luis Herranz, Kai Wang, Yongmei Cheng, Shangling Jui, and Joost van de Weijer. Semantic drift compensation for class-incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6982–6991, 2020.
Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3987– 3995, 2017.
Bowen Zhao, Xi Xiao, Guojun Gan, Bin Zhang, and Shu-Tao Xia. Maintaining discrimination and fairness in class incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13208–13217, 2020.
# A APPENDIX
A.1 PSEUDO CODE FOR IDLVQ-C
# Algorithm 1 IDLVQ-C
<table><tr><td>In the base task(t = 1)</td><td></td></tr><tr><td>Initialize 01,{m𝑖,.,mN1} and γ</td><td></td></tr><tr><td>Minimize L = LcE + XintraLintra W.r.t. θ1,{ml,.,mN1} and γ</td><td></td></tr><tr><td>Pick exemplars from D1 for classes in the base task: xi = arg minxeD1 |lft-1(x) - m1|l²</td><td></td></tr><tr><td>for novel task t = 2,3,... do</td><td></td></tr><tr><td>Initialize {mt-1+1.*., mNt}</td><td></td></tr><tr><td>Minimize L=LM +XFLF + XintraLintra W.r.t. 0t and {mNt-1+1,.,mNt}</td><td></td></tr><tr><td></td><td>t-1 t-1 +</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Pick exemplars from Dt for classes in the novel task t: x' = arg minx∈Dt |lfet-1(x) - m ll²</td></tr><tr><td>end for</td><td></td></tr></table>
# A.2 PSEUDO CODE FOR IDLVQ-R
# Algorithm 2 IDLVQ-R
<table><tr><td>In the base task (t =1) Initializeθ,{m1,..,mN1},{q],..,qN1} and γ</td></tr><tr><td>Minimize Lmse w.r.t. θ,{ml,..,mN1},{ql,.,qN1} and γ</td></tr><tr><td>for novel task t = 2,3,.. do</td></tr><tr><td></td></tr><tr><td>Initialize {mNt-1+1,, mNt} and {qNt-1+1.…,qNt}</td></tr><tr><td>Minimize LmsE w.r.t. {mNt-1+1..*,mNt} and {qNt-1+1,.,qNt}</td></tr><tr><td>end for</td></tr><tr><td></td></tr></table>
# A.3 EXPERIMENT DETAILS FOR INCREMENTAL FEW-SHOT CLASSIFICATIO
The base model is trained by the SGD optimizer (momentum of 0.9 and weight decay of 1e-4) with a mini-batch size of 64. For CUB dataset, the initial learning rate is 0.01 and is decayed by 0.1 after 60 and 120 epochs (200 epochs in total). For miniImageNet, the learning rate also starts from 0.01 and is decayed by 0.1 every 200 epochs (600 epochs in total). In an incremental learning session $( t > 1 )$ ), the model is fine-tuned with with $\mathcal { D } ^ { t }$ with a learning rate of 0.01 for 100 epochs. Since novel data $\mathcal { D } ^ { t }$ $t > 1$ ) contains very few training samples, all training samples in $\mathcal { D } ^ { t }$ are included in one mini-batch. In addition, we use $\lambda _ { i n t r a } = 1 . 0$ and $\lambda _ { F } = 0 . 5$ for both datasets. Empirically, larger $\lambda _ { i n t r a }$ leads to more compact intra-class variation. However, convergence could be slow if $\lambda _ { i n t r a }$ is too large. In addition, larger $\lambda _ { F }$ results in less forgetting in old classes but makes learning novel classes more difficult.
# A.4 ADDITIONAL RESULTS FOR INCREMENTAL FEW-SHOT CLASSIFICATION
The accuracies for base and novel classes are reported separately in Table 5 and 6 for CUB amd miniImageNet, respectively. The prediction accuracy of novel classes is calculated upon all novel classes the model has been trained on. Note that the accuracy in Table 1 and 2 is calculated upon all classes (including base and novel classes) that the model has been trained on. The proposed IDLVQC demonstrates strong capability of preserving old knowledge by achieving the best performance on old classes across all learning sessions. In parallel, Imprint method performs slightly better on novel classes than IDLVQ-C in early incremental learning sessions, while IDLVQ-C outperforms Imprint method in longer incremental learning sessions. The advantage of IDLVQ-C can be attributed to the adaptive feature extractor, which is tuned in each learning session.
Table 5: Prediction accuracy on CUB base and novel classes using the 10-way 5-shot incremental setting.
<table><tr><td rowspan="2">Base classes</td><td colspan="10">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr><tr><td>Fine-tune</td><td>77.30</td><td>44.23</td><td>36.28</td><td>27.52</td><td>25.96</td><td>23.05</td><td>17.68</td><td>13.07</td><td>11.78</td><td>10.99</td><td>10.71</td></tr><tr><td>Joint train</td><td>77.30</td><td>75.83</td><td>75.25</td><td>74.51</td><td>74.58</td><td>73.74</td><td>73.95</td><td>73.25</td><td>73.11</td><td>73.25</td><td>73.18</td></tr><tr><td>iCaRL (Rebuffi et al., 2017)</td><td>77.30</td><td>59.38</td><td>58.81</td><td>54.43</td><td>48.27</td><td>43.28</td><td>39.17</td><td>34.91</td><td>32.43</td><td>29.36</td><td>25.87</td></tr><tr><td>Rebalancing (Hou et al.,2019)</td><td>77.30</td><td>66.43</td><td>60.32</td><td>55.36</td><td>46.39</td><td>41.76</td><td>37.12</td><td>32.58</td><td>31.26</td><td>27.03</td><td>24.25</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>77.30</td><td>72.55</td><td>72.21</td><td>72.06</td><td>71.64</td><td>71.29</td><td>71.02</td><td>70.94</td><td>70.67</td><td>70.60</td><td>70.53</td></tr><tr><td>ILVQ (Xu et al., 2012)</td><td>77.30</td><td>74.18</td><td>73.57</td><td>72.66</td><td>72.56</td><td>71.57</td><td>71.14</td><td>71.12</td><td>71.02</td><td>70.98</td><td>70.85</td></tr><tr><td>SDC (Yu et al., 2020)</td><td>77.34</td><td>76.05</td><td>75.21</td><td>74.12</td><td>72.36</td><td>71.81</td><td>71.68</td><td>71.43</td><td>71.25</td><td>71.27</td><td>70.96</td></tr><tr><td>Imprint (Qi et al., 2018)</td><td>77.02</td><td>74.76</td><td>74.57</td><td>73.69</td><td>72.69</td><td>70.88</td><td>70.34</td><td>70.12</td><td>70.07</td><td>69.84</td><td>69.27</td></tr><tr><td>IDLVQ-C</td><td>77.37</td><td>76.32</td><td>75.90</td><td>75.91</td><td>75.49</td><td>74.86</td><td>74.58</td><td>74.37</td><td>74.02</td><td>73.39</td><td>73.32</td></tr><tr><td rowspan="2">Novel classes</td><td></td><td></td><td></td><td></td><td></td><td>sessions</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr><tr><td>Fine-tune</td><td>=</td><td>66.23</td><td>26.86</td><td>18.12</td><td>16.16</td><td>15.85</td><td>13.76</td><td>13.68</td><td>12.23</td><td>11.37</td><td>10.81</td></tr><tr><td>Joint train</td><td>=</td><td>47.78</td><td>36.55</td><td>34.77</td><td>36.68</td><td>38.52</td><td>38.91</td><td>40.37</td><td>41.50</td><td>42.51</td><td>43.28</td></tr><tr><td>iCaRL (Rebuffi et al., 2017)</td><td>-</td><td>35.18</td><td>33.97</td><td>27.04</td><td>21.99</td><td>23.99</td><td>23.04</td><td>24.01</td><td>22.96</td><td>24.04</td><td>24.59</td></tr><tr><td>Rebalancing (Hou et al.,2019)</td><td>=</td><td>45.53</td><td>35.24</td><td>20.39</td><td>20.25</td><td>19.65</td><td>20.91</td><td>21.29</td><td>21.95</td><td>21.60</td><td>22.97</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td></td><td>41.86</td><td>35.01</td><td>29.72</td><td>29.43</td><td>28.72</td><td>28.65</td><td>30.02</td><td>29.56</td><td>30.59</td><td>30.19</td></tr><tr><td>ILVQ (Xu et al., 2012)</td><td></td><td>40.74</td><td>32.89</td><td>29.54</td><td>29.30</td><td>30.38</td><td>28.82</td><td>32.12</td><td>29.17</td><td>30.32</td><td>30.09</td></tr><tr><td>SDC (Yu et al., 2020)</td><td></td><td>58.45</td><td>40.65</td><td>35.77</td><td>33.23</td><td>31.16</td><td>30.24</td><td>33.25</td><td>30.89</td><td>32.26</td><td>32.08</td></tr><tr><td>Imprint (Qi et al.,2018)</td><td></td><td>59.69</td><td>44.15</td><td>38.68</td><td>38.11</td><td>40.46</td><td>41.14</td><td>42.17</td><td>40.33</td><td>40.47</td><td>40.37</td></tr><tr><td>IDLVQ-C</td><td>=</td><td>58.72</td><td>42.18</td><td>37.86</td><td>39.97</td><td>40.84</td><td>41.30</td><td>43.21</td><td>40.32</td><td>42.34</td><td>42.30</td></tr></table>
The test accuracy on CUB dataset using 10-way 10-shot and 10-way 20-shot incremental settings are reported in Table 7 and 8, respectively. The prediction accuracy improves in all methods with more training samples per class. The iCaRL and Rebalancing methods show the most significant improvement when the number of training samples increases. The proposed IDLVQ-C is effective in different incremental few-shot scenarios as it achieves the best performance on 5-shot, 10-shot and 20-shot settings.
# A.5 EXPERIMENT DETAILS FOR INCREMENTAL FEW-SHOT REGRESSION
Sinusoidal wave: A six-layer feedforward neural network with ReLU nonlinear activation is used as the feature extractor. IDLVQ-R learns 10 reference vectors and targets from the base task. In each incremental learning sessions, 5 pairs of reference vectors and targets are added. After new reference vectors and targets are fine-tuned, the model is capable of make prediction for all seen tasks. 10 exemplars are selected uniformly from the training set in the base task. In the incremental learning session of the 2nd task, the model is fine-tuned on 10 exemplars and 5 novel training samples. After the training converges, 5 novel training samples in the current task are added to the exemplar set. In the incremental learning session of the 3rd task, the model is fine-tuned with 15 exemplars from old tasks and 5 novel training samples.
Table 6: Prediction accuracy on miniImageNet base and novel classes using the 5-way 5-shot incremental setting.
<table><tr><td rowspan="2">Base classes</td><td colspan="9">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr><tr><td>Fine-tune</td><td>64.25</td><td>32.28</td><td>20.87</td><td>6.95</td><td>3.17</td><td>3.16</td><td>1.92</td><td>1.53</td><td>1.46</td></tr><tr><td>Joint train</td><td>64.25</td><td>63.30</td><td>62.83</td><td>62.16</td><td>62.18</td><td>62.68</td><td>61.86</td><td>61.87</td><td>61.89</td></tr><tr><td>iCaRL (Rebuffi et al., 2017)</td><td>64.25</td><td>51.66</td><td>48.97</td><td>45.62</td><td>37.39</td><td>30.86</td><td>28.68</td><td>26.83</td><td>24.47</td></tr><tr><td>Rebalancing (Hou et al., 2019)</td><td>64.25</td><td>52.87</td><td>50.16</td><td>44.78</td><td>37.48</td><td>28.75</td><td>25.58</td><td>22.97</td><td>21.57</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>64.25</td><td>59.27</td><td>58.88</td><td>58.69</td><td>58.22</td><td>57.63</td><td>57.03</td><td>56.80</td><td>56.47</td></tr><tr><td>ILVQ (Xu et al.,2012)</td><td>64.25</td><td>60.24</td><td>59.62</td><td>59.02</td><td>58.61</td><td>57.71</td><td>57.16</td><td>56.83</td><td>56.49</td></tr><tr><td>SDC (Yu et al., 2020)</td><td>64.62</td><td>63.58</td><td>62.78</td><td>61.12</td><td>60.29</td><td>59.37</td><td>59.05</td><td>59.97</td><td>59.87</td></tr><tr><td>Imprint (Qi et al.,2018)</td><td>64.71</td><td>63.52</td><td>62.96</td><td>62.13</td><td>61.17</td><td>61.27</td><td>60.63</td><td>59.86</td><td>59.64</td></tr><tr><td>IDLVQ-C</td><td>64.77 63.77</td><td></td><td>63.22</td><td>62.44</td><td>61.22</td><td>61.47</td><td>60.97</td><td>60.66</td><td>60.44</td></tr><tr><td rowspan="2">Novel classes</td><td></td><td></td><td></td><td></td><td>sessions</td><td></td><td></td><td></td><td></td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td></tr><tr><td>Fine-tune</td><td></td><td>4.07</td><td>4.49</td><td>3.75</td><td>1.93</td><td>1.53</td><td>1.77</td><td>1.61</td><td>1.36</td></tr><tr><td>Joint train</td><td>-</td><td>4.80</td><td>9.84</td><td>13.26</td><td>12.30</td><td>14.03</td><td>14.01</td><td>15.21</td><td>15.62</td></tr><tr><td>iCaRL (Rebuffi et al., 2017)</td><td>=</td><td>4.60</td><td>8.09</td><td>8.92</td><td>7.87</td><td>9.10</td><td>8.19</td><td>7.86</td><td>7.70</td></tr><tr><td>Rebalancing (Hou et al.,2019)</td><td></td><td>5.29</td><td>8.23</td><td>9.43</td><td>8.00</td><td>8.93</td><td>8.81</td><td>8.83</td><td>8.27</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td></td><td>5.32</td><td>8.41</td><td>9.79</td><td>11.42</td><td>12.14</td><td>11.67</td><td>11.39</td><td>11.35</td></tr><tr><td>ILVQ (Xu et al.,2012)</td><td></td><td>5.25</td><td>9.29</td><td>10.47</td><td>12.09</td><td>12.35</td><td>11.86</td><td>11.45</td><td>11.34</td></tr><tr><td>SDC (Yu et al., 2020)</td><td></td><td>12.23</td><td>11.05</td><td>10.12</td><td>12.33</td><td>11.46</td><td>10.81</td><td>12.58</td><td>13.30</td></tr><tr><td>Imprint (Qi et al., 2018)</td><td></td><td>15.81</td><td>12.21</td><td>13.83</td><td>16.09</td><td>13.81</td><td>12.45</td><td>12.93</td><td>13.69</td></tr><tr><td>IDLVQ-C</td><td>-</td><td>13.07</td><td>12.19</td><td>13.34</td><td>15.86</td><td>14.14</td><td>12.55</td><td>13.11</td><td>13.94</td></tr></table>
Table 7: Prediction accuracy on CUB using the 10-way 10-shot incremental setting.
<table><tr><td rowspan="2">Method</td><td colspan="10">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr><tr><td>Fine-tune</td><td>77.30</td><td>47.16</td><td>36.34</td><td>26.92</td><td>24.08</td><td>21.24</td><td>17.19</td><td>14.31</td><td>12.73</td><td>11.75</td><td>11.43</td></tr><tr><td>Joint train</td><td>77.30</td><td>73.29</td><td>71.54</td><td>68.72</td><td>66.38</td><td>65.42</td><td>64.98</td><td>65.74</td><td>64.82</td><td>64.47</td><td>64.16</td></tr><tr><td>iCaRL (Rebuffi et al., 2017)</td><td>77.30</td><td>59.66</td><td>56.24</td><td>52.26</td><td>48.77</td><td>46.37</td><td>44.54</td><td>43.17</td><td>42.35</td><td>41.19</td><td>40.92</td></tr><tr><td>Rebalancing (Hou et al., 2019)</td><td>77.30</td><td>64.53</td><td>58.35</td><td>53.82</td><td>49.27</td><td>47.12</td><td>45.16</td><td>43.05</td><td>42.37</td><td>41.02</td><td>40.86</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>77.30</td><td>69.82</td><td>66.12</td><td>63.19</td><td>61.17</td><td>58.85</td><td>58.04</td><td>57.75</td><td>55.84</td><td>55.82</td><td>55.60</td></tr><tr><td>ILVQ (Xu et al., 2012)</td><td>77.30</td><td>71.26</td><td>66.84</td><td>63.82</td><td>62.66</td><td>59.71</td><td>58.92</td><td>58.11</td><td>56.31</td><td>56.14</td><td>56.03</td></tr><tr><td>SDC (Yu et al., 2020)</td><td>77.34</td><td>74.67</td><td>69.73</td><td>66.71</td><td>66.49</td><td>62.14</td><td>61.33</td><td>59.84</td><td>58.01</td><td>57.39</td><td>56.62</td></tr><tr><td>Imprint (Qi et al.,2018)</td><td>77.02</td><td>74.07</td><td>70.26</td><td>66.84</td><td>64.45</td><td>62.46</td><td>61.85</td><td>61.02</td><td>59.20</td><td>58.93</td><td>58.43</td></tr><tr><td>IDLVQ-C</td><td>77.37</td><td>74.79</td><td>70.96</td><td>68.08</td><td>65.94</td><td>64.12</td><td>63.58</td><td>62.98</td><td>60.85</td><td>60.54</td><td>59.72</td></tr></table>
Table 8: Prediction accuracy on CUB using the 10-way 20-shot incremental setting.
<table><tr><td rowspan="2">Method</td><td colspan="10">sessions</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr><tr><td>Fine-tune</td><td>77.30</td><td>47.68</td><td>36.75</td><td>27.01</td><td>24.56</td><td>21.72</td><td>17.88</td><td>15.24</td><td>12.84</td><td>11.89</td><td>11.52</td></tr><tr><td>Joint train</td><td>77.30</td><td>74.34</td><td>72.59</td><td>70.85</td><td>70.14</td><td>70.01</td><td>69.69</td><td>69.67</td><td>69.48</td><td>69.41</td><td>69.42</td></tr><tr><td>iCaRL (Rebuff et al.,2017)</td><td>77.30</td><td>68.85</td><td>63.56</td><td>60.34</td><td>57.71</td><td>56.28</td><td>55.97</td><td>55.02</td><td>54.62</td><td>52.21</td><td>52.23</td></tr><tr><td>Rebalancing (Hou et al.,2019)</td><td>77.30</td><td>69.36</td><td>65.49</td><td>61.32</td><td>59.30</td><td>58.68</td><td>58.77</td><td>57.42</td><td>56.25</td><td>55.33</td><td>54.17</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>77.30</td><td>70.84</td><td>67.82</td><td>64.81</td><td>62.95</td><td>61.71</td><td>60.98</td><td>60.73</td><td>59.51</td><td>59.30</td><td>58.95</td></tr><tr><td>ILVQ (Xu et al., 2012)</td><td>77.30</td><td>71.50</td><td>68.77</td><td>66.12</td><td>64.31</td><td>62.89</td><td>62.31</td><td>62.00</td><td>61.52</td><td>59.79</td><td>59.23</td></tr><tr><td>SDC (Yu et al.,2020)</td><td>77.34</td><td>74.62</td><td>71.63</td><td>68.66</td><td>66.75</td><td>65.24</td><td>64.21</td><td>63.62</td><td>61.97</td><td>61.54</td><td>61.11</td></tr><tr><td>Imprint (Qi et al., 2018)</td><td>77.02</td><td>74.14</td><td>70.72</td><td>67.75</td><td>65.88</td><td>64.63</td><td>64.28</td><td>63.82</td><td>62.00</td><td>61.84</td><td>61.40</td></tr><tr><td>IDLVQ-C</td><td>77.37</td><td>74.84</td><td>72.07</td><td>69.05</td><td>67.28</td><td>65.51</td><td>65.19</td><td>64.84</td><td>62.77</td><td>62.55</td><td>61.96</td></tr></table>
3D spatial data: We follow the same training and test protocols as the sinusoidal wave dataset. We choose 40, 15 and 15 reference vectors and targets for 1st, 2nd and 3rd tasks, respectively. Adding more reference vectors does not result in obvious improvement in accuracy in our experiments.
 Figure 2: Comparison results of different few-shot settings, evaluated with ResNet18 on CUB dataset
# A.6 VISUALIZATION OF IDLVQ-C
We show the visualization of standard neural networks and IDLVQ-C with/without intra-class variation loss in Fig. 3. MNIST dataset is used as a toy example for visualization. Classes 0-7 are old classes with sufficient training samples, and classes 8 and 9 are novel classes with few-shot training samples. It can be observed in Fig. 3(a) and 3(b) that standard neural networks and IDLVQ-C (without intra-class variation loss) trained by cross-entropy loss do not have compact intra-class variation. Consequently, features of novel classes are more likely to overlap with old classes. In this case, the performance of class-incremental learning degrades very quickly because the classifier cannot distinguish between features from different classes. In comparison, the proposed IDLVQ-C makes intra-class variation compact and leaves large margin between classes in Fig 3(c). As a result, the features of novel classes are less likely to overlap existing classes. The compact intra-class variation and large margin between classes make features of novel classes distinguishable so that learning novel classes is easier. In addition, the margin based loss only updates the model parameters when necessary and avoids catastrophic forgetting of old classes.
 Figure 3: Visualization of feature spaces in different methods. Dots represent features of samples and crosses denote references vectors of classes. (a) standard neural networks; (b) IDLVQ-C without $\mathcal { L } _ { i n t r a }$ ; (c) IDLVQ-C.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219# InfoGCL: Information-Aware Graph Contrastive Learning
Dongkuan $\mathbf { X } \mathbf { u } ^ { 1 }$ Wei Cheng2 Dongsheng Luo1 Haifeng Chen2 Xiang Zhang1 1The Pennsylvania State University 2NEC Labs America 1{dux19,dul262,xzz89}@psu.edu 2{weicheng,haifeng}@nec-labs.com
# Abstract
Various graph contrastive learning models have been proposed to improve the performance of learning tasks on graph datasets in recent years. While effective and prevalent, these models are usually carefully customized. In particular, although all recent researches create two contrastive views, they differ greatly in view augmentations, architectures, and objectives. It remains an open question how to build your graph contrastive learning model from scratch for particular graph learning tasks and datasets. In this work, we aim to fill this gap by studying how graph information is transformed and transferred during the contrastive learning process and proposing an information-aware graph contrastive learning framework called InfoGCL. The key point of this framework is to follow the Information Bottleneck principle to reduce the mutual information between contrastive parts while keeping task-relevant information intact at both the levels of the individual module and the entire framework so that the information loss during graph representation learning can be minimized. We show for the first time that all recent graph contrastive learning methods can be unified by our framework. We empirically validate our theoretical analysis on both node and graph classification benchmark datasets, and demonstrate that our algorithm significantly outperforms the state-of-the-arts.
# 1 Introduction
Inspired by their success in the vision and language domains, contrastive learning methods have been wildly adopted by recent progress in graph learning to improve the performance of a variety of tasks [42, 13, 22]. In a nutshell, these methods typically learn representations by creating two augmented views of a graph and maximizing the feature consistency between the two views. Inheriting the advantages of self-supervised learning, contrastive learning relieves graph representation learning from its reliance on label information in graph domain, where label information can be very costly or even impossible to collect while unlabeled/partially labeled data is common, such as chemical graph data [28]. Graph contrastive learning methods have achieved similar (and even better) performance as compared to the equivalent methods trained with labels on benchmark graph datasets [42, 13, 6].
Despite being effective and prevalent, existing graph contrastive learning models differ mostly in augmented view design, encoding architecture, and contrastive objective (refer to Table 1 in Appendix for more comparisons). For a learning task, it usually requires a substantial degree of domain expertise to carefully design and customize these modules for the specific dataset. For example, while both DGI [33] and InfoGraph [28] seek to obtain graph representations by maximizing the mutual information between patch-level and graph-level representations, they adopt different graph encoders, GCN [15] and GIN [38] respectively. mvgrl [13] applies graph diffusion convolution to construct the augmented view, while GCC [22] and GRACE [45] adopt subgraph sampling and graph perturbation, respectively.
 Figure 1: Graph contrastive learning approaches consist of three stages: 1) a graph $\mathcal { G }$ undergoes view augmentation, $q _ { i } ( \cdot ) , q _ { j } ( \cdot )$ , to obtain two semantically similar views, $\mathbf { v } _ { i }$ , $\mathbf { v } _ { j }$ . 2) the two views are fed into view encoder networks, $f _ { i } ( \cdot )$ , $f _ { j } ( \cdot )$ , to extract latent representations, ${ \bf z } _ { i } , { \bf z } _ { j }$ . 3) the feature consistency between representations is maximized to optimize the objective function based on contrastive mode $( c _ { i } ( \cdot ) , c _ { j } ( \cdot ) )$ , where $c _ { i } ( \cdot ) , c _ { j } ( \cdot )$ are aggregation operations applied to representations.
The main question this paper attempts to answer is: how to perform contrastive learning for your learning tasks on specific graph datasets? However, answering this question is challenging. First, contrastive learning consists of multiple components, such as view augmentation and information encoding. For each of them, there are various choices. Numerous variations make it difficult to design models that are both robust and efficient. Existing graph contrastive learning approaches are carefully designed for different learning tasks on different datasets, however, none of them studies the guiding principles for choosing the best components. Second, graph data has unique properties that distinguish it from other types of data, such as rich structural information and highly diverse distribution [33, 28, 11, 10]. Thus, it is desirable to design the contrastive learning model that fits your graph data properties, even without any domain knowledge of the data.
We propose to address these challenges via Information Bottleneck (IB) [31], which provides a crucial principle for representation learning. Specifically, IB encourages the representations to be maximally informative about the target in the downstream task, which helps keep task-relevant information. Concurrently, IB discourages the representation learning from acquiring the task-irrelevant information from the input data, which is related to the idea of minimal sufficient statistics [27]. However, different from the typical representation learning, there are two information flows involved in the two augmented views in contrastive learning. Therefore, we extend the previous IB work [37, 43] and propose InfoGCL, an information-aware contrastive learning framework for graph data.
To study how information is transformed and transferred, we decouple a typical graph contrastive learning model into three sequential modules (as shown in Figure 1): view augmentation, view encoding, and representation contrasting. We further formalize how to find the optimal of the three modules into three optimization problems. To build the optimal graph contrastive learning model for the particular dataset and task, we argue that it is necessary and sufficient to minimize the mutual information between contrastive representations while maximizing task-relevant information at the levels of both individual module and entire framework. Our work is also motivated by the InfoMin theory [30], which suggests that a good set of views for contrastive learning in the vision domain should share the minimal information necessary to perform well at the downstream task. Beyond view selection, our work extends InfoMin to suggest principles of selecting view encodings and contrastive modes for graph learning considering the unique properties of graph data.
We suggest practically feasible principles to find the optimal modules in graph contrastive learning and show that all recent graph contrastive learning methods can be unified by these principles: i) the augmented views should contain as much task-relevant information as possible, while they should share as little information as possible; ii) the view encoder should be task-relevant and simple as much as possible; iii) the contrastive mode should keep task-relevant information as much as possible after contrasting. Besides, we also investigate the role of negative samples in graph contrastive learning and argue that negative samples are not necessarily required, especially when graph data is not extremely sparse. Our proposed method, InfoGCL, is validated on a rich set of benchmark datasets for both node-level and graph-level tasks, where we analyze its ability to capture the unique structural properties of the graph data. The results demonstrate that our algorithm achieves highly competitive performance with up to $5 . 2 \%$ relative improvement in accuracy on graph classification task and competitive results on node classification task over the state-of-the-art unsupervised methods.
# 2 Related Work
Graph Contrastive Learning. Some recent research efforts in graph domain have been attracted by the success of contrastive learning in vision and language domains [3, 8, 4]. A number of graph contrastive learning approaches have been proposed [28, 22, 42, 13]. Despite all of them creating two views and targeting at maximizing the feature disagreement between the two views, these methods are carefully designed and differ in various aspects. Deep graph Infomax (DGI) [33] applied the InfoMax principle [18] to graph data by contrasting the representations of node-level and graph-level for node classification tasks. Different from DGI, InfoGraph [28] aims at node classification tasks and it contrasts the representations of graph-level and substructure-level of different granularity. In addition, DGI and InfoGraph use different graph encoders to extract latent representations. mvgrl [13] studies both node and graph classification tasks. It transforms the adjacency matrix to a diffusion matrix and treat the two matrices as two congruent views. However, in GCC [22] and GRACE [45], subgraph sampling and graph perturbation are used to create the augmented views. GraphCL [42] explores the view augmentations approaches for graph contrastive learning. Specifically, it studies the approaches of node dropping, edge perturbation, attribute masking, and subgraph sampling. A recent work [44] also studies graph data augmentations. However, it focuses on graph neural networks for node classification and does not study the contrastive learning framework. Our method differs from them. We aim to answer the question how to perform contrastive learning for your graph data and tasks. Instead of carefully designing the architectures, we decouple typical graph contrastive learning into three stages and provide our InfoGCL principles to analyze the optimality theoretically and practically.
Information Bottleneck. Our method is related to the Information Bottleneck (IB) theory [31], which aims to find the best trade-off between accuracy and complexity when summarizing a random variable. IB has been recently used to study the deep learning approaches [26, 37, 43]. Specifically, IB expresses the trade-off between the mutual information measures $I ( \mathbf { D } , \mathbf { Z } )$ and $I ( \mathbf { Z } , \mathbf { y } )$ as
$$\operatorname* { m a x } \mathbf { I } \mathbf { B } _ { \beta } = - I ( \mathbf { D } ; \mathbf { Z } ) + \beta I ( \mathbf { Z } ; \mathbf { y } ) ,$$
where D, Z, y are the input, the latent representation and the task label, respectively. $\theta$ is a hyperparameter. In other words, IB aims to learn representation $\mathbf { Z }$ that is maximally expressive about y, while being minimally expressive about $\mathbf { D }$ . More recently, there are some efforts applying the IB theory to graph representation learning. [37] aims to generate both expressive and robust graph representations, while [43] studies the subgraph recognition problem. In contrast, our work focuses on graph contrastive learning, where the two augmented views make the optimization objective (information trade-off) different. Our work is also related to the idea of minimal sufficient statistics [27], which has been recently studied in the vision domain [30], claiming that a good set of image views should share the minimal information necessary to perform well at the downstream task. Different from [30], we focus on the graph domain and propose three stages considering the unique properties of graph data.
# 3 Preliminaries and Notations
Graph Representation Learning. A graph is denoted by $\mathcal { G } = \left( \mathbf { A } , \mathbf { X } \right)$ . $\mathbf { A } \in \mathbb { R } ^ { n \times n }$ is the adjacency matrix. $\mathbf { X } \in \mathbb { R } ^ { n \times d }$ is the node attribute matrix, where $d$ is the attribute dimension. In this work, we focus on both node-level and graph-level tasks. For node-level task, given graph $\mathcal { G }$ and the labels of a subset of nodes, denoted by ${ \bf Y } _ { v }$ , the goal is to learn the latent representation $\mathbf { z } _ { v }$ for each node $v$ such that $\mathbf { z } _ { v }$ preserves both network structures and node attributes, which can be further used to predict ${ \bf Y } _ { v }$ . For graph-level task, given a set of graphs $\mathbb { G } = \{ \mathcal { G } ^ { 1 } , \mathcal { G } ^ { 2 } , \cdot \cdot \cdot \mathrm ~ \} \}$ and the labels of some graphs, denoted by $\mathbf { Y } _ { g }$ , the goal is to learn the latent representation $\mathbf { z } _ { g }$ for each graph such that $\mathbf { z } _ { g }$ can be used to predict $\mathbf { Y } _ { g }$ . Typically, the graph data is fed into graph neural networks (GNNs) to generate the representations, such as $\mathbf { z } _ { g } = \mathbf { G } \mathbf { N } \mathbf { N } \mathbf { s } ( \mathcal { G } )$ .
 Figure 2: Illustration of optimal views. (Left) The relationships between graph $\mathcal { G }$ , two views, $\mathbf { v } _ { i }$ , $\mathbf { v } _ { j }$ , and task $y$ in terms of information entropy. A, B, C, D, E are overlapping areas. Two views are contained by graph because views are functions of graph. (Middle) A, B, E become null when Eqs. (4)-(5) hold, which indicates the views and graph share the same amount of task-relevant information. (Right) C further becomes null when Eq. (3) holds, which indicates all the shared information between views is task-relevant, i.e., the views are optimal.
Graph Contrastive Learning. Given an input graph, graph contrastive learning aims to learn the representations of graph or nodes (for graph-level or node-level tasks respectively) through maximizing the feature consistency between two augmented views of the input graph via contrastive loss in the latent space. We decouple a typical graph contrastive learning model into three sequential modules.
(i) View augmentation. Graph $\mathcal { G }$ undergoes data augmentation $q ( \cdot )$ to obtain two views $\mathbf { v } _ { i }$ , $\mathbf { v } _ { j }$ , i.e., $\mathbf { v } _ { i } \sim q _ { i } ( \mathcal { G } )$ and $\mathbf { v } _ { j } \sim q _ { j } ( { \mathcal { G } } )$ . A view is represented as graph data, such as $\mathbf { v } _ { i } = ( \mathbf { A } _ { v _ { i } } , \mathbf { X } _ { v _ { i } } )$ , where $\mathbf { A } _ { v _ { i } } \in \mathbb { R } ^ { n \times n }$ and $\mathbf { X } _ { v _ { i } } \in \mathbb { R } ^ { n \times d }$ . In practice, view augmentation approaches include node dropping, edge perturbation, subgraph sampling, etc.
(ii) View encoding. Graph-level or node-level latent representation is extracted from views $\mathbf { v } _ { i } , \mathbf { v } _ { j }$ by using the view encoder networks $f ( \cdot )$ (a GNN backbone plus a projection MLP), i.e., $\mathbf { z } _ { i } \sim f _ { i } ( \mathbf { v } _ { i } )$ and $\mathbf { z } _ { j } \sim f _ { j } ( \mathbf { v } _ { j } )$ . The two encoders might or might not share parameters depending on whether they are from the same domain.
(iii) Representation contrasting. Given the latent representations, a contrastive loss is optimized to score the positive pairs $\mathbf { z } _ { i } , \mathbf { z } _ { j }$ higher compared to other negative pairs. Typically, the negative pairs are constructed from the augmented views of other graphs in the same minibatch. The InfoNCE loss [21] has been adopted as one of popular contrastive losses, which is defined as:
$$\mathcal { L } _ { N C E } = - \mathbb { E } \left[ l o g \frac { e x p ( h ( \mathbf { z } _ { i , n } , \mathbf { z } _ { j , n } ) ) } { \sum _ { n ^ { \prime } = 1 } ^ { N } e x p ( h ( \mathbf { z } _ { i , n } , \mathbf { z } _ { j , n ^ { \prime } } ) ) } \right] ,$$
where $h ( \cdot )$ is a contrasting operation to score the agreement between two representations. Theoretically, minimizing the InfoNCE loss equivalently maximizes a lower bound on the mutual information between the views of positive pairs. In other words, $I ( \mathbf { z } _ { i } , \mathbf { z } _ { j } ) \geqslant l o g ( N ) - \mathcal { L } _ { N C E }$ , where $I ( \cdot )$ measures the mutual information.
# 4 Information-Aware Graph Contrastive Learning
In this paper, we study how to perform contrastive learning for specific graph tasks and datasets. In particular, we attempt to answer the following questions for graph contrastive learning: (i) What is the optimal augmented views? (ii) What is the optimal view encoder? (iii) What is the optimal contrastive mode?
# 4.1 View Augmentation
The goal of view augmentation is to create realistically rational data via the transformation approaches that do not affect the semantic label. Compared to the augmentation in other domains, graph view augmentation needs to consider the structural information of graph data, such as the node, the edge, and the subgraph. There are various graph view augmentation methods proposed recently. We follow a similar definition used in [42] to categorize four kinds of view augmentation approaches for graph data. Node dropping discards a certain part of nodes along with their edges in the input graph to create a new graph view. Edge perturbation perturbs the connectivity in the graph via adding or dropping partial edges. Attribute masking masks part of node attributes and assumes that the missing attributes can be well predicted by the remaining ones. Subgraph sampling samples a subgraph from the input graph. The rationale behind these approaches is that the semantic meaning of graph has certain robustness to graph perturbation.
The augmented views generated in the graph contrastive framework are typically used in a separate downstream task. To characterize what views are optimal for a downstream task, we define the optimality of views. The main motivation is: the optimal augmented views should contain the most task-relevant information, and the information shared between views should only be task-relevant.
Corollary 1. (Optimal Augmented Views) For a downstream task $T$ whose goal is to predict a semantic label $y$ , the optimal views, $\mathbf { v } _ { i } ^ { * } , \mathbf { v } _ { j } ^ { * } ,$ , generated from the input graph $\mathcal { G }$ are the solutions to the following optimization problem :
$$\begin{array} { c } { { ( \mathbf { v } _ { i } ^ { * } , \mathbf { v } _ { j } ^ { * } ) = \underset { \mathbf { v } _ { i } , \mathbf { v } _ { j } } { \arg \operatorname* { m i n } I ( \mathbf { v } _ { i } ; \mathbf { v } _ { j } ) } } } \\ { { s . t . ~ I ( \mathbf { v } _ { i } ; y ) = I ( \mathbf { v } _ { j } ; y ) } } \\ { { I ( \mathbf { v } _ { i } ; y ) = I ( \mathcal { G } ; y ) } } \end{array}$$
This says that for the optimal graph views, the amount of information shared between them is minimized (Eq. (3)), while the two views contain the same amount of information with respect to $y$ (Eq. (4)), which is also the amount of information that the input gprah contains about the task (Eq. (5)). The illustration of the optimal views is shown in Figure 2 and the proof is in the Appendix.
# 4.2 View Encoding
View encoding aims to extract the latent representations of nodes or graphs via feeding the data of two views into view encoder networks such that the generated representations preserve both structure and attribute information in the views. The view encoders are quite flexible in graph contrastive learning and typically they are GCN [15], GAT [32], or GIN [38], etc.
The representations extracted via view encoding are further utilized to optimize the objective function of contrastive learning. After well trained, the view encoders are used to generate the graph/node representations for a downstream task. To characterize what encoders are optimal, we define the optimality of view encoders for graph contrastive learning. The main motivation is: the representation generated by the optimal encoder for a view should keep all the shared information by the two contrastive views, meanwhile the kept information is all task-relevant.
Corollary 2. (Optimal View Encoder) Given the optimal views, $\mathbf { v } _ { i } ^ { * } , \mathbf { v } _ { j } ^ { * }$ , for a downstream task $T$ whose goal is to predict a semantic label $y$ , the optimal view encoder for view $\mathbf { v } _ { i } ^ { * }$ is the solution to the following optimization problem :
$$\boldsymbol f _ { i } ^ { * } = \arg \operatorname* { m i n } _ { \boldsymbol f _ { i } } I ( f _ { i } ( \mathbf { v } _ { i } ^ { * } ) ; \mathbf { v } _ { i } ^ { * } )$$
$$s . t . \ I ( f _ { i } ( \mathbf { v } _ { i } ^ { * } ) ; \mathbf { v } _ { j } ^ { * } ) = I ( \mathbf { v } _ { i } ^ { * } ; \mathbf { v } _ { j } ^ { * } )$$
It indicates that for the optimal view encoder, the amount of information shared between the optimal view and the extracted representation is minimized (Eq. (6)), while the information shared between the two optimal views is kept after the encoding process of one view (Eq. (7)). The illustration of the optimal encoder is shown in Figure 3 and the proof is illustrated in the Appendix.
# 4.3 Representation Contrasting
To allow flexible contrasting for graph data, we consider contrastive modes similar to [13]. A contrastive mode is denoted by $( c _ { i } ( \cdot ) , c _ { j } ( \cdot ) )$ , where $c _ { i } ( \cdot )$ , $c _ { j } ( \cdot )$ are the aggregation operations applied to the representations extracted by view encoders, The contrastive modes are unique to graph data because of the structural information inside a graph. Specifically, we consider five contrastive modes. In global-global mode, the graph representations from two views are contrasted. Thus, $c _ { i } ( \cdot )$ , $c _ { j } ( \cdot )$ are averaging aggregation operations in this mode. In local-global mode, we contrast the node representations from one view with the graph representations from the other view. Thus, $c _ { i } ( \cdot )$ , $c _ { j } ( \cdot )$ are the identical transformation and averaging aggregation operations, respectively. In local-local mode, the node representations from two views are contrasted. In multi-scale mode, we contrast graph representation of one view with the intermediate representation from the other. In hybrid mode, both global-global and local-global are applied.
 Figure 3: Illustration of optimal view encoding. (Left) The relationships between two (optimal) views, $\mathbf { v } _ { i } ^ { * }$ , $\mathbf { v } _ { j } ^ { * }$ , task $y$ , and representation $\mathbf { z } _ { i }$ in terms of information entropy. A, B, C are null because the two views are optimal here. $\mathbf { z } _ { i }$ is contained by view $\mathbf { v } _ { i } ^ { * }$ because representations are functions of views. (Middle) $\mathbf { z } _ { i }$ covers $\mathbf { D }$ when Eq. (7) holds, which indicates the shared information between views is kept after encoding. $( R i g h t )$ View $\mathbf { z } _ { i }$ further exactly covers $\mathbf { D }$ and the view encoding becomes optimal, i.e., $\mathbf { z } _ { i } ^ { * }$ , which indicates all the information shared between view $\mathbf { v } _ { i } ^ { * }$ and representation $\mathbf { z } _ { i } ^ { * }$ is task-relevant.
To characterize which mode is optimal, we define the optimality of contrastive mode for graph contrastive learning. The main motivation is: the optimal contrastive mode keeps the most taskrelevant information after the representations are aggregated. The proof is included in the Appendix.
Corollary 3. (Optimal Contrastive Mode) Given the latent representations, $\mathbf { z } _ { i } ^ { * }$ , $\mathbf { z } _ { j } ^ { \ast }$ , extracted by the optimal view encoders, i.e., $\mathbf { z } _ { i } ^ { * } = f _ { i } ^ { * } ( \mathbf { v } _ { i } ^ { * } )$ , $\mathbf { z } _ { j _ { - } } ^ { * } = f _ { j _ { - } } ^ { * } ( \mathbf { v } _ { j } ^ { * } )$ , and a downstream task $T$ with label $y _ { \mathrm { { i } } }$ , the optimal contrastive mode is the solution to the following optimization problem, where $c _ { i }$ , $c _ { j }$ are the aggregation operations applied to the latent representations:
$$\displaystyle ( c _ { i } ^ { * } , c _ { j } ^ { * } ) = \arg \operatorname* { m i n } _ { ( c _ { i } , c _ { j } ) } - I ( c _ { i } ( \mathbf { z } _ { i } ^ { * } ) ; c _ { j } ( \mathbf { z } _ { j } ^ { * } ) ) .$$
# 4.4 InfoGCL Principle
According to our proposed corollaries, we can theoretically design the optimal contrastive learning approach for our specific graph data and task. However, in real-world scenarios, the conditions to meet the exact optimality of contrastive learning is hard or even not practically possible to reach because of data noise and limited model capability. Therefore, we propose to achieve the optimal for each stage independently and practically, which is an approximation to achieve the original optimality. Specifically, we make the following propositions to address the questions of the optimal views, optimal view encoder, and optimal contrastive mode.
Proposition 1. For a task $T$ with label $y _ { ; }$ , given a bunch of graph view augmentation methods, $\{ q _ { 1 } ( \cdot ) _ { : }$ , $q _ { 2 } ( \cdot ) , \cdot \cdot \cdot \}$ , that create two views $\mathbf { v } _ { i }$ , $\mathbf { v } _ { j }$ , the recommended augmentation methods are the ones, $q _ { i } ( \cdot )$ , $q _ { j } ( \cdot )$ , that maximize $I ( \mathbf { v } _ { i } ; y ) + I ( \mathbf { v } _ { j } ; y ) - I ( \mathbf { v } _ { i } ; \mathbf { v } _ { j } )$ , i.e., the area of $A { + } B { + } D$ in Figure 2.
Proposition 2. Given a task $T$ with label $y$ and a set of view encoders, $\{ f _ { i } ^ { 1 } ( \cdot ) , f _ { i } ^ { 2 } ( \cdot ) , \cdot \cdot \cdot \ \} ,$ , that generate representation $\mathbf { z } _ { i }$ via taking view $\mathbf { v } _ { i }$ as input, the recommended view encoder is the one that maximizes the mutual information between $\mathbf { v } _ { i }$ , $\mathbf { z } _ { i }$ and $y$ . Symmetrically the same for view $\mathbf { v } _ { j }$ .
Proposition 3. Given a task $T$ with label $y$ , the extracted representations, $z _ { i } , \ z _ { j }$ , and a set of aggregation operations, $\{ c _ { 1 } ( \cdot ) , c _ { 2 } ( \cdot ) , \cdot \cdot \cdot \ \} ,$ , the recommended contrastive mode is the one, $( c _ { i } , c _ { j } )$ , that has the largest amount of mutual information between $c _ { i } ( \mathbf { z } _ { i } )$ , $c _ { j } ( \mathbf { z } _ { j } )$ and $y$ .
The qualitative and quantitative evaluation of these propositions are shown in Section 5.3.
# 4.5 Role of Negative Samples
Current graph contrastive learning approaches heavily depend on negative samples. However, recent progresses of contrastive learning in vision domain indicate that negative samples are not necessarily required [8, 4], of which the main benefit is to avoid careful treatment to retrieve the negative pairs. To study the influence of negative samples on graph contrastive learning, we follow the framework of SimSiam [4] to revise the loss function as Eq.(9). A very recent work [29] also studies graph contrastive learning without negative samples. Different from it, we focus on both node and graph classification tasks.
Table 1: Dataset statistics.
<table><tr><td rowspan="2"></td><td colspan="6">Graph Task Datasets</td><td colspan="3">Node Task Datasets</td></tr><tr><td>MUTAG</td><td>PTC-MR</td><td>IMDB-B</td><td>IMDB-M</td><td>NCI1</td><td>COLLAB</td><td>Cora</td><td>Citeseer</td><td>Pubmed</td></tr><tr><td>#Graphs</td><td>188</td><td>344</td><td>1000</td><td>1500</td><td>4110</td><td>5000</td><td>1</td><td>1</td><td>1</td></tr><tr><td>#Nodes</td><td>17.9</td><td>14.3</td><td>19.8</td><td>13.0</td><td>29.9</td><td>74.5</td><td>3327</td><td>2708</td><td>19717</td></tr><tr><td>#Edges</td><td>19.8</td><td>14.7</td><td>193.1</td><td>65.9</td><td>1.1</td><td>33.0</td><td>4732</td><td>5429</td><td>44338</td></tr><tr><td>#Classes</td><td>2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>3</td><td>6</td><td>7</td><td>3</td></tr></table>
$$\mathcal { L } = - \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \frac { \mathbf { z } _ { i , n } } { \| \mathbf { z } _ { i , n } \| } \cdot \frac { \mathbf { z } _ { j , n } } { \| \mathbf { z } _ { j , n } \| } ,$$
# 5 Experiments
In this section, we evaluate our InfoGCL with a number of experiments. We first describe datasets, evaluation protocol, and experimental setup. Then, we present the experimental results on both node and graph classification. Last, we analyze our proposed principles via ablation study.
# 5.1 Setup
We use both graph classification and node classification benchmark datasets that are widely used in the existing graph contrastive learning approaches. The graph classification datasets include MUTAG [17], PTC-MR [17], IMDB-B [40], IMDB-M [40], NCI1 [34], and COLLAB [40]. MUTAG is a collection of nitroaromatic compounds represented as graphs, where vertices stand for atoms and edges represent bonds between atoms. PTC-MR is a collection of 344 chemical compounds which report the carcinogenicity for rats. IMDB-B and IMDB-M are two movie collaboration datasets, where nodes represent actors/actress and there is an edge between them if they appear in the same movie. In NCI1, graphs are the representation of chemical compounds, where vertices stand for atoms and edges represent bonds between atoms. COLLAB is a collaboration dataset, where researchers are nodes and an edge indicates collaboration between two researchers. The node classification datasets include Citeseer, Cora, and Pubmed [23]. All of them are citation networks, where nodes are documents and edges are citation links. These datasets are summarized in Table 1.
We closely follow the evaluation protocol of previous state-of-the-art graph contrastive learning approaches. For graph classification, we report the mean 10-fold cross validation accuracy after 5 runs followed by a linear SVM. The linear SVM is trained by applying cross validation on training data folds and the best mean accuracy is reported. For node classification, we report the mean accuracy on test set after 50 runs of training followed by a linear neural network model. To make comparison fair, we adopt the basic setting of InfoGraph for graph classification. We conduct experiment with the values of the number of GNN layers, the number of epochs, batch size, the parameter C of SVM in the sets {2, 4, 8, 12}, {10, 20, 40, 100}, {32, 64, 128, 256} and $\{ 1 0 ^ { - 3 } , \ : \mathrm { { \dot { 1 } 0 ^ { - 2 } } } , . . . , \ : 1 0 ^ { 2 } , 1 0 ^ { 3 } \ : \ : \}$ , respectively. We adopt the basic setting of DGI for node classification. Specifically, we set the number of GNN layers to 1 and experiment with the batch size in the set {2, 4, 8}. The hidden dimension of representations is set to 512. We also apply the early stopping strategy.
# 5.2 Experimental Results
To evaluate our method InfoGCL on graph classification, we use thhree categories of baselines. The kernel approaches include shortest path kernel (SP) [2], Graphlet kernel (GK) [25], WeisfeilerLehman sub-tree kernel (WL) [24], deep graph kernels (DGK) [39], and multi-scale Laplacian kernel (MLG) [16]. The supervised baselines include GraphSAGE [12], GCN [15], GIN [38], GAT [32]. We also compare with the unsupervised approaches, including RandomWalk [7], node2vec [9], sub2vec [14], graph2vec [20], InfoGraph [28], GraphCL [42], and mvgrl [13]. Table 2 shows the graph classification results. We observe that our approach achieves the best results compared to other unsupervised approaches. Our approach also outperforms or matches the best kernel approaches across the datasets. Even compared with the supervised ones, our approach achieves the best in 2 out of 6 datasets and the results of our approach on other 4 dataset are among the top.
Table 2: Graph classification results $( \% )$
<table><tr><td>Method</td><td>MUTAG</td><td>PTC-MR</td><td>IMDB-B</td><td>IMDB-M</td><td>NCI1</td><td>COLLAB</td></tr><tr><td colspan="7">Kernel Approaches</td></tr><tr><td>SP</td><td>85.2 ± 2.4</td><td>58.2 ± 2.4</td><td>55.6± 0.2</td><td>38.0±0.3</td><td>73.5 ± 0.1</td><td></td></tr><tr><td>GK</td><td>81.7 ± 2.1</td><td>57.3 ± 1.4</td><td>65.9 ± 1.0</td><td>43.9 ± 0.4</td><td>66.0 ± 0.1</td><td>72.8± 0.3</td></tr><tr><td>WL</td><td>80.7 ± 3.0</td><td>58.0 ± 0.5</td><td>72.3 ± 3.4</td><td>47.0 ± 0.5</td><td>80.0± 0.5</td><td>78.9 ± 1.9</td></tr><tr><td>DGK</td><td>87.4 ± 2.7</td><td>60.1 ± 2.6</td><td>67.0 ± 0.6</td><td>44.6 ± 0.5</td><td>80.3 ± 0.5</td><td>73.1 ± 0.3</td></tr><tr><td>MLG</td><td>87.9 ± 1.6</td><td>63.3 ± 1.5</td><td>66.6 ± 0.3</td><td>41.2 ± 0.0</td><td>80.8 ± 1.3</td><td></td></tr><tr><td colspan="7">Supervised Approaches</td></tr><tr><td>GraphSAGE</td><td>85.1 ± 7.6 63.9 ± 7.7</td><td></td><td>72.3 ± 5.3</td><td>50.9 ± 2.2</td><td>77.7 ± 1.5</td><td>68.3 ± 4.2</td></tr><tr><td>GCN</td><td>85.6 ± 5.8</td><td>64.2 ± 4.3</td><td>74.0± 3.4</td><td>51.9 ± 3.8</td><td>80.2 ± 2.0</td><td>79.0 ± 1.8</td></tr><tr><td>GIN-0</td><td>89.4 ± 5.6</td><td>64.6 ± 7.0</td><td>75.1 ± 5.1</td><td>52.3 ± 2.8</td><td>82.7 ± 1.7</td><td>80.2 ± 1.9</td></tr><tr><td>GIN-e</td><td>89.0 ± 6.0</td><td>63.7 ±8.2</td><td>74.3 ± 5.1</td><td>52.1 ± 3.6</td><td>82.7 ± 1.6</td><td>80.1 ± 1.9</td></tr><tr><td>GAT</td><td>89.4 ± 6.1</td><td>66.7 ± 5.1</td><td>70.5 ± 2.3</td><td>47.8 ± 3.1</td><td>66.6 ± 2.2</td><td>67.4 ± 2.9</td></tr><tr><td colspan="7">Unsupervised Approaches</td></tr><tr><td>RandomWalk</td><td>83.7 ± 1.5</td><td>57.9 ± 1.3</td><td>50.7±0.3</td><td>34.7 ± 0.2</td><td>64.3 ± 0.3</td><td></td></tr><tr><td>node2vec</td><td>72.6 ±10.2</td><td>58.6±8.0</td><td>50.2 ± 0.9</td><td>36.0 ± 0.7</td><td>54.9 ± 1.6</td><td>56.1 ± 0.2</td></tr><tr><td>sub2vec</td><td>61.1 ± 15.8</td><td>60.0 ± 6.4</td><td>55.3 ± 1.5</td><td>36.7 ± 0.8</td><td>52.8 ±1.5</td><td>-</td></tr><tr><td>graph2vec</td><td>83.2 ±9.6</td><td>60.2 ± 6.9</td><td>71.1 ± 0.5</td><td>50.4 ± 0.9</td><td>75.4 ±1.2</td><td></td></tr><tr><td>InfoGraph</td><td>89.0 ± 1.1</td><td>61.7 ± 1.4</td><td>73.0± 0.9</td><td>49.7 ± 0.5</td><td>76.2 ±1.4</td><td>70.7 ± 1.1</td></tr><tr><td>GraphCL</td><td>86.8 ± 1.3</td><td>61.3 ± 2.1</td><td>71.1 ± 0.4</td><td>49.2 ± 0.6</td><td>77.9 ± 0.4</td><td>71.4 ± 1.2</td></tr><tr><td>mvgrl</td><td>89.7 ± 1.1</td><td>62.5 ± 1.7</td><td>74.2 ± 0.7</td><td>51.2 ± 0.5</td><td>77.0 ± 0.8</td><td>76.0 ± 1.2</td></tr><tr><td></td><td></td><td></td><td></td><td>51.4 ± 0.8</td><td>80.2 ± 0.6</td><td></td></tr><tr><td>InfoGCL</td><td>91.2 ± 1.3</td><td>63.5 ± 1.5</td><td>75.1 ± 0.9</td><td></td><td></td><td>80.0 ± 1.3</td></tr></table>
Table 3: Node classification results $( \% )$ .
<table><tr><td>Method</td><td>Cora</td><td>Citeseer</td><td>Pubmed</td></tr><tr><td></td><td>Supervised Approaches</td><td></td><td></td></tr><tr><td>MLP</td><td>55.1</td><td>46.5</td><td>71.4</td></tr><tr><td>ICA</td><td>75.1</td><td>69.1</td><td>73.9</td></tr><tr><td>LP</td><td>68.0</td><td>45.3</td><td>63.0</td></tr><tr><td>ManiReg</td><td>59.5</td><td>60.1</td><td>70.7</td></tr><tr><td>SemiEmb</td><td>59.0</td><td>59.6</td><td>71.7</td></tr><tr><td>Planetoid</td><td>75.7</td><td>64.7</td><td>77.2</td></tr><tr><td>Chebyshev</td><td>81.2</td><td>69.8</td><td>74.4</td></tr><tr><td>GCN</td><td>81.5</td><td>70.3</td><td>79.0</td></tr><tr><td>JKNet</td><td>82.7 ± 0.4</td><td>73.0 ± 0.5</td><td>77.9 ± 0.4</td></tr><tr><td>GAT</td><td>83.0 ± 0.7</td><td>72.5± 0.7</td><td>79.0 ± 0.3</td></tr><tr><td></td><td>Unsupervised Approaches</td><td></td><td></td></tr><tr><td>Linear</td><td>47.9 ± 0.4</td><td>49.3 ± 0.2</td><td>69.1 ± 0.3</td></tr><tr><td>DeepWalk</td><td>70.7 ± 0.6</td><td>51.4 ± 0.5</td><td>74.3 ± 0.9</td></tr><tr><td>GAE</td><td>71.5 ± 0.4</td><td>65.8 ±0.4</td><td>72.1 ± 0.5</td></tr><tr><td>VERSE</td><td>72.5 ± 0.3</td><td>55.5± 0.4</td><td></td></tr><tr><td>DGI</td><td>83.8 ± 0.5</td><td>72.0 ± 0.6</td><td>77.9 ± 0.3</td></tr><tr><td>GraphCL</td><td>82.5 ± 0.1</td><td>73.1 ± 0.2</td><td></td></tr><tr><td>mvgrl</td><td>86.8 ± 0.5</td><td>73.3 ± 0.5</td><td>80.1 ± 0.7</td></tr><tr><td>InfoGCL</td><td>83.5 ± 0.3</td><td>73.5 ± 0.4</td><td>79.1 ± 0.2</td></tr></table>
For node classification tasks, we compare InfoGCL with some supervised approaches and unsupervised approaches. The supervised baselines include a simple MLP model, iterative classification algorithm (ICA) [19], manifold regularization (ManiReg) [1], semi-supervised embedding (SemiEmb) [35], Planetoid [41], Chebyshev [5], GCN, JKNet [36], GAT. Table 3 shows the node classification results. It is observed that our approach achieves the state-of-the-art results and competes the best one with respect to the existing unsupervised approaches. Compared to supervised baselines, our approach outperforms all the baselines.
<table><tr><td>Method</td><td>MUTAG</td><td>IMDB-B</td><td>COLLAB</td><td>Cora</td><td>Citeseer</td><td>Pubmed</td></tr><tr><td>InfoGCL (w/o neg)</td><td>91.0 ± 1.4</td><td>75.1± 0.5</td><td>80.2 ±1.0</td><td>78.6 ± 0.4</td><td>70.4 ± 0.6</td><td>77.4±0.7</td></tr><tr><td>InfoGCL (w/ neg)</td><td>91.2 ± 1.3</td><td>75.1 ± 0.9</td><td>80.0± 1.3</td><td>83.5±0.3</td><td>73.5 ± 0.4</td><td>79.1±0.2</td></tr></table>
Table 4: Comparison between InfoGCL with negative samples and without negative samples.
# 5.3 Evaluation of InfoGCL Principle
We can unify the existing graph contrastive learning methods through the perspective of InfoGCL principle: all recent graph contrastive learning methods can be decoupled into three stages that implicitly follow the InfoGCL principle, though being different in model architecture design and optimization strategies. Below, we analyze some observations from several recent work. Because of the limited space, please refer to the Appendix for more results of the quantitative analysis.
Obs. i. Composing a graph and its augmentation benefits downstream performance [42]. Compared to composing a graph and the graph itself, augmentation leads to smaller $I ( \mathbf { v } _ { i } ; \mathbf { v } _ { j } )$ (Proposition 1).
Obs. ii. Composing different augmentations benefits more [42]. Compared to composing a graph and its augmentations, two augmentations further decrease $I ( \mathbf { v } _ { i } ; \mathbf { v } _ { j } )$ (Proposition 1).
Obs. iii. Node dropping and subgraph sampling are generally beneficial across datasets [42]. When compared to attribute masking and edge perturbation, they change the semantic meaning of the graph relatively slightly, which leads to higher $I ( \mathbf { v } _ { i } ; y )$ , $I ( \mathbf { v } _ { j } ; \bar { y } )$ (Proposition 1).
Obs. iv. Edge perturbation benefits social networks but hurts some biochemical molecules [42]. The semantic meaning of social networks are robust to edge perturbation. However, the semantic meaning of some biochemical molecules are determined by local connection pattern, where edge perturbation decreases $I ( \mathbf { v } _ { i } ; y )$ (Proposition 1).
Obs. v. Contrasting node and graph representations consistently performs better than other contrastive modes across benchmarks [13]. Compared to other contrastive modes, node-graph (i.e., local-global) mode generally extracts more graph structure information, which benefits predicting task label $y$ (Proposition 3).
# 5.4 Effect of Negative Samples
To study the effect of negative samples on graph contrastive learning, we follow SimSiam [4] and design the objective as Eq. (9). We conduct experiments on three graph task and three node task datasets. The results are reported in Table 4. It is observed that the negative samples show little influence on the three graph task datasets, while performance drops on the three node task datasets, especially the Cora dataset.
According to the dataset statistics summarized in Table 1, we see the networks of Cora, Citeseer, Pubmed are much sparser (in terms of network topology). Furthermore, we know the node features of these three datasets are also much sparser (one-hot encoding with high dimensionality). We speculate this because the contrastive learning models tends to collapse easier if negative samples are not used, especially when data is too sparse. Therefore,we make the hypothesis: negative samples benefit graph modeling, especially when i) network topology, and ii) node features are extremely sparse.
# 6 Conclusion and Limitations
We propose InfoGCL, an information-aware graph contrastive learning framework for graph contrastive learning. Existing graph contrastive learning approaches are usually carefully designed. We aim to answer how to perform contrastive learning for your learning tasks on specific graph data. Our method decouples the typical contrastive learning approaches into three sequential modules and provides the theoretical analysis for reaching the optimality. To address the questions of optimality in a practical way, we propose the InfoGCL principle, which is implicitly followed by all recent graph contrastive learning approaches. In addition, we explore the role of negative samples in graph contrastive learning and find negative samples are not necessarily required. Experiments on both node and graph benchmark datasets demonstrate the effectiveness of our method. Note that our method is not without limitations. We can further improve our method by designing better practical approximations to the theoretical optimality of graph contrastive learning.
# Funding Transparency Statement
This project was partially supported by NSF projects IIS-1707548 and CBET-1638320.
# References
[1] Mikhail Belkin, Partha Niyogi, and Vikas Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. J. Mach. Learn. Res, 7, 2006. [2] Karsten M. Borgwardt and Hans-Peter Kriegel. Shortest-path kernels on graphs. In ICDM, 2005. [3] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. ICML, 2020. [4] Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. CoRR, abs/2011.10566, 2020. [5] Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NIPS, 2016. [6] Yuanqi Du, Shiyu Wang, Xiaojie Guo, Hengning Cao, Shujie Hu, Junji Jiang, Aishwarya Varala, Abhinav Angirekula, and Liang Zhao. Graphgt: Machine learning datasets for deep graph generation and transformation. 2021. [7] Gartner, Flach, and Wrobel. On graph kernels: Hardness results and efficient alternatives. In COLT Workshop, 2003. [8] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Pires, Zhaohan Guo, Mohammad Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent: A new approach to self-supervised learning. 2020. [9] Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In KDD, 2016. [10] Xiaojie Guo, Yuanqi Du, and Liang Zhao. Property controllable variational autoencoder via invertible mutual dependence. In International Conference on Learning Representations, 2020. [11] Xiaojie Guo, Yuanqi Du, and Liang Zhao. Deep generative models for spatial networks. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 505–515, 2021. [12] William L. Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NeurIPS, 2017. [13] Kaveh Hassani and Amir Hosein Khasahmadi. Contrastive multi-view representation learning on graphs. In ICML, pages 3451–3461. 2020. [14] Kexin Huang and Marinka Zitnik. Graph meta learning via local subgraphs. CoRR, abs/2006.07889, 2020. [15] Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017. [16] Risi Kondor and Horace Pan. The multiscale laplacian graph kernel. In NIPS, 2016. [17] Nils Kriege and Petra Mutzel. Subgraph matching kernels for attributed graphs. In ICML, 2012. [18] R. Linsker. Self-organization in a perceptual network. Computer, 21:105, 1988. [19] Qing Lu and Lise Getoor. Link-based classification. In ICML, 2003.
[20] Annamalai Narayanan, Mahinthan Chandramohan, Rajasekar Venkatesan, Lihui Chen, Yang Liu, and Shantanu Jaiswal. graph2vec: Learning distributed representations of graphs. CoRR, 2017. [21] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. [22] Jiezhong Qiu, Qibin Chen, Yuxiao Dong, Jing Zhang, Hongxia Yang, Ming Ding, Kuansan Wang, and Jie Tang. Gcc: Graph contrastive coding for graph neural network pre-training. KDD, 2020. [23] Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina EliassiRad. Collective classification in network data. AI magazine, 29(3):93–93, 2008. [24] Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M. Borgwardt. Weisfeiler-lehman graph kernels. J. Mach. Learn. Res, pages 2539–2561, 2011. [25] Nino Shervashidze, S. V. N. Vishwanathan, Tobias Petri, Kurt Mehlhorn, and Karsten M. Borgwardt. Efficient graphlet kernels for large graph comparison. In AISTATS, 2009. [26] Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017. [27] Stefano Soatto and Alessandro Chiuso. Modeling visual representations: Defining properties and deep approximations. In ICLR, 2016. [28] Fan-Yun Sun, Jordan Hoffman, Vikas Verma, and Jian Tang. Infograph: Unsupervised and semi-supervised graph-level representation learning via mutual information maximization. In ICLR, 2019. [29] Shantanu Thakoor, Corentin Tallec, Mohammad Gheshlaghi Azar, Rémi Munos, Petar Velickovi ˇ c, and Michal Valko. Bootstrapped representation learning on graphs. ´ arXiv preprint arXiv:2102.06514, 2021. [30] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. In NeurIPS, volume 33, 2020. [31] Naftali Tishby, Fernando C. N. Pereira, and William Bialek. The information bottleneck method. CoRR, physics/0004057, 2000. [32] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua ´ Bengio. Graph Attention Networks. ICLR, 2018. [33] Petar Velickovi ˇ c, William Fedus, William L. Hamilton, Pietro Liò, Yoshua Bengio, and R Devon ´ Hjelm. Deep Graph Infomax. In ICLR, 2019. [34] Nikil Wale, Ian A Watson, and George Karypis. Comparison of descriptor spaces for chemical compound retrieval and classification. Knowledge and Information Systems, 14(3):347–375, 2008. [35] Jason Weston, Frédéric Ratle, Hossein Mobahi, and Ronan Collobert. Deep learning via semi-supervised embedding, 2013. [36] Felix Wu, Tianyi Zhang 0007, Amauri H. Souza Jr., Christopher Fifty, Tao Yu, and Kilian Q. Weinberger. Simplifying graph convolutional networks. ICML, 2019. [37] Tailin Wu, Hongyu Ren, Pan Li, and Jure Leskovec. Graph information bottleneck. CoRR, 2020. [38] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In ICLR, 2019. [39] Pinar Yanardag and S. V. N. Vishwanathan. Deep graph kernels. In KDD, 2015. [40] Pinar Yanardag and SVN Vishwanathan. Deep graph kernels. In KDD, pages 1365–1374, 2015. [41] Zhilin Yang, William W. Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. ICML, abs/1603.08861, 2016. [42] Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. In NeurIPS, volume 33, 2020. [43] Junchi Yu, Tingyang Xu, Yu Rong, Yatao Bian, Junzhou Huang, and Ran He. Graph information bottleneck for subgraph recognition. ICLR, 2021. [44] Tong Zhao, Yozen Liu, Leonardo Neves, Oliver Woodford, Meng Jiang, and Neil Shah. Data augmentation for graph neural networks. arXiv preprint arXiv:2006.06830, 2020. [45] Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Deep Graph Contrastive Representation Learning. In ICML Workshop, 2020.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331# DOMAIN GENERALIZATION WITH MIXSTYLE
Kaiyang Zhou1, Yongxin Yang1, Yu Qiao2, Tao Xiang1
1University of Surrey, UK 2Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences, Shenzhen, China k.zhou.vision@gmail.com {yongxin.yang, t.xiang}@surrey.ac.uk yu.qiao@siat.ac.cn
# ABSTRACT
Though convolutional neural networks (CNNs) have demonstrated remarkable ability in learning discriminative features, they often generalize poorly to unseen domains. Domain generalization aims to address this problem by learning from a set of source domains a model that is generalizable to any unseen domain. In this paper, a novel approach is proposed based on probabilistically mixing instancelevel feature statistics of training samples across source domains. Our method, termed MixStyle, is motivated by the observation that visual domain is closely related to image style (e.g., photo vs. sketch images). Such style information is captured by the bottom layers of a CNN where our proposed style-mixing takes place. Mixing styles of training instances results in novel domains being synthesized implicitly, which increase the domain diversity of the source domains, and hence the generalizability of the trained model. MixStyle fits into mini-batch training perfectly and is extremely easy to implement. The effectiveness of MixStyle is demonstrated on a wide range of tasks including category classification, instance retrieval and reinforcement learning.
# 1 INTRODUCTION
Key to automated understanding of digital images is to compute a compact and informative feature representation. Deep convolutional neural networks (CNNs) have demonstrated remarkable ability in representation learning, proven to be effective in many visual recognition tasks, such as classifying photo images into 1,000 categories from ImageNet (Krizhevsky et al., 2012) and playing Atari games with reinforcement learning (Mnih et al., 2013). However, it has long been discovered that the success of CNNs heavily relies on the i.i.d. assumption, i.e. training and test data should be drawn from the same distribution; when such an assumption is violated even just slightly, as in most realworld application scenarios, severe performance degradation is expected (Hendrycks & Dietterich, 2019; Recht et al., 2019).
Domain generalization (DG) aims to address such a problem (Zhou et al., 2021; Blanchard et al., 2011; Muandet et al., 2013; Li et al., 2018a; Zhou et al., 2020b; Balaji et al., 2018; Dou et al., 2019; Carlucci et al., 2019). In particular, assuming that multiple source domains containing the same visual classes are available for model training, the goal of DG is to learn models that are robust against data distribution changes across domains, known as domain shift, so that the trained model can generalize well to any unseen domains. Compared to the closely related and more widely studied domain adaptation (DA) problem, DG is much harder in that no target domain data is available for the model to analyze the distribution shift in order to overcome the negative effects. Instead, a DG model must rely on the source domains and focus on learning domain-invariant feature representation in the hope that it would remain discriminative given target domain data.
A straightforward solution to DG is to expose a model with a large variety of source domains. Specifically, the task of learning domain-invariant and thus generalizable feature representation becomes easier when data from more diverse source domains are available for the model. This would reduce the burden on designing special models or learning algorithms for DG. Indeed, model training with large-scale data of diverse domains is behind the success of existing commercial face recognition or vision-based autonomous driving systems. A recent work by $\mathrm { X u }$ et al. (2021) also emphasizes the importance of diverse training distributions for out-of-distribution generalization. However, collecting data of a large variety of domains is often costly or even impossible. It thus cannot be a general solution to DG.
 Figure 1: 2-D t-SNE (Maaten & Hinton, 2008) visualization of the style statistics (concatenation of mean and standard deviation) computed from the first residual block’s feature maps of a ResNet-18 (He et al., 2016) trained on four distinct domains (Li et al., 2017). It is clear that different domains are well separated.
In this paper, a novel approach is proposed based on probabilistically mixing instance-level feature statistics of training samples across source domains. Our model, termed MixStyle, is motivated by the observation that visual domain is closely related to image style. An example is shown in Fig. 1: the four images from four different domains depict the same semantic concept, i.e. dog, but with distinctive styles (e.g., characteristics in color and texture). When these images are fed into a deep CNN, which maps the raw pixel values into category labels, such style information is removed at the output. However, recent style transfer studies (Huang & Belongie, 2017; Dumoulin et al., 2017) suggest that such style information is preserved at the bottom layers of the CNN through the instance-level feature statistics, as shown clearly in Fig. 4. Importantly, since replacing such statistics would lead to replaced style while preserving the semantic content of the image, it is reasonable to assume that mixing styles from images of different domains would result in images of (mixed) new styles. That is, more diverse domains/styles can be made available for training a more domain-generalizable model.
Concretely, our MixStyle randomly selects two instances of different domains and adopts a probabilistic convex combination between instance-level feature statistics of bottom CNN layers. In contrast to style transfer work (Huang & Belongie, 2017; Dumoulin et al., 2017), no explicit image synthesis is necessary meaning much simpler model design. Moreover, MixStyle perfectly fits into modern mini-batch training. Overall, it is very easy to implement with only few lines of code. To evaluate the effectiveness as well as the general applicability of MixStyle, we conduct extensive experiments on a wide spectrum of datasets covering category classification (Sec. 3.1), instance retrieval (Sec. 3.2), and reinforcement learning (Sec. 3.3). The results demonstrate that MixStyle can significantly improve CNNs’ cross-domain generalization performance.1
# 2 METHODOLOGY
# 2.1 BACKGROUND
Normalizing feature tensors with instance-specific mean and standard deviation has been found effective for removing image style in style transfer models (Ulyanov et al., 2016; Huang & Belongie, 2017; Dumoulin et al., 2017). Such an operation is widely known as instance normalization (IN, Ulyanov et al. (2016)). Let $\boldsymbol { x } ^ { \prime } \in \mathbb { R } ^ { B \times C \times \dot { H } \times W }$ be a batch of tensors, with $B , C , H$ and $W$ denoting the dimension of batch, channel, height and width, respectively, IN is formulated as
$$\mathrm { I N } ( x ) = \gamma \frac { x - \mu ( x ) } { \sigma ( x ) } + \beta ,$$
where $\gamma , \beta \in \mathbb { R } ^ { C }$ are learnable affine transformation parameters, and $\mu ( \boldsymbol { x } ) , \sigma ( \boldsymbol { x } ) \in \mathbb { R } ^ { B \times C }$ are mean and standard deviation computed across the spatial dimension within each channel of each instance (tensor), i.e.
$$\mu ( x ) _ { b , c } = \frac { 1 } { H W } \sum _ { h = 1 } ^ { H } \sum _ { w = 1 } ^ { W } x _ { b , c , h , w } ,$$
and
$$\sigma ( x ) _ { b , c } = \sqrt { \frac { 1 } { H W } \sum _ { h = 1 } ^ { H } \sum _ { w = 1 } ^ { W } ( x _ { b , c , h , w } - \mu ( x ) _ { b , c } ) ^ { 2 } } .$$
Huang & Belongie (2017) introduced adaptive instance normalization (AdaIN), which simply replaces the scale and shift parameters in Eq. (1) with the feature statistics of style input $y$ to achieve arbitrary style transfer:
$$\mathrm { A d a I N } ( x ) = \sigma ( y ) \frac { x - \mu ( x ) } { \sigma ( x ) } + \mu ( y ) .$$
# 2.2 MIXSTYLE
Our method, MixStyle, draws inspiration from AdaIN. However, rather than attaching a decoder for image generation, MixStyle is designed for the purpose of regularizing CNN training by perturbing the style information of source domain training instances. It can be implemented as a plug-andplay module inserted between CNN layers of, e.g., a supervised CNN classifier, without the need to explicitly generate an image of new style.
More specifically, MixStyle mixes the feature statistics of two instances with a random convex weight to simulate new styles. In terms of implementation, MixStyle can be easily integrated into mini-batch training. Given an input batch $x$ , MixStyle first generates a reference batch $\tilde { x }$ from $x$ . When domain labels are given, $x$ is sampled from two different domains $i$ and $j$ , e.g., $\bar { \boldsymbol { x } } = [ x ^ { i } , x ^ { j } ]$ $\bar { x ^ { i } }$ and $x ^ { j }$ have the same batch size). Then, $\tilde { x }$ is obtained by swapping the position of $x ^ { i }$ and $x ^ { j }$ , followed by a shuffling operation along the batch dimension applied to each batch, i.e. $\mathbf { \widetilde { \boldsymbol { x } } } = [ \mathrm { S h u f f e } ( \boldsymbol { x } ^ { j } ) , \mathrm { S h u f f e } ( \boldsymbol { x } ^ { i } ) ]$ . See Fig. 2(a) for an illustration. In cases where domain labels are unknown, $x$ is randomly sampled from the training data, and $\tilde { x }$ is simply obtained by $\tilde { x } = \mathrm { S h u f f e } ( x )$ (see Fig. 2(b)). Fig. 4 shows that sub-domains exist within each domain, so even if two instances of the same domain are sampled, new domain could be synthesized. After shuffling, MixStyle computes the mixed feature statistics by
 Figure 2: A graphical illustration of how a reference batch is generated. Domain label is denoted by color.
$$\begin{array} { r } { \gamma _ { m i x } = \lambda \sigma ( x ) + ( 1 - \lambda ) \sigma ( \tilde { x } ) , } \\ { \beta _ { m i x } = \lambda \mu ( x ) + ( 1 - \lambda ) \mu ( \tilde { x } ) , } \end{array}$$
where $\lambda \in \mathbb { R } ^ { B }$ are instance-wise weights sampled from the Beta distribution, $\lambda \sim B e t a ( \alpha , \alpha )$ with $\alpha \in ( 0 , \infty )$ being a hyper-parameter. Unless specified otherwise, we set $\alpha$ to 0.1 throughout this paper. Finally, the mixed feature statistics are applied to the style-normalized $x$ ,
$${ \mathrm { M i x S t y l e } } ( x ) = \gamma _ { m i x } { \frac { x - \mu ( x ) } { \sigma ( x ) } } + \beta _ { m i x } .$$
In practice, we use a probability of 0.5 to decide if MixStyle is activated or not in the forward pass. At test time, no MixStyle is applied. Note that gradients are blocked in the computational graph of $\mu ( \cdot )$ and $\sigma ( \cdot )$ . MixStyle can be implemented with only few lines of code. See Algorithm 1 in Appendix A.1 for the PyTorch-like pseudo-code.
Table 1: Leave-one-domain-out generalization results on PACS.
<table><tr><td>Method</td><td>Art</td><td>Cartoon</td><td>Photo</td><td>Sketch</td><td>Avg</td></tr><tr><td>MMD-AAE CCSA JiGen</td><td>75.2 80.5 79.4 79.8 82.1</td><td>72.7 76.9 75.3 76.8</td><td>96.0 93.6 96.0 96.0</td><td>64.2 66.8 71.6 70.2</td><td>77.0 79.4 80.5 80.7</td></tr><tr><td>Epi-FCR Metareg L2A-OT ResNet-18</td><td>83.7 83.3 77.0±0.6</td><td>77.0 77.2 78.2 75.9±0.6</td><td>93.9 95.5 96.2 96.0±0.1</td><td>73.0 70.3 73.6 69.2±0.6</td><td>81.5 81.7 82.8 79.5</td></tr><tr><td>+ Manifold Mixup</td><td>75.6±0.7</td><td>70.1±0.9</td><td>93.5±0.7</td><td>65.4±0.6</td><td>76.2</td></tr><tr><td>+ Cutout</td><td>74.9±0.4</td><td>74.9±0.6</td><td>95.9±0.3</td><td>67.7±0.9</td><td>78.3</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>+ CutMix</td><td>74.6±0.7</td><td>71.8±0.6</td><td>95.6±0.4</td><td>65.3±0.8</td><td>76.8</td></tr><tr><td></td><td>74.7±1.0</td><td>72.3±0.9</td><td></td><td></td><td></td></tr><tr><td>+ Mixup (w/o label interpolation)</td><td></td><td></td><td>93.0±0.4</td><td>69.2±0.2</td><td>77.3</td></tr><tr><td>+ Mixup</td><td>76.8±0.7</td><td>74.9±0.7</td><td>95.8±0.3</td><td>66.6±0.7</td><td>78.5</td></tr><tr><td>+ DropBlock</td><td>76.4±0.7</td><td>75.4±0.7</td><td>95.9±0.3</td><td>69.0±0.3</td><td>79.2</td></tr><tr><td>+ MixStyle w/ random shuffle</td><td>82.3±0.2</td><td>79.0±0.3</td><td>96.3±0.3</td><td>73.8±0.9</td><td>82.8</td></tr><tr><td>+ MixStyle w/ domain label</td><td>84.1±0.4</td><td>78.8±0.4</td><td>96.1±0.3</td><td>75.9±0.9</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>83.7</td></tr></table>
# 3 EXPERIMENTS
# 3.1 GENERALIZATION IN CATEGORY CLASSIFICATION
Dataset and implementation details. We choose the PACS dataset (Li et al., 2017), a commonly used domain generalization (DG) benchmark concerned with domain shift in image classification. PACS consists of four domains, i.e. Art Painting, Cartoon, Photo and Sketch, with totally 9,991 images of 7 classes. As shown in Fig. 1, the domain shift mainly corresponds to image style changes. For evaluation, a model is trained on three domains and tested on the remaining one. Following prior work (Li et al., 2019; Zhou et al., 2020a), we use ResNet-18 (He et al., 2016) as the classifier where MixStyle is inserted after the 1st, 2nd and 3rd residual blocks. Our code is based on Dassl.pytorch (Zhou et al., 2020c).2
Baselines. Our main baselines are general-purpose regularization methods including Mixup (Zhang et al., 2018b), Manifold Mixup (Verma et al., 2019), DropBlock (Ghiasi et al., 2018), CutMix (Yun et al., 2019) and Cutout (DeVries & Taylor, 2017), which are trained using the same training parameters as MixStyle and the optimal hyper-parameter setup as reported in their papers. We also compare with the existing DG methods which reported state-of-the-art performance on PACS. These include domain alignment-based CCSA (Motiian et al., 2017) and MMD-AAE (Li et al., 2018b), Jigsaw puzzle-based JiGen (Carlucci et al., 2019), adversarial gradient-based CrossGrad (Shankar et al., 2018), meta-learning-based Metareg (Balaji et al., 2018) and Epi-FCR (Li et al., 2019), and data augmentation-based L2A-OT (Zhou et al., 2020a).
Comparison with general-purpose regularization methods. The results are shown in Table 1. Overall, we observe that the general-purpose regularization methods do not offer any clear advantage over the vanilla ResNet-18 in this DG task, while MixStyle improves upon the vanilla ResNet18 with a significant margin. Compared with Mixup, MixStyle is $5 . 2 \%$ better on average. Recall that Mixup also interpolates the output space, we further compare with a variant of Mixup in order to demonstrate the advantage of mixing style statistics at the feature level over mixing images at the pixel level for DG—following Sohn et al. (2020), we remove the label interpolation in Mixup and sample the mixing weights from a uniform distribution of $[ 0 , 1 ]$ . Still, MixStyle outperforms this new baseline with a large margin, which justifies our claim. MixStyle and DropBlock share some commonalities in that they are both applied to feature maps at multiple layers, but MixStyle significantly outperforms DropBlock in all test domains. The reason why DropBlock is ineffective here is because dropping out activations mainly encourages a network to mine discriminative patterns, but does not reinforce the ability to cope with unseen styles, which is exactly what MixStyle aims to achieve: by synthesizing “new” styles (domains) MixStyle regularizes the network to become more robust to domain shift. In addition, it is interesting to see that on Cartoon and Photo, MixStyle w/ random shuffle obtains slightly better results. The reason might be because there exist sub-domains in a source domain (see Fig. 4(a-c)), which allow random shuffling to produce more diverse “new” domains that lead to a more domain-generalizable model.
Comparison with state-of-the-art DG methods. Overall, MixStyle outperforms most DG methods by a clear margin, despite being a much simpler method. The performance of MixStyle w/ domain label is nearly $1 \%$ better on average than the recently introduced L2A-OT. From a data augmentation perspective, MixStyle and L2A-OT share a similar goal—to synthesize data from pseudo-novel domains. MixStyle accomplishes this goal through mixing style statistics at the feature level. Whereas L2A-OT works at the pixel level: it trains an image generator by maximizing the domain difference (measured by optimal transport) between the original and the generated images, which introduces much heavier computational overhead than MixStyle in terms of GPU memory and training time. It is worth noting that MixStyle’s domain label-free version is highly competitive: its $8 2 . 8 \%$ accuracy is on par with L2A-OT’s.
# 3.2 GENERALIZATION IN INSTANCE RETRIEVAL
Dataset and implementation details. We evaluate MixStyle on the person re-identification (re-ID) problem, which aims to match people across disjoint camera views. As each camera view is itself a distinct domain, person re-ID is essentially a cross-domain image matching problem. Instead of using the standard protocol where training and test data come from the same camera views, we adopt the cross-dataset setting so test camera views are never seen during training. Specifically, we train a model on one dataset and then test its performance on the other dataset. Two commonly used re-ID datasets are adopted: Market1501 (Zheng et al., 2015) and Duke (Ristani et al., 2016; Zheng et al., 2017). Ranking accuracy and mean average precision (mAP) are used as the performance measures (displayed in percentage). We test MixStyle on two CNN architectures: ResNet-50 (He et al., 2016) and OSNet (Zhou et al., 2019). The latter was designed specifically for re-ID. In both architectures, MixStyle is inserted after the 1st and 2nd residual blocks. Our code is based on Torchreid (Zhou & Xiang, 2019).3
Baselines. We compare with three baseline methods: 1) The vanilla model, which serves as a strong baseline; 2) DropBlock, which was the top-performing competitor in Table 1; 3) RandomErase (Zhong et al., 2020), a widely used regularization method in the re-ID literature (similar to Cutout).
Results. The results are reported in Table 2. It is clear that only MixStyle consistently outperforms the strong vanilla model under both settings with considerable margins, while DropBlock and RandomErase are unable to show any benefit. Notably, RandomErase, which simulates occlusion by erasing pixels in random rectangular regions with random values, has been used as a default trick when training re-ID CNNs. However, RandomErase shows a detrimental effect in the cross-dataset re-ID setting. Indeed, similar to DropBlock, randomly erasing pixels offers no guarantee to improve the robustness when it comes to domain shift.
# 3.3 GENERALIZATION IN REINFORCEMENT LEARNING
Though RL has been greatly advanced by using CNNs for feature learning in raw pixels (Mnih et al., 2013), it has been widely acknowledged that RL agents often overfit training environments while generalize poorly to unseen environments (Cobbe et al., 2019; Igl et al., 2019).
Dataset and implementation details. We conduct experiments on Coinrun (Cobbe et al., 2019), a recently introduced RL benchmark for evaluating the generalization performance of RL agents. As shown in Fig. 3(a), the goal in Coinrun is to control a character to collect golden coins while avoiding both stationary and non-stationary obstacles. We follow Igl et al. (2019) to construct and train our RL agent: the CNN architecture used in IMPALA (Espeholt et al., 2018) is adopted as the policy network, and is trained by the Proximal Policy Optimization (PPO) algorithm (Schulman et al., 2017). Please refer to Igl et al. (2019) for further implementation details. MixStyle is inserted after the 1st and 2nd convolutional sequences. Training data are sampled from 500 levels while test data are drawn from new levels of only the highest difficulty. As domain labels are difficult to define, we use the random shuffle version of MixStyle. Our code is built on top of Igl et al. (2019).4
Table 2: Generalization results on the cross-dataset person re-ID task.
<table><tr><td rowspan="2">Model</td><td colspan="4">Market1501-→Duke</td><td colspan="4">Duke-→Market1501</td></tr><tr><td>mAP</td><td>R1</td><td>R5</td><td>R10</td><td>mAP</td><td>R1</td><td>R5</td><td>R10</td></tr><tr><td>ResNet-50</td><td>19.3</td><td>35.4</td><td>50.3</td><td>56.4</td><td>20.4</td><td>45.2</td><td>63.6</td><td>70.9</td></tr><tr><td>+ RandomErase</td><td>14.3</td><td>27.8</td><td>42.6</td><td>49.1</td><td>16.1</td><td>38.5</td><td>56.8</td><td>64.5</td></tr><tr><td>+ DropBlock</td><td>18.2</td><td>33.2</td><td>49.1</td><td>56.3</td><td>19.7</td><td>45.3</td><td>62.1</td><td>69.1</td></tr><tr><td>+ MixStyle w/ random shuffle</td><td>23.8</td><td>42.2</td><td>58.8</td><td>64.8</td><td>24.1</td><td>51.5</td><td>69.4</td><td>76.2</td></tr><tr><td>+ MixStyle w/ domain label</td><td>23.4</td><td>43.3</td><td>58.9</td><td>64.7</td><td>24.7</td><td>53.0</td><td>70.9</td><td>77.8</td></tr><tr><td>OSNet</td><td>25.9</td><td>44.7</td><td>59.6</td><td>65.4</td><td>24.0</td><td>52.2</td><td>67.5</td><td>74.7</td></tr><tr><td>+ RandomErase</td><td>20.5</td><td>36.2</td><td>52.3</td><td>59.3</td><td>22.4</td><td>49.1</td><td>66.1</td><td>73.0</td></tr><tr><td>+ DropBlock</td><td>23.1</td><td>41.5</td><td>56.5</td><td>62.5</td><td>21.7</td><td>48.2</td><td>65.4</td><td>71.3</td></tr><tr><td>+ MixStyle w/ random shuffle</td><td>27.2</td><td>48.2</td><td>62.7</td><td>68.4</td><td>27.8</td><td>58.1</td><td>74.0</td><td>81.0</td></tr><tr><td>+ MixStyle w/ domain label</td><td>27.3</td><td>47.5</td><td>62.0</td><td>67.1</td><td>29.0</td><td>58.2</td><td>74.9</td><td>80.9</td></tr></table>
 Figure 3: (a) Coinrun benchmark. (b) Test performance in unseen environments. (c) Difference between training and test performance.
Baselines. Following Igl et al. (2019), we train strong baseline models and add MixStyle on top of them to see whether MixStyle can bring further improvements. To this end, we train two baseline models: 1) Baseline, which combines weight decay and data augmentation;5 2) IBAC-SNI (the $\lambda = 0 . 5$ version), the best-performing model in Igl et al. (2019) which is based on selective noise injection.
Results. The test performance is shown in Fig. 3(b). Comparing Baseline (blue) with Baseline+MixStyle (orange), we can see that MixStyle brings a significant improvement. Interestingly, the variance is also significantly reduced by using MixStyle, as indicated by the smaller shaded areas (for both orange and red lines). These results strongly demonstrate the effectiveness of MixStyle in enhancing generalization for RL agents. When it comes to the stronger baseline IBAC-SNI (green), MixStyle (red) is able to bring further performance gain, suggesting that MixStyle is complementary to IBAC-SNI. This result also shows the potential of MixStyle as a plug-and-play component to be combined with other advanced RL methods. It is worth noting that Baseline+MixStyle itself is already highly competitive with IBAC-SNI. Fig. 3(c) shows the generalization gap from which it can been seen that the models trained with MixStyle (orange & red) clearly generalize faster and better than those without using MixStyle (blue & green).
 Figure 4: 2-D visualization of flattened feature maps (top) and the corresponding style statistics (bottom). res1-4 denote the four residual blocks in order in a ResNet architecture. We observe that res1 to res3 contain domain-related information while res4 encodes label-related information.
Table 3: Ablation study on where to apply MixStyle in the ResNet architecture. (a) Category classification on PACS.
<table><tr><td>Model</td><td>Accuracy</td></tr><tr><td>ResNet-18</td><td>79.5</td></tr><tr><td>+ MixStyle (res1)</td><td>80.1</td></tr><tr><td>+ MixStyle (res12)</td><td>81.6</td></tr><tr><td>+ MixStyle (res123)</td><td>82.8</td></tr><tr><td>+ MixStyle (res1234)</td><td>75.6</td></tr><tr><td>+ MixStyle (res14)</td><td>76.3</td></tr><tr><td>+ MixStyle (res23)</td><td>81.7</td></tr></table>
(b) Cross-dataset person re-ID.
<table><tr><td>Model</td><td>mAP</td></tr><tr><td>ResNet-50</td><td>19.3</td></tr><tr><td>+ MixStyle (res1)</td><td>22.6</td></tr><tr><td>+ MixStyle (res12) + MixStyle (res123)</td><td>23.8</td></tr><tr><td>+MixStyle (res1234)</td><td>22.0</td></tr><tr><td>+ MixStyle (res14)</td><td>10.2</td></tr><tr><td>+MixStyle (res23)</td><td>11.1 20.6</td></tr></table>
# 3.4 ANALYSIS
Where to apply MixStyle? We repeat the experiments on PACS (category classification) and the re-ID datasets (instance retrieval) using the ResNet architecture. Given that a standard ResNet model has four residual blocks denoted by $\mathtt { r e s l - 4 }$ , we train different models with MixStyle applied to different layers. For notation, res1 means MixStyle is applied after the first residual block; res12 means MixStyle is applied after both the first and second residual blocks; and so forth. The results are shown in Table 3. We have the following observations. 1) Applying MixStyle to multiple lowerlevel layers generally achieves a better performance—for instance, res12 is better than res1 on both tasks. 2) Different tasks favor different combinations—res123 achieves the best performance on PACS, while on the re-ID datasets $\mathtt { r e s 1 2 }$ is the best. 3) On both tasks, the performance plunges when applying MixStyle to the last residual block. This makes sense because res4 is the closest to the prediction layer and tends to capture semantic content (i.e. label-sensitive) information rather than style. In particular, res4 is followed by an average-pooling layer, which essentially forwards the mean vector to the prediction layer and thus forces the mean vector to capture label-related information. As a consequence, mixing the statistics at res4 breaks the inherent label space. This is clearer in Fig. 4: the features and style statistics in $\mathtt { r e s l - 3 }$ exhibit clustering patterns based on domains while those in res4 have a high correlation with class labels.
 Figure 5: Evaluation on the hyper-parameter $\alpha$ on (a) PACS, (b) person re-ID datasets and (c) Coinrun. In (b), M and D denote Market1501 and Duke respectively.
Mixing vs. replacing. Unlike the AdaIN formulation, which completely replaces one style with the other, MixStyle mixes two styles via a convex combination. Table 4 shows that mixing is better than replacing. This is easy to understand: mixing diversifies the styles (imagine an interpolation between two data points).
Random vs. fixed shuffle at multiple layers. Applying MixStyle to multiple layers, which has been shown advantageous in Table 3, raises another question of whether to shuffle the mini-batch at different layers or use the same shuffled order for all layers. Table 5 suggests that using random shuffle at different layers gives a better performance, which may be attributed to the increased noise level that gives a better regularization effect.
Table 4: Mixing vs. replacing.
<table><tr><td></td><td>Accuracy (%)</td></tr><tr><td>Mixing</td><td>82.8±0.4</td></tr><tr><td>Replacing</td><td>82.1±0.5</td></tr></table>
Table 5: Random vs. fixed shuffle at multiple layers.
<table><tr><td colspan="2">Accuracy (%)</td></tr><tr><td>Random</td><td>82.8±0.4</td></tr><tr><td>Fixed</td><td>82.4±0.5</td></tr></table>
Sensitivity of hyper-parameter. Recall that $\alpha$ is used to control the shape of Beta distribution, which has a direct effect on how the convex weights $\lambda$ are sampled. The smaller $\alpha$ is, the more likely the value in $\lambda$ is close to the extreme value of 0 or 1. In other words, a smaller $\alpha$ favors the style statistics in Eqs. (5) & (6) to be dominated by one side. We first evaluate $\alpha$ on PACS. Fig. 5(a) shows that with $\alpha$ increasing from 0.1 to 0.4, the accuracy slides from $8 2 . 8 \%$ to $8 1 . 7 \%$ . However, further increasing $\alpha$ does not impact on the accuracy. Therefore, the results suggest that the performance is not too sensitive to $\alpha$ ; and selecting $\alpha$ from $\lbrace 0 . 1 , 0 . 2 , 0 . 3 \rbrace$ seems to be a good starting point. We further experiment with $\alpha \in \{ 0 . 1 , 0 . 2 , 0 . 3 \}$ on the re-ID datasets and the Coinrun benchmark. Figs. 5(b) & (c) show that in general the variance for the results of different values is small. Therefore, we suggest practitioners to choose $\alpha$ from $\lbrace 0 . 1 , 0 . 2 , 0 . 3 \rbrace$ , with $\alpha = 0 . 1$ being a good default setting.
For more analyses and discussions, please see Appendix A.2.
# 4 RELATED WORK
Domain generalization, or DG, studies out-of-distribution (OOD) generalization given only source data typically composed of multiple related but distinct domains. We refer readers to Zhou et al. (2021) for a comprehensive survey in this topic. Many DG methods are based on the idea of aligning features between different sources, with a hope that the model can be invariant to domain shift given unseen data. For instance, Li et al. (2018b) achieved distribution alignment in the hidden representation of an autoencoder using maximum mean discrepancy; Li et al. (2018c) resorted to adversarial learning with auxiliary domain classifiers to learn features that are domain-agnostic. Some works explored domain-specific parameterization, such as domain-specific weight matrices (Li et al., 2017) and domain-specific BN (Seo et al., 2020). Recently, meta-learning has drawn increasing attention from the DG community (Li et al., 2018a; Balaji et al., 2018; Dou et al., 2019). The main idea is to expose a model to domain shift during training by using pseudo-train and pseudo-test domains, both drawn from source domains. Data augmentation has also been investigated for learning domain-invariant models. Shankar et al. (2018) introduced a cross-gradient training method (CrossGrad) where source data are augmented by adversarial gradients obtained from a domain classifier.
Gong et al. (2019) proposed DLOW (for the DA problem), which models intermediate domains between source and target via a domainness factor and learns an image translation model to generate intermediate-domain images. Very recently, Zhou et al. (2020a) introduced L2A-OT to learn a neural network to map source data to pseudo-novel domains by maximizing an optimal transport-based distance measure. Our MixStyle is related to DLOW and L2A-OT in its efforts to synthesizing novel domains. However, MixStyle differs in the fact that it is done implicitly with a much simpler formulation leveraging the feature-level style statistics and only few lines of extra code on top of a standard supervised classifier while being more effective. Essentially, MixStyle can be seen as feature-level augmentation, which is clearly different from the image-level augmentation-based DLOW and L2A-OT.
Generalization in deep RL has been a challenging problem where RL agents often overfit training environments, and as a result, perform poorly in unseen environments with different visual patterns or levels (Zhang et al., 2018a). A natural way to improve generalization, which has been shown effective in (Cobbe et al., 2019; Farebrother et al., 2018), is to use regularization, e.g., weight decay. However, Igl et al. (2019) suggested that stochastic regularization methods like dropout and batch normalization (which uses estimated population statistics) have adverse effect as the training data in RL are essentially model-dependent. As such, they proposed selective noise injection (SNI), which basically combines a stochastic regularization technique with its deterministic counterpart. They further integrated SNI with information bottleneck actor critic (IBAC-SNI) to reduce the variance in gradients. Curriculum learning has been investigated in (Justesen et al., 2018) where the level of training episodes progresses from easy to difficult over the course of training. Gamrian & Goldberg (2019) leveraged the advances in GAN-based image-to-image translation (Liu et al., 2017) to map target data to the source domain which the agent was trained on. Tobin et al. (2017) introduced domain randomization, which diversifies training data by rendering images with different visual effects via a programmable simulator. With a similar goal of data augmentation, Lee et al. (2020) pre-processed input images with a randomly initialized network. Very recent studies (Laskin et al., 2020; Kostrikov et al., 2020) have shown that it is useful to combine a diverse set of label-preserving transformations, such as rotation, shifting and Cutout. Different from the aforementioned methods, our MixStyle works at the feature level and is orthogonal to most existing methods. For instance, we have shown in Sec. 3.3 that MixStyle significantly improves upon IBAC-SNI.
# 5 CONCLUSION
We presented a simple yet effective domain generalization method, termed MixStyle. MixStyle mixes the feature statistics of two instances to synthesize novel domains, which is inspired by the observation in style transfer work that the feature statistics encode style/domain-related information. Extensive experiments covering a wide range of tasks were conducted to demonstrate that MixStyle yields new state-of-the-art on three different tasks.
# ACKNOWLEDGMENTS
This work was supported in part by the Shanghai Committee of Science and Technology, China (Grant No. 20DZ1100800), in part by the National Natural Science Foundation of China under Grant (61876176, U1713208), the National Key Research and Development Program of China (No. 2020YFC2004800), and in part by the Guangzhou Research Program (201803010066).
# REFERENCES
Yogesh Balaji, Swami Sankaranarayanan, and Rama Chellappa. Metareg: Towards domain generalization using meta-regularization. In NeurIPS, 2018.
Gilles Blanchard, Gyemin Lee, and Clayton Scott. Generalizing from several related classification tasks to a new unlabeled sample. In NeurIPS, 2011.
Fabio M. Carlucci, Antonio D’Innocente, Silvia Bucci, Barbara Caputo, and Tatiana Tommasi. Domain generalization by solving jigsaw puzzles. In CVPR, 2019.
Karl Cobbe, Oleg Klimov, Chris Hesse, Taehoon Kim, and John Schulman. Quantifying generalization in reinforcement learning. In ICML, 2019.
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
Qi Dou, Daniel C Castro, Konstantinos Kamnitsas, and Ben Glocker. Domain generalization via model-agnostic learning of semantic features. In NeurIPS, 2019.
Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. In ICLR, 2017.
Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. In ICML, 2018.
Jesse Farebrother, Marlos C Machado, and Michael Bowling. Generalization and regularization in dqn. arXiv preprint arXiv:1810.00123, 2018.
Shani Gamrian and Yoav Goldberg. Transfer learning for related reinforcement learning tasks via image-to-image translation. In ICML, 2019.
Yaroslav Ganin and Victor S. Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, 2015.
Golnaz Ghiasi, Tsung-Yi Lin, and Quoc V Le. Dropblock: A regularization method for convolutional networks. In NeurIPS, 2018.
Rui Gong, Wen Li, Yuhua Chen, and Luc Van Gool. Dlow: Domain flow for adaptation and generalization. In CVPR, 2019.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR, 2019.
Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In ICCV, 2017.
Maximilian Igl, Kamil Ciosek, Yingzhen Li, Sebastian Tschiatschek, Cheng Zhang, Sam Devlin, and Katja Hofmann. Generalization in reinforcement learning with selective noise injection and information bottleneck. In NeurIPS, 2019.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
Niels Justesen, Ruben Rodriguez Torrado, Philip Bontrager, Ahmed Khalifa, Julian Togelius, and Sebastian Risi. Illuminating generalization in deep reinforcement learning through procedural level generation. arXiv preprint arXiv:1806.10729, 2018.
Ilya Kostrikov, Denis Yarats, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649, 2020.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012.
Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, and Aravind Srinivas. Reinforcement learning with augmented data. arXiv preprint arXiv:2004.14990, 2020.
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In IEEE, 1998.
Kimin Lee, Kibok Lee, Jinwoo Shin, and Honglak Lee. Network randomization: A simple technique for generalization in deep reinforcement learning. In ICLR, 2020.
Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Deeper, broader and artier domain generalization. In ICCV, 2017.
Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Learning to generalize: Metalearning for domain generalization. In AAAI, 2018a.
Da Li, Jianshu Zhang, Yongxin Yang, Cong Liu, Yi-Zhe Song, and Timothy M Hospedales. Episodic training for domain generalization. In ICCV, 2019.
Haoliang Li, Sinno Jialin Pan, Shiqi Wang, and Alex C. Kot. Domain generalization with adversarial feature learning. In CVPR, 2018b.
Ya Li, Xinmei Tiana, Mingming Gong, Yajing Liu, Tongliang Liu, Kun Zhang, and Dacheng Tao. Deep domain generalization via conditional invariant adversarial networks. In ECCV, 2018c.
Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In NeurIPS, 2017.
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 2008.
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.
Saeid Motiian, Marco Piccirilli, Donald A. Adjeroh, and Gianfranco Doretto. Unified deep supervised domain adaptation and generalization. In ICCV, 2017.
Krikamol Muandet, David Balduzzi, and Bernhard Scholkopf. Domain generalization via invariant feature representation. In ICML, 2013.
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NeurIPS-W, 2011.
Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In ICML, 2019.
Ergys Ristani, Francesco Solera, Roger Zou, Rita Cucchiara, and Carlo Tomasi. Performance measures and a data set for multi-target, multi-camera tracking. In ECCV, 2016.
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
Seonguk Seo, Yumin Suh, Dongwan Kim, Jongwoo Han, and Bohyung Han. Learning to optimize domain specific normalization for domain generalization. In ECCV, 2020.
Shiv Shankar, Vihari Piratla, Soumen Chakrabarti, Siddhartha Chaudhuri, Preethi Jyothi, and Sunita Sarawagi. Generalizing across domains via cross-gradient training. In ICLR, 2018.
Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. In NeurIPS, 2020.
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 2014.
Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. In IROS, 2017.
Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv:1607.08022, 2016.
Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In CVPR, 2017.
Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David LopezPaz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In ICML, 2019.
Keyulu Xu, Mozhi Zhang, Jingling Li, Simon Shaolei Du, Ken-Ichi Kawarabayashi, and Stefanie Jegelka. How neural networks extrapolate: From feedforward to graph neural networks. In ICLR, 2021. Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In ICCV, 2019. Chiyuan Zhang, Oriol Vinyals, Remi Munos, and Samy Bengio. A study on overfitting in deep reinforcement learning. arXiv preprint arXiv:1804.06893, 2018a. Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018b. Liang Zheng, Liyue Shen, Lu Tian, Shengjin Wang, Jingdong Wang, and Qi Tian. Scalable person re-identification: A benchmark. In ICCV, 2015. Zhedong Zheng, Liang Zheng, and Yi Yang. Unlabeled samples generated by gan improve the person re-identification baseline in vitro. In ICCV, 2017. Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In AAAI, 2020. Kaiyang Zhou and Tao Xiang. Torchreid: A library for deep learning person re-identification in pytorch. arXiv preprint arXiv:1910.10093, 2019. Kaiyang Zhou, Yongxin Yang, Andrea Cavallaro, and Tao Xiang. Omni-scale feature learning for person re-identification. In ICCV, 2019. Kaiyang Zhou, Yongxin Yang, Timothy Hospedales, and Tao Xiang. Learning to generate novel domains for domain generalization. In ECCV, 2020a. Kaiyang Zhou, Yongxin Yang, Timothy M Hospedales, and Tao Xiang. Deep domain-adversarial image generation for domain generalisation. In AAAI, 2020b. Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang. Domain adaptive ensemble learning. arXiv preprint arXiv:2003.07325, 2020c. Kaiyang Zhou, Ziwei Liu, Yu Qiao, Tao Xiang, and Chen Change Loy. Domain generalization: A survey. arXiv preprint arXiv:2103.02503, 2021.
# A APPENDIX
# A.1 PSEUDO-CODE OF MIXSTYLE
Algorithm 1 provides a PyTorch-like pseudo-code.
# Algorithm 1 PyTorch-like pseudo-code for MixStyle.
# x: input features of shape (B, C, H, W) # p: probabillity to apply MixStyle (default: 0.5) # alpha: hyper-parameter for the Beta distribution (default: 0.1) # eps: a small value added before square root for numerical stability (default: 1e-6)
if not in training mode: return x
if random probability $>$ p: return x
$\mathrm { ~ \textit ~ { ~ B ~ } ~ } = \mathrm { ~ \textit ~ { ~ x ~ } ~ }$ .size(0) # batch size
mu $= \times$ .mean(dim=[2, 3], keepdim $\cdot ^ { = }$ True) # compute instance mean var $=$ x.var(dim=[2, 3], keepdim $\cdot ^ { = }$ True) # compute instance variance sig $=$ (var $^ +$ eps).sqrt() # compute instance standard deviation mu, sig $\qquad = \quad \mathtt { m u }$ .detach(), sig.detach() # block gradients x_normed $=$ (x - mu) / sig # normalize input
lmda $=$ Beta(alpha, alpha).sample((B, 1, 1, 1)) # sample instance-wise convex weights
if domain label is given: # in this case, input $\begin{array} { r } { \mathrm { ~ ~ \underline { ~ } { ~ \sf ~ } { ~ \sf ~ } { ~ \sf ~ } { ~ \sf ~ } = ~ \mathrm { ~ ~ \tau ~ } [ \times \hat { \mathrm { ~ ~ \underline { ~ } { ~ \bf ~ } { ~ \underline { ~ } { ~ \bf ~ } { ~ \tau ~ } ~ } } } } } \end{array}$ x perm $=$ torch.arange(B-1, -1, -1) # inverse index perm_j, perm_i $=$ perm.chunk(2) # separate indices perm_j $=$ perm_j[torch.randperm(B // 2)] # shuffling perm_i $=$ perm_i[torch.randperm(B // 2)] # shuffling perm $=$ torch.cat([perm_j, perm_i], 0) # concatenation else: perm $=$ torch.randperm(B) # generate shuffling indices
mu2, sig2 $=$ mu[perm], sig[perm] # shuffling mu_mix $=$ mu $\star$ lmda $^ +$ mu2 $\star$ (1 - lmda) # generate mixed mean sig_mix $=$ sig $\star$ lmda $^ +$ sig2 $\star$ (1 - lmda) # generate mixed standard deviation return x_normed $\star$ sig_mix $^ +$ mu_mix # denormalize input using the mixed statistics
Table 7: Test results on the source domains on PACS. A: Art. C: Cartoon. P: Photo. S: Sketch.
<table><tr><td>Method</td><td>C,P,S</td><td>A,P,S</td><td>A,C,S</td><td>A,C,P</td><td>Avg</td></tr><tr><td>Vanilla</td><td>99.49±0.03</td><td>99.47±0.04</td><td>99.38±0.02</td><td>99.65±0.03</td><td>99.50</td></tr><tr><td>MixStyle</td><td>99.55±0.02</td><td>99.54±0.01</td><td>99.47±0.03</td><td>99.68±0.03</td><td>99.56</td></tr></table>
Table 8: Leave-one-domain-out generalization results on Digits-DG.
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>MNIST MNIST-M SVHN SYN</td><td rowspan=1 colspan=1>Avg</td></tr><tr><td rowspan=1 colspan=1>JiGen</td><td rowspan=1 colspan=1>96.5 61.4 63.7 74.0</td><td rowspan=1 colspan=1>73.9</td></tr><tr><td rowspan=1 colspan=1>CCSA</td><td rowspan=1 colspan=1>95.2 58.2 65.5 79.1</td><td rowspan=1 colspan=1>74.5</td></tr><tr><td rowspan=3 colspan=1>MMD-AAECrossGradL2A-OT</td><td rowspan=1 colspan=1>96.5 58.4 65.0 78.4</td><td rowspan=3 colspan=1>74.675.878.1</td></tr><tr><td rowspan=1 colspan=1>96.7 61.1 65.3 80.2</td></tr><tr><td rowspan=1 colspan=1>96.7 63.9 68.6 83.2</td></tr><tr><td rowspan=8 colspan=1>CNN+ Mixup w/o label interpolation+ Manifold Mixup+ CutMix+ Mixup+ Cutout+ DropBlock+ MixStyle (ours)</td><td rowspan=1 colspan=1>95.8±0.3 58.8±0.5 61.7±0.5 78.6±0.6</td><td rowspan=1 colspan=1>73.7</td></tr><tr><td rowspan=1 colspan=1>93.7±0.6 55.2±1.0 61.6±0.9 74.4±0.8</td><td rowspan=3 colspan=1>71.271.771.8</td></tr><tr><td rowspan=1 colspan=1>92.7±0.4 53.1±0.8 64.4±0.2 76.8±0.5</td></tr><tr><td rowspan=1 colspan=1>94.9±0.2 50.1±0.5 64.1±0.9 78.1±0.7</td></tr><tr><td rowspan=1 colspan=1>94.2±0.5 56.5±0.8 63.3±0.7 76.7±0.6</td><td rowspan=4 colspan=1>72.774.175.376.5</td></tr><tr><td rowspan=1 colspan=1>95.8±0.4 58.4±0.6 61.9±0.9 80.6±0.5</td></tr><tr><td rowspan=1 colspan=1>96.2±0.1 60.5±0.6 64.1±0.8 80.2±0.6</td></tr><tr><td rowspan=1 colspan=1>96.5±0.3 63.5±0.8 64.7±0.7 81.2±0.8</td></tr></table>
# A.2 FURTHER ANALYSIS
# MixStyle between same-domain instances.
We are interested in knowing if mixing styles between same-domain instances helps performance. To this end, we sample each mini-batch from a single domain during training when using MixStyle. The results are shown in Table 6 where we observe that mixing styles between same-domain instances is about $1 \%$ better than the baseline model. This suggests that instancespecific style exists. Nonetheless, the performance is clearly worse than mixing styles between instances of different domains.
Table 6: Investigation on the effect of mixing styles between same-domain instances.
<table><tr><td>Accuracy (%)</td></tr><tr><td>ResNet18 79.5</td></tr><tr><td>+MixStyle w/ same-domain 80.4</td></tr><tr><td>+MixStyle w/random shuffle 82.8</td></tr><tr><td>+MixStyle w/ domain label 83.7</td></tr></table>
Performance on source domains. To prove that MixStyle does not sacrifice the performance on seen domains in exchange for gains on unseen domains, we report the test accuracy on the held-out validation set of the source domains on PACS in Table 7.
Results on Digits-DG and Office-Home. In addition to the experiments on PACS (in Sec. 3.1), we further evaluate MixStyle’s effectiveness on two DG datasets, namely Digits-DG (Zhou et al., 2020a) and Office-Home (Venkateswara et al., 2017). Digits-DG contains four digit datasets (domains) including MNIST (LeCun et al., 1998), MNIST-M (Ganin & Lempitsky, 2015), SVHN (Netzer et al., 2011) and SYN (Ganin & Lempitsky, 2015). Images from different digit datasets differ drastically in font style, stroke color and background. Office-Home is composed of four domains (Artistic, Clipart, Product and Real World) with around 15,500 images of 65 classes for home and office object recognition. The results are shown in Tables 8 and 9 where no domain labels are used in MixStyle. Similar to the results on PACS, here we observe that MixStyle also brings clear improvements to the baseline CNN model and outperforms all general-purpose regularization methods on both Digits-DG and Office-Home. Compared with more sophisticated DG methods like L2A-OT, MixStyle’s performance is comparable, despite being much simpler to train and consuming much less computing resources.
Table 9: Leave-one-domain-out generalization results on Office-Home.
<table><tr><td>Method</td><td>Artistic</td><td>Clipart</td><td>Product</td><td>Real World</td><td>Avg</td></tr><tr><td>JiGen CCSA</td><td>53.0</td><td>47.5</td><td>71.5</td><td>72.8</td><td>61.2</td></tr><tr><td>MMD-AAE</td><td>59.9 56.5</td><td>49.9 47.3</td><td>74.1 72.1</td><td>75.7 74.8</td><td>64.9 62.7</td></tr><tr><td>CrossGrad</td><td></td><td></td><td></td><td>75.8</td><td>64.4</td></tr><tr><td>L2A-OT</td><td>58.4</td><td>49.4</td><td>73.9</td><td></td><td></td></tr><tr><td>ResNet18</td><td>60.6 58.9±0.3</td><td>50.1 49.4±0.1</td><td>74.8 74.3±0.1</td><td>77.0 76.2±0.2</td><td>65.6 64.7</td></tr><tr><td>+ Manifold Mixup</td><td>56.2±0.4</td><td>46.3±0.3</td><td>73.6±0.1</td><td>75.2±0.2</td><td>62.8</td></tr><tr><td>+ Mixup w/o label interpolation + Cutout</td><td>57.0±0.2 57.8±0.2</td><td>48.7±0.2</td><td>71.4±0.6</td><td>74.5±0.4</td><td>62.9</td></tr><tr><td></td><td></td><td>48.1±0.3</td><td>73.9±0.2</td><td>75.8±0.3</td><td>63.9</td></tr><tr><td>+ CutMix</td><td>57.9±0.1</td><td>48.3±0.3</td><td>74.5±0.1</td><td>75.6±0.4</td><td>64.1</td></tr><tr><td>+ DropBlock</td><td>58.0±0.1</td><td>48.1±0.1</td><td>74.3±0.3</td><td>75.9±0.4</td><td>64.1</td></tr><tr><td>+ Mixup + MixStyle (ours)</td><td>58.2±0.1 58.7±0.3</td><td>49.3±0.2 53.4±0.2</td><td>74.7±0.1 74.2±0.1</td><td>76.1±0.1 75.9±0.1</td><td>64.6 65.5</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487# WASSERSTEIN EMBEDDING FOR GRAPH LEARNING
Soheil Kolouri∗ †, Navid Naderializadeh∗†, Gustavo K. Rohde‡, & Heiko Hoffmann†
{skolouri,nnaderializadeh,hhoffmann}@hrl.com, gustavo@virginia.edu
# ABSTRACT
We present Wasserstein Embedding for Graph Learning (WEGL), a novel and fast framework for embedding entire graphs in a vector space, in which various machine learning models are applicable for graph-level prediction tasks. We leverage new insights on defining similarity between graphs as a function of the similarity between their node embedding distributions. Specifically, we use the Wasserstein distance to measure the dissimilarity between node embeddings of different graphs. Unlike prior work, we avoid pairwise calculation of distances between graphs and reduce the computational complexity from quadratic to linear in the number of graphs. WEGL calculates Monge maps from a reference distribution to each node embedding and, based on these maps, creates a fixed-sized vector representation of the graph. We evaluate our new graph embedding approach on various benchmark graph-property prediction tasks, showing state-of-the-art classification performance while having superior computational efficiency. The code is available at https://github.com/navid-naderi/WEGL.
# 1 INTRODUCTION
Many exciting and practical machine learning applications involve learning from graph-structured data. While images, videos, and temporal signals (e.g., audio or biometrics) are instances of data that are supported on grid-like structures, data in social networks, cyber-physical systems, communication networks, chemistry, and bioinformatics often live on irregular structures (Backstrom & Leskovec, 2011; Sadreazami et al., 2017; Jin et al., 2017; Agrawal et al., 2018; Naderializadeh et al., 2020). One can represent such data as (attributed) graphs, which are universal data structures. Efficient and generalizable learning from graph-structured data opens the door to a vast number of applications, which were beyond the reach of classic machine learning (ML) and, more specifically, deep learning (DL) algorithms.
Analyzing graph-structured data has received significant attention from the ML, network science, and signal processing communities over the past few years. On the one hand, there has been a rush toward extending the success of deep neural networks to graph-structured data, which has led to a variety of graph neural network (GNN) architectures. On the other hand, the research on kernel approaches (Gärtner et al., 2003), perhaps most notably the random walk kernel (Kashima et al., 2003) and the Weisfeiler-Lehman (WL) kernel (Shervashidze et al., 2011; Rieck et al., 2019; Morris et al., 2019; 2020), remains an active field of study and the methods developed therein provide competitive performance in various graph representation tasks (see the recent survey by Kriege et al. (2020)).
To learn graph representations, GNN-based frameworks make use of three generic modules, which provide i) feature aggregation, ii) graph pooling (i.e., readout), and iii) classification $\mathrm { H u ^ { * } }$ et al., 2020). The feature aggregator provides a vector representation for each node of the graph, referred to as a node embedding. The graph pooling module creates a representation for the graph from its node embeddings, whose dimensionality is fixed regardless of the underlying graph size, and which can then be analyzed using a downstream classifier of choice. On the graph kernel side, one leverages a kernel to measure the similarities between pairs of graphs, and uses conventional kernel methods to perform learning on a set of graphs (Hofmann et al., 2008). A recent example of such methods is the framework provided by Togninalli et al. (2019), in which the authors propose a novel node embedding inspired by the WL kernel, and combine the resulting node embeddings with the
Wasserstein distance (Villani, 2008; Kolouri et al., 2017) to measure the dissimilarity between two graphs. Afterwards, they leverage conventional kernel methods based on the pairwise-measured dissimilarities to perform learning on graphs.
Considering the ever-increasing scale of graph datasets, which may contain tens of thousands of graphs or millions to billions of nodes per graph, the issue of scalability and algorithmic efficiency becomes of vital importance for graph learning methods (Hernandez & Brown, 2020; Hu et al., 2020). However, both of the aforementioned paradigms of GNNs and kernel methods suffer in this sense. On the GNN side, acceleration of the training procedure is challenging and scales poorly as the graph size grows (Bojchevski et al., 2019). On the graph kernel side, the need for calculating the matrix of all pairwise similarities can be a burden in datasets with a large number of graphs, especially if calculating the similarity between each pair of graphs is computationally expensive. For instance, in the method proposed in (Togninalli et al., 2019), the computational complexity of each calculation of the Wasserstein distance is cubic in the number of nodes (or linearithmic for the entropy-regularized distance).
To overcome these issues, inspired by the linear optimal transport framework of (Wang et al., 2013), we propose a linear Wasserstein Embedding for Graph Learning, which we refer to as WEGL. Our proposed approach embeds a graph into a Hilbert space, where the $\ell _ { 2 }$ distance between two embedded graphs provides a true metric between the graphs that approximates their 2-Wasserstein distance. For a set of $M$ graphs, the proposed method provides:
1. Reduced computational complexity of estimating the graph Wasserstein distance (Togninalli et al., 2019) for a dataset of $M$ graphs from a quadratic complexity in the number of graphs, i.e., M(M−1)2 calculations, to linear complexity, i.e., M calculations of the Wasserstein distance; and 2. An explicit Hilbertian embedding for graphs, which is not restricted to kernel methods, and therefore can be used in conjunction with any downstream classification framework.
We show that compared to multiple GNN and graph kernel baselines, WEGL achieves either stateof-the-art or competitive results on benchmark graph-level classification tasks, including classical graph classification datasets (Kersting et al., 2020) and the recent molecular property-prediction benchmarks (Hu et al., 2020). We also compare the algorithmic efficiency of WEGL with two baseline GNN and graph kernel methods and demonstrate that it is much more computationally efficient relative to those algorithms.
# 2 BACKGROUND AND RELATED WORK
In this section, we provide a brief background on different methods for deriving representations for graphs and an overview on Wasserstein distances by reviewing the related work in the literature.
# 2.1 GRAPH REPRESENTATION METHODS
Let $G = ( \nu , \mathcal { E } )$ denote a graph, comprising a set of nodes $\nu$ and a set of edges $\mathcal { E } \subseteq \mathcal { V } ^ { 2 }$ , where two nodes $u , v \in \mathcal { V }$ are connected to each other if and only if $( u , v ) \in \mathcal { E }$ .1 For each node $v \in \mathcal V$ , we define its set of neighbors as $\mathcal { N } _ { v } \triangleq \{ u \in \mathcal { V } : ( u , v ) \in \mathcal { E } \}$ . The nodes of the graph $G$ may have categorical labels and/or continuous attribute vectors. We use a unified notation of $\mathbf { \bar { \boldsymbol { x } } } _ { v } \in \mathbb { R } ^ { F }$ to denote the label and/or attribute vector of node $v \in \mathcal V$ , where $F$ denotes the node feature dimensionality. Moreover, we use $w _ { u v } \in \mathbb { R } ^ { E }$ to denote the edge feature vector for any edge $( u , v ) \in \mathcal { E }$ , where $E$ denotes the edge feature dimensionality. Node and edge features may be present depending on the graph dataset under consideration.
To learn graph properties from the graph structure and its node/edge features, one can use a function $\psi : \mathcal { G } \mathcal { H }$ to map any graph $G$ in the space of all possible graphs $\mathcal { G }$ to an embedding $\psi ( G )$ in a Hilbert space $\mathcal { H }$ . Kernel methods have been among the most popular ways of creating such graph embeddings. A graph kernel is defined as a function $k : \mathcal { G } ^ { 2 } \mathbb { R }$ , where for two graphs $G$ and $G ^ { \prime }$ , $k ( G , G ^ { \prime } )$ represents the inner product of the embeddings $\psi ( G )$ and $\psi ( G ^ { \prime } )$ over the Hilbert space $\mathcal { H }$ . The mapping $\psi$ could be explicit, as in graph convolutional neural networks, or implicit as in the case of the kernel similarity function $k ( \cdot , \cdot )$ (i.e., the kernel trick). Kriege et al. (2014) provide a thorough discussion on explicit and implicit embeddings for learning from graphs.
Kashima et al. (2003) introduced graph kernels based on random walks on labeled graphs. Subsequently, shortest-path kernels were introduced in (Borgwardt & Kriegel, 2005). These works have been followed by graphlet and Weisfeiler-Lehman subtree kernel methods (Shervashidze et al., 2009; 2011; Morris et al., 2017). More recently, kernel methods using spectral approaches (Kondor & Pan, 2016), assignment-based approaches (Kriege et al., 2016; Nikolentzos et al., 2017), and graph decomposition algorithms (Nikolentzos et al., 2018) have also been proposed in the literature.
Despite being successful for many years, kernel methods often fail to leverage the explicit continuous features that are provided for the graph nodes and/or edges, making them less adaptable to the underlying data distribution. To alleviate these issues, and thanks in part to the prominent success of deep learning in many domains, including computer vision and natural language processing, techniques based on graph neural networks (GNNs) have emerged as an alternative paradigm for learning representations from graph-based data. In general, a GNN comprises multiple hidden layers, where at each layer, each node combines the features of its neighboring nodes in the graph to derive a new feature vector. At the GNN output, the feature vectors of all nodes are aggregated using a readout function (such as global average pooling), resulting in the final graph embedding $\psi ( G )$ . More details on the combining and readout mechanisms of GNNs are provided in Appendix A.4.
Kipf and Welling (Kipf & Welling, 2016) proposed a GNN architecture based on a graph convolutional network (GCN) framework. This work, alongside other notable works on geometric deep learning (Defferrard et al., 2016), initiated a surge of interest in GNN architectures, which has led to several architectures, including the Graph Attention network (GAT) (Velickovi ˇ c et al., 2017), ´ Graph SAmple and aggreGatE (GraphSAGE) (Hamilton et al., 2017), and the Graph Isomorphism Network (GIN) (Xu et al., 2019). Each of these architectures modifies the GNN combining and readout functions and demonstrates state-of-the-art performance in a variety of graph representation learning tasks.
# 2.2 WASSERSTEIN DISTANCES
Let $\mu _ { i }$ denote a Borel probability measure with finite $p ^ { \mathrm { t h } }$ moment defined on $\mathcal { Z } \subseteq \mathbb { R } ^ { d }$ , with corresponding probability density function $p _ { i }$ , i.e., $d \mu _ { i } ( z ) = p _ { i } ( z ) d z$ . The 2-Wasserstein distance between $\mu _ { i }$ and $\mu _ { j }$ defined on $\mathcal { Z } , \mathcal { Z } ^ { j } \subseteq \mathbb { R } ^ { d }$ is the solution to the optimal mass transportation problem with $\ell _ { 2 }$ transport cost (Villani, 2008):
$$\mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { j } ) = \binom { \operatorname* { i n f } _ { } } { \gamma \in \Gamma ( \mu _ { i } , \mu _ { j } ) } \int _ { \mathcal { Z } \times \mathcal { Z } ^ { \prime } } \| z - z ^ { \prime } \| ^ { 2 } d \gamma ( z , z ^ { \prime } ) \bigg ) ^ { \frac { 1 } { 2 } } ,$$
where $\Gamma ( \mu _ { i } , \mu _ { j } )$ is the set of all transportation plans $\gamma \in \Gamma ( \mu _ { i } , \mu _ { j } )$ such that $\gamma ( A \times \mathcal { Z } ^ { \prime } ) = \mu _ { i } ( A )$ and $\gamma ( \mathcal { Z } \times B ) = \mu _ { j } ( B )$ for any Borel subsets $A \subseteq { \mathcal { Z } }$ and $B \subseteq { \mathcal { Z } } ^ { \prime }$ . Due to Brenier’s theorem (Brenier, 1991), for absolutely continuous probability measures $\mu _ { i }$ and $\mu _ { j }$ (with respect to the Lebesgue measure), the 2-Wasserstein distance can be equivalently obtained from
$${ \mathcal W } _ { 2 } ( \mu _ { i } , \mu _ { j } ) = \bigg ( \operatorname* { i n f } _ { f \in M P ( \mu _ { i } , \mu _ { j } ) } \int _ { \mathcal Z } \| z - f ( z ) \| ^ { 2 } d \mu _ { i } ( z ) \bigg ) ^ { \frac { 1 } { 2 } } ,$$
where $M P ( \mu _ { i } , \mu _ { j } ) = \{ f : \mathcal { Z } \to \mathcal { Z } ^ { \prime } | f _ { \# } \mu _ { i } = \mu _ { j } \}$ and $f _ { \# } \mu _ { i }$ represents the pushforward of measure $\mu _ { i }$ , characterized as
$$\int _ { B } d \mu _ { j } ( z ^ { \prime } ) = \int _ { f ^ { - 1 } ( B ) } d \mu _ { i } ( z ) \quad \mathrm { f o r a n y B o r e l s u b s e t } B \subseteq { \mathcal { Z } } ^ { \prime } .$$
The mapping $f$ is referred to as a transport map (Kolouri et al., 2017), and the optimal transport map is called the Monge map. For absolutely continuous measures, the differential form of the above equation takes the following form, $d e t ( \tilde { D f } ( z ) ) p _ { j } ( f ( z ) ) = p _ { i } ( z )$ , which is referred to as the Jacobian equation. For discrete probability measures, when the transport plan $\gamma$ is a deterministic optimal coupling, such a transport plan is referred to as a Monge coupling (Villani, 2008).
Recently, Wasserstein distances have been used for representation learning on graphs and images (Togninalli et al., 2019; Zhang et al., 2020; Bécigneul et al., 2020). In particular, (Togninalli et al., 2019) proposed a Wasserstein kernel for graphs that involves pairwise calculation of the Wasserstein distance between graph representations. Pairwise calculation of the Wasserstein distance, however, could be expensive, especially for large graph datasets. In what follows, we apply the linear optimal transportation framework (Wang et al., 2013) to define a Hilbertian embedding, in which the $\ell _ { 2 }$ distance provides a true metric between the probability measures that approximates $\mathcal { W } _ { 2 }$ . We show that in a dataset containing $M$ graphs, this framework reduces the computational complexity from calculating $\frac { M ( M - 1 ) } { 2 }$ linear programs to $M$ .
# 3 LINEAR WASSERSTEIN EMBEDDING
Wang et al. (2013) and the follow-up works (Seguy & Cuturi, 2015; Kolouri et al., 2016; Courty et al., 2018) describe frameworks for isometric Hilbertian embedding of probability measures such that the Euclidean distance between the embedded images approximates $\mathcal { W } _ { 2 }$ . We leverage the prior work and introduce the concept of linear Wasserstein embedding for learning graph embeddings.
# 3.1 THEORETICAL FOUNDATION
We adhere to the definition of the linear Wasserstein embedding for continuous measures. However, all derivations hold for discrete measures as well. More precisely, let $\mu _ { 0 }$ be a reference probability measure defined on $\mathcal { Z } \subseteq \mathbb { R } ^ { d }$ , with a positive probability density function $p _ { 0 }$ , s.t. $d \mu _ { 0 } ( z ) = p _ { 0 } ( z ) d z$ and $p _ { 0 } ( z ) > 0$ for $\forall z \in { \mathcal { Z } }$ . Let $f _ { i }$ denote the Monge map that pushes $\mu _ { 0 }$ into $\mu _ { i }$ , i.e.,
 Figure 1: Graphical representation of the linear Wasserstein embedding framework, where the probability distributions are mapped to the tangent space with respect to a fixed reference distribution. The figure is adapted from Kolouri et al. (2017).
$$f _ { i } = \mathrm { a r g m i n } _ { f \in M P ( \mu _ { 0 } , \mu _ { i } ) } \int _ { \mathcal Z } \| z - f ( z ) \| ^ { 2 } d \mu _ { 0 } ( z ) .$$
Define $\phi ( \mu _ { i } ) \triangleq ( f _ { i } - i d ) \sqrt { p _ { 0 } }$ , where $i d ( z ) = z , \forall z \in \mathcal { Z }$ is the identity function. In cartography, such a mapping is known as the equidistant azimuthal projection, while in differential geometry, it is called the logarithmic map. The mapping $\phi ( \cdot )$ has the following characteristics (partially illustrated in Figure 1):
1. $\phi ( \cdot )$ provides an isometric embedding for probability measures, i.e., using the Jacobian equation pi = det(Df −1i )p0(f −1i ), where fi = φ(µi)√p .
2. $\phi ( \mu _ { 0 } ) = 0$ , i.e., the reference is mapped to zero.
3. $\| \phi ( \mu _ { i } ) - \phi ( \mu _ { 0 } ) \| _ { 2 } = \| \phi ( \mu _ { i } ) \| _ { 2 } = \mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { 0 } )$ , i.e., the mapping preserves distances to $\mu _ { 0 }$
4. $\lVert \phi ( \mu _ { i } ) - \phi ( \mu _ { j } ) \rVert _ { 2 } \approx \mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { j } )$ , i.e., the $\ell _ { 2 }$ distance between $\phi ( \mu _ { i } )$ and $\phi ( \mu _ { j } )$ , while being a true metric between $\mu _ { i }$ and $\mu _ { j }$ , is an approximation of $\mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { j } )$ .
Embedding probability measures $\{ \mu _ { i } \} _ { i = 1 } ^ { M }$ via $\phi ( \cdot )$ requires calculating $M$ Monge maps. The fourth characteristic above states that $\phi ( \cdot )$ provides a linear embedding for the probability measures. Therefore, we call it the linear Wasserstein embedding. The mapping $\phi ( \mu _ { i } )$ could be thought as the Reproducing Kernel Hilbert Space (RKHS) embedding of the measure, $\mu _ { i }$ (Muandet et al., 2017). In practice, for discrete distributions, the Monge coupling is used, which could be approximated from the Kantorovich plan (i.e., the transport plan) via the so-called barycenteric projection (Wang et al., 2013). We here acknowledge the concurrent work by Mialon et al. (2021), where the authors use a similar idea to the linear Wasserstein embedding as a pooling operator for learning from sets of features. The authors demonstrate the relationship between their proposed optimal transport-based pooling operation and the widespread attention pooling methods in the literature. A detailed description of the capabilities of the linear Wasserstein embedding framework is included in Appendix A.1. We next provide the numerical details of the barycenteric projection (Ambrosio et al., 2008; Wang et al., 2013).
# 3.2 NUMERICAL DETAILS
Consider a set of probability distributions $\{ p _ { i } \} _ { i = 1 } ^ { M }$ , and let $Z _ { i } = \left[ z _ { 1 } ^ { i } , \ldots , z _ { N _ { i } } ^ { i } \right] ^ { T } \in \mathbb { R } ^ { N _ { i } \times d }$ be an array containing $N _ { i }$ i.i.d. samples from distribution $p _ { i }$ , i.e., $z _ { k } ^ { i } \in \mathbb { R } ^ { d } \sim p _ { i } , \forall k \in \{ 1 , \dots , N _ { i } \} .$ . Let us define $p _ { 0 }$ to be a reference distribution, with $\boldsymbol { Z } _ { 0 } = \left[ z _ { 1 } ^ { 0 } , \ldots , z _ { N } ^ { 0 } \right] ^ { T } \in \mathbb { R } ^ { N \times d }$ , where $\begin{array} { r } { N = \lfloor \frac { 1 } { M } \sum _ { i = 1 } ^ { M } N _ { i } \rfloor } \end{array}$ and $z _ { j } ^ { 0 } \in \mathbb { R } ^ { d } \sim p _ { 0 } , \forall j \in \{ 1 , \dots , N \}$ . The optimal transport plan between $p _ { i }$ and $p _ { 0 }$ , denoted by $\pi _ { i } ^ { * } \in \mathbb { R } ^ { N \times N _ { i } }$ , is the solution to the following linear program,
$$\begin{array} { r } { \pi _ { i } ^ { * } = \underset { \ b { \pi } \in \Pi _ { i } } { \operatorname { a r g m i n } } \sum _ { \ b { \pi } \in \Pi _ { i } } ^ { N } \displaystyle \sum _ { j = 1 } ^ { N _ { i } } \sum _ { k = 1 } ^ { N _ { i } } \pi _ { j k } \lVert z _ { j } ^ { 0 } - z _ { k } ^ { i } \rVert ^ { 2 } , } \end{array}$$
where $\Pi _ { i } \triangleq \Big \{ \pi \in \mathbb { R } ^ { N \times N _ { i } } \big | N _ { i } \sum _ { j = 1 } ^ { N } \pi _ { j k } = N \sum _ { k = 1 } ^ { N _ { i } } \pi _ { j k } = 1 , \forall k \in \{ 1 , \dots , N _ { i } \} , \forall j \in \{ 1 , \dots , N \} \Big \} .$ The Monge map is then approximated from the optimal transport plan by barycentric projection via
$$F _ { i } = N ( \pi _ { i } ^ { * } Z _ { i } ) \in \mathbb { R } ^ { N \times d } .$$
Note that the transport plan $\pi _ { i }$ could split the mass in $z _ { j } ^ { 0 } \in Z _ { 0 }$ and distribute it on $z _ { k } ^ { i } \mathrm { s }$ . The barycentric projection calculates the center of mass of the transportation locations for $z _ { j } ^ { 0 }$ to ensure that no mass splitting is happening (see Figure 5), and hence it approximates a Monge coupling. Finally, the√ embedding can be calculated by $\phi ( Z _ { i } ) = ( F _ { i } - Z _ { 0 } ) / \sqrt { N } \in \mathbb { R } ^ { N \times d }$ . With a slight abuse of notation, we use $\phi ( p _ { i } )$ and $\phi ( Z _ { i } )$ interchangeably throughout the paper. Due to the barycenteric projection, here, $\phi ( \cdot )$ is only pseudo-invertible.
# 4 WEGL: A LINEAR WASSERSTEIN EMBEDDING FOR GRAPHS
The application of the optimal transport problem to graphs is multifaceted. For instance, some works focus on solving the “structured” optimal transport concerning an optimal probability flow, where the transport cost comes from distances on an often unchanging underlying graph (Léonard et al., 2016; Essid & Solomon, 2018; Titouan et al., 2019). Here, we are interested in applying optimal transport to measure the dissimilarity between two graphs (Maretic et al., 2019; Togninalli et al., 2019; Dong & Sawin, 2020). Our work significantly differs from (Maretic et al., 2019; Dong & Sawin, 2020), which measure the dissimilarity between non-attributed graphs based on distributions defined by their Laplacian spectra and is closer to (Togninalli et al., 2019).
Our proposed graph embedding framework, termed Wasserstein Embedding for Graph Learning (WEGL), combines node embedding methods for graphs with the linear Wasserstein embedding explained in Section 3. More precisely, let $\{ G _ { i } = ( \breve { \mathcal { V } } _ { i } , \dot { \mathcal { E } } _ { i } ) \} _ { i = 1 } ^ { M }$ denote a set of $M$ individual graphs, each with a set of possible node features $\{ x _ { v } \} _ { v \in \mathcal { V } _ { i } }$ and a set of possible edge features $\{ w _ { u v } \} _ { ( u , v ) \in \mathcal { E } _ { i } }$ . Let $h ( \cdot )$ be an arbitrary node embedding process, where $h ( G _ { i } ) = Z _ { i } = \left[ z _ { 1 } , \ldots , z _ { | \mathcal { V } _ { i } | } \right] ^ { T } \in \mathbb { R } ^ { | \mathcal { V } _ { i } | \times d }$ . Having the node embeddings $\{ Z _ { i } \} _ { i = 1 } ^ { M }$ , we can then calculate a reference node embedding $Z _ { 0 }$ (see Section 4.2 for details), which leads to the linear Wasserstein embedding $\phi ( Z _ { i } )$ with respect to $Z _ { 0 }$ , as described in Section 3. Therefore, the entire embedding for each graph $G _ { i } , i \in \{ 1 , \dots , M \}$ , is obtained by composing $\phi ( \cdot )$ and $h ( \cdot )$ , i.e., $\psi ( G _ { i } ) = \phi { \left( h ( G _ { i } ) \right) }$ . Figure 2 visualizes this process.
# 4.1 NODE EMBEDDING
There are many choices for node embedding methods (Chami et al., 2020). These methods in general could be parametric or non-parametric, e.g., as in propagation/diffusion-based embeddings. Parametric embeddings are often implemented via a GNN encoder. The encoder can capture different graph properties depending on the type of supervision (e.g., supervised or unsupervised). Selfsupervised embedding methods have also been recently shown to be promising $\mathrm { H u ^ { * } }$ et al., 2020).
In this paper, for our node embedding process $h ( \cdot )$ , we follow a similar non-parametric propagation/diffusion-based encoder as in (Togninalli et al., 2019). One of the appealing advantages of this framework is its simplicity, as there are no trainable parameters involved. In short, given a graph $G = ( \nu , \mathcal { E } )$ with node features $\{ x _ { v } \} _ { v \in \mathcal { V } }$ and scalar edge features $\{ w _ { u v } \} _ { ( u , v ) \in \mathcal { E } }$ , we use the following instantiation of equation 12 to define the combining function as
 Figure 2: Our proposed graph embedding framework, WEGL, combines node embedding methods with the linear Wasserstein embedding framework described in Section 3. Given a graph $G _ { i } = ( \nu _ { i } , \bar { \mathcal { E } } _ { i } )$ , we first embed the graph nodes into a $d$ -dimensional Hilbert space and obtain an array of node embeddings, denoted by $h ( G _ { i } ) = Z _ { i } \in \mathbb { R } ^ { | V _ { i } | \times d }$ . We then calculate the linear Wasserstein embedding of $Z _ { i }$ with respect to a reference $Z _ { 0 }$ , i.e., $\phi ( Z _ { i } )$ , to derive the final graph embedding.
$$x _ { v } ^ { ( l ) } = \sum _ { u \in { \mathcal { N } } _ { v } \cup \{ v \} } \frac { w _ { u v } } { \sqrt { { \mathsf { d e g } } ( u ) { \mathsf { d e g } } ( v ) } } \cdot x _ { u } ^ { ( l - 1 ) } , \forall l \in \{ 1 , \ldots , L \} , \forall v \in \mathcal { V } ,$$
where for any node $v \in \mathcal V$ , its degree ${ \mathsf { d e g } } ( v )$ is defined as its number of neighbors in $G$ augmented with self-connections, i.e., $\deg ( v ) \triangleq 1 + | \mathcal { N } _ { v } |$ . Note that the normalization of the messages between graph nodes by the (square root of) the two end-point degrees in equation 7 have also been used in other architectures, including GCN (Kipf & Welling, 2016). For the cases where the edge weights are not available, including self-connection weights $\{ w _ { v v } \} _ { v \in \mathcal { V } }$ , we set them to one. In Appendix A.5, we show how we use an extension of equation 7 to treat graphs with multiple edge features/labels. Finally, we let $z _ { v } = g \left( \{ x _ { v } ^ { ( l ) } \} _ { l = 0 } ^ { L } \right)$ represent the resultant embedding for each node $v \in \mathcal V$ , where $g ( \cdot )$ is a local pooling process on a single node (not a global pooling), e.g., concatenation or averaging.
# 4.2 CALCULATION OF THE REFERENCE DISTRIBUTION
To calculate the reference distribution, we use the $k$ -means clustering algorithm on $\textstyle \bigcup _ { i = 1 } ^ { M } Z _ { i }$ with $\begin{array} { r } { N = \left\lfloor { \frac { 1 } { M } } \sum _ { i = 1 } ^ { M } N _ { i } \right\rfloor } \end{array}$ centroids. Alternatively, one can calculate the Wasserstein barycenter (Cuturi & Doucet, 2014) of the node embeddings or simply use $N$ samples from a normal distribution. While approximation of the 2-Wasserstein distance in the tangent space depends on the reference distribution choice, surprisingly, we see a stable performance of WEGL for different references. In Appendix A.2, we compare the performance of WEGL with respect to different references.
# 5 EXPERIMENTAL EVALUATION
In this section, we discuss the evaluation results of our proposed algorithm on multiple benchmark graph classification datasets. We use the PyTorch Geometric framework (Fey & Lenssen, 2019) for implementing WEGL. In all experiments, we use scikit-learn for the implementation of our downstream classifiers on the embedded graphs (Buitinck et al., 2013).
# 5.1 MOLECULAR PROPERTY PREDICTION ON THE OPEN GRAPH BENCHMARK
We first evaluate our algorithm on the molecular property prediction task on the ogbg-molhiv dataset. This dataset is part of the Open Graph Benchmark (Hu et al., 2020), which involves node-level, link-level, and graph-level learning and prediction tasks on multiple datasets spanning diverse problem domains. The ogbg-molhiv dataset, in particular, is a molecular tree-like dataset, consisting of 41, 127 graphs, with an average number of 25.5 nodes and 27.5 edges per graph. Each graph is a molecule, with nodes representing atoms and edges representing bonds between them, and
<table><tr><td rowspan=10 colspan=1>NNO</td><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Validation ROC-AUC(%) Test ROC-AUC (%)</td></tr><tr><td rowspan=1 colspan=1>GCN (Kipf & Welling,2016)</td><td rowspan=1 colspan=1>83.8±0.9 76.0 ±1.2</td></tr><tr><td rowspan=1 colspan=1>GIN + Virtual Node (Xu et al., 2019)</td><td rowspan=1 colspan=1>84.8 ± 0.7 77.1 ± 1.5</td></tr><tr><td rowspan=1 colspan=1>DeeperGCN (Li et al.,2020)</td><td rowspan=1 colspan=1>84.3±0.6 78.6 ± 1.2</td></tr><tr><td rowspan=1 colspan=1>HIMP (Fey et al., 2020)</td><td rowspan=1 colspan=1>78.8 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>GCN + GraphNorm (Cai et al., 2020)</td><td rowspan=1 colspan=1>79.0 ± 1.1 78.8±1.0</td></tr><tr><td rowspan=1 colspan=1>WEGL+Random Forest</td><td rowspan=1 colspan=1>79.2 ± 2.2 75.5 ± 1.5</td></tr><tr><td rowspan=1 colspan=1>WEGL + Virtual Node + Random Forest</td><td rowspan=1 colspan=1>81.9 ± 1.3 76.5 ± 1.8</td></tr><tr><td rowspan=1 colspan=1>WEGL + Virtual Node + AutoML</td><td rowspan=1 colspan=1>81.6± 0.6 79.1 ± 0.3</td></tr><tr><td rowspan=1 colspan=1>GAP + Virtual Node +Random Forest</td><td rowspan=1 colspan=1>74.9 ± 2.4 72.1 ± 1.7</td></tr></table>
Table 1: Graph classification results on the ogbg-molhiv dataset. The results for GCN and GIN are reported from (Hu et al., 2020). The best validation and test results are shown in bold.
it includes both node and edge attributes, characterizing the atom and bond features. The goal is to predict a binary label indicating whether or not a molecule inhibits HIV replication.
To train and evaluate our proposed method, we use the scaffold split provided by the dataset, and report the mean and standard deviation of the results across 10 different random seeds. We perform a grid search over a set of hyperparameters and report the configuration that leads to the best validation performance. We also report a virtual node variant of the graphs in our evaluations, where each graph is augmented with an additional node that is connected to all the original nodes in the graph. This node serves as a shortcut for message passing among the graph nodes, bringing any pair of nodes within at most two hops of each other. The complete implementation details can be found in Appendix A.5.
Table 1 shows the evaluation results of WEGL on the ogbg-molhiv dataset in terms of the ROC-AUC (i.e., Receiver Operating Characteristic Area Under the Curve), alongside multiple GNNbased baseline algorithms. Specifically, we show the results using two classifiers: A random forest classifier (Breiman, 2001) and an automated machine learning (AutoML) classifier using the AutoSklearn 2.0 library (Feurer et al., 2020). As the table demonstrates, while WEGL embeddings combined with random forest achieve a decent performance level, using AutoML further enhances the performance and achieves state-of-the-art test results on this dataset, showing the high expressive power of WEGL in large-scale graph datasets, without the need for end-to-end training.
Moreover, as an ablation study, we report the evaluation results on the ogbg-molhiv dataset using a random forest classifier, where the Wasserstein embedding module after the node embedding process is replaced with global average pooling (GAP) among the output node embeddings of each graph to derive the graph-level embedding. As the table demonstrates, there is a significant performance drop when using GAP graph embedding, which indicates the benefit of our proposed graph embedding method as opposed to average readout.
# 5.2 TUD BENCHMARK DATASETS
We also consider a set of social network, bioinformatics and molecule graph datasets (Kersting et al., 2020). The social network datasets (IMDB-BINARY, IMDB-MULTI, COLLAB, REDDIT-BINARY, and REDDIT-MULTI-5K) lack both node and edge features. Therefore, in these datasets we use a one-hot representation of the node degrees as their initial feature vectors, as also used in prior work, e.g., (Xu et al., 2019). To handle the large scale of the REDDIT-BINARY and REDDIT-MULTI-5K and datasets, we clip the node degrees at 500.
Moreover, for the molecule (PTC-MR) and bioinformatics (ENZYMES and PROTEINS) datasets, we use the readily-provided node labels in (Kersting et al., 2020) as the initial node feature vectors. Besides, for PTC-MR which has edge labels, as explained in Appendix A.5, we use an extension of equation 7 to use the one-hot encoded edge features in the diffusion process. To evaluate the performance of WEGL, we follow the methodology used in (Yanardag & Vishwanathan, 2015; Niepert et al., 2016; Xu et al., 2019), where for each dataset, we perform 10-fold cross-validation with random splitting on the entire dataset, conducting a grid search over the desired set of hyperparameters as mentioned in Appendix A.5, and we then report the mean and standard deviation of the validation accuracies achieved during cross-validation. For this experiment, we use two ensemble classifiers, namely Random Forest and Gradient Boosted Decision Tree (GBDT), together with kernel-SVM with an RBF kernel (SVM-RBF). Given that the Euclidean distance in the embedding space approximates the 2-Wasserstein distance, the SVM-RBF classification results are comparable with those reported by Togninalli et al. (2019).
Table 2: Graph classification accuracy $( \% )$ of our method and comparison with the state-of-the-art GNNs and graph kernels (GKs) on various TUD graph classification tasks. The results for DGCNN are reported from (Errica et al., 2020). The top-three performers on each dataset are shown in bold.
<table><tr><td rowspan="5">NNO</td><td>Method</td><td>IMDB-B</td><td>IMDB-M</td><td>COLLAB</td><td>RE-B</td><td>RE-M5K PTC-MR</td><td>ENZYMES</td><td>PROTEINS</td></tr><tr><td>DGCNN (Zhang et al.,2018a)</td><td>69.2±3.0</td><td>45.6±3.4 71.2±1.9</td><td>87.8±2.5</td><td>49.2±1.2</td><td>58.6</td><td>38.9±5.7</td><td>72.9±3.5</td></tr><tr><td>GraphSAGE (Hamilton et al.,2017)</td><td>68.8±4.5 47.6±3.5 73.9±1.7 84.3±1.9 50.0±1.3 63.9±7.7</td><td></td><td></td><td></td><td></td><td></td><td>75.9±3.2</td></tr><tr><td>GIN (Xu et al., 2019)</td><td>75.1±5.1</td><td>2.3±2.8</td><td>80.2±1.9</td><td>92.4±2.5 57.5±1.5</td><td>564.6±7.0</td><td></td><td>76.2±2.8</td></tr><tr><td>GNTK (Du et al., 2019)</td><td></td><td>76.9±3.6 52.8±4.6 83.6±1.0</td><td></td><td></td><td>67.9±6.9</td><td></td><td>75.6±4.2</td></tr><tr><td rowspan="5"></td><td>CapsGNN (Xinyi & Chen,2019)</td><td>73.1±4.8</td><td>50.3±2.6 79.6±0.9</td><td></td><td>52.9±1.5</td><td></td><td>54.7±5.7</td><td>76.3±3.6</td></tr><tr><td>GraphNorm (Cai et al.,2020)</td><td>76.0±3.7</td><td></td><td>80.2±1.0 93.5±2.1</td><td></td><td>64.9±7.5</td><td></td><td> 77.4±4.9</td></tr><tr><td>DGK(Yanardag & Vishwanathan,2015)</td><td></td><td></td><td></td><td></td><td>67.0±0.6 44.6±0.5 73.1±0.3 78.0±0.4 41.3±0.2 57.3±1.1</td><td>27.1±0.8</td><td>71.7±0.5</td></tr><tr><td>WL (Shervashidze et al.,2011)</td><td>73.8±3.9 49.8±0.5 74.8±0.2 68.2±0.2 51.2±0.3 57.0±2.0</td><td></td><td></td><td></td><td></td><td>53.2±1.1</td><td>72.9±0.6</td></tr><tr><td>RetGK (Zhang et al., 2018b)</td><td></td><td></td><td></td><td></td><td>71.0±0.6 46.7±0.6 73.6±0.3 90.8±0.2 54.2±0.3 67.9±1.4 59.1±1.1</td><td></td><td>75.2±0.3</td></tr><tr><td rowspan="4">3</td><td>AWE (Ivanov & Burnaev,2018)</td><td></td><td>74.5±5.8 51.5±3.6 73.9±1.9 87.9±2.5 50.5±1.9</td><td></td><td></td><td></td><td>35.8±5.9</td><td></td></tr><tr><td>WWL(Togninalli et al., 2019)</td><td>74.4±0.8</td><td></td><td></td><td></td><td>66.3±1.2</td><td>59.1±0.8</td><td>74.3±0.6</td></tr><tr><td>WEGL +SVM-RBF</td><td></td><td></td><td></td><td></td><td>73.4±2.5 51.7±3.1 78.6±1.0 92.1±1.9 56.1±2.3 63.4±5.3</td><td>57.3±4.2</td><td>76.0±4.4</td></tr><tr><td>WEGL + Random Forest</td><td></td><td></td><td></td><td>75.4±5.0 52.0±4.1 79.8±1.5 92.0±0.8 55.1±2.5</td><td></td><td>67.5±7.7 60.5±5.9</td><td>76.5±4.2</td></tr><tr><td>s.InO</td><td>WEGL + GBDT</td><td>75.2±5.0</td><td>52.3±2.9</td><td>80.6±2.0 92.9±1.9</td><td>55.4±1.6</td><td>66.2±6.9</td><td>60.0±6.3</td><td>76.3±3.9</td></tr></table>
Table 2 shows the classification accuracies achieved by WEGL on the aforementioned datasets as compared with several GNN and graph kernel baselines, whose results are extracted from the corresponding original papers. As the table demonstrates, our proposed algorithm achieves either state-of-the-art or competitive results across all the datasets, and in particular, it is among the top-three performers in all of them. This shows the effectiveness of the proposed linear Wasserstein embedding for learning graph-level properties across different domains.
# 5.3 COMPUTATION TIME
As mentioned before, one of the most important advantages of WEGL as compared to other graph representation learning methods is its algorithmic efficiency. To evaluate that, we compare the wall-clock training and inference times of WEGL with those of GIN and the Wasserstein Weisfeiler-Lehman (WWL) graph kernel on five different TUD datasets (IMDB-B, MUTAG, PTC-MR, PROTEINS, and $\mathrm { { N C I 1 } } ) ^ { 2 }$ . For WEGL and WWL, we use the exact linear programming solver (as opposed to the entropy-regularized version). We carry out our experiments for WEGL and WWL on a $2 . 3 \ : \mathrm { G H z }$ Intel
R Xeon
R E5-2670 v3 CPU, while we use a 16 GB NVIDIA
R Tesla
R P100 GPU for GIN. As a reference, we implement GIN on the aforementioned CPU hardware as well.
Figure 3 shows how the training and inference run-times of WEGL, WWL and GIN scale with the number of graphs in the dataset, the average number of nodes per graph, and the average number of edges per graph. As the figure illustrates, while having similar or even better performance, training WEGL is several orders of magnitude faster than WWL and GIN, especially for datasets with larger numbers of graphs. Note that training WWL becomes very inefficient as the number of graphs in the dataset increases due to the pairwise distance calculation between all the graphs.
During inference, WEGL is slightly slower than GIN, when implemented on a GPU. However, on most datasets, WEGL is considerably faster in inference as compared to GIN implemented on a CPU. Moreover, both algorithms are significantly faster than WWL. Using GPU-accelerated implementations of the diffusion process in equation 7 and the entropy-regularized transport problem could potentially further enhance the computational efficiency of WEGL during inference.
 Figure 3: Average wall-clock time comparison of our proposed method, WEGL with WWL (Togninalli et al., 2019) and GIN (Xu et al., 2019). WEGL and WWL were implemented on a 2.3 GHz Intel
R $\operatorname { \dot { X } e o n } ^ { \mathbb { Q } }$ E5-2670 v3 CPU. Moreover, GIN was implemented twice, once using the aforementioned CPU and once using a 16 GB NVIDIA
R Tesla
R P100 GPU, with 5 hidden layers, 300 training epochs and a batch size of 16 in both cases.
# 6 CONCLUSION
We considered the problem of graph property prediction and introduced the linear Wasserstein Embedding for Graph Learning, which we denoted as WEGL. Similar to (Togninalli et al., 2019), our approach also relies on measuring the Wasserstein distances between the node embeddings of graphs. Unlike (Togninalli et al., 2019), however, we further embed the node embeddings of graphs into a Hilbert space, in which their Euclidean distance approximates their 2-Wasserstein distance. WEGL provides two significant benefits: i) it has linear complexity in the number of graphs (as opposed to the quadratic complexity of (Togninalli et al., 2019)), and ii) it enables the application of any ML algorithm of choice, such as random forest, gradient boosted decision tree, or even AutoML. We demonstrated WEGL’s superior performance and highly efficient training on a wide range of benchmark datasets, including the ogbg-molhiv dataset and the TUD graph classification tasks.
# ACKNOWLEDGEMENT
We gratefully acknowledge funding by the United States Air Force under Contract No. FA8750-19- C-0098. Gustavo K. Rohde also acknowledges funding by NIH grant GM130825. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the United States Air Force and DARPA.
# REFERENCES
Monica Agrawal, Marinka Zitnik, and Jure Leskovec. Large-scale analysis of disease pathways in the human interactome. In PSB, pp. 111–122. World Scientific, 2018.
Luigi Ambrosio, Nicola Gigli, and Giuseppe Savaré. Gradient flows: in metric spaces and in the space of probability measures. Springer Science & Business Media, 2008.
Lars Backstrom and Jure Leskovec. Supervised random walks: predicting and recommending links in social networks. In Proceedings of the Fourth ACM International Conference on Web Search and Data Mining, pp. 635–644, 2011.
Gary Bécigneul, Octavian-Eugen Ganea, Benson Chen, Regina Barzilay, and Tommi Jaakkola. Optimal transport graph neural networks. arXiv preprint arXiv:2006.04804, 2020.
Aleksandar Bojchevski, Johannes Klicpera, Bryan Perozzi, Martin Blais, Amol Kapoor, Michal Lukasik, and Stephan Günnemann. Is pagerank all you need for scalable graph neural networks? In Proceedings of the $1 5 ^ { t h }$ International Workshop on Mining and Learning with Graphs (MLG), 2019.
Karsten M Borgwardt and Hans-Peter Kriegel. Shortest-path kernels on graphs. In Fifth IEEE International Conference on Data Mining (ICDM’05). IEEE, 2005.
Leo Breiman. Random forests. Machine learning, 45(1):5–32, 2001.
Yann Brenier. Polar factorization and monotone rearrangement of vector-valued functions. Communications on pure and applied mathematics, 44(4):375–417, 1991.
Lars Buitinck, Gilles Louppe, Mathieu Blondel, Fabian Pedregosa, Andreas Mueller, Olivier Grisel, Vlad Niculae, Peter Prettenhofer, Alexandre Gramfort, Jaques Grobler, Robert Layton, Jake VanderPlas, Arnaud Joly, Brian Holt, and Gaël Varoquaux. API design for machine learning software: Experiences from the scikit-learn project. In ECML PKDD Workshop: Languages for Data Mining and Machine Learning, pp. 108–122, 2013.
Tianle Cai, Shengjie Luo, Keyulu Xu, Di He, Tie-yan Liu, and Liwei Wang. Graphnorm: A principled approach to accelerating graph neural network training. arXiv preprint arXiv:2009.03294, 2020.
Ines Chami, Sami Abu-El-Haija, Bryan Perozzi, Christopher Ré, and Kevin Murphy. Machine learning on graphs: A model and comprehensive taxonomy. arXiv preprint arXiv:2005.03675, 2020.
Nicolas Courty, Rémi Flamary, and Mélanie Ducoffe. Learning wasserstein embeddings. In International Conference on Learning Representations, 2018.
Marco Cuturi and Arnaud Doucet. Fast computation of Wasserstein barycenters. In Proceedings of the 31st International Conference on Machine Learning, Proceedings of Machine Learning Research, pp. 685–693. PMLR, 2014. URL http://proceedings.mlr.press/v32/cuturi14. html.
Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, pp. 3844–3852, 2016.
Yihe Dong and Will Sawin. COPT: Coordinated optimal transport on graphs. arXiv preprint arXiv:2003.03892, 2020.
Simon S Du, Kangcheng Hou, Russ R Salakhutdinov, Barnabas Poczos, Ruosong Wang, and Keyulu Xu. Graph neural tangent kernel: Fusing graph neural networks with graph kernels. In Advances in Neural Information Processing Systems, pp. 5724–5734, 2019.
P Dvurechensky, A Gasnikov, and A Kroshnin. Computational optimal transport: Complexity by accelerated gradient descent is better than by sinkhorn’s algorithm. In 35th International Conference on Machine Learning, ICML 2018, pp. 2196–2220, 2018.
Federico Errica, Marco Podda, Davide Bacciu, and Alessio Micheli. A fair comparison of graph neural networks for graph classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ HygDF6NFPB.
Montacer Essid and Justin Solomon. Quadratically regularized optimal transport on graphs. SIAM Journal on Scientific Computing, 40(4):A1961–A1986, 2018.
Matthias Feurer, Katharina Eggensperger, Stefan Falkner, Marius Lindauer, and Frank Hutter. Autosklearn 2.0: The next generation. arXiv preprint arXiv:2007.04074, 2020.
Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
Matthias Fey, Jan-Gin Yuen, and Frank Weichert. Hierarchical inter-message passing for learning on molecular graphs. arXiv preprint arXiv:2006.12179, 2020.
R’emi Flamary and Nicolas Courty. Pot python optimal transport library, 2017. URL https: //pythonot.github.io/.
Thomas Gärtner, Peter Flach, and Stefan Wrobel. On graph kernels: Hardness results and efficient alternatives. In Learning Theory and Kernel Machines, pp. 129–143. Springer, 2003.
Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pp. 1024–1034, 2017.
Danny Hernandez and Tom B Brown. Measuring the algorithmic efficiency of neural networks. arXiv preprint arXiv:2005.04305, 2020.
Thomas Hofmann, Bernhard Schölkopf, and Alexander J Smola. Kernel methods in machine learning. The Annals of Statistics, pp. 1171–1220, 2008.
Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020.
Weihua $\mathrm { H u ^ { * } }$ , Bowen Liu\*, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ HJlWWJSFDH.
Sergey Ivanov and Evgeny Burnaev. Anonymous walk embeddings. In International Conference on Machine Learning, pp. 2186–2195, 2018.
Wengong Jin, Connor Coley, Regina Barzilay, and Tommi Jaakkola. Predicting organic reaction outcomes with Weisfeiler-Lehman network. In Advances in Neural Information Processing Systems, pp. 2607–2616, 2017.
Hisashi Kashima, Koji Tsuda, and Akihiro Inokuchi. Marginalized kernels between labeled graphs. In Proceedings of the $2 { \cal O } ^ { t h }$ International Conference on Machine Learning (ICML-03), pp. 321–328, 2003.
Kristian Kersting, Nils M. Kriege, Christopher Morris, Petra Mutzel, and Marion Neumann. Benchmark data sets for graph kernels, 2020. URL http://www.graphlearning.io/.
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
Soheil Kolouri, Akif B Tosun, John A Ozolek, and Gustavo K Rohde. A continuous linear optimal transport approach for pattern analysis in image datasets. Pattern Recognition, 51:453–462, 2016.
Soheil Kolouri, Se Rim Park, Matthew Thorpe, Dejan Slepcev, and Gustavo K Rohde. Optimal mass transport: Signal processing and machine-learning applications. IEEE Signal Processing Magazine, 34(4):43–59, 2017.
Risi Kondor and Horace Pan. The multiscale Laplacian graph kernel. In Advances in Neural Information Processing Systems, pp. 2990–2998, 2016.
Nils Kriege, Marion Neumann, Kristian Kersting, and Petra Mutzel. Explicit versus implicit graph feature maps: A computational phase transition for walk kernels. In 2014 IEEE international conference on data mining, pp. 881–886. IEEE, 2014.
Nils M Kriege, Pierre-Louis Giscard, and Richard Wilson. On valid optimal assignment kernels and applications to graph classification. In Advances in Neural Information Processing Systems, pp. 1623–1631, 2016.
Nils M Kriege, Fredrik D Johansson, and Christopher Morris. A survey on graph kernels. Applied Network Science, 5(1):1–42, 2020.
Christian Léonard et al. Lazy random walks and optimal transport on graphs. The Annals of Probability, 44(3):1864–1915, 2016.
Guohao Li, Chenxin Xiong, Ali Thabet, and Bernard Ghanem. Deepergcn: All you need to train deeper gcns. arXiv preprint arXiv:2006.07739, 2020.
Hermina Petric Maretic, Mireille El Gheche, Giovanni Chierchia, and Pascal Frossard. GOT: An optimal transport framework for graph comparison. In Advances in Neural Information Processing Systems, pp. 13876–13887, 2019.
Grégoire Mialon, Dexiong Chen, Alexandre d’Aspremont, and Julien Mairal. A trainable optimal transport embedding for feature aggregation and its relationship to attention. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id $=$ ZK6vTvb84s.
Caroline Moosmüller and Alexander Cloninger. Linear optimal transport embedding: Provable fast wasserstein distance computation and classification for nonlinear problems. arXiv preprint arXiv:2008.09165, 2020.
Christopher Morris, Kristian Kersting, and Petra Mutzel. Glocalized Weisfeiler-Lehman graph kernels: Global-local feature maps of graphs. In 2017 IEEE International Conference on Data Mining (ICDM), pp. 327–336. IEEE, 2017.
Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4602–4609, 2019.
Christopher Morris, Gaurav Rattan, and Petra Mutzel. Weisfeiler and leman go sparse: Towards scalable higher-order graph embeddings. Advances in Neural Information Processing Systems, 33, 2020.
K Muandet, K Fukumizu, B Sriperumbudur, and B Schölkopf. Kernel mean embedding of distributions: A review and beyond. Foundations and Trends in Machine Learning, 10(1-2):1–144, 2017.
Navid Naderializadeh, Mark Eisen, and Alejandro Ribeiro. Wireless power control via counterfactual optimization of graph neural networks. arXiv preprint arXiv:2002.07631, 2020.
Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In International Conference on Machine Learning, pp. 2014–2023, 2016.
Giannis Nikolentzos, Polykarpos Meladianos, and Michalis Vazirgiannis. Matching node embeddings for graph similarity. In Thirty-First AAAI Conference on Artificial Intelligence, 2017.
Giannis Nikolentzos, Polykarpos Meladianos, Stratis Limnios, and Michalis Vazirgiannis. A degeneracy framework for graph similarity. In IJCAI, pp. 2595–2601, 2018.
Bastian Rieck, Christian Bock, and Karsten Borgwardt. A persistent weisfeiler-lehman procedure for graph classification. In International Conference on Machine Learning, pp. 5448–5458, 2019.
Hamidreza Sadreazami, Arash Mohammadi, Amir Asif, and Konstantinos N Plataniotis. Distributedgraph-based statistical approach for intrusion detection in cyber-physical systems. IEEE Transactions on Signal and Information Processing over Networks, 4(1):137–147, 2017.
Vivien Seguy and Marco Cuturi. Principal geodesic analysis for probability measures under the optimal transport metric. In Advances in Neural Information Processing Systems, pp. 3312–3320, 2015.
Nino Shervashidze, SVN Vishwanathan, Tobias Petri, Kurt Mehlhorn, and Karsten Borgwardt. Efficient graphlet kernels for large graph comparison. In Artificial Intelligence and Statistics, pp. 488–495, 2009.
Nino Shervashidze, Pascal Schweitzer, Erik Jan Van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-Lehman graph kernels. Journal of Machine Learning Research, 12(77): 2539–2561, 2011.
Vayer Titouan, Nicolas Courty, Romain Tavenard, Chapel Laetitia, and Rémi Flamary. Optimal transport for structured data with application on graphs. In Proceedings of the $3 6 ^ { t h }$ International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 6275–6284, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/titouan19a.html.
Matteo Togninalli, Elisabetta Ghisu, Felipe Llinares-López, Bastian Rieck, and Karsten Borgwardt. Wasserstein Weisfeiler-Lehman graph kernels. In Advances in Neural Information Processing Systems, pp. 6436–6446, 2019.
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
Cédric Villani. Optimal transport: Old and new, volume 338. Springer Science & Business Media, 2008.
Wei Wang, Dejan Slepcev, Saurav Basu, John A Ozolek, and Gustavo K Rohde. A linear optimal ˇ transportation framework for quantifying and visualizing variations in sets of images. International Journal of Computer Vision, 101(2):254–269, 2013.
Zhang Xinyi and Lihui Chen. Capsule graph neural network. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Byl8BnRcYm.
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ ryGs6iA5Km.
Pinar Yanardag and SVN Vishwanathan. Deep graph kernels. In Proceedings of the $2 { { I } ^ { s t } }$ ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1365–1374, 2015.
Chi Zhang, Yujun Cai, Guosheng Lin, and Chunhua Shen. Deepemd: Few-shot image classification with differentiable earth mover’s distance and structured classifiers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning architecture for graph classification. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018a.
Zhen Zhang, Mianzhi Wang, Yijian Xiang, Yan Huang, and Arye Nehorai. RetGK: Graph kernels based on return probabilities of random walks. In Advances in Neural Information Processing Systems, pp. 3964–3974, 2018b.
# A APPENDIX
Here we provide further details on the theoretical aspect of WEGL, our implementation details, and the sensitivity of the results to the choice of reference distribution. We also share our implementation code on the ogbg-molhiv dataset to help with the review process.
# A.1 DETAILED DISCUSSION ON LINEAR WASSERSTEIN EMBEDDING
The linear Wasserstein embedding used in WEGL is based on the Linear Optimal Transport (LOT) framework introduced in (Wang et al., 2013). The main idea is to compute the “projection” of the manifold of probability measures to the tangent space at a fixed reference measure. In particular, the tangent space at measure $\mu _ { 0 }$ is the set of vector fields $\begin{array} { r } { \mathcal { V } _ { \mu _ { 0 } } = \{ v : \mathcal { Z } \to \mathbb { R } ^ { d } \mid \int _ { \mathcal { Z } } \vert v ( z ) \vert ^ { 2 } \hat { d } \mu _ { 0 } ( z ) < \infty \} } \end{array}$ such that the inner product is the weighted $\ell _ { 2 }$ :
$$\langle v _ { i } , v _ { j } \rangle _ { \mu _ { 0 } } = \int _ { \mathcal Z } v _ { i } ( z ) \cdot v _ { j } ( z ) d \mu _ { 0 } ( z ) .$$
We can then define $v _ { i } ( \cdot ) \triangleq f ( \cdot ) - i d ( \cdot )$ , where $f ( \cdot )$ is the optimal transport map from $\mu _ { 0 }$ to $\mu _ { i }$ . Note that $v _ { i } \in \mathcal { V } _ { \mu _ { 0 } }$ , $v _ { 0 } = 0$ , and
$$\lVert v _ { i } - v _ { 0 } \rVert _ { \mu _ { 0 } } ^ { 2 } = \lVert v _ { i } \rVert _ { \mu _ { 0 } } ^ { 2 } = \langle v _ { i } , v _ { i } \rangle _ { \mu _ { 0 } } = \int _ { \mathcal { Z } } \lVert f ( z ) - z \rVert ^ { 2 } d \mu _ { 0 } ( z ) = \mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { 0 } ) .$$
In the paper, we use $\phi ( \mu _ { i } ) = v _ { i } \sqrt { p _ { 0 } }$ to turn the weighted- $\ell _ { 2 }$ into $\ell _ { 2 }$ .
The discussion above assumes an absolutely continuous reference measure $\mu _ { 0 }$ . A more interesting treatment of the problem is via the generalized geodesics defined in (Ambrosio et al., 2008), connecting $\mu _ { i }$ and $\mu _ { j }$ and enabling us to use discrete reference measures. Following the notation in (Ambrosio et al., 2008), given the reference measure $\mu _ { 0 }$ , let $\Gamma ( \mu _ { i } , \mu _ { 0 } )$ be the set of transport plans between $\mu _ { i }$ and $\mu _ { 0 }$ , and let $\Gamma ( \mu _ { i } , \mu _ { j } , \mu _ { 0 } )$ be the set of all measures on the product space ${ \mathcal { Z } } \times { \mathcal { Z } } \times { \mathcal { Z } }$ such that the marginals over $\mu _ { i }$ and $\mu _ { j }$ are $\Gamma ( \mu _ { j } , \mu _ { 0 } )$ and $\Gamma ( \mu _ { i } , \mu _ { 0 } )$ , respectively. Then the linearized optimal transport distance is defined as
$$d _ { \mathrm { L O T } , \mu _ { 0 } } ^ { 2 } ( \mu _ { i } , \mu _ { j } ) = \operatorname* { i n f } _ { \gamma \in \Gamma ( \mu _ { i } , \mu _ { j } , \mu _ { 0 } ) } \int _ { \mathcal { Z } \times \mathcal { Z } \times \mathcal { Z } } \| z - z ^ { \prime } \| ^ { 2 } d \gamma ( z , z ^ { \prime } , z ^ { \prime \prime } ) .$$
In a discrete setting, where $\begin{array} { r } { \mu _ { i } = \frac { 1 } { N _ { i } } \displaystyle \sum _ { n = 1 } ^ { N _ { i } } \delta _ { z _ { n } } , \mu _ { j } = \frac { 1 } { N _ { j } } \displaystyle \sum _ { m = 1 } ^ { N _ { j } } \delta _ { z _ { m } ^ { \prime } } } \end{array}$ , and $\mu _ { 0 } = \frac { 1 } { N } \sum _ { l = 1 } ^ { N } \delta _ { z _ { l } ^ { \prime \prime } }$ , we have
$$d _ { \mathrm { L O T } , \mu _ { 0 } } ^ { 2 } ( \mu _ { i } , \mu _ { j } ) = \operatorname* { m i n } _ { \gamma \in \Gamma ( \mu _ { i } , \mu _ { j } , \mu _ { 0 } ) } \frac { 1 } { N _ { i } N _ { j } N } \sum _ { n = 1 } ^ { N _ { i } } \sum _ { m = 1 } ^ { N _ { j } } \sum _ { l = 1 } ^ { N } \gamma _ { n m l } \lVert z _ { n } - z _ { m } ^ { \prime } \rVert ^ { 2 } .$$
See Figure 4a for a depiction of Equation equation 11’s meaning. Finally, the idea of barycenteric projection used to approximate Monge couplings and provide a fixed-size representation is shown in Figure 4b.
 Figure 4: Illustration of (a) the meaning behind $\gamma _ { n m l }$ used in the LOT distance in equation 11, and (b) the idea of the barycenteric projection, which provides a fixed-size representation (i.e., of size $N$ ).
 Figure 5: An experiment demonstrating the capability of the linear Wasserstein embedding. (a) A simple dataset consisting of shifted and scaled noisy ring distributions $\{ p _ { i } \} _ { i = 1 } ^ { M }$ , where we only observe samples Zi = [zik ∼ pi]Nii=1 from each distribution, together with the process of obtaining the linear Wasserstein embedding with respect to a reference distribution. In short, for each distribution $p _ { i }$ , the embedding approximates the Monge-map (i.e., a vector field) from the reference samples $Z _ { 0 }$ to the target samples $Z _ { i }$ by a barycentric projection of the optimal transport plan. Adding samples in the embedding space corresponds to adding their vector fields, which can be used to calculate (b) the mean distribution in the embedding space, i.e., $\begin{array} { r } { \phi ^ { - 1 } \big ( \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \phi ( p _ { i } ) \big ) } \end{array}$ and (c)-(d) the Euclidean geodesics in this space, i.e., $\phi ^ { - 1 } ( \alpha \phi ( p _ { i } ) + ( 1 - \alpha ) \phi ( p _ { j } ) )$ for $\alpha \in [ 0 , 1 ]$ . As can be seen, the calculated mean is the Wasserstein barycenter of the dataset, and the Euclidean geodesics in the embedding space follow the Wasserstein geodesics in the original space.
Next, to demonstrate the capability of the linear Wasserstein embedding, we present the following experiment. Consider a set of distributions $\{ p _ { i } \} _ { i = 1 } ^ { M }$ , where each $p _ { i }$ is a translated and dilated ring distribution in $\mathbb { R } ^ { 2 }$ , and $N _ { i }$ samples are observed from $p _ { i }$ , where $N _ { i }$ and $N _ { j }$ could be different for $i \neq j$ . We then consider a normal distribution as the reference distribution and calculate the linear Wasserstein embedding with respect to the reference (See Figure 5a). Given the pseudo-invertible nature of the embedding, to demonstrate the modeling capability of the framework, we calculate the mean in the embedding space (i.e., on the vector fields), and invert it to obtain the mean distribution $\bar { p }$ . Figure 5b shows the calculated mean, indicating that the linear Wasserstein embedding framework has successfully retrieved a ring distribution as the mean. Finally, we calculate Euclidean geodesics in the embedding space (i.e., the convex combination of the vector fields) between $p _ { i }$ and $p _ { 0 }$ , as well as between $p _ { i }$ and $p _ { j }$ , and show the inverted geodesics in Figures 5c and 5d, respectively. As the figures demonstrate, the calculated geodesics follow the Wasserstein geodesics.
# APPROXIMATION ERROR OF THE EMBEDDING
Given the Euclidean distance in the embedding space is a transport-based distance (i.e., the socalled LOT distance) that approximates the Wasserstein distance, a natural question arises about the approximation error. Here we point the reader to the recent work of Moosmüller $\&$ Cloninger (2020) in which the authors provide bounds on how well the Euclidean distance in the embedding space approximates the 2-Wasserstein distance. In particular, the authors show that:
$$\mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { j } ) \le \| \phi ( \mu _ { i } ) - \phi ( \mu _ { j } ) \| _ { 2 } \le \mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { j } ) + \| f _ { \mu _ { i } } ^ { \mu _ { j } } - f _ { \mu _ { 0 } } ^ { \mu _ { j } } \circ f _ { \mu _ { i } } ^ { \mu _ { 0 } } \| _ { \mu _ { i } } ,$$
where $f _ { \mu _ { i } } ^ { \mu _ { j } }$ is the optimal transport map from $\mu _ { i }$ to $\mu _ { j }$ . This inequality simply indicates that the approximation error is caused by conditioning the transport map to be obtained by composition of the optimal transport maps from $\mu _ { i }$ to $\mu _ { 0 }$ , and then from $\mu _ { 0 }$ to $\mu _ { j }$ . More importantly, it can be shown that if $\mu _ { i }$ and $\mu _ { j }$ are shifted and scaled versions of the reference measure, $\mu _ { 0 }$ , then the embedding is isometric (See Figure 1 and 2 in Moosmüller $\&$ Cloninger (2020)).
Maybe a less interesting upper bound can also be obtained by the triangle inequality:
$$\mathcal { W } _ { 2 } ( \mu _ { i } , \mu _ { j } ) \le \| \phi ( \mu _ { i } ) - \phi ( \mu _ { j } ) \| _ { 2 } \le \mathcal { W } _ { 2 } ( \mu _ { i } , \sigma ) + \mathcal { W } _ { 2 } ( \sigma , \mu _ { j } ) ,$$
which ensures some regularity of the embedding.
# REGULARITY OF THE EMBEDDING
A good question was raised during the feedback period, about the regularity of the proposed embedding. The regularity of the graph embedding will depend on both the regularity of node-embedding and the Wasserstein embedding. In the following, we avoid the discussion on regularity of the nodeembedding (as it is not the main focus of our work), and focus on the regularity of the Wasserstein embedding. To that end, we first point out several regularity characteristics pointed out in Appendix A of Moosmüller & Cloninger (2020). Most notably Theorem 4.2 in their paper, shows an almost isometric property when the distortions are within an $\epsilon$ -tube around the set of shifts and scalings. In short, let $\varepsilon _ { 2 } ( \mathcal { Z } ) , R > 0 , \epsilon > 0 , \mathcal { E }$ be the set of all shifts and scalings, and
$$\mathcal { E } _ { \mu , R } = \{ h \in \mathcal { E } : \| h \| _ { \mu } \leq R \} ,$$
and let
$$\mathcal G _ { \mu , R , \epsilon } = \{ g \in L ^ { 2 } ( \mathcal Z , \mu ) : \exists h \in \mathcal E _ { \mu , R } : \| g - h \| _ { \mu } \leq \epsilon \} ,$$
which is the $\epsilon$ -tube around set of shifts and scalings. Now, assume $\mu _ { 0 } \in P _ { 2 } ( \mathcal { Z } )$ is the reference measure and both $\mu$ and $\mu _ { 0 }$ satisfy Caffarelli’s regularity theorem. Then for $g _ { 1 } , g _ { 2 } \in \mathcal { G } _ { \mu , R , \epsilon }$ we have
$$0 \leq \| \phi ( g _ { 1 \# } \mu ) - \phi ( g _ { 2 \# } \mu ) \| _ { 2 } - \mathcal { W } _ { 2 } ( g _ { 1 \# } \mu , g _ { 2 \# } \mu ) \leq C _ { \mu _ { 0 } , \mu , R } \epsilon + \bar { C } _ { \mu _ { 0 } , \mu , R } \epsilon ^ { 2 } ,$$
where $C _ { \mu _ { 0 } , \mu , R }$ and $\bar { C } _ { \mu _ { 0 } , \mu , R }$ are constants depending on $\mu _ { 0 } , \mu$ , and $R$
The results shown above can be used to derive regularity results for the linear Wasserstein embedding with respect to additive noise. We know that the addition of two random variables leads to a new random variable with its PDF being the convolution of the original PDFs. Therefore, for features $Z _ { i } = [ z _ { 1 } , . . . , z _ { N _ { i } } ] ^ { T }$ , let $\hat { Z } _ { i } = \underbrace { [ z _ { 1 } + \bar { e } _ { 1 } } _ { \hat { z } _ { 1 } } , . . . , \underbrace { z _ { N _ { i } } + e _ { N _ { i } } } _ { \hat { z } _ { N _ { i } } } ] ^ { T }$ denote the noisy samples for $e _ { i } \sim \eta$ , where $\eta$ is the noise distribution. Then the noisy samples, $\hat { z } _ { i }$ , will be distributed according to $\hat { \mu } _ { i } = \mu _ { i } * \eta$ . For instance, for the Gaussian additive noise, $\hat { \mu } _ { i }$ is the smoothed version of $\mu _ { i }$ . Therefore, there exists a transport map in $g \in \mathcal { G } _ { \mu _ { i } , R , \epsilon }$ for which, $\hat { \mu } _ { i } = g _ { \# } \mu _ { i }$ and $\Vert g - i d \Vert _ { \mu _ { i } } = \mathcal { W } _ { 2 } ( \hat { \mu } _ { i } , \mu _ { i } ) \leq \epsilon$ , and we have:
$$0 \leq \| \phi ( \mu _ { i } ) - \phi ( \hat { \mu } _ { i } ) \| _ { 2 } \leq ( C _ { \mu _ { 0 } , \mu _ { i } , R } + 1 ) \epsilon + \bar { C } _ { \mu _ { 0 } , \mu _ { i } , R } \epsilon ^ { 2 }$$
# A.2 SENSITIVITY TO THE CHOICE OF REFERENCE DISTRIBUTION
To measure the dependency of WEGL on the reference distribution choice, we changed the reference to a normal distribution (i.e., data-independent). We compared the results of WEGL using the new reference distribution to that using a reference distribution calculated via $k$ -means on the training set. We used the ogbg-molhiv dataset with initial node embedding of size 300 and 4 diffusion layers. We ran the experiment with 100 different random seeds, and measured the test ROC-AUC of WEGL calculated with the two aforementioned reference distributions. Figure 6 shows the results of this experiment, indicating that the choice of reference distribution is statistically insignificant.
 Figure 6: ROC-AUC $( \% )$ results on ogbg-molhiv dataset, when the reference distribution is calculated by $k$ -means (Section 4.2) on the training dataset (denoted as $k$ -means), compared to when it is fixed to be a normal distribution (denoted as Normal). With a $p$ -value $= 0 . 0 5$ , the choice of the template is statistically insignificant.
 Figure 7: Comparing the performance of the linear programming (LP) solver with the Sinkhorn algorithm (on entropy regularized OT problem) on the ogbg-molhiv dataset for various regularization parameters.
A.3 LINEAR PROGRAMMING VS. ENTROPY REGULARIZATION
In this paper, we used the Python Optimal Transport (Flamary & Courty, 2017) for the calculation of the optimal transport plans. During the feedback period, a point came up regarding the entropyregularized version of the OT problem (Cuturi & Doucet, 2014), which reduces the complexity of the linear programming problem from being cubic, in the number of nodes, to being quadratic, using the Sinkhorn algorithm. Given the Sinkhorn algorithm’s iterative nature, the computational gain of the method is prominent when calculating the transportation problem between graphs with a large number of nodes (e.g., larger than $1 0 ^ { 3 }$ ). However, the graph datasets used in this paper often have a small number of nodes (e.g., $< 5 0$ ). In these settings, linear programming is efficient. To obtain any computational gain using the Sinkhorn algorithm, one would need to use a large regularization coefficient, which reduces the Sinkhorn algorithm’s precision.
Here we ran an experiment on the ogbg-molhiv dataset. We obtain the transport plans between the node embeddings and the reference distribution using the linear programming solver (using ot.emd2 from (Flamary & Courty, 2017)) and the Sinkhorn algorithm for the entropy-regularized problem (using ot.sinkhorn2 from (Flamary & Courty, 2017)). We measure the calculation time as well as the calculated distances for both algorithms. For the Sinkhorn algorithm, we used four different regularization values. We report the mean and standard deviation of calculation time ratio, i.e., tSinkhorntLP and the relative error of calculating the 2-Wasserstein distance, i.e., $| \frac { \mathcal { W } _ { 2 , S i n k h o r n } - \mathcal { W } _ { 2 , L P } } { \mathcal { W } _ { 2 , L P } } |$ in Figure 7. As the figure shows, due to the small graph size, the LP solver is efficient and little to no gain can be obtained using the Sinkhorn algorithm. Nevertheless, in the case of dealing with larger graph sizes, the entropy regularized formulation should be the definite choice. Finally, for the entropy-regularized OT problem, more efficient solvers have been proposed that outperform the Sinkhorn algorithm (Dvurechensky et al., 2018). However, given the acceptable performance of the linear programming solver (at least for the graph datasets in this paper), we did not find it necessary to seek more efficient solvers.
# A.4 INNER WORKING OF GNNS
In its most general form, a GNN consists of $L$ hidden layers, where at the $l ^ { \mathrm { t h } }$ layer, each node $v \in \mathcal V$ aggregates and combines messages from its 1-hop neighboring nodes $\mathcal { N } _ { v }$ , resulting in the feature vector
$$x _ { v } ^ { ( l ) } = \Psi _ { \mathrm { c o m b i n e } } \left( x _ { v } ^ { ( l - 1 ) } , \left\{ ( x _ { u } ^ { ( l - 1 ) } , w _ { u v } ) \right\} _ { u \in \mathcal { N } _ { v } } \right) , \forall l \in \left\{ 1 , \ldots , L \right\} , \forall v \in \mathcal { V } ,$$
where $\Psi _ { \mathsf { c o m b i n e } } ( \cdot )$ denotes a parametrized and differentiable combining function.
At the input layer, each node $v \in \mathcal V$ starts with its initial feature vector $x _ { v } ^ { 0 } = x _ { v } \in \mathbb { R } ^ { F }$ , and the $\{ x _ { v } ^ { ( l ) } \} _ { l = 1 } ^ { L }$ l application of GN. At the GNN output,.e., readout) function s in equation 12, computes intermediate feature vectorse vectors of all nodes from all layers go through a global, resulting in the final graph embedding $\Psi _ { \mathrm { r e a d o u t } } ( \cdot )$
$$\psi ( G ) = \Psi _ { \sf r e a d o u t } \left( \left\{ x _ { v } ^ { ( l ) } \right\} _ { v \in \mathcal { V } , l \in \{ 0 , \dots , L \} } \right) .$$
# A.5 IMPLEMENTATION DETAILS
To derive the node embeddings, we use the diffusion process in equation 7 for the datasets without edge features/labels, i.e., all the social network datasets (IMDB-BINARY, IMDB-MULTI, COLLAB, REDDIT-BINARY, REDDIT-MULTI-5K, and REDDIT-MULTI-12K) and four of the molecule and bioinformatics datasets (ENZYMES, PROTEINS, D&D, and NCI1). We specifically set $w _ { u v } = 1$ for any $( u , v ) \in \mathcal { E }$ and also for all self-connections, i.e., $w _ { v v } = 1$ , $\forall v \in \nu$ .
The remaining datasets contain edge labels that cannot be directly used with equation 7. Specifically, each edge in the MUTAG and PTC-MR datasets has a categorical label, encoded as a one-hot vector of dimension four. Moreover, in the ogbg-molhiv dataset, each edge has three categorical features indicating bond type (five categories), bond stereochemistry (six categories) and whether the bond is conjugated (two categories). We first convert each categorical feature to its one-hot representation, and then concatenate them together, resulting in a binary 13-dimensional feature vector for each edge.
In each of the three aforementioned datasets, for any edge $( u , v ) \in \mathcal { E }$ , let us denote its binary feature vector by $w _ { u v } \in \{ 0 , 1 \} ^ { E }$ , where $E$ is equal to 4, 4, and 13 for MUTAG, PTC-MR, and ogbg-molhiv, respectively. We then use the following extension of the diffusion process in equation 7,
$$x _ { v } ^ { ( l ) } = \sum _ { u \in \mathcal { V } } \left( \sum _ { e = 1 } ^ { E } \frac { w _ { u v , e } } { \sqrt { \deg _ { e } ( u ) \deg _ { e } ( v ) } } \right) x _ { u } ^ { ( l - 1 ) } , \forall l \in \{ 1 , \ldots , L \} , \forall v \in \mathcal { V } ,$$
where for any $e \in \{ 1 , \ldots , E \}$ , $w _ { u v , e }$ denotes the $e ^ { \mathrm { t h } }$ element of $w _ { u v }$ , and for any node $v \in \nu$ , we define ${ \mathsf { d e g } } _ { e } ( v )$ as its degree over the $e ^ { \mathrm { t h } }$ elements of the edge features; i.e., $\begin{array} { r } { \mathsf { d e g } _ { e } ( v ) \triangleq \sum _ { u \in \mathcal { V } } w _ { u v , e } } \end{array}$ We assign vectors of all-one features to the self-connections in the graph; i.e., $w _ { v v , e } = 1$ , $\forall v \in$ $\mathcal { V } , \forall e \in \mathsf { \bar { \{ 1 , \dots , E \} } }$ . Note that the formulation of the diffusion process in equation 14 can be seen as an extension of equation 7, where the underlying graph with multi-dimensional edge features is broken into $E$ parallel graphs with non-negative single-dimensional edge features, and the parallel graphs perform message passing at each round/layer of the diffusion process.
For the ogbg-molhiv experiments in which virtual nodes were appended to the original molecule graphs, we set the initial feature vectors of all virtual nodes to all-zero vectors. Moreover, for any graph $G _ { i }$ in the dataset with $| \nu _ { i } |$ nodes, we set the edge features for the edge between the virtual node $v _ { \mathsf { v i r t u a l } }$ and each of the original graph nodes $u \in \mathcal { V } _ { i }$ as $\begin{array} { r } { w _ { u v _ { \mathrm { v i r t u a l } } , e } = \frac { 1 } { | \mathcal { V } _ { i } | } , \mathsf { \bar { v } } e \in \{ 1 , \dots , E \} } \end{array}$ . The normalization by the number of graph nodes is included so as to regulate the degree of the virtual node used in equation 14. We also include the resultant embedding of the virtual node at the end of the diffusion process in the calculation of the graph embedding $\psi ( G _ { i } )$ .
In the experiments conducted on each dataset, once the node embeddings are derived from the diffusion process, we standardize them by subtracting the mean embedding and dividing by the standard deviation of the embeddings, where the statistics are calculated based on all the graphs in the dataset. Moreover, to reduce the computational complexity of estimating the graph embeddings for the ogbg-molhiv dataset, we further apply a 20-dimensional PCA on the node embeddings.
# HYPERPARAMETERS
We use the following set of hyperparameters to perform a grid search over in each of the experiments:
• Random Forest: min_samples_leaf $\in \quad \{ 1 , 2 , 5 \}$ , min_samples_split $\in$ $\{ 2 , 5 , 1 0 \}$ , and n_estimators $\in \{ 2 5 , 5 0 , 1 0 0 , 1 \dot { 5 } 0 , 2 0 \dot { 0 } \}$ . • Gradient Boosted Decision Tree (GBDT): min_samples_leaf $\in \quad \{ 1 , 2 , 5 \}$ , min_samples_split $\in \ \{ 2 , 5 , 1 0 \}$ , n_estimators $\in \{ 2 5 , 5 0 , 1 0 0 , 1 5 0 , 2 0 0 \}$ , and max_depth $\in \{ 1 , 3 , 5 \}$ . • SVM-Linear and SVM-RBF: $C \in \{ 1 0 ^ { - 2 } , . . . , 1 0 ^ { 5 } \}$ . • Multi-Layer Perceptron (MLP): $\mathrm { h i d d e n \_ l a y e r \_ s i z e s } \in \{ ( 1 2 8 ) , ( 2 5 6 ) , ( 1 2 8 , 6 4 ) , ( 2 5 6 , 1 2 8 ) \} .$ • Auto-ML: Auto-Sklearn 2.0 searches over a space of 42 hyperparameters using Bayesian optimization techniques, as mentioned in Feurer et al. (2020). • Number of Diffusion Layers in equation 7 and equation 14: $L \in \{ 3 , \ldots , 8 \}$ .
• Initial Node Feature Dimensionality (for ogbg-molhiv only): $\{ 1 0 0 , 3 0 0 , 5 0 0 \}$ • Node Embedding Type: For a graph with $F$ -dimensional initial node features, we consider using the following three types of node embedding:
– Concat: $z _ { v } = \Big [ x _ { v } ^ { ( 0 ) } \big \| \ x _ { v } ^ { ( 1 ) } \big \| \ . . . \big \| \ x _ { v } ^ { ( L ) } \Big ] \in \mathbb { R } ^ { ( L + 1 ) F }$ , where $\parallel$ denotes concatenation. – Average: $\begin{array} { r } { z _ { v } = \frac { 1 } { L + 1 } \sum _ { l = 0 } ^ { L } x _ { v } ^ { ( l ) } \in \mathbb { R } ^ { F } } \end{array}$ . – Final: $z _ { v } = x _ { v } ^ { ( L ) } \in \mathbb { R } ^ { F }$ .
# A.6 TUD BENCHMARK — COMPLETE RESULTS
Here, we report the comprehensive set of classification results of our proposed method, WEGL, for each of the node embedding types mentioned in Section A.5, using five different classifiers: Linear SVM, Kernel-SVM (SVM-RBF), Gradient Boosted Decision Trees (GBDT), Multi-Layer Perceptron (MLP), and Random Forest (RF). The results are shown in Table 3.
<table><tr><td rowspan=1 colspan=3>7.16.815.33 5.55 5.24,1</td><td rowspan=1 colspan=3>1'78'2917 1597659</td><td rowspan=1 colspan=3>914846778414.95</td><td rowspan=10 colspan=4>9.45198'0干 0.09533 6.6779 07858干07869干6.18111441845238.14935555535729 7090'2干 1'19£'9 干9'19</td><td rowspan=25 colspan=2>L'1F8'9L 1'1干9'9,333581 8.1557867951155559555.557.451.946.755556.9F189S.157.354,/F9.49 L'L干S'L95953.955 3.53330555.118'0F0'76 0'£+8.505 4'1-8'81'[干8'6L5.558.01 3.454.11 5£9F6.451.1441.155.15</td></tr><tr><td rowspan=1 colspan=3>7.16.815.33 5.55 5.24,1</td><td rowspan=2 colspan=3>1'78'2917 15976599L干0'48 583038 648</td><td rowspan=3 colspan=3>914846778499干ε687'9 干8'280'01 7'28633595L6S187651</td></tr><tr><td rowspan=1 colspan=3>569984/08 51614</td></tr><tr><td rowspan=1 colspan=3>士士土</td><td rowspan=1 colspan=3>士土土</td></tr><tr><td rowspan=1 colspan=3>11441247517:11</td><td rowspan=1 colspan=3>440.94 4444</td><td rowspan=1 colspan=3>633595L6S1</td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2>土土</td><td rowspan=1 colspan=3>士士土</td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=1 colspan=1>3.030.05</td><td rowspan=1 colspan=2>32:3623 133</td><td rowspan=1 colspan=3>7:33405F 8:05</td><td rowspan=1 colspan=3>£'9干009555 585</td></tr><tr><td rowspan=1 colspan=3>584960</td><td rowspan=2 colspan=3>32355578879</td><td rowspan=2 colspan=3>0'9 干 7'5969干799</td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2>土土</td></tr><tr><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=2>99 779</td><td rowspan=1 colspan=3>56488</td><td rowspan=1 colspan=3>646262</td><td rowspan=1 colspan=2>9 709</td></tr><tr><td rowspan=1 colspan=3>25</td><td rowspan=3 colspan=3></td><td rowspan=3 colspan=3>1</td><td rowspan=3 colspan=4>9.53511</td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=3>1926</td><td rowspan=2 colspan=3>61干8'88</td><td rowspan=1 colspan=1></td><td rowspan=3 colspan=3></td><td rowspan=4 colspan=1>8'0F0'765</td><td rowspan=6 colspan=1>0'£+8.504'1-8'81</td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>61干8'88</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>26</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>,</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>,</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>土</td><td rowspan=2 colspan=3></td><td rowspan=1 colspan=1></td><td rowspan=2 colspan=1>'[干8'6L</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=2>3463</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=2>38</td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2>土土</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>43</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>395115</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>313111</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=2>5020</td><td rowspan=1 colspan=1>5</td><td rowspan=2 colspan=3></td></tr><tr><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=1>土</td><td rowspan=1 colspan=2>土土</td><td rowspan=1 colspan=1>土</td></tr><tr><td rowspan=1 colspan=3>1 </td><td rowspan=1 colspan=3>17415</td><td rowspan=1 colspan=3>744144</td><td rowspan=1 colspan=4>12575</td></tr><tr><td rowspan=1 colspan=1>Ceoer</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>[u</td><td rowspan=1 colspan=1>Coocer</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>[rng</td><td rowspan=1 colspan=1>Cooeea</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>[eu</td><td rowspan=1 colspan=1>Coeee</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>Ceoeea</td><td rowspan=1 colspan=1> </td></tr><tr><td rowspan=1 colspan=3> JIITrr - iit</td><td rowspan=1 colspan=3>SUY - IKH</td><td rowspan=1 colspan=3>GERI</td><td rowspan=1 colspan=4>JTN</td><td rowspan=1 colspan=2>F</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359# Fast Extra Gradient Methods for Smooth Structured Nonconvex-Nonconcave Minimax Problems
Sucheol Lee Department of Mathematical Sciences KAIST Daejeon, Republic of Korea csfh1379@kaist.ac.kr
Donghwan Kim Department of Mathematical Sciences KAIST Daejeon, Republic of Korea donghwankim@kaist.ac.kr
# Abstract
Modern minimax problems, such as generative adversarial network and adversarial training, are often under a nonconvex-nonconcave setting, and developing an efficient method for such setting is of interest. Recently, two variants of the extragradient (EG) method are studied in that direction. First, a two-time-scale variant of the EG, named $\mathrm { E G + }$ , was proposed under a smooth structured nonconvexnonconcave setting, with a slow $\mathcal { O } ( \bar { 1 } / k )$ rate on the squared gradient norm, where $k$ denotes the number of iterations. Second, another variant of EG with an anchoring technique, named extra anchored gradient (EAG), was studied under a smooth convex-concave setting, yielding a fast $\mathcal { O } ( 1 / k ^ { 2 } )$ rate on the squared gradient norm. Built upon $\mathrm { E G + }$ and EAG, this paper proposes a two-time-scale EG with anchoring, named fast extragradient (FEG), that has a fast $\mathcal { O } ( 1 / k ^ { 2 } )$ rate on the squared gradient norm for smooth structured nonconvex-nonconcave problems; the corresponding saddle-gradient operator satisfies the negative comonotonicity condition. This paper further develops its backtracking line-search version, named FEG-A, for the case where the problem parameters are not available. The stochastic analysis of FEG is also provided.
# 1 Introduction
Recently, nonconvex-nonconcave minimax problems have received an increased attention in the optimization community and the machine learning community due to their applications to generative adversarial network [10] and adversarial training [27]. In this paper, we consider a smooth structured nonconvex-nonconcave minimax problem:
$$\operatorname* { m i n } _ { \pmb { x } \in \mathbb { R } ^ { d _ { \boldsymbol { x } } } } \operatorname* { m a x } _ { \pmb { y } \in \mathbb { R } ^ { d _ { \boldsymbol { y } } } } f ( \pmb { x } , \pmb { y } ) ,$$
where $f : \mathbb { R } ^ { d _ { x } } \times \mathbb { R } ^ { d _ { y } } \mathbb { R }$ is smooth and is possibly nonconvex in $_ { \textbf { \em x } }$ for fixed $\textbf { { y } }$ , and possibly nonconcave in $\textbf { { y } }$ for fixed $_ { \textbf { \em x } }$ ; the saddle-gradient operator $\pmb { F } : = ( \nabla _ { x } f , - \nabla _ { y } f )$ satisfies the negative comonotonicity [1]. We construct an efficient (first-order) method, using a saddle gradient operator $\pmb { F }$ for finding a first-order stationary point of the problem (1).
So far little is known under the nonconvex-nonconcave setting, compared to the convex-concave setting. Recent works [4, 7, 22, 24, 26, 42, 44] studied extragradient-type methods [19, 39] for minimax problems under various structured nonconvex-nonconcave settings. In other words, they consider various non-monotone conditions on $\pmb { F }$ , such as the Minty variational inequality (MVI) condition [4], the weak MVI condition [7], and the negative comonotonicity [1].1 Among them, this paper focuses on the negative comonotonicity condition for a Lipschitz continuous $\pmb { F }$ . To the best of our knowledge, the following two-time-scale variant of the extragradient method, named $\mathrm { E G + }$ :
$$\begin{array} { c } { { z _ { k + 1 / 2 } = z _ { k } - \frac { \alpha _ { k } } { \beta } { \cal F } z _ { k } , } } \\ { { z _ { k + 1 } = z _ { k } - \alpha _ { k } { \cal F } z _ { k + 1 / 2 } , } } \end{array}$$
is the only known (explicit)2 method, using $\pmb { F }$ , that converges under the considered setting3 [7], where $z _ { k } : = ( x _ { k } , y _ { k } )$ . The $\mathrm { E G + }$ , however, has a slow $\mathcal { O } ( 1 / k )$ rate on the squared gradient norm. Note that a similar two-time-scale approach has been found to stabilize the stochastic extragradient method with unbounded noise variance [14].
Meanwhile, under the smooth convex-concave setting, recent works [6, 17, 21, 40, 43] suggest that Halpern-type [12] (or anchoring) methods, performing a convex combination of an initial point $z _ { \mathrm { 0 } }$ and the last updated point $z _ { k }$ at each iteration, has a fast $\mathcal { O } ( 1 / k ^ { 2 } )$ rate in terms of the squared gradient norm. In particular, [43] developed the following anchoring variant of the extragradient method, named extra anchored gradient (EAG):
$$\begin{array} { r l } & { z _ { k + 1 / 2 } = z _ { k } + \beta _ { k } ( z _ { 0 } - z _ { k } ) - \alpha _ { k } F z _ { k } , } \\ & { \quad z _ { k + 1 } = z _ { k } + \beta _ { k } ( z _ { 0 } - z _ { k } ) - \alpha _ { k } F z _ { k + 1 / 2 } . } \end{array}$$
This is the first (explicit) method with a fast $\mathcal { O } ( 1 / k ^ { 2 } )$ rate on the squared gradient norm, when $\pmb { F }$ satisfies both the Lipschitz continuity and the monotonicity. [43] also showed that such $\mathcal { O } ( 1 / k ^ { 2 } )$ rate is optimal for first-order methods using a Lipschitz continuous and monotone $\pmb { F }$ .
Built upon both $\mathrm { E G + }$ and EAG, this paper studies the following class of two-time-scale anchored extragradient methods, named fast extragradient (FEG):
$$\begin{array} { r l } & { z _ { k + 1 / 2 } = z _ { k } + \beta _ { k } ( z _ { 0 } - z _ { k } ) - ( 1 - \beta _ { k } ) ( \alpha _ { k } + 2 \rho _ { k } ) { \cal F } z _ { k } , } \\ & { ~ z _ { k + 1 } = z _ { k } + \beta _ { k } ( z _ { 0 } - z _ { k } ) - \alpha _ { k } { \cal F } z _ { k + 1 / 2 } - ( 1 - \beta _ { k } ) 2 \rho _ { k } { \cal F } z _ { k } . } \end{array}$$
(Class FEG)
Note that (Class FEG) reuses the $\pmb { F } z _ { k }$ term in the $z _ { k + 1 }$ update, unlike the standard extragradienttype methods, which we found essential for handling the negative comonotonicity condition. We leave further understanding the use of $\pmb { F } z _ { k }$ and the formulation of (Class FEG) as future work. The proposed FEG method (with appropriately chosen step coefficients $\alpha _ { k }$ , $\beta _ { k }$ and $\rho _ { k }$ discussed later) has an $\mathcal { O } ( 1 / k ^ { 2 } )$ rate on the squared gradient norm, under the Lipschitz continuity and the negative comonotonicity conditions on $\pmb { F }$ . To the best of our knowledge, this is the first accelerated method under the nonconvex-nonconcave setting. The FEG also has value under the smooth convex-concave setting. First, when $\pmb { F }$ is Lipschitz continuous and monotone, the rate bound of FEG is about 27/4 times smaller than that of EAG. Also note that the rate bound of FEG is only about four times larger than the $\mathcal { O } ( 1 / k ^ { 2 } )$ lower complexity bound of first-order methods under such setting [43], further closing the gap between the lower and upper complexity bounds. Second, when $\pmb { F }$ is cocoercive, FEG has a rate faster than that of a version of Halpern iteration [12] in [6].
We also develop an adaptive variant of FEG, named FEG-A, which updates its parameters, $\alpha _ { k }$ and $\rho _ { k }$ in (Class FEG), adaptively using a backtracking line-search [2, 25, 31]. FEG requires the knowledge of the two problem parameters for the Lipschitz continuity and the comonotonicity of $\pmb { F }$ . However, those global parameters can be conservative, and in practice, they are even usually unknown. For such cases, the FEG-A adaptively and locally estimates the problem parameters, while preserving the fast rate $\mathcal { O } ( 1 / k ^ { 2 } )$ on the squared gradient norm for smooth structured nonconvex-nonconcave minimax problems.
Lastly, we study a stochastic version of FEG, named S-FEG, which uses an unbiased stochastic estimate of $\pmb { F } z$ , i.e., $\tilde { F } z = F z + \xi$ , instead of $\pmb { F } z$ in FEG, where $\xi$ denotes a stochastic noise. For a Lipschitz continuous and monotone $\pmb { F }$ , we provide a convergence analysis in terms of the expected squared gradient norm. In specific, we show that the S-FEG is stable with a rate $\mathcal { O } ( 1 / k ^ { 2 } ) \overset { \cdot } { + } \mathcal { O } ( \epsilon )$ , when the noise variance decreases in the order of $\mathcal { O } ( \epsilon / k )$ , while being unstable otherwise due to error accumulation. This is similar to the convergence behavior of a stochastic version of Nesterov’s fast gradient method [35, 36], observed in [5], for smooth convex minimization.
Our main contributions are summarized as follows.
• We propose the FEG method that has an accelerated convergence rate $\mathcal { O } ( 1 / k ^ { 2 } )$ on the squared gradient norm for smooth structured nonconvex-nonconcave minimax problems. We present that the FEG method has a rate faster than those of the EAG and the Halpern iteration for smooth convex-concave problems. We construct a backtracking line-search version of FEG, named FEG-A, for the case where the Lipschitz constant and comonotonicity parameters of $\pmb { F }$ are unavailable. • We analyze a stochastic version of FEG, named S-FEG, for smooth convex-concave problems.
# 2 Related work
# 2.1 Methods for convex-concave minimax problems
The extragradient method [19] is one of the widely used methods for solving smooth convex-concave minimax problems (see, e.g., [4, 7, 22, 24, 26, 42, 44] for its extensions and applications). In terms of the duality gap, $\begin{array} { r } { \operatorname* { m a x } _ { { \pmb y } ^ { \prime } \in \mathcal { V } } f ( { \pmb x } , { \pmb y } ^ { \prime } ) - \operatorname* { m i n } _ { { \pmb x } ^ { \prime } \in \mathcal { X } } f ( { \pmb x } ^ { \prime } , { \pmb y } ) } \end{array}$ , where $\mathcal { X }$ and $\mathcal { V }$ are compact4 domains, the ergodic iterate of the extragradient-type methods [32, 37] have an $\mathcal { O } ( 1 / k )$ rate. Such $\mathcal { O } ( 1 / k )$ rate on the duality gap is order-optimal for the first-order methods [34, 38], leaving no room for√ improvement. On the other hand, the last iterate of the extragradient method has a slower $\mathcal { O } ( 1 / \sqrt { k } )$ rate on the duality gap, under an additional assumption that $\pmb { F }$ has a Lipschitz derivative [9]. In terms of the squared gradient norm, $\| \ b { F z } \| ^ { 2 }$ , the best iterate of the extragradient-type methods [19, 39] have an $\mathcal { O } ( 1 / k )$ rate [40, 41, 43]. The last iterate of the extragradient method also has a rate $\mathcal { O } ( 1 / k )$ , when $\pmb { F }$ is further assumed to have a Lipschitz derivative [9]. Unlike the duality gap, the $\mathcal { O } ( 1 / k )$ rate on the squared gradient norm is not optimal [43]. From now on throughout this paper, we mainly study and compare the convergence rates on the squared gradient norm, which still has room for improvement in convex-concave problems, and has meaning for nonconvex-nonconcave minimax problems, unlike the duality gap.
Recently, [6, 17, 21, 40, 43] found that Halpern-type [12] (or anchoring) methods yield a fast $\mathcal { O } ( 1 / k ^ { 2 } )$ rate in terms of the squared gradient norm for minimax problems. [17, 21] showed that the (implicit) Halpern iteration [12] with appropriately chosen step coefficients has an $\mathcal { O } ( 1 / k ^ { 2 } )$ rate on the squared norm of a monotone $\pmb { F }$ . Then, for a cocoercive $\pmb { F }$ , an (explicit) version of the Halpern iteration was studied in [6, 17] that has the same fast rate. In addition, [6] constructed a double-loop version of the Halpern iteration for a Lipschitz continuous and monotone $\pmb { F }$ , which has a rate $\tilde { \mathcal { O } } ( 1 / k ^ { 2 } )$ on the squared gradient norm, slower than the rate $\mathcal { O } ( 1 / k ^ { 2 } )$ . While this is promising compared to the $\bar { \mathcal { O } ( 1 / k ) }$ rate of the extragradient methods on the squared gradient norm [40, 41, 43], the computational complexity due to its double-loop nature and a relatively slow rate remained a problem. Very recently, [43] proposed the extra anchored gradient (EAG) method, which is the first (explicit) method with a fast $\bar { \mathcal { O } } ( \bar { 1 } / k ^ { 2 } )$ rate for smooth convex-concave minimax problems, i.e., for Lipschitz continuous and monotone operators. In addition, [43] proved that the EAG is order-optimal by showing that the lower complexity bound of first-order methods is $\Omega ( 1 / k ^ { 2 } )$ .
$$\begin{array} { c c c c c } { { \mathrm { C o c o e r c i v e } } } & { { \subseteq } } & { { \bf M o n o t o n e } } & { { \subseteq } } & { { \mathrm { N e g a t i v e ~ c o m o n o t o n e } } } \\ { { } } & { { } } & { { | \bigcap } } & { { } } & { { | \bigcap } } \\ { { } } & { { } } & { { \mathrm { M V I } } } & { { \subseteq } } & { { \mathrm { W e a k ~ M V I } } } \end{array}$$
Figure 1: Relations between the conditions on $\pmb { F }$ .
# 2.2 Methods for nonconvex-nonconcave minimax problems
Some recent literature considered relaxing the monotonicity condition of the saddle gradient operator to tackle modern nonconvex-nonconcave minimax problems. For example, the Minty variational inequality (MVI) condition, i.e., there exists $z _ { \ast } \in Z _ { \ast } ( F )$ satisfying $\langle F z , z - z _ { * } \rangle \ge 0$ for all $z \in \mathbb { R } ^ { d }$ where $Z _ { * } ( F ) : = \{ z _ { * } \in \mathbb { R } ^ { d } : F z _ { * } = \mathbf { 0 } \}$ , is studied in [4, 23, 22, 24]. This condition is also studied under the name, the coherence, in [26, 42, 44]. Moreover, [7] considered a weaker condition, named the weak MVI condition, i.e., for some $\rho < 0$ , there exists $z _ { \ast } \in Z _ { \ast } ( F )$ satisfying $\langle F z , z - z _ { * } \rangle \geq \rho \Vert F z \Vert ^ { 2 }$ for all $z \in \mathbb { R } ^ { d }$ . The weak MVI condition is implied by the negative comonotonicity [1] or, equivalently, the (positive) cohypomonotonicity [3]. The comonotonicity will be further discussed in the upcoming section.
For $L$ -Lipschitz continuous $\pmb { F }$ , [4, 42] showed that the extragradient-type methods have an $\mathcal { O } ( 1 / k )$ rate on the squared gradient norm under the MVI condition, and [7] developed the $( \mathrm { E G + } )$ method under the weak MVI condition (and thus under the negative comonotonicty), which also has an $\mathcal { O } ( 1 / k )$ rate on the squared gradient norm. To the best of our knowledge, there is no known accelerated method for the nonconvex-nonconcave setting; our proposed FEG method is the first method to have a fast $\mathcal { O } ( 1 / k ^ { 2 } )$ rate under the nonconvex-nonconcave setting. The convergence rates of the existing methods and the FEG on the squared gradient norm are summarized in Table 1.
Table 1: Comparison of the convergence rates of the existing extragradient-type methods and the FEG, with respect to the squared gradient norm, for smooth structured minimax problems, under various assumptions on the Lipschitz continuous saddle gradient operator $\pmb { F }$ .
<table><tr><td rowspan="2" colspan="2">Method</td><td colspan="2">Convex-concave</td><td colspan="3">Nonconvex-nonconcave</td></tr><tr><td></td><td>Cocoercive Monotone</td><td>Negative comonotone</td><td>MVI</td><td>Weak MVI</td></tr><tr><td rowspan="2">Normal</td><td>EG [4, 42]</td><td>0(1/k)</td><td>0(1/k)</td><td></td><td>0(1/k)</td><td></td></tr><tr><td>EG+[7]</td><td>0(1/k)</td><td>0(1/k)</td><td>0(1/k)</td><td>0(1/k)</td><td>0(1/k)</td></tr><tr><td rowspan="2">Accelerated</td><td>Halpern [12, 6]</td><td>0(1/k²)</td><td>(1/k²)</td><td></td><td></td><td></td></tr><tr><td>EAG [43] FEG (this paper)</td><td>0(1/k2) 0(1/k2)</td><td>0(1/k²) 0(1/k2)</td><td>0(1/k2)</td><td></td><td></td></tr></table>
# 3 Preliminaries
The followings are the two main assumptions for the saddle gradient operator $\pmb { F }$ of the smooth structured nonconvex-nonconcave problem (1). Under such assumptions, we develop efficient methods that find a first-order stationary point $z _ { \ast } \in Z _ { \ast } ( F )$ where $Z _ { * } ( \hat { F } ) : = \{ z _ { * } \in \mathbb { R } ^ { d } : \hat { F } z _ { * } = \mathbf { 0 } \}$ .
Assumption 1 ( $L$ -Lipschitz continuity). For some $L \in ( 0 , \infty )$ , $\pmb { F }$ satisfies
$$\| F z - F z ^ { \prime } \| \le L \| z - z ^ { \prime } \| , \quad \forall z , z ^ { \prime } \in \mathbb R ^ { d } .$$
Assumption 2 ( $\rho$ -Comonotonicity). For some $\textstyle \rho \in { \bigl ( } - { \frac { 1 } { 2 L } } , \infty { \bigr ) }$ , $\pmb { F }$ satisfies
$$\begin{array} { r } { \langle F z - F z ^ { \prime } , z - z ^ { \prime } \rangle \ge \rho \| F z - F z ^ { \prime } \| ^ { 2 } , \quad \forall z , z ^ { \prime } \in \mathbb { R } ^ { d } . } \end{array}$$
The $\rho$ -comonotonicity consists of three cases depending on the choice of $\rho$ ; the negative comonotonicity when $\rho < 0$ , the monotonicity when $\rho = 0$ , and the cocoercivity when $\rho > 0$ . The negative comonotonicity is weaker than the other two, and is the main focus of this paper. The following is an examplary nonconvex-nonconcave condition that is stronger than the negative comonotonicity [1, 3].
Example 1. Let $f$ be twice continuously differentiable and $\gamma$ -weakly-convex-weakly-concave. Further assume that $f$ satisfies
$$\begin{array} { r } { \nabla _ { x x } ^ { 2 } f + \nabla _ { x y } ^ { 2 } f ( \eta I - \nabla _ { y y } ^ { 2 } f ) ^ { - 1 } \nabla _ { y x } ^ { 2 } f \succeq \alpha I , } \\ { - \nabla _ { y y } ^ { 2 } f + \nabla _ { y x } ^ { 2 } f ( \eta I + \nabla _ { x x } ^ { 2 } f ) ^ { - 1 } \nabla _ { x y } ^ { 2 } f \succeq \alpha I , } \end{array}$$
for some $\alpha \geq 0$ and $\eta > \gamma ,$ , named $\alpha \geq 0$ -interaction dominant condition in [11]. Then, the saddle gradient of $f$ satisfies the $- \frac { 1 } { \eta }$ -negative comonotonicity. (See Appendix A.1.) For any $\gamma$ -weaklyconvex-weakly-concave function, the condition (2) holds with $\alpha = - \gamma < 0$ . Its extreme case is
$\begin{array} { r } { f ( x , y ) = - \frac { \gamma } { 2 } x ^ { 2 } + \frac { \gamma } { 2 } y ^ { 2 } } \end{array}$ , where there is no interaction between x and y. On the other hand, when the the second terms in the left-hand side of (2) are sufficently positive definite, a nonconvex-nonconave function satisfies the condition (2) with a nonnegative condition is satisfied when the interaction term of Hess $\alpha$ .n cific, the is domin $\alpha \geq 0$ -interaction dominantany negative curvature $\nabla _ { \substack { x y } } ^ { 2 } f$ in Hessians $\nabla _ { x x } ^ { 2 } f$ and $- \nabla _ { \boldsymbol { y } \boldsymbol { y } } ^ { 2 } f l l l \boldsymbol { l } \boldsymbol { l } \boldsymbol { l } \boldsymbol { l }$ .
We next present our proposed FEG, and illustrate that the FEG outperforms existing methods such as $\mathrm { E G + }$ , EAG, and the Halpern iteration, for each three comonoticity case, respectively.
# 4 Fast extragradient (FEG) method for Lipschitz continuous and comonotone operators
This section considers an instance of (Class FEG) with $\begin{array} { r } { \alpha _ { k } = \frac { 1 } { L } } \end{array}$ , $\begin{array} { r } { \beta _ { k } = \frac { 1 } { k + 1 } } \end{array}$ , and $\rho _ { k } = \rho$ for all $k \geq 0$ The resulting method, named FEG, is illustrated in Algorithm 1, which has an $\mathcal { O } ( 1 / k ^ { 2 } )$ fast rate with respect to the squared gradient norm, in Theorem 4.1. The proof of Theorem 4.1 is provided in Section 7.
# Algorithm 1 Fast extragradient (FEG) method
<table><tr><td>Input: z0 ∈ Rd,L ∈ (0,∞o),ρ ∈(- 2,00) for k = 0,1,... do</td></tr><tr><td>2+1/=+1(2-(1-1)(+2)F 1</td></tr><tr><td></td></tr><tr><td>1 2 2k+1= 2k+ k+1</td></tr></table>
end for
Theorem 4.1. For the $L$ -Lipschitz continuous and $\rho$ -comonotone operator $\pmb { F }$ with $\rho > - \frac { 1 } { 2 L }$ and for any $z _ { \ast } \in Z _ { \ast } ( F )$ , the sequence $\{ z _ { k } \} _ { k \ge 0 }$ generated by FEG satisfies, for all $k \geq 1$ ,
$$\| F z _ { k } \| ^ { 2 } \leq \frac { 4 \| z _ { 0 } - z _ { * } \| ^ { 2 } } { \Big ( \frac { 1 } { L } + 2 \rho \Big ) ^ { 2 } k ^ { 2 } } .$$
The following example shows that the bound (3) of the FEG is exact for $\rho = 0$ and $k = 4 l + 2$ . The bound (3) is not known to be exact in general, and we leave finding the exact bound as future work.
Example 2. Let $f : \mathbb { R } \times \mathbb { R } \to \mathbb { R }$ be $f ( x , y ) = L x y .$ . Its saddle gradient operator and solution are $\pmb { F } ( x , y ) = ( L y , - L x )$ and $z _ { * } = ( 0 , 0 )$ , respectively. For the initial point $z _ { 0 } = ( x _ { 0 } , y _ { 0 } ) =$ $( 1 , 0 )$ , the sequence $\{ z _ { k } \} _ { k \ge 0 }$ generated by FEG satisfies $\begin{array} { r } { z _ { 4 l + 2 } = \left( 0 , \frac { 1 } { 2 l + 1 } \right) } \end{array}$ for all $l \geq 0$ . Hence, $\begin{array} { r } { \| F z _ { 4 l + 2 } \| ^ { 2 } = \frac { L ^ { 2 } } { ( 2 l + 1 ) ^ { 2 } } = \frac { 4 L ^ { 2 } \| z _ { 0 } - z _ { * } \| ^ { 2 } } { ( 4 l + 2 ) ^ { 2 } } } \end{array}$ for all $l \geq 0 .$ . (See Appendix B.1.)
We next compare the rate bound (3) with existing analyses for the three cases $\begin{array} { r } { - \frac { 1 } { 2 L } < \rho < 0 , \rho = 0 } \end{array}$ and $\rho > 0$ .
# 4.1 Comparison to $\mathbf { E G + }$ under the negative comonotonicity $( \rho < 0 )$ )
Under the negative comonotonicity with $\begin{array} { r } { - \frac { 1 } { 8 L } < \rho < 0 } \end{array}$ , the $( \mathrm { E G + } )$ method with $\begin{array} { r } { \alpha _ { k } = \frac { 1 } { 2 L } } \end{array}$ and $\begin{array} { r } { \beta = \frac { 1 } { 2 } } \end{array}$ rate on the squared gradient norm. To the best of our knowledge, this is the best known rate, and the FEG has a faster $\mathcal { O } ( 1 \bar { \vert } k ^ { 2 } )$ rate with a wider region of convergence $\begin{array} { r } { - \frac { 1 } { 2 L } < \rho < 0 } \end{array}$ .
# 4.2 Comparison to EAG under the monotonicity $( \rho = 0$ )
For an $L$ -Lipschitz continuous and monotone operator $\pmb { F }$ , [43] proposed two EAG methods, named EAG-C and EAG-V, with same βk = 1k+2 but with different choices of $\alpha _ { k }$ . EAG-C sets $\alpha _ { k }$ to be a constant $\frac { 1 } { 8 L }$ for all $k \geq 0$ in (EAG), and has a large constant 260 in its convergence rate, $\begin{array} { r } { \| \pmb { F } \pmb { z } _ { k } \| ^ { 2 } \le \frac { 2 6 0 L ^ { 2 } \| \pmb { z } _ { 0 } - \pmb { z } _ { * } \| ^ { 2 } } { ( k + 1 ) ^ { 2 } } } \end{array}$ 260L2kz0−z∗k22 for all k ≥ 0. On the other hand, while EAG-V requires a complicated recursive update for {αk}, αk+1 = αk1−α2L2 $\begin{array} { r } { \alpha _ { k + 1 } = \frac { \alpha _ { k } } { 1 - \alpha _ { k } ^ { 2 } L ^ { 2 } } \big ( 1 - \frac { ( k + 2 ) ^ { 2 } } { ( k + 1 ) ( k + 3 ) } \alpha _ { k } ^ { 2 } L ^ { 2 } \big ) } \end{array}$ for all $k \geq 0$ , with $\begin{array} { r } { \alpha _ { 0 } = \frac { 0 . 6 1 8 } { L } } \end{array}$ , its rate has a smaller constant 27.
 Figure 2: Numerical result with $\begin{array} { r } { f ( x , y ) = - \frac { 1 } { 6 } x ^ { 2 } + \frac { 2 \sqrt { 2 } } { 3 } x y + \frac { 1 } { 6 } y ^ { 2 } } \end{array}$ . The dashed line represents the theoretical bound (3) of FEG.
The FEG takes a constant $\begin{array} { r } { \alpha _ { k } \ = \ \frac { 1 } { L } } \end{array}$ , unlike EAG-V, but has an even smaller constant 4 in its convergence rate $\begin{array} { r } { \| \pmb { F } \pmb { z } _ { k } \| ^ { 2 } \le \frac { 4 L ^ { 2 } \| \pmb { z } _ { 0 } - \pmb { z } _ { * } \| ^ { 2 } } { k ^ { 2 } } } \end{array}$ 4L2kz0−z∗k2k2 for ρ = 0. Therefore, the FEG with ρ = 0 has about $2 6 0 / 4$ -times and $2 7 / 4$ -times faster convergence rate compared to those of EAG-C and EAG-V, respectively. Furthermore, the rate bound of FEG with $\rho = 0$ is only about 4-times larger than the lower complexity bound of first-order methods under the considered setting [43], reducing the gap between the lower and upper complexity bounds from 27 to 4.
# 4.3 Comparison to the Halpern iteration under the cocoercivity $( \rho > 0 )$ )
For a $\rho$ -cocoercive operator $\pmb { F }$ , an (explicit) version of Halpern iteration [12], studied in [6], has a fast rate, $\begin{array} { r } { \| \boldsymbol { F } \boldsymbol { z } _ { k } \| ^ { 2 } \le \frac { \| \boldsymbol { z } _ { 0 } - \boldsymbol { z } _ { * } \| ^ { 2 } } { \rho ^ { 2 } k ^ { 2 } } } \end{array}$ kz0−z∗k2ρ2k2 . Note that while the ρ-cocoercivity implies the 1ρ -Lipschitz continuity, there is case where the $\rho$ -cocoercive (and thus Lipschitz continuous) operator has a Lipschitz constant $L$ smaller than $\frac { 1 } { \rho }$ . Since $\begin{array} { r } { L \le \frac { 1 } { \rho } } \end{array}$ , the FEG has a rate $\begin{array} { r } { \| \boldsymbol { F } \boldsymbol { z } _ { k } \| ^ { 2 } \le \frac { 4 \| \boldsymbol { z } _ { 0 } - \boldsymbol { z } _ { * } \| ^ { 2 } } { ( 1 / L + 2 \rho ) ^ { 2 } k ^ { 2 } } = \frac { 4 \| \boldsymbol { z } _ { 0 } - \boldsymbol { z } _ { * } \| ^ { 2 } } { 9 \rho ^ { 2 } k ^ { 2 } } } \end{array}$ that is faster than that of Halpern iteration. However, if we take into account that the FEG requires computing the saddle gradient twice per iteration, unlike Halpern iteration studied in [6], the FEG method has a slower rate in terms of the number of gradient computations. If we narrow down to the case $\begin{array} { r } { L < \frac { 1 } { 2 \rho } } \end{array}$ , the FEG has a faster rate, $\begin{array} { r } { \| \ b { F } \ b { z } _ { k } \| ^ { 2 } \leq \frac { 4 \| \ b { z } _ { 0 } - \ b { z } _ { * } \| ^ { 2 } } { ( 1 / L + 2 \rho ) ^ { 2 } k ^ { 2 } } < \frac { \| \ b { z } _ { 0 } - \ b { z } _ { * } \| ^ { 2 } } { 4 \rho ^ { 2 } k ^ { 2 } } } \end{array}$ . For such case, the FEG has a rate faster than that of the Halpern iteration, even in terms of the number of gradient computations.
# 4.4 Toy example
rformed a toy exp, which has an iment on a simple quadratic-Lipschitz continuous and nction, -comon $\begin{array} { r } { f ( x , y ) = \frac { \rho L ^ { 2 } } { 2 } x ^ { 2 } + L \sqrt { 1 - \rho ^ { 2 } L ^ { 2 } } x y - } \end{array}$ ${ \frac { \rho L ^ { 2 } } { 2 } } y ^ { 2 }$ $L$ $\rho$ $\begin{array} { r } { \rho = - \frac { 1 } { 3 L } } \end{array}$ and $L = 1$ , Figure 2 illustrates that the FEG converges with an accelerated rate whereas $\mathrm { E G + }$ , EAG-C, EAG-V, and the (explicit) version of Halpern iteration [6] diverge. This example presents that the existing guarantees on convergence and acceleration of the aforementioned methods under the convex-concave setting do not generalize to the nonconvex-nonconcave setting.
# 5 FEG with backtracking line-search
The FEG requires the knowledge of the two global parameters $L$ and $\rho$ for Lipschitz continuity and comonotonicity, respectively. Those global parameters are often difficult to compute in practice and can be locally conservative. To handle these two disadvantages, we employ the backtracking line-search technique [2, 25, 31] in FEG. We adaptively decrease the two step size parameters, $\tau$ and $\eta$ , to satisfy the both conditions, the local $\frac { 1 } { \tau _ { - } }$ -Lipschitz continuity and the $\frac { \eta - \tau } { 2 }$ -comonotonicity.5 A pseudocode of the resulting method, named FEG-A, is illustrated in Algorithm 2. For a detailed description of the FEG-A, see Algorithm 4 in Appendix C.1.
# Algorithm 2 Fast extragradient method with adaptive step size (FEG-A)
Input: $\boldsymbol { z } _ { 0 } \in \mathbb { R } ^ { d }$ , $\tau _ { - 1 } \in ( \operatorname* { m a x } \{ 0 , - 2 \rho \} , \infty )$ , $\eta _ { 0 } \in ( 0 , \infty )$ , $\delta \in ( 0 , 1 )$ Find the smallest nonnegative integer $i _ { 0 }$ such that $\hat { z } = { z _ { 0 } - \tau _ { - 1 } ( 1 - \delta ) ^ { i _ { 0 } } F z _ { 0 } }$ satisfies $\Vert \pmb { F } \hat { z } -$ $\begin{array} { r } { \pmb { F } z _ { 0 } \| \leq \frac { 1 } { \tau _ { - 1 } ( 1 - \delta ) ^ { i _ { 0 } } } \| \hat { \pmb { z } } - z _ { 0 } \| } \end{array}$ . $\tau _ { 0 } = \tau _ { - 1 } ( 1 - \delta ) ^ { i _ { 0 } }$ , $z _ { \mathrm { 1 } } = z _ { \mathrm { 0 } } - \tau _ { 0 } F z _ { \mathrm { 0 } }$ . for $k = 1 , 2 , \ldots$ do $i _ { k } = j _ { k } = 0$ . Increase each $i _ { k }$ and $j _ { k }$ one by one until
$$\begin{array} { r l } & { \hat { z } _ { k + 1 / 2 } = z _ { k } + \cfrac { 1 } { k + 1 } ( z _ { 0 } - z _ { k } ) - \bigg ( 1 - \cfrac { 1 } { k + 1 } \bigg ) \eta _ { k - 1 } ( 1 - \delta ) ^ { j _ { k } } F z _ { k } \qquad \mathrm { a n d } } \\ & { \hat { z } _ { k + 1 } = z _ { k } + \cfrac { 1 } { k + 1 } ( z _ { 0 } - z _ { k } ) - \tau _ { k - 1 } ( 1 - \delta ) ^ { i _ { k } } F z _ { k + 1 / 2 } } \\ & { \qquad - \bigg ( 1 - \cfrac { 1 } { k + 1 } \bigg ) ( \eta _ { k - 1 } ( 1 - \delta ) ^ { j _ { k } } - \tau _ { k - 1 } ( 1 - \delta ) ^ { i _ { k } } ) F z _ { k } } \end{array}$$
satisfy both conditions,
$$\begin{array} { r l } & { \qquad \| F \hat { z } _ { k + 1 } - F \hat { z } _ { k + 1 / 2 } \| \le \frac { 1 } { \tau _ { k - 1 } ( 1 - \delta ) ^ { i _ { k } } } \| \hat { z } _ { k + 1 } - \hat { z } _ { k + 1 / 2 } \| \qquad \mathrm { a n d } } \\ & { \qquad \langle F \hat { z } _ { k + 1 } - F z _ { k } , \hat { z } _ { k + 1 } - z _ { k } \rangle \ge \frac { \eta _ { k - 1 } ( 1 - \delta ) ^ { j _ { k } } - \tau _ { k - 1 } ( 1 - \delta ) ^ { i _ { k } } } { 2 } \| F \hat { z } _ { k + 1 } - F z _ { k } \| ^ { 2 } . } \\ & { \qquad \frac { \tilde { \mathbf { \phi } } _ { k } } { \mathrm { \Delta } r } = \tau _ { k - 1 } ( 1 - \delta ) ^ { i _ { k } } , \eta _ { k } = \eta _ { k - 1 } ( 1 - \delta ) ^ { j _ { k } } , z _ { k + 1 } = \hat { z } _ { k + 1 } . } \end{array}$$
The following lemma shows that each of the nonincreasing sequences $\{ \tau _ { k } \} _ { k \ge 0 }$ and $\{ \eta _ { k } \} _ { k \ge 0 }$ of the FEG-A has a positive lower bound, and thus FEG-A is well-defined6, under the condition $\rho > - \frac { \tau _ { k } } { 2 }$ . This condition for ρ can be weaker than the condition ρ > − 12L of FEG, since the local Lipschitz parameter $\scriptstyle { \frac { 1 } { \tau _ { k } } }$ can be smaller than $L$ . This is another benefit of using a backtracking line-search in FEG, over the standard FEG.
Lemma 5.1. For the $L$ -Lipschitz and $\rho$ -comonotone operator $\pmb { F }$ and a given constant $\delta \in ( 0 , 1 )$ , the step size $\tau _ { k }$ of FEG-A is lower bounded by a positive value $\begin{array} { r } { \underline { { \tau } } : = \operatorname* { m i n } \left\{ \tau _ { - 1 } , { \frac { 1 - \delta } { L } } \right\} } \end{array}$ for all $k \geq 0$ , and $\begin{array} { r } { { \mathfrak { j } } f \rho > - { \frac { \tau _ { k } } { 2 } } } \end{array}$ , the step size $\eta _ { k }$ is lower bounded by a positive value $\operatorname* { m i n } \left\{ \eta _ { 0 } , ( 1 - \delta ) \bigl ( \tau _ { k } + 2 \rho \bigr ) \right\}$ for all $k \geq 1$ .
The FEG-A method also has the following $\mathcal { O } ( 1 / k ^ { 2 } )$ rate with respect to the squared gradient norm in Theorem 5.1, when $\rho > - \frac { \tau _ { k } } { 2 }$ . The proof is provided in Section 7 and Appendix C.3.
Theorem 5.1. For the $L$ -Lipschitz and $\rho$ -comonotone operator $\pmb { F }$ and for any $z _ { \ast } \in Z _ { \ast } ( F )$ , the sequence $\{ z _ { k } \} _ { k \ge 0 }$ generated by FEG-A satisfies
$$\| F z _ { k } \| ^ { 2 } \leq \frac { 4 \| z _ { 0 } - z _ { * } \| ^ { 2 } } { ( ( k - 1 ) \eta _ { k } + \tau _ { k } + 2 \rho ) ^ { 2 } }$$
for all $k \geq 1$ , if $\rho > - \frac { \tau _ { k } } { 2 }$
This rate bound of FEG-A reduces to that of FEG in Theorem 4.1, when we choose $\begin{array} { r } { \tau _ { - 1 } = \frac { 1 } { L } } \end{array}$ and $\begin{array} { r } { \eta _ { 0 } = \frac { 1 } { L } + 2 \rho } \end{array}$ for FEG-A.
# 6 FEG under stochastic setting
When exactly computing $\pmb { F } z$ is expensive in practice, one usually instead consider its stochastic estimate for computational efficiency (see, e.g., [13, 16, 26, 33, 40, 42, 44]). This section also considers using a stochastic oracle in FEG for smooth convex-concave problems. In specific, this section assumes that we only have access to a noisy saddle gradient oracle, $\tilde { F } z _ { k / 2 } = F \bar { z } _ { k / 2 } + \xi _ { k / 2 }$ , where $\{ \xi _ { k / 2 } \} _ { k \geq 0 }$ are independent random variables satisfying $\mathbb { E } [ \xi _ { k / 2 } ] = 0$ and $\mathbb { E } [ \| \xi _ { k / 2 } \| ^ { 2 } ] = \sigma _ { k / 2 } ^ { 2 }$ for all $k \geq 0$ . Under this setting, we study a stochastic first-order method, named stochastic fast extragradient (S-FEG) method, illustrated in Algorithm 3.
# Algorithm 3 Stochastic fast extragradient (S-FEG) method
Input: $\boldsymbol { z } _ { 0 } \in \mathbb { R } ^ { d }$ , $L \in ( 0 , \infty )$ . for $k = 0 , 1 , \ldots$ do
$$\begin{array} { l } { { z _ { k + 1 / 2 } = z _ { k } + \displaystyle \frac { 1 } { k + 1 } ( z _ { 0 } - z _ { k } ) - \left( 1 - \displaystyle \frac { 1 } { k + 1 } \right) \displaystyle \frac { 1 } { L } \tilde { F } z _ { k } } } \\ { { z _ { k + 1 } = z _ { k } + \displaystyle \frac { 1 } { k + 1 } ( z _ { 0 } - z _ { k } ) - \displaystyle \frac { 1 } { L } \tilde { F } z _ { k + 1 / 2 } } } \end{array}$$
# end for
The following theorem provides an upper bound of the expected squared gradient norm for the S-FEG. (See Appendix D.3 for the proof.)
Theorem 6.1. Let $\tilde { F } z _ { k / 2 } = F z _ { k / 2 } + \xi _ { k / 2 }$ , where $\{ \xi _ { k / 2 } \} _ { k \geq 0 }$ are independent random variables satisfying $\mathbb { E } [ \xi _ { k / 2 } ] = 0$ and $\mathbb { E } [ \| \xi _ { k / 2 } \| ^ { 2 } ] = \sigma _ { k / 2 } ^ { 2 }$ for all $k \geq 0$ . Then, for the $L$ -Lipschitz continuous and monotone operator $F$ and for any $z _ { * } \in Z _ { * } ( F )$ , the sequence $\{ z _ { k } \} _ { k \ge 0 }$ generated by S-FEG satisfies
$$\mathbb { E } [ \| F z _ { k } \| ^ { 2 } ] \le \frac { 4 L ^ { 2 } \| z _ { 0 } - z _ { * } \| ^ { 2 } } { k ^ { 2 } } + \frac { 6 } { k ^ { 2 } } \left[ \sigma _ { 0 } ^ { 2 } + \sum _ { l = 1 } ^ { k - 1 } ( l ^ { 2 } \sigma _ { l } ^ { 2 } + ( l + 1 ) ^ { 2 } \sigma _ { l + 1 / 2 } ^ { 2 } ) \right]$$
for all $k \geq 1$ . Furthermore, if $\sigma _ { 0 } ^ { 2 } \le \frac { \epsilon } { 6 }$ , $\sigma _ { k } ^ { 2 } \le \frac { \epsilon } { 6 k }$ and $\textstyle \sigma _ { k + 1 / 2 } ^ { 2 } \leq \frac { \epsilon } { 6 ( k + 1 ) }$ for all $k \geq 1$ , then the bound (4) reduces to
$$\mathbb { E } [ \| F z _ { k } \| ^ { 2 } ] \le \frac { 4 L ^ { 2 } \| z _ { 0 } - z _ { * } \| ^ { 2 } } { k ^ { 2 } } + \epsilon$$
for all $k \geq 1$
Here, we needed the noise variance $\sigma _ { k / 2 } ^ { 2 }$ to decrease in the order of $\mathcal { O } ( 1 / k )$ so that the stochastic error of the S-FEG does not accumulate. Otherwise, if $\sigma _ { k / 2 } ^ { 2 }$ is a constant for all $k$ , the error accumulates with rate ${ \mathcal { O } } ( k )$ . In short, the S-FEG will suffer from error accumulation, unless the stochastic error decreases with rate $\mathcal { O } ( 1 / k )$ . Such error accumulation behavior also appears in a stochastic version of Nesterov’s fast gradient method [35, 36] for smooth convex minimization [5, 8]. Similar to [5], we believe that adjusting the step coefficients of the S-FEG can make the S-FEG become relatively stable even with a constant noise, which we leave as future work.
# 7 Convergence analysis with nonincreasing potential lemma
We analyze FEG and FEG-A by finding a nonincreasing potential function in a form $V _ { k } ~ =$ $a _ { k } \| F z _ { k } \| ^ { 2 } - b _ { k } \left. F z _ { k } , z _ { 0 } - z _ { k } \right.$ in the lemma below. We provide a similar potential lemma for S-FEG in Appendix D.2. The convergence analyses of EAG and Halpern iteration are also based on such potential function [6, 43].
Lemma 7.1. Let $\{ z _ { k } \} _ { k \ge 0 }$ be the sequence generated by (Class FEG) with $\{ \alpha _ { k } \} _ { k \geq 0 } , \{ \beta _ { k } \} _ { k \geq 0 } ,$ $\{ L _ { k } \} _ { k \ge 0 } \subset ( 0 , \infty )$ and $\{ \rho _ { k } \} _ { k \ge 0 } \subset \mathbb { R } ,$ , satisfying $\alpha _ { 0 } \in ( 0 , \infty )$ , $\textstyle \alpha _ { k } \in { \bigl ( } 0 , { \frac { 1 } { L _ { k } } } { \bigr ] }$ , $\beta _ { 0 } = 1$ , $\{ \beta _ { k } \} _ { k \ge 1 } \subseteq$ $( 0 , 1 )$ for all $k \geq 1$ , and
$$\frac { ( 1 - \beta _ { k + 1 } ) } { 2 \beta _ { k + 1 } } ( \alpha _ { k + 1 } + 2 \rho _ { k + 1 } ) - \rho _ { k + 1 } \leq \frac { 1 } { 2 \beta _ { k } } ( \alpha _ { k } + 2 \rho _ { k } ) - \rho _ { k }$$
for all $k \geq 0$ . Assume that the following conditions are satisfied.
$$\begin{array} { c } { { \| { \pmb F } { \boldsymbol z } _ { 1 } - { \pmb F } { \boldsymbol z } _ { 0 } \| \leq L _ { 0 } \| { \boldsymbol z } _ { 1 } - { \boldsymbol z } _ { 0 } \| } } \\ { { \| { \pmb F } { \boldsymbol z } _ { k + 1 } - { \pmb F } { \boldsymbol z } _ { k + 1 / 2 } \| \leq L _ { k } \| { \boldsymbol z } _ { k + 1 } - { \boldsymbol z } _ { k + 1 / 2 } \| } } \\ { { \langle { \pmb F } { \boldsymbol z } _ { k + 1 } - { \pmb F } { \boldsymbol z } _ { k } , { \boldsymbol z } _ { k + 1 } - { \pmb z } _ { k } \rangle \geq \rho _ { k } \| { \pmb F } { \boldsymbol z } _ { k + 1 } - { \pmb F } { \boldsymbol z } _ { k } \| ^ { 2 } } } \end{array}$$
Then the potential function
$$V _ { k } = a _ { k } \| F z _ { k } \| ^ { 2 } - b _ { k } \left. F z _ { k } , z _ { 0 } - z _ { k } \right.$$
with $\begin{array} { r } { a _ { 0 } = \frac { \alpha _ { 0 } ( L _ { 0 } ^ { 2 } \alpha _ { 0 } ^ { 2 } - 1 ) } { 2 } } \end{array}$ , $b _ { 0 } = 0 , b _ { 1 } = 1 ,$
$$a _ { k } = { \frac { b _ { k } ( 1 - \beta _ { k } ) } { 2 \beta _ { k } } } ( \alpha _ { k } + 2 \rho _ { k } ) - b _ { k } \rho _ { k } a n d b _ { k + 1 } = { \frac { b _ { k } } { 1 - \beta _ { k } } }$$
for all $k \geq 1$ satisfies $V _ { k } \le V _ { k - 1 }$ for all $k \geq 1$
Based on the above potential lemma, we next provide a convergence analysis of FEG. The analyses for the convergence rate of FEG-A and S-FEG, i.e., the proofs of Theorem 5.1 and Theorem 6.1, are similar to that of FEG and are provided in Appendix C.3 and Appendix D.3.
# 7.1 Convergence analysis for FEG
Proof of Theorem 4.1. Recall that FEG is equivalent to (Class FEG) with $\begin{array} { r } { \alpha _ { k } = \frac { 1 } { L } , \beta _ { k } = \frac { 1 } { k + 1 } } \end{array}$ , and $\rho _ { k } = \rho$ . It is straightforward to verify that the given $\{ \alpha _ { k } \} _ { k \ge 0 }$ and $\{ \beta _ { k } \} _ { k \ge 0 }$ satisfy the conditions in Lemma 7.1 with $L _ { k } = L$ for all $k \geq 0$ . Since
$$\begin{array} { c } { { a _ { k } = \displaystyle \frac { b _ { k } ( 1 - \beta _ { k } ) } { 2 \beta _ { k } } ( \alpha _ { k } + 2 \rho _ { k } ) - b _ { k } \rho _ { k } = \displaystyle \frac { k ^ { 2 } } { 2 } \Big ( \frac 1 L + 2 \rho \Big ) - k \rho \qquad \mathrm { a n d } } } \\ { { b _ { k } = \displaystyle \frac { 1 } { 1 - \beta _ { k - 1 } } b _ { k - 1 } = \Big ( \prod _ { i = 1 } ^ { k - 1 } \frac 1 { 1 - \beta _ { i } } \Big ) b _ { 1 } = k , } } \end{array}$$
Lemma 7.1 implies that
$$0 = V _ { 0 } \geq V _ { k } = \left( \frac { k ^ { 2 } } { 2 } \Big ( \frac { 1 } { L } + 2 \rho \Big ) - k \rho \right) \| F z _ { k } \| ^ { 2 } - k \left. F z _ { k } , z _ { 0 } - z _ { k } \right. .$$
Therefore,
$$\begin{array} { r l } & { \displaystyle \frac { k ^ { 2 } } { 2 } \Big ( \frac { 1 } { L } + 2 \rho \Big ) \| F z _ { k } \| ^ { 2 } \leq k \langle F z _ { k } , z _ { 0 } - z _ { k } \rangle + k \rho \| F z _ { k } \| ^ { 2 } } \\ & { \quad \quad \quad \quad = k \langle F z _ { k } , z _ { 0 } - z _ { * } \rangle + k \langle F z _ { k } , z _ { * } - z _ { k } \rangle + k \rho \| F z _ { k } \| ^ { 2 } } \\ & { \quad \quad \quad \leq k \langle F z _ { k } , z _ { 0 } - z _ { * } \rangle \quad \quad \quad \quad ( \because \rho \mathrm { - c o m o n o t o n i c i t y ~ o f ~ } F ) } \\ & { \quad \quad \quad \quad \leq k \| F z _ { k } \| \| z _ { 0 } - z _ { * } \| . } \end{array}$$
The desired result follows directly by dividing both sides by $\begin{array} { r } { \frac { k ^ { 2 } } { 2 } \left( \frac { 1 } { L } + 2 \rho \right) \| F z _ { k } \| } \end{array}$ .
# 8 Discussion: first-order methods for Lipschitz continuous operators
Throughout this paper, we studied and constructed efficient methods in a class of first-order methods:
$$z _ { k } \in z _ { 0 } + \operatorname { s p a n } \{ F z _ { 0 } , \cdot \cdot \cdot , F z _ { k } \}$$
denoted by $\mathcal { A }$ , for smooth structured nonconvex-nonconcave problems. We observed that all existing first-order methods, including the FEG, required an additional condition, such as the negative comonoticity, on a Lipschitz continuous $\pmb { F }$ to guarantee convergence. One would then be curious whether or not there exists an (efficient) method in class $\mathcal { A }$ that guarantees convergence without any additional condition on a Lipschitz continuous $\pmb { F }$ . Unfortunately, the following lemma states that there exists a worst-case7 smooth example that none of the methods in $\mathcal { A }$ can find its stationary point. The corresponding smooth function is illustrated in Figure 3.
 Figure 3: A smooth worst-case example $f ( x , y )$ (5) with $L = R = 1$ for first-order methods. any sequence $\{ z _ { k } \} _ { k \ge 0 }$ generated by a first-order method in class $\mathcal { A }$ starting from $( 0 , 0 )$ is contained in the line $x = y$ .
Lemma 8.1. Let us consider the following function $f : \mathbb { R } ^ { 2 } \to \mathbb { R }$ for some $L , R > 0$ :
$$\begin{array} { r } { f ( x , y ) = \left\{ \begin{array} { l l } { \frac { R } { 2 } } & { f o r x < y - \sqrt { \frac { R } { L } } } \\ { - \frac { L } { 2 } ( x - y ) ^ { 2 } - \sqrt { L R } ( x - y ) } & { f o r y - \sqrt { \frac { R } { L } } \leq x < y } \\ { \frac { L } { 2 } ( x - y ) ^ { 2 } - \sqrt { L R } ( x - y ) } & { f o r y \leq x < y + \sqrt { \frac { R } { L } } } \\ { - \frac { R } { 2 } } & { f o r y + \sqrt { \frac { R } { L } } < x . } \end{array} \right. } \end{array}$$
Its saddle-gradient operator $\pmb { F }$ is $L$ -Lipschitz continuous but not comonotone.8 Then, the sequence $\{ z _ { k } \} _ { k \ge 0 }$ generated by any first-order method in class $\mathcal { A }$ with $z _ { 0 } = ( 0 , 0 )$ satisfies $\| { \pmb { F } } { \pmb { z } } _ { k } \| ^ { 2 } = 2 L R$ for all $k \geq 0$ .
Proof. $\pmb { F }$ satisfies $F ( x , y ) = ( - \sqrt { L R } , - \sqrt { L R } )$ whenever $x = y$ . Hence, for all sequences $\{ z _ { k } \} _ { k \ge 0 }$ satisfying $z _ { 0 } = ( 0 , 0 )$ and $z _ { k } \in z _ { 0 } + \operatorname { s p a n } \{ F z _ { 0 } , \cdot \cdot \cdot , F z _ { k } \}$ for all $k \geq 0$ , we have that $\{ z _ { k } \} _ { k \ge 0 } \subseteq$ $\{ z = ( x , y ) \in \mathbb { R } ^ { 2 } | x = y \}$ ; thus, $\| { \pmb { F } } z _ { k } \| ^ { 2 } = 2 L R$ for all $k \geq 0$ .
The lemma implies that one should consider a class of methods, other than the class $\mathcal { A }$ , to guarantee finding a stationary point of any smooth problem, which we leave as future work. We also leave finding additional conditions for a Lipschitz continuous $\pmb { F }$ , weaker than the weak MVI condition and the negative comonotonicity (with $\begin{array} { r } { { \Dot { \rho } } > - \frac { 1 } { 2 L } ) } \end{array}$ , which guarantee convergence or its accelerated rate, respectively, as future work.
# 9 Conclusion
This paper proposed a two-time-scale and anchored extragradient method, named FEG, for smooth structured nonconvex-nonconcave problems. The proposed FEG has an accelerated $\mathcal { O } ( 1 / k ^ { 2 } )$ rate, with respect to the squared gradient norm, for the Lipschitz continuous and negative comonotone operators for the first time. The FEG also has value for smooth convex-concave problems, compared to existing works. We further studied its backtracking line-search version, named FEG-A, for the smooth structured nonconvex-nonconcave problems and studied its stochastic version, named S-FEG, for smooth convex-concave problems. We leave extending this work to stochastic, composite, or more general nonconvex-nonconcave setting and applying to more realistic problems as future work.
# Acknowledgments and Disclosure of Funding
This work was supported in part by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. 2019R1A5A1028324), the POSCO Science Fellowship of POSCO TJ Park Foundation, and the Samsung Science and Technology Foundation (No. SSTFBA2101-02).
# References
[1] H. H. Bauschke, W. M. Moursi, and X. Wang. Generalized monotone operators and their averaged resolvents. Mathematical Programming, 189(1):55–74, 2021. [2] A. Beck and M. Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM J. Imaging Sci., 2(1):183–202, 2009. [3] P. L. Combettes and T. Pennanen. Proximal methods for cohypomonotone operators. SIAM J. Control Optim., 43(2):731–42, 2004. [4] C. D. Dang and G. Lan. On the convergence properties of non-Euclidean extragradient methods for variational inequalities with generalized monotone operators. Computational Optimization and Applications, 60(2):277–310, 2015. [5] O. Devolder. Stochastic first order methods in smooth convex optimization, 2011. [6] J. Diakonikolas. Halpern iteration for near-optimal and parameter-free monotone inclusion and strong solutions to variational inequalities. In Conference on Learning Theory, pages 1428–1451. PMLR, 2020. [7] J. Diakonikolas, C. Daskalakis, and M. Jordan. Efficient methods for structured nonconvexnonconcave min-max optimization. In International Conference on Artificial Intelligence and Statistics, pages 2746–2754. PMLR, 2021. [8] S. Ghadimi and G. Lan. Accelerated gradient methods for nonconvex nonlinear and stochastic programming. Mathematical Programming, 156(1):59–99, March 2016. [9] N. Golowich, S. Pattathil, C. Daskalakis, and A. Ozdaglar. Last iterate is slower than averaged iterate in smooth convex-concave saddle point problems. In Conference on Learning Theory (COLT), 2020. [10] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. In Neural Info. Proc. Sys., 2014. [11] B. Grimmer, H. Lu, P. Worah, and V. Mirrokni. The landscape of the proximal point method for nonconvex-nonconcave minimax optimization, 2020. [12] B. Halpern. Fixed points of nonexpanding maps. Bull. Amer. Math. Soc, 73:957–961, 1967. [13] Y.-G. Hsieh, F. Iutzeler, J. Malick, and P. Mertikopoulos. On the convergence of single-call stochastic extra-gradient methods. In Neural Info. Proc. Sys., 2019. [14] Y.-G. Hsieh, F. Iutzeler, J. Malick, and P. Mertikopoulos. Explore aggressively, update conservatively: Stochastic extragradient methods with variable stepsize scaling. In Neural Info. Proc. Sys., 2020. [15] Y.-P. Hsieh, P. Mertikopoulos, and V. Cevher. The limits of min-max optimization algorithms: convergence to spurious non-critical sets. In Proc. Intl. Conf. Mach. Learn, 2021. [16] A. Juditsky, A. Nemirovski, and C. Tauvel. Solving variational inequalities with stochastic mirror-prox algorithm. Stochastic Systems, 1(1):17–58, 2011. [17] D. Kim. Accelerated proximal point method for maximally monotone operators. Mathematical Programming, 190(1):57–87, 2021. [18] U. Kohlenbach. On the proximal point algorithm and its Halpern-type variant for generalized monotone operators in Hilbert space. Optimization Letters, 2021. [19] G. M. Korpelevich. An extragradient method for finding saddle points and other problems. Ekonomika i Mateaticheskie Metody, 12(4):747–56, 1976. [20] A. Letcher. On the impossibility of global convergence in multi-loss optimization. In Proc. Intl. Conf. on Learning Representations, 2021. [21] F. Lieder. On the convergence rate of the Halpern-iteration. Optimization Letters, 15(2):405–418, 2021. [22] M. Liu, Y. Mroueh, J. Ross, W. Zhang, X. Cui, P. Das, and T. Yang. Towards better understanding of adaptive gradient algorithms in generative adversarial nets. In International Conference on Learning Representations, 2020. [23] M. Liu, H. Rafique, Q. Lin, and T. Yang. First-order convergence theory for weakly-convexweakly-concave min-max problems. J. Mach. Learning Res., 22(169):1–34, 2021. [24] Y. Malitsky. Golden ratio algorithms for variational inequalities. Mathematical Programming, 184(1):383–410, 2020. [25] Y. Malitsky and T. Pock. A first-order primal-dual algorithm with linesearch. SIAM Journal on Optimization, 28(1):411–432, 2018. [26] P. Mertikopoulos, B. Lecouat, H. Zenati, C.-S. Foo, V. Chandrasekhar, and G. Piliouras. Optimistic mirror descent in saddle-point problems: going the extra (gradient) mile. In Proc. Intl. Conf. on Learning Representations, 2019. [27] A. M ˛adry, A. Makelov, L. Schmdit, D. Tsipras, and A. Vladu. Towards deep learning models resistant to adversarial attacks. In Proc. Intl. Conf. on Learning Representations, 2018. [28] A. Mokhtari, A. Ozdaglar, and S. Pattathil. A unified analysis of extra-gradient and optimistic gradient methods for saddle point problems: Proximal point approach. In Proc. Intl. Conf. Artificial Intelligence and Stat. (AISTATS), 2020. [29] R. D. C. Monteiro and B. F. Svaiter. On the complexity of the hybrid proximal extragradient method for the iterates and the ergodic mean. SIAM J. Optim., 20(6):2755–87, 2010. [30] R. D. C. Monteiro and B. F. Svaiter. Complexity of variants of Tseng’s modified FB splitting and Korpelevich’s methods for hemivariational inequalities with applications to saddle-point and convex optimization problems. SIAM Journal on Optimization, 21(4):1688–1720, 2011. [31] M. C. Mukkamala, P. Ochs, T. Pock, and S. Sabach. Convex-concave backtracking for inertial bregman proximal gradient algorithms in nonconvex optimization. SIAM Journal on Mathematics of Data Science, 2(3):658–682, 2020. [32] A. Nemirovski. Prox-method with rate of convergence $O ( 1 / t )$ for variational inequalities with Lipschitz continuous monotone operators and smooth convex-concave saddle point problems. SIAM J. Optim., 15(1):229–51, 2004. [33] A. Nemirovski, A. Juditsky, G. Lan, and A. Shapiro. Robust stochastic approximation approach to stochastic programming. SIAM J. Optim., 19(4):1574–609, 2009. [34] A. Nemirovski and D. Yudin. Problem complexity and method efficiency in optimization. wiley, 1983. [35] Y. Nesterov. A method for unconstrained convex minimization problem with the rate of convergence $O ( 1 / k ^ { 2 } )$ . Dokl. Akad. Nauk. USSR, 269(3):543–7, 1983. [36] Y. Nesterov. Smooth minimization of non-smooth functions. Mathematical Programming, 103(1):127–52, May 2005. [37] Y. Nesterov. Dual extrapolation and its applications to solving variational inequalities and related problems. Mathematical Programming, 109(2-3):319–44, March 2007. [38] Y. Ouyang and Y. Xu. Lower complexity bounds of first-order methods for convex-concave bilinear saddle-point problems. Mathematical Programming, 185(1):1–35, 2021. [39] L. D. Popov. A modification of the Arrow-Hurwicz method for search of saddle points. Mathematical notes of the Academy of Sciences of the USSR, 28(5):845–8, November 1980. [40] E. K. Ryu, K. Yuan, and W. Yin. ODE analysis of stochastic gradient methods with optimism and anchoring for minimax problems and GANs, 2019. arxiv 1905.10899. [41] M. V. Solodov and B. F. Svaiter. A hybrid approximate extragradient–proximal point algorithm using the enlargement of a maximal monotone operator. Set-Valued Analysis, 7(4):323–345, 1999. [42] C. Song, Z. Zhou, Y. Zhou, Y. Jiang, and Y. Ma. Optimistic dual extrapolation for coherent non-monotone variational inequalities. In Neural Info. Proc. Sys., 2020. [43] T. Yoon and E. K. Ryu. Accelerated algorithms for smooth convex-concave minimax problems with $\mathcal { O } ( 1 / k ^ { 2 } )$ rate on squared gradient norm. In Proc. Intl. Conf. Mach. Learn, 2021. [44] Z. Zhou, P. Mertikopoulos, N. Bambos, S. Boyd, and P. Glynn. Stochastic mirror descent in variationally coherent optimization problems. In Neural Info. Proc. Sys., 2017.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206# RETHINKING SELF-DRIVING: MULTI-TASK KNOWLEDGE FOR BETTER GENERALIZATION AND ACCIDENT EXPLANATION ABILITY
Anonymous authors Paper under double-blind review
# ABSTRACT
Current end-to-end deep learning driving models have two problems: (1) Poor generalization ability of unobserved driving environment when diversity of training driving dataset is limited (2) Lack of accident explanation ability when driving models don’t work as expected. To tackle these two problems, rooted on the believe that knowledge of associated easy task is benificial for addressing difficult task, we proposed a new driving model which is composed of perception module for see and think and driving module for behave, and trained it with multi-task perception-related basic knowledge and driving knowledge stepwisely. Specifically segmentation map and depth map (pixel level understanding of images) were considered as what & where and how far knowledge for tackling easier drivingrelated perception problems before generating final control commands for difficult driving task. The results of experiments demonstrated the effectiveness of multitask perception knowledge for better generalization and accident explanation ability. With our method the average sucess rate of finishing most difficult navigation tasks in untrained city of CoRL test surpassed current benchmark method for 15 percent in trained weather and 20 percent in untrained weathers.
# 1 INTRODUCTION
Observing progressive improvement in various fields of pattern recognition with end-to-end deep learning based methods(Krizhevsky et al., 2012; Girshick, 2015), self-driving researchers try to revolutionize autonomous car field with the help of end-to-end deep learning techniques(Bojarski et al., 2016b; Chen et al., 2015; Codevilla et al., 2017). Impressive results have been acquired by mapping camera images directly to driving control commands(Bojarski et al., 2016b) with simple structure similar to ones for image classfication task(Simonyan & Zisserman, 2014). Further researches were conducted to improve the performance of deep learning based autonomous driving system, for example, Conditional Imitation Learning(Codevilla et al., 2017) approach has been proposed to solve the ambigious action problem.
However, two crutial problems failed to be spotted: (1) Poor generalization ability of unobserved driving environment given limited diversity of training scenerios. For example, though Dosovitskiy et al. (2017) addressed the driving direction selection problem, it showed poor generalization ability in unseen test town which has different map and building structure than training town’s. This generalization problem is extremely important since collected driving dataset always has limitation of diversity (2) Current end-to-end autonomous approaches lack of accident explanation ability when these models behave unexpectedly. Although saliency map based visualization methods(Smilkov et al., 2017; Sundararajan et al., 2017; Springenberg et al., 2014; Bojarski et al., 2016a) have been proposed to dig into the ’black box’, the only information these methods could bring is the possible attention of the model instead of the perception process of the model.
We proposed a new driving approach to solve the two aforementioned problems by using multi-task basic perception knowledge. We argue that when end-to-end model is trained to address a specific difficult task, it’s better to train the model with some basic knowledge to solve relevant easier tasks before(Pan et al., 2010). An analogy for this can be observed when human beings learn a difficult knowledge. For example, to solve a complex integration problem, compared with students without basic math knowledge, students who know about basic knowledge of math are able to learn the core of intergration more quickly and solve other similar integration problems instead of memorizing the solution of the specific problem.
Our proposed model consists of two modules: perception module and driving module as in Fig. 1. The perception module is used for learning easier driving-related perception knowledge, which we refer as ability of pixel level understanding of input including what & where and how far knowledge. We trained perception module with segmentation map and depth map first, while the former serves as what & where knowledge and the latter serves as how far knowledge. By visualizing inferenced segmentation and depth results whether perception process works well or not could be inferred. After the perception module was trained to have ability of pixel level understanding of its image input, we freezed the perception module weights and trained driving module with driving dataset. This decomposition of end-to-end driving network strucuture is considered to be mediated perception approach(Ullman, 1980). With our proposed driving structure and stepwise training strategy, the generalization and accident explanation problems were addressed to a certain extent.
# 2 RELATED WORK
Depending on whether mediated perception knowledge are generated, self-driving models are categorized into mediated perception approach(Ullman, 1980) and behavior reflex approach.
For mediated perception approaches, there are several well-behaved deep learning methods, for example, Deep-Driving method(Chen et al., 2015) fisrtly converts input RGB images to some key perception indicators related to final driving controls. They designed a very simple driving controller based on predicted perception indicators. Problem of this approach is that key perception indicators have limitation of describing unseen scenerios and are difficult to collect in reality. Except for inferencing for final driving controls, there are approaches which focus on inferencing intermediate description of driving situation only. For separate scene understanding task, car detection(Lenz et al., 2011) and lane detection(Aly, 2008) are two main topics in this area.
Instead of inferencing one perception task at most, multi-task learning method aims at tackling several relevant tasks simultaneously. Teichmann et al. (2016) uses input image to solve both object detection and road segmentation tasks. Branched E-Net(Neven et al., 2017) not only infers for segmentation map, but also depth map of current driving scenarios. These multi-task learning methods shows better result when sharing the encoder of different perception tasks together, but they haven’t really tried to make the car drive either in simulator or reality.
As for behavior reflex approach which is also called ’end-to-end learning’, NVIDIA firstly proposed a model for mapping input image pixels directly to final driving control output(steer only)(Bojarski et al., 2016b). Some other approaches further atempted to create more robust models, for example, long short-term memory (LSTM) was utilized to make driving models store a memory of past(Chi & Mu, 2017).
One problem is that aforementioned methods were tested in dissimlar driving scenerios using different driving dataset, thus it’s hard to determine if model itself is the source of the better driving behavior instead of effectiveness of data(Sun et al., 2017).
Codevilla et al. (2017) was tested in a public urban driving simulator Dosovitskiy et al. (2017) and sucessed to tackle the ambigous action problem which refers as optimal driving action can’t be inferred from perceptual input alone. Benefit from CoRL test in Dosovitskiy et al. (2017), fair comparision could be conducted using same driving dataset. Codevilla et al. (2017) showed limitation of generalization ability problem in test town different from train town(Dosovitskiy et al., 2017) as in CoRL test training dataset could be only collected from single train town.
When the end-to-end driving method behaves badly and causes accidents, accident explanation ability is required. Though saliency-map based visualization methods(Bojarski et al., 2016a; Smilkov et al., 2017) help understand the influence of input on final driving control, it’s extremely hard to derive which module of the model fails when driving problems happen — If the model percepts incorrectly or the driving inference processes wrongly based on good perception information. Driving system was enabled to give quantitative explanation by visualizing inferenced multi-task basic knowledge to solve this problem.
# 3 FRAMEWORK OF PROPOSED SYSTEM
Basic strucure of the proposed model is shown in Fig. 1. The proposed model has two parts: (1) Multi-task basic knowledge perception module (2) Driving decision branch module. The perception module is used to percept the world by inferencing dpeth map and segmentation map, which is composed of one shared encoder and two decoders for two different basic perception knowledge: (1) Segmentation decoder for generating ’what & where’ information by predicting segmentation maps; (2) Depth decoder for predicting ’how far’ the objects in vision are by inferencing depth maps. The perception module is aimed at extracting encoded feature map containing pixel level understanding information for driving module and qualitative explanation when proposed model doesn’t work as expected by visualizing the predicted segmentation and depth maps to determine if the driving problem is caused by percept process or driving process.
The driving module enbales the model to generate driving decisions for different direction following guidances. We categorized the real world driving guidance into four types: (1) Following lane (2) Turning left (3) Going straight (4) Turning right as done in Codevilla et al. (2017). For each driving guidance direction, there is a driving branch(which predicts the value of driving controls) corresponding to it, therefore there are four driving guidance branches totally. The output of second last layer in perception module is inputted to the driving module, therefore the training of which could benefit from the multi-knowledge extracted by the perception module. Instead of linear layers, convolution layers are utilized for inferencing final driving controls for each direction, which helps keeping the spatial relation of information and reducing number of parameters as non-negligible quantity of direction branches.
# 3.1 MULTI-TASK BASIC KNOWLEDGE PERCEPTION MODULE
The perception module is built with residual block proposed in (He et al., 2016) which solves gradient vanishing and ’degradation problem’, and it has a structure similar to Segnet(Badrinarayanan et al., 2015) prosposed for efficient image segmentation task. Huge difference is that in our proposed method there are two different decoders for inferencing both segmentation and depth maps simultaneously instead of segmentation map only. Besides, we constraint the total strides in encoder to 8 for keeping resolution of feature map, as large total stride has negative influence on feature map size reconstuction. Hybrid Dilated Convolution Wang et al. (2017) is adapted as last part of the encoder as it enlarges the receptive field and avoids theoretical issue of gridding problem. Groupout(Park) is also adapted to avoid overfitting problem in the convolution network.
# 3.2 DRIVING DECISION BRANCH MODULE
The driving module is built with residual block and has a general form as Codevilla et al. (2017) in last output layer for several direction outputs. It is all based on convolutional layers in order to keep the spatial information and reduce parameters motivated by Springenberg et al. (2014). Four different high level driving guidance such as ”turning right” are utilized for selecting which direction branch’s output is supposed to be considered as final driving outputs. Driving outputs contain steering and acceleration/brake, both of them range from -1 to 1. Since there are 4 output branches corresponding to 4 high level driving guidances, 8 feature map size convolution kernels are set in the last layer for output scalar value, in which each two are regarded as driving controls for one driving guidance. To determine the limitation of RGB image, no other information such as current speed or steering angle were used as input. Instead we atempted to predict the current speed based on current RGB image to keep the driving smoothly as done in (Codevilla et al., 2017). The input of the driving module is not from the last layer’s output of the encoder part in the perception module, but the second last layer’s output of the encoder part due to empirically selection for best generalization.
 Figure 1: Basic structure of proposed self-driving system. The components which lie in the red bounding box are refered as parts of perception module. The components which lie in the blue bounding box forms the driving module. In order to see the limiation of RGB image, only current RGB image and driving guidance are used as inputs seperatedly for perception module and driving module.
# 4 EXPERIMENTS
# 4.1 SYSTEM SETUP
The training dataset is collected in CARLA simulator(Dosovitskiy et al., 2017). CARLA simulator is a self-driving simulator developed by Intel Co. for collecting self-driving related information and evaluating driving model with a standard testing environment named CoRL test. CoRL test is composed of 4 tasks of increasing difficulty: (1) Straight: the goal is straight ahead of the starting position. (2) One turn: getting to the goal takes one turn, left or right. (3) Navigation: navigation with an arbitrary number of turns. (4) Navigation with dynamic obstacles: same as previous task, but with other vehicles and pedestrians(Dosovitskiy et al., 2017).
The main metric for quantitatively evaluating is the average success rate of finishing seperate tasks in CoRL test. CoRL test contains tests both in trained town and untrained town under both trained and untrained weathers. Test trained town and untrained town are constructed with different maps and different building texture.
# 4.2 DATASET
Dataset for training our model could be categorized into 2 items: (1) Perception module training dataset (2) Driving module training dataset. For perception module, we trained it with 35,000 pairs of RGB images, segmentation and depth maps and evaluated with 5,000 pairs. As for driving module, we trained with 455,000 dataset, and evaluated on 62,000 evaluation dataset. Before training our proposed model, two vital data processing methods were used: balancing dataset and data augmentation.
Table 1: Quantitive evaluation of methods in the goal-directed navigation tasks in CoRL test. The table reports the percentage of success rate of finishing corresponding task in different condition. Higher means better performance.
<table><tr><td></td><td colspan="4">Training conditions</td><td colspan="4">New town</td><td colspan="4">New weather</td><td colspan="4">New town&weather</td></tr><tr><td>Task</td><td>MP</td><td>IL</td><td>RL</td><td>OURS</td><td>MP</td><td>IL</td><td>RL</td><td>OURS</td><td>MP</td><td>IL</td><td>RL</td><td>OURS</td><td>MP</td><td>IL</td><td>RL</td><td>OURS</td></tr><tr><td>Straight</td><td>98</td><td>95</td><td>89</td><td>98</td><td>92</td><td>97</td><td>74</td><td>100</td><td>100</td><td>98</td><td>86</td><td>100</td><td>50</td><td>80</td><td>68</td><td>96</td></tr><tr><td>One turn</td><td>82</td><td>89</td><td>34</td><td>87</td><td>61</td><td>59</td><td>12</td><td>81</td><td>95</td><td>90</td><td>16</td><td>88</td><td>50</td><td>48</td><td>20</td><td>82</td></tr><tr><td>Navigation</td><td>80</td><td>86</td><td>14</td><td>81</td><td>24</td><td>40</td><td>3</td><td>72</td><td>94</td><td>84</td><td>2</td><td>88</td><td>47</td><td>44</td><td>6</td><td>78</td></tr><tr><td>Nav. dynamic</td><td>77</td><td>83</td><td>7</td><td>81</td><td>24</td><td>38</td><td>2</td><td>53</td><td>89</td><td>82</td><td>2</td><td>80</td><td>44</td><td>42</td><td>4</td><td>62</td></tr></table>
For fair comparison, we use same driving dataset published by Conditional Imitation Learning(Codevilla et al., 2017) except that we collected extra segmentation and depth maps in train town for training our proposed perception module.
# 4.2.1 DATA BALANCING
Dataset balancing contributed to better generalization of both perception module and driving module in our experiments as it enables each mini-batch to be a microcosm of the whole dataset. For perception module, dataset were balanced to ensure that each mini-batch contains all different training weathers and an equal amount of going straight and turning situations. For driving module, we balance each training mini-batch to ensure equally distribution of different driving direction guidance, and reorganized large steer(absolute value larger than 0.4) data accounts for 1/3 in each mini-batch, brake situation data acounts for $1 / 3$ , noise steer situation for 1/10.
# 4.2.2 DATA AUGMENTATION
We add guassian noise, coarse dropout, contrast normalization, Guassian blur to both training dataset for perception and driving module for enlarging training dataset distribution.
# 4.3 TRAINING DETAILS
We trained the whole system using a step-wise training method which is firstly we trained the perception module with multi-task basic perception knowledge, then we freezed the weights of perception module and train driving module with driving dataset. For training the perception module, we used mini-batch size 24 and set ratio of segmentation loss and depth loss to be 1.5:1. Softmax categorical crossentropy is used for segmentation loss, binary crossentropy is used for depth loss. Adam of 0.001, which is multiplied by a factor of 0.2 of previous learning rate if validation loss does’t drop for 1 epoch is used as optmizer. L2 weight decay and early stopping are also used for avoid overfitting. As for training the driving module, we consider MSE loss and use Adam with starting learning rate of 0.002 which exponentially decay of 0.9 every epoch. Early stopping and L2 decay are used for regularization.
# 5 EXPERIMENTS & RESULTS
# 5.1 GENERALIZATION ABILITY TEST
We compare the results of driving performance between our proposal and other methods tested in CoRL test via success rate of finishing each task. The details of results are shown in Table. 1
From Table. 1, though our proposal finished slightly less in training conditions comparing with other methods, our proposal achieved much higher success rate in untrained town environments, which demonstrates our model has much better generalization ability of adapting to untrain town than other methods tested in the CoRL test when trained with limited diversity of training conditions. One important notice is that we use the almost the same driving dataset for training as the method Codevilla et al. (2017) showed in the Table. ??.
We could also visualize the perception process when the model works. One example of test in untrained town and untrained weather is shown in Fig. 2.
 Figure 2: Screenshots of captured single RGB image and our proposal’s inference results which consists of predicted segmentation map and depth map during test in untrained town under untrained weather. Obviously from the inferenced segmentation and depth maps we get information that the driving model knows a car is passing by the left side.
# 5.2 ORIGIN OF BETTER GERNERALIZATION ABILITY
Since we observed our training model has better generalization ability in unseen town comparing with other methods when almost the same driving dataset were used to train (except that we collected extra depth maps and segmentation maps in same training environments), we want to investigate the origin of the better generalization ability. There are two possible reasons why our training model has better generalization ability in unseen town: (1) Basic knowledge (segmentation map and depth map) (2) Network structure. Therefore we conduct experiments by comparing performance of two methods:
• Our original proposal: Firstly train perception module with basic knowledge, after training perception module, freeze its weights and train driving module with driving dataset Compared method: Train the encoder of perception module and driving module together with driving dataset. No basic perception knowledge is used for training model.
Since tests in CoRL cost much time, we limited our evaluation to the most difficult untrained town under untrained weathers test. Results are shown in Table. 2. From the results it’s obvious that multibasic knowledge we use in the training phase is the origin of our proposal’s good generalization ability of untrained town instead of the network structure. Moreover, the network structure could be improved to achieve better performance in the furture.
# 5.3 QUALITATIVE CAUSE EXPLANATION ABILITY OF DRIVING PROBLEMS
Besides basic knowledge leads to better generalization ability, it could also be used to give a qualitative explanation of driving problems. Basic knowledge of segmentation map and depth map are output from the perception module during test phase, therefore how the driving module percepts the current scenario could be known by simply visualizing the outputs of segmentation and depth from perception module. Depending on the predicted pixel understanding of the situation, cause of driving problem could be inferred.
Table 2: Quantitive evaluation of original proposal which uses segmentataion and depth maps in training phase and compared method which doesn’t use. Results shows that when multi-knowldge is not used for training, the success rate drops hugely in the testing town under untained weathers. It indicates that multi-basic knowledge is the main origin of the good generalization ability in our proposal. New town&weather test
<table><tr><td>Task</td><td>COMPARED</td><td>ORIGINAL</td></tr><tr><td>Straight</td><td>91</td><td>96</td></tr><tr><td>One turn</td><td>52</td><td>82</td></tr><tr><td>Navigation</td><td>20</td><td>78</td></tr><tr><td>Nav. dynamic</td><td>16</td><td>62</td></tr></table>
One example is shown in Fig. 3. For a failed straight task in untrained town under untrained weather soft rain sunset as the driving model failed to move forward, we visualized outputs of segmentation and depth maps predicted by perception module. It’s obvious that this failure case is caused by the perception module since the model falsely percepted that there is a car in front of it and in order to avoid collision it did’t start. There is no car actually thus the perception module made false judgement. However, what’s interesting is that sometimes it fools readers to think that there is a car in Fig. 3 because of sun ray reflection on the wet road and the perception module has the similar understanding as these readers. Therefore in some aspects the perception module makes the right judgement instead of wrong’s. For traditional end-to-end learning driving methods(Bojarski et al., 2016b) it’s impossible to reason as they don’t focus on the cause explanation ability which is of great importance for practice use of deep learning driving models.
 Figure 3: Failed straight task in untrained town under untrained soft rain sunset weather. From predicted segmentation and depth maps, we know that the driving model thinks that there is a car in front of it but actually there isn’t any car in front of it.
# 5.4 FINE-TUNE TEST
Fine-tuneYosinski et al. (2014), which refers to use other well-trained models weights on different target-related dataset as initial weights for training with target dataset instead of using weights initializing methods(Glorot & Bengio, 2010; He et al., 2015; LeCun et al., 2012), is a common trick used in deep learning since empirically it could leads to better generalization on new target dataset. Here in our specific case we refer fine-tune method to be after training perception module we train the weights of the encoder of the perception module as well instead of freezing these weights. In
Table. 3 we compare the performance of fine-tune method and our original proposed method.
Table 3: Quantitive evaluation of original proposal and fine-tune method which doens’t freeze the perception module’s weights during training the driving module. Results shows that the success rate of the fine-tune method drops dramaticaly in the testing town under untained weathers.
<table><tr><td colspan="2">New town&weather test</td></tr><tr><td>Task</td><td>FINETUNE ORIGINAL</td></tr><tr><td>Straight</td><td>88</td></tr><tr><td>One turn 59</td><td>96 82</td></tr><tr><td>Navigation</td><td>42 78</td></tr><tr><td>Nav. dynamic</td><td>33 62</td></tr></table>
In this comparison we achieved counter-intuition results: after fine-tune the weights of the perception module the driving model achieved worse results than original method which freeze the weights of perception module when training the driving module.
One possible reason is that the generalization ability lies in the perception module instead of the driving module, therefore when we train the perception module again with driving dataset, the ability of generating compressed multi-knowdege information is destoryed. As the fine-tune model couldn’t benefit from the multi-task knowledge anymore, it failed to produce the same generalization ability as the original proposal did.
Furthermore we conduct experiment on visualizing one direction of loss surface by projecting the loss surface to 2 dimension(Goodfellow & Vinyals, 2014) to investigate some qualitative explanation for this comparison result. $x$ axis corresponds to linear interpolation of the weights of original proposed method and weights of compared fine-tuned method after training. Formulation of calculating the weights in this projection direction is Equation. 1.
$$\alpha \in [ - 1 , 2 ] , f ( \alpha x _ { f i n e t u n e } + ( 1 - \alpha ) x _ { r g b 0 } )$$
$\alpha$ is linear interpolation ratio, $x _ { f i n t u n e }$ and $x _ { r g b 0 }$ are trained weights of fine-tune method and original proposal method. $f ( x )$ is loss function of the whole model while input is considered as different model weights. We draw out the projected loss surface as Fig. 4 by sampling from the interpolation weigthts. From Fig. 4 we can get one possible qualitative reason for worse behavior of fine-tune method from a loss surface perspective: Model weight got by using fine-tune method is stuck in a super flat surface, while model weights of original proposed method successfully finds a local minimum.
# 6 CONCLUSION
In this paper we propose a new driving system for better generalization and accident explanation ability by enabling it to do simpler driving-related perception task before generating commands for diffult driving task. Through multiple experiments we empirically proved the effectiveness of the multi basic perception knowledge for better generalization ability of unobserved town when diversity of training dataset is limited. Besides our proposed model has self-explanation ability by visualizing the predicted segmentation and depth maps from the perception module to determine the cause of driving problems when they happen. One interesting result we acquired by comparing different train strategies is that the generalization ability of driving origins from basic knowledge and lies in weights of the perception module which should not be modified during training with driving dataset. We hope our work could movitivate other researches to use multi-task target related perception knowledge for better performance in robot learning. In future we will investigate more effective network structures.
 Figure 4: One perceptive of loss surface by linear interpolation of original proposed method weights and fine-tune method weights. Blue line refers to test loss, red line refers to train loss. From the visualization perspective it’s possibly that finetune method weights are stuck in a flat surface while the original proposed weights sucessfully find a local minimum.
# ACKNOWLEDGMENTS
Thanks to all Prof.Ogata lab members especially Kamuza SASAKI san who teaches me about Deep Learning patiently when I have zero knowledge of what it is. Great thanks to my bros Zehai TU and Pengfei LI who support me no matter how annoying I am in the midnight. Final thanks to my homie Mengcheng SONG for being a Hiphop guide for me and makes me understand about the importance of always ’keep it real’.
# REFERENCES
Mohamed Aly. Real time detection of lane markers in urban streets. In Intelligent Vehicles Symposium, 2008 IEEE, pp. 7–12. IEEE, 2008.
Vijay Badrinarayanan, Alex Kendall, and Roberto Cipolla. Segnet: A deep convolutional encoderdecoder architecture for image segmentation. arXiv preprint arXiv:1511.00561, 2015.
Mariusz Bojarski, Anna Choromanska, Krzysztof Choromanski, Bernhard Firner, Larry Jackel, Urs Muller, and Karol Zieba. Visualbackprop: efficient visualization of cnns. arXiv preprint arXiv:1611.05418, 2016a.
Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016b.
Chenyi Chen, Ari Seff, Alain Kornhauser, and Jianxiong Xiao. Deepdriving: Learning affordance for direct perception in autonomous driving. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2722–2730, 2015.
Lu Chi and Yadong Mu. Deep steering: Learning end-to-end driving model from spatial and temporal visual cues. arXiv preprint arXiv:1708.03798, 2017.
Felipe Codevilla, Matthias Muller, Alexey Dosovitskiy, Antonio L ¨ opez, and Vladlen Koltun. End-´ to-end driving via conditional imitation learning. arXiv preprint arXiv:1710.02410, 2017.
Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. Carla: An open urban driving simulator. arXiv preprint arXiv:1711.03938, 2017.
Ross Girshick. Fast r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 1440–1448, 2015.
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 249–256, 2010.
Ian J. Goodfellow and Oriol Vinyals. Qualitatively characterizing neural network optimization problems. CoRR, abs/1412.6544, 2014. URL http://arxiv.org/abs/1412.6544.
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.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
Yann A LeCun, Leon Bottou, Genevieve B Orr, and Klaus-Robert M ´ uller. Efficient backprop. In ¨ Neural networks: Tricks of the trade, pp. 9–48. Springer, 2012.
Philip Lenz, Julius Ziegler, Andreas Geiger, and Martin Roser. Sparse scene flow segmentation for moving object detection in urban environments. In Intelligent Vehicles Symposium (IV), 2011 IEEE, pp. 926–932. IEEE, 2011.
Davy Neven, Bert De Brabandere, Stamatios Georgoulis, Marc Proesmans, and Luc Van Gool. Fast scene understanding for autonomous driving. arXiv preprint arXiv:1708.02550, 2017.
Sinno Jialin Pan, Qiang Yang, et al. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2010.
Eunbyung Park. Groupout: A way to regularize deep convolutional neural network.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viegas, and Martin Wattenberg. Smoothgrad: ´ removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017.
Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Computer Vision (ICCV), 2017 IEEE International Conference on, pp. 843–852. IEEE, 2017.
Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. arXiv preprint arXiv:1703.01365, 2017.
Marvin Teichmann, Michael Weber, Marius Zoellner, Roberto Cipolla, and Raquel Urtasun. Multinet: Real-time joint semantic reasoning for autonomous driving. arXiv preprint arXiv:1612.07695, 2016.
Shimon Ullman. Against direct perception. Behavioral and Brain Sciences, 3(3):373–381, 1980.
Panqu Wang, Pengfei Chen, Ye Yuan, Ding Liu, Zehua Huang, Xiaodi Hou, and Garrison Cottrell. Understanding convolution for semantic segmentation. arXiv preprint arXiv:1702.08502, 2017.
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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428# CUTTING DOWN TRAINING MEMORY BY RE-FOWARDING
Anonymous authors Paper under double-blind review
# ABSTRACT
Deep Neutral Networks(DNNs) require huge GPU memory when training on modern image/video databases. Unfortunately, the GPU memory as a hardware resource is always finite, which limits the image resolution, batch size, and learning rate that could be used for better DNN performance. In this paper, we propose a novel training approach, called Re-forwarding, that substantially reduces memory usage in training. Our approach automatically finds a subset of vertices in a DNN computation graph, and stores tensors only at these vertices during the first forward. During backward, extra local forwards (called the Re-forwarding process) are conducted to compute the missing tensors between the subset of vertices. The total memory cost becomes the sum of (1) the memory cost at the subset of vertices and (2) the maximum memory cost among local re-forwards. Re-forwarding trades training time overheads for memory and does not compromise any performance in testing. We propose theories and algorithms that achieve the optimal memory solutions for DNNs with either linear or arbitrary computation graphs. Experiments show that Re-forwarding cuts down up-to $8 0 \%$ of training memory on popular DNNs such as Alexnet, VGG, ResNet, Densenet and Inception net.
# 1 INTRODUCTION
The standard DNN training process consists of two alternated stages: forward and backward. Fig. 1 (a) illustrates an example of feed-forward neural networks. In the forward stage, the network takes an input tensor, $[ B a t \bar { c } h S i z e \times C h a n n e l \times W i d t h \times H e i g h t ]$ , and computes the tensors at each layer until producing the output. In the backward stage, difference between the output and ground truth is passed back along the network to compute the gradients at each layer. The regular training approach saves tensors at all layers during forward, because they are all needed to compute gradients during backward. The total memory cost is the sum of cost over all layers.
In popular backbone DNNs for feature extraction of images, such as AlexNet (Krizhevsky et al. (2012)), VGG (Simonyan & Zisserman (2014)) and ResNet (He et al. (2016)), the memory cost increases quadratically with the input image resolution and network depth. For example, given an median size input tensor of (32, 3, 224, 224), ResNet101 requires around $5 0 0 0 ~ \mathrm { M B }$ . In more challenging tasks, DNNs that detect small objects and large number of object categories require input image resolution of more than $6 0 0 \times 6 0 0$ (Ren et al. (2015); Singh et al. (2017); Redmon & Farhadi (2018)). The memory issue is worse for video-based DNNs, such as CDC (Shou et al. (2017)), C3D (Ji et al. (2013)) and 3D-ResNet (Hara et al. (2017)). To model complex activities in video, the input tensor may contain 64 frames. Moreover, DNN training takes much more memory than testing. In order to train DNNs with large databases and big learning rate, the batch size can be up to 64. In training DNN compositions, such as Generative adversarial networks (GANs), multiple generator and discriminator networks are simultaneously stored in GPU memory.
Existing efforts to address memory issues presented three main approaches: (1) Better single GPUs. Recent GPUs provide larger memory at the expense of exponentially growing price and power consumption. For instance, from TitanXp, Quadro P6000 to Tesla V100, for 1-2.7 times increase in memory, the prices increase 2.8-8.5 times. (2) Parallelization among multiple GPUs (Dean et al. (2012); Shi et al. (2009); Langford et al. (2009); Mcdonald et al. (2009); McDonald et al. (2010); Zinkevich et al. (2010); Agarwal et al. (2014); Agarwal & Duchi (2011)), which requires expensive clusters, introduces substantial I/O cost, and does not reduce the total memory cost. (3) Low-level heuristic techniques. Optimization of computation graphs (Aho et al. (1986)), which merges inplace operations into non-inplace operations to cut down memory. Liveness analysis (Aho et al. (1986)), which dynamically recycles garbage tensors in training epochs. These approaches are specific to certain DNN structures, data and tasks.
 Figure 1: Regular Training Approach vs. Re-forwarding (our). (a) The regular approach saves all tensors during forward, and uses these tensors to compute gradients during backward. (b) Reforwarding (our) saves a subset of tensors during the first forward, and conducts “Re-forward” to compute tensors for gradients during backward.
To address above issues, we propose a fundamental approach that explores trade-off between memory and computation power of GPUs. Note that recent affordable GPUs, although limited in memory ( 12GB), provide exceptional improvement in GPU cores and FLOPS. Trading computational time for memory is a very attractive solution that make it possible to train very heavy DNNs with finite GPU memory. Our approach only saves tensors at a subset of layers during the first forward, and conduct only extra local forwards to compute the missing tensors needed during backward. We call the extra forward process as Re-forwarding. The total memory cost is the sum of (1) the cost at the subset of layers and (2) the maximum memory cost among local re-forwards. Training with Reforwarding, see Fig. 1 (b), leads to substantial memory reduction. We propose sophisticate theories and efficient algorithms that achieve the optimal memory solution of arbitrary computation graphs.
# 2 RELATED WORK
To alleviate the memory pressure from a single GPU processor, many researchers utilized the wellestablished techniques for distributed computation (Dean et al. (2012); Shi et al. (2009); Langford et al. (2009); Mcdonald et al. (2009); McDonald et al. (2010); Zinkevich et al. (2010); Agarwal et al. (2014); Agarwal & Duchi (2011)). These techniques distribute memory pressure to possibly infinite GPUs or server clusters, but do not reduce the total memory cost of DNNs.
Other researchers reduced the memory on finite hardware by optimizing computation graph of DNN and performing liveness analysis. The computation graph of DNNs describes the dependencies of tensors among layers. Liveness analysis recycles garbage to manage memory. These ideas were originated from compiler optimization (Aho et al. (1986)) and has been widely adopted by deep learning frameworks: Theano (Bastien et al. (2012); Bergstra et al. (2010)), MXNet (Chen et al. (2015)), Tensorflow (Abadi et al. (2016)) and CNTK (Yu et al. (2014)). Some other techniques efficiently swap data between CPU and GPU (Wang et al. (2018); Rhu et al. (2016)). These techniques usually cost extra I/O time and still do not actually reduce the total memory cost.
The closest work to our approach, Chen et al.(Chen et al. (2016)), uses the gradient checkpoints (similar to the subset of layers in Re-forwarding). However, (Chen et al. (2016)) only worked on linear computation graph via a heuristic algorithm. Our approach generates optimal solutions for both linear and arbitrary computation graphs. Our algorithm reduces training memory by manipulating high-level tensors, therefore is generalizable to any DNNs and their compositions. All previous techniques are compatible to our approach and can further improve the memory efficiency of DNN training.
# 3 LINEAR COMPUTATION GRAPH (LCG)
Denote a computation graph as $G = \left( E , V \right)$ . $E = \{ e _ { i } \}$ and $V = \{ v _ { i } \}$ are the edges and vertices in the computation graph, respectively. In deep neural networks, the vertices represent the tensors and the edges represent operations. Denote function $l ( \cdot )$ as a measure of memory cost. $V _ { R }$ is the subset of vertices saved during the first forward. $l ( v _ { i } )$ is defined as the memory cost of storing vertex $v _ { i }$ . For two adjacent vertices $v _ { i }$ and $v _ { j }$ in set $V _ { R }$ , the memory cost during re-forwarding from $v _ { i }$ to $v _ { j }$ defined as . Using th $\begin{array} { r } { l ( v _ { i } , v _ { j } ) = \sum _ { t = i + 1 } ^ { j - 1 } l ( v _ { t } ) } \end{array}$ , which is the sum of cost over all the vertices between cost of training with re-forwarding is formulated as $v _ { i }$ and $v _ { j }$
$$\operatorname* { m i n } _ { V _ { R } } \sum _ { i } l ( v _ { i } ) + \operatorname* { m a x } _ { j } l ( v _ { j } , v _ { j + 1 } ) ,$$
where the first term is the sum of the memory cost of all the stored tensors, and the second term is the maximal cost among the re-forwards.
For easy illustration, we start by formulating Re-forwarding on Linear Computation Graphs (LCG) (Fig. 2 (a)). For LCGs, Eqn. 1 can be solved in two cases.
 Figure 2: (a) Linear Computation Graph (LCG). “s” denotes the start vertex,“t” denotes the end vertex. (b) Arbitrary Computation Graph (ACG). The structure between $\mathbf { \dot { s } } ^ { \mathbf { \gamma } }$ and “t” vertices may contain arbitrary branches and connections.
Case(1) LCG with Identical Vertex Cost: Suppose a LCG has $N$ vertices, each of which has the same cost $\begin{array} { r } { l ( v _ { i } ) = \frac { 1 } { N } } \end{array}$ and the total cost is 1. Obviously, the optimal solution is reached when vertices in $V _ { R }$ are distributed evenly in the LCG. Suppose the number of vertices in $V _ { R }$ is $k$ . The total cost is then $\textstyle { \frac { k } { N } } + { \frac { 1 } { k } }$ . The optimal solution of Eqn. 1 is $k = \sqrt { N }$ , and the optimal total cost is $\textstyle { \frac { 2 } { \sqrt { N } } }$ .
Case (2) LCG with Non-identical Vertex Cost: When the assumption of identical cost does not hold, the solution to Eqn. 1 does not have an analytic form. Denote the maximal Re-forward cost $\operatorname* { m a x } _ { j } l ( v _ { j } , v _ { j + 1 } )$ as a constant $C$ , and the solution to Eqn. 1 is reduced to solving for $\operatorname* { m i n } _ { V _ { R } } \sum _ { i } l ( v _ { i } )$ .
# Algorithm 1 Linear Computation Graph (LCG) Solver
<table><tr><td>1: for each vertex pair (Ui,Uj) in G do</td><td></td></tr><tr><td>2:</td><td>Set the maximal term as l(Ui, Uj)</td></tr><tr><td>3:</td><td>Construct Accessibility Graph</td></tr><tr><td>4:</td><td>Find the shortest path in the Accessibility Graph as the solution</td></tr><tr><td>5:</td><td>Compute the actual total cost of the solution</td></tr><tr><td>6: 7:</td><td>Save the solution if it's better. Suppose the actual max term of this solution is B,and l(vi,Uj) = C,skip the loops where</td></tr></table>
All the Re-forward costs in an optimal solution satisfy the constraint $l ( v _ { j } , v _ { j + 1 } ) \le C$ . We solve Eqn. 1 by constructing a new graph, called Accessibility Graph $G ^ { A } = \left( E ^ { A } , V \right)$ . The edges of $G ^ { A }$ , called Accessibility Edge $e _ { i j } ^ { A }$ , exists between vertex $v _ { i }$ and $v _ { j }$ if and only if $l ( v _ { i } , v _ { j } ) \leq C$ . Now the problem of solving $\operatorname* { m i n } _ { V _ { R } } \sum _ { i } l ( v _ { i } )$ is equivalent to finding the shortest path from the source vertex and the target vertex in the Accessibility Graph. Notice that in the optimal solution, the max term equal the one maximal term among all $l ( v _ { i } , v _ { i + 1 } )$ terms. To traverse all possible max terms, we can simply compute the loss of every vertex pair and use it as a possible max term. Given a max term $C$ , suppose the actual max term of the solution under $C$ is $B$ and $B < C$ . It’s obvious that for all the max terms $B \leq m a x < C$ , the solution would be the same solution. Therefore, these max terms can be skipped. Algorithm 1 summarizes the process for searching an optimal solution for
LCG. Suppose there are $N$ vertices in the computation graph, the time complexity of Algorithm 1 is $O ( N ^ { 4 } ) ^ { \bar { 1 } }$ .
# 4 ARBITRARY COMPUTATION GRAPH(ACG)
As generalization of DNNs with LCG, we present theory2 and algorithms for DNNs with Arbitrary Computation Graphs (ACG), in particular the acyclic directed graphs(Fig. 2 (b)).
# 4.1 ASSUMPTION FOR OPTIMALITY
The optimal solution of Re-forwarding corresponds to an optimal division of ACG, such that memory cost (Eqn. 1) is minimum. We denote that an ACG is divided into end-to-end segments by a set of vertices. These end-to-end segments can have multiple endpoint vertices, for example, multiple source vertices and multiple target vertices. In this paper, as an assumption and also for simplification, these end-to-end segments are narrowed down to those with only one source vertex and one target vertex.
Another assumption in the case of ACG is imposed on the operation that has multiple inputs: one can compute the gradients of output with respect to the gradients of inputs without using the current value of inputs. Examples of operations that meet this assumption are: concatenation (the gradient of output is also the concatenation of the gradient of input), add (the gradient of output equals the gradient of input), etc. An example that breaks this assumption is multiplication (the gradient of input depends on the input). Fortunately, most of the popular networks meet this assumption. A simple way to remove this assumption is to store all the input tensors of this multi-input operation. However, this is not modeled by our loss function and may lead to sub-optimal solution.
In summary, there are only two assumptions in our approach: (1) the segment in a solution only has two endpoints (source and target). (2) the multi-input operation can compute the gradients of output without using the current value of input. Under these two assumptions, our approach is optimal for ACGs.
# 4.2 DEFINITION AND THEOREM
 Figure 3: Closed Set Examples: (a) Closed set in a graph. there cannot exist a closed set between $v _ { 2 }$ and $v _ { 4 }$ because $v _ { 3 }$ depends on $v _ { 1 }$ . There can exist a closed set between $v _ { 1 }$ and $v _ { 3 }$ because $v _ { 2 }$ doesn’t depend on any other vertex. (b) Splittable Closed Set (Type 1). $v _ { 2 }$ is the splitting vertex of $s _ { 1 3 }$ . (c) Branched Closed Set (Type 2). (d) Non-branched Closed Set (Type 3).
Definition 1. Closed Set: $A$ set s containing vertices and edges is a closed set if and only if it satisfies the following three properties: 1. All the vertices of $s$ have a common ancestor $v _ { i }$ and $a$ common descendent $v _ { j }$ ; 2. Denote the vertex subset of s as $V$ , edge subset as $E$ , and the set of edges between two arbitrary vertices of $V \cup \{ v _ { i } , v _ { j } \}$ is $E ^ { \prime }$ , the edge from $v _ { i }$ to $v _ { j }$ (if exists) as $e _ { i j }$ . $E$ must either be $E ^ { \prime }$ or $E ^ { \prime } - \left\{ e _ { i j } \right\}$ ; 3. An arbitrary ${ \bar { v } } _ { 1 } \in V$ doesn’t have edge with another arbitrary $v _ { 2 } \not \in V \cup \{ v _ { i } , v _ { j } \}$ . For multiple valid closed sets between $v _ { i }$ and $v _ { j }$ , we denote the largest one as $s _ { i j }$
In the definition of Closed Set, property 1 corresponds to the two endpoint assumption in section 4.1 where the two endpoints become $v _ { i }$ and $v _ { j }$ in the definition. Property 2 confines the edge subsets of $s$ to be one of two cases: $E ^ { \prime }$ or $E ^ { \prime } - \{ e _ { i j } \}$ . Both cases are valid although they have different edges. Property 3 guarantees the independence of such a set $s$ , meaning that the vertices within $s$ have no connections with other vertices outside $s \cup \{ v _ { i } , v _ { j } \}$ . As there might be multiple valid closed sets between $v _ { i }$ and $v _ { j }$ , which corresponds to the Branched Closed Set in Definition 5, we denote the largest closed set between $v _ { i }$ and $v _ { j }$ as $s _ { i j }$ and denote smaller closed set with an extra superscript, such as $s _ { i j } ^ { 1 }$ .
Definition 3. Splitting Vertex: A vertex $v _ { t } \in s _ { i j }$ is a splitting vertex of $s _ { i j }$ if and only if $s _ { i t }$ exists, $s _ { t j }$ exists and $s _ { i j } = s _ { i t } \cup s _ { t j } \cup \{ v _ { t } \}$ and $s _ { i t } \cap s _ { t j } ^ { \mathsf { ^ { * } } } = \varnothing$
Definition 4. Splittable Closed Set (Type 1): closed set with at least $I$ splitting vertex.
The definition of Splitting Vertex is to describe whether a closed set can be divided into two linearly arranged closed set. A closed set is splittable if it has at least 1 splitting vertex and is defined as Closed Set Type 1.
Definition 5. Branched Closed Set (Type 2): A closed set is branched if it has $O$ splitting vertex and can be divided into branches: $s _ { i j } = s _ { i j } ^ { 1 } \cup s _ { i j } ^ { 2 }$ and $s _ { i j } ^ { 1 } \cap s _ { i j } ^ { 2 } = \emptyset$
Definition 6. Non-branched Closed Set (Type 3): A closed set $s _ { i j }$ is non-branched if it has $O$ splitting vertex and no branch: $\mathbb { A } s _ { i j } ^ { 1 } \subsetneq s _ { i j }$
Among closed set with no splitting vertex, we categorize closed set with branches as Closed Set Type 2, and closed set without branches as Closed Set Type 3. The examples of different types of closed set are shown in Fig. 3.
 Figure 4: Example divisions of three types of closed sets. Members of a division are colored differently. (a) Division of closed set type 1. The division is $\{ [ s _ { 1 2 } ] , [ s _ { 2 3 } ] \}$ (b) Division of closed set type 2. The division is $\{ [ s _ { 1 2 } ^ { 1 } ] , [ s _ { 1 2 } ^ { \check { 2 } } ] , [ s _ { 1 2 } ^ { 3 } ] \}$ (c) Division of closed set type 3. The division is $\{ [ s _ { 1 2 } ] , [ s _ { 1 3 } ] , [ s _ { 2 3 } ] , [ s _ { 2 4 } ] , [ s _ { 3 4 } ] \}$
Definition 7. Maximal Split: $\{ [ s _ { p q } ] \}$ is a maximal split of non-branched $s _ { i j }$ if $\mathbf { \dot { \theta } } [ s _ { i j } ] = \cup \{ [ s _ { p q } ] \}$ and $\forall s _ { a b } , s _ { c d } \in \{ [ s _ { p q } ] \} , s _ { a b } \cap s _ { c d } \stackrel { \sim } { = } \hat { \emptyset }$ and $\mathcal { \bar { A } } \{ [ s _ { p q } ^ { \prime } ] \} \subsetneq \mathbf { \bar { \{ } } [ s _ { p q } ] \}$ such that $\cup \{ [ s _ { p q } ^ { \prime } ] \} = \left[ s _ { k t } \right] \subsetneq [ \bar { s _ { i j } } ]$
Definition 8. Division of Closed Set: For type 1, its division is the linear segments separated by all its splitting vertices; for type 2, its division is all its branches, any of which cannot be divided into more branches; for type 3, its division is its maximal split.
For closed set type 1, it can be divided into linearly arranged segments. For closed set type 2, it can be divided into branches. So here we investigate the division of closed set type 3. As we don’t want trivial division, for example, division that is formed by every edge in the closed set, we define Maximal Split to describe the split such that each member of the split is as large as possible. An example of maximal split is shown in Fig. 4 (c). In the definition of maximal split, the term maximal is implied by saying that any subset of this split cannot be combined into a single closed set. If it can, then the maximal split will be formed by this larger closed set and all the rest of the previous split. For closed set type 3, we use its maximal split as its division.
Definition 9. Division Tree: Division tree is a representation of a computation graph, where the root node is the whole computation graph, the leaf nodes are all the single tensors in the computation graph, and for a non-leaf node, its children is the members of its division.
With the division of 3 types of closed sets, the computation graph can be reorganized into a division tree (Figure 5) where a non-leaf node would be a closed set and its children would be its corresponding division. The root node is the whole computation graph, the largest closed set, and the leaf nodes would be single tensors in the computation graph. With division tree, we can apply divide-and-conquer to search for optimal solution.
 Figure 5: In this tree, the root node is the whole computation graph. All the leaf nodes are single tensors. Every other node except root and leaves is a member of the division of its parent.
Theorem 1. The division tree of a computation graph is unique and complete.
The uniqueness of the division tree indicates that the optimal solution of the division tree would also be the optimal solution of the whole computation graph. The completeness indicates that the division tree has included all the possible members of solution and represents the whole search space for the optimal solution. Theorem 1 is proved in the appendix.
# 4.3 ALGORITHM
We search optimal solutions for ACGs by solving several sub-problems using Algorithm 2-4 respectively. Based on these components, we present our final solver as Algorithm 5.
Algorithm 2 judges whether a vertex is a splitting vertex of a closed set. This algorithm mainly follows the Definition 3 and uses vertex set to check the property of a splitting vertex. With this algorithm, we can judge whether a closed set is type 1 and get its division if it is. Suppose there are $N$ vertices in $s _ { i j }$ , the time complexity of Algorithm 2 is $\bar { O ( N ^ { 2 } ) }$ .
1: Let $\{ v _ { i n } \}$ be the vertices of all the vertices within $\left[ s _ { i j } \right]$ that have paths to $v _ { t }$ . Let $\{ v _ { o u t } \}$ be the vertices of all the vertices within $\left[ s _ { i j } \right]$ that have paths from $v _ { t }$ . 2: if $\{ v _ { i n } \} \cup \{ V _ { o u t } \} \cup \{ v _ { t } \} = \{ v | v \in \lbrack s _ { i j } ^ { - } \rbrack \}$ and $\{ v _ { i n } \} \cap \{ V _ { o u t } \} = \emptyset$ and $\mathcal { \nexists } v _ { 1 } \in \{ v _ { i n } \} , v _ { 2 } \in \{ v _ { o u t } \}$ , $v _ { 1 } , v _ { 2 }$ have connections then 3: Return true 4: else 5: Return False
Algorithm 3 examines whether a closed set is branched. It uses a growing algorithm to check whether an independent subpart of this closed set can form a closed set. If a non-trivial closed set $s _ { i j }$ has an edge from $v _ { i }$ to $v _ { j }$ , then it’s branched because this edge itself can be treated as a closed set. Combined with Algorithm 2, we can know the type of a closed set and get its division if it’s type 2. Suppose there are $N$ vertices in $s _ { i j }$ , the time complexity of Algorithm 3 is $O ( N ^ { 2 } )$ .
Algorithm 4 addresses the problem of finding the maximal split, the division of a closed set type $3 \ s _ { i j }$ . First get all the possible closed sets within $s _ { i j }$ and use a property of maximal split to judge whether this closed set is a member of the maximal split. The property is: there cannot exist another closed set $s _ { a b } \subsetneq s _ { i j }$ but contains any member of this maximal split. This property is proved in Lemma 6 of the appendix. Suppose there are $N$ vertices in $s _ { i j }$ , the time complexity of Algorithm 4 is $O ( N ^ { 4 } )$ .
Algorithm 5 is the solver for ACGs. First, the division tree of the computation graph is built. Similar to the linear solver, a max term list is formed by the cost of all the possible closed sets for traverse. Given a max term, we propose a greedy idea: for a closed set, never expand it unless the its cost exceed the max term. In other word, if the max term doesn’t allow a leap over this closed set, we expand it, otherwise, do not expand it. Because once expanded, some cost of other vertices inside this closed set might be introduced, and the cost will never be smaller than unexpanded. If some children of the closed set type 1 are expanded, the rest reforms a few linear segments and still can be solved by the linear solver. If some children of the closed set type 2 or 3 are expanded, the other
1: if $s _ { i j }$ has at least 1 vertex then 2: if $s _ { i j }$ includes an edge from $v _ { i }$ to $v _ { j }$ then 3: Return true 4: else 5: Initialize a vertex set $s = \{ v _ { k } \}$ . $v _ { k } \in s _ { i j }$ is a randomly chosen vertex. 6: while True do 7: For any $v _ { t } \in s _ { i j } , v _ { t } \notin s$ that has connection to any $v _ { k } \in s$ , add $v _ { t }$ to $s$ . 8: if No more vertex can be added to $s$ then 9: Break 10: if $s = \{ v \in s _ { i j } \}$ then 11: Return false 12: else 13: Return true 14: else 15: Return false 1: for each vertex pair $( v _ { k } , v _ { t } )$ except $( v _ { i } , v _ { j } )$ in $\left[ s _ { i j } \right]$ do 2: For all the vertices $\{ v \}$ that have paths from $v _ { k }$ and have paths to $v _ { t }$ . 3: if $\nexists v _ { 2 } \notin \{ v \}$ and $v _ { 2 } \neq v _ { k } , v _ { t } , v _ { 2 }$ has connection to a $v _ { 1 } \in \{ v \}$ then 4: Form a closed set $s _ { k t }$ with all these vertices. 5: for each formed closed set $s _ { k t }$ do 6: If there doesn’t exist a $s _ { a b }$ such that $s _ { k t } \subsetneq s _ { a b } \subsetneq s _ { i j }$ , put $s _ { k t }$ into the maximal split.
members remain unexpanded and need no changes. Suppose there are $N$ vertices in computation graph, the time complexity of Algorithm 5 is $\bar { O ( N ^ { 4 } ) }$ .
# Algorithm 5 Arbitrary Computation Graph (ACG) Solver
1: Get all possible closed set and their costs. Use their costs to form the max term list. 2: Reorganize the computation graph into a division tree: from the root node (the computation graph), build its children from its division, until all the leaf nodes are single tensors. 3: for each possible max term $m$ in max term list $\{ m \}$ do 4: if current closed set is type 1 then 5: For all the children that have cost larger than current max term. Expand them and solve the next level. 6: All the expanded children have separated the current closed set to linear segments. Solve all the linear segments with current max term. 7: else 8: For all the children that have cost larger than current max term. Expand them and solve the next level. 9: All the other members remain unexpanded. 10: Summarize the total loss, save the current solution if it’s better.
# 5 EXPERIMENT
We evaluated Re-forwarding on two main groups of neural networks (1) networks with linear structures, such as Alexnet (Krizhevsky et al. (2012)) and vgg series (Simonyan & Zisserman (2014)). (2) networks with non-linear structures, such as Resnet series (He et al. (2016)), Densenet series (Huang et al. (2017)) and Inception net (Szegedy et al. (2016)). For each network in Table 1, an computation graph is built such that every vertex is a Float32 tensor, every edge is an operation, and the memory cost of a vertex is its tensor size (measured in MB). We compared Re-forwarding with Chen (Chen et al. (2016)) and the regular training approach. Note that Chen et al. (2016) only worked on linear computation graphs. To compare with (Chen et al. (2016)) on non-linear networks, we manually re-organized all the non-linear computation graphs into linear computation graphs with their splitting vertices, and fed them to Chen et al. (2016) (see Table 1 “Chen et al. (2016) manual (MB)”). Our Re-forwarding approach directly works on arbitrary computation graphs. We have also included a customized network (“CustomNet”), on which even the manual version of Chen’s approach is not applicable. Our approach directly works on all networks. The computation graph of this network is visualized in the appendix.
Table 1: Training memory usage and time overhead of the regular, Chen et al. (2016), Chen et al. (2016) manual and Re-forwarding (ours) approach on linear and non-linear computation graph.
<table><tr><td rowspan="2">Linear network</td><td rowspan="2">Regular (MB)</td><td rowspan="2">Chen et al.(2016) (MB)</td><td rowspan="2">Re-forwarding (ours) (MB)</td><td rowspan="2">off (ours)</td><td rowspan="2">Memory CutRegular Training</td><td rowspan="2">Space Efficient Training Time (s)</td><td rowspan="2">Time Overhead</td></tr><tr><td>Time (s)</td></tr><tr><td>Alexnet batch 1024</td><td>3550</td><td>3108</td><td>2620</td><td>26%</td><td>1.295</td><td>1.816</td><td>40%</td></tr><tr><td>Vgg11 batch 64</td><td>2976</td><td>2292</td><td>1802</td><td>39%</td><td>0.606</td><td>0.819</td><td>35%</td></tr><tr><td>Vgg13 batch 64</td><td>4152</td><td>2586</td><td>2586</td><td>38%</td><td>1.020</td><td>1.333</td><td>31%</td></tr><tr><td>Vgg16 batch 64</td><td>4470</td><td>2894</td><td>2586</td><td>42%</td><td>1.307</td><td>1.696</td><td>30%</td></tr><tr><td>Vgg19 batch 64</td><td>4788</td><td>2894</td><td>2502</td><td>48%</td><td>1.593</td><td>2.060</td><td>29%</td></tr><tr><td rowspan="2">Non-linear network</td><td rowspan="2">Regular</td><td rowspan="2">Chen et al. (2016)</td><td rowspan="2">Re-forwarding</td><td rowspan="2">Memory Cut</td><td rowspan="2">Regular Training</td><td rowspan="2">Space Efficient</td><td rowspan="2">Time</td></tr><tr><td></td></tr><tr><td></td><td>(MB)</td><td>manual (MB)</td><td>(ours) (MB)</td><td>off (ours)</td><td>Time (s)</td><td>Training Time (s)</td><td>Overhead</td></tr><tr><td>Resnet18 batch 256</td><td>5402</td><td>2898</td><td>2898</td><td>46%</td><td>1.144</td><td>1.599</td><td>40%</td></tr><tr><td>Resnet34 batch 128</td><td>3900</td><td>1936</td><td>1544</td><td>60%</td><td>1.041</td><td>1.419</td><td>36%</td></tr><tr><td>Resnet50 batch 64</td><td>5206</td><td>2332</td><td>1798</td><td>65%</td><td>0.740</td><td>1.027</td><td>40%</td></tr><tr><td>Resnetl01 batch 32</td><td>3812</td><td>1216</td><td>970</td><td>75%</td><td>0.624</td><td>0.853</td><td>37%</td></tr><tr><td>Resnetl52 batch 16</td><td>2810 3984</td><td>636</td><td>564</td><td>80%</td><td>0.450</td><td>0.628</td><td>39%</td></tr><tr><td>Densenet121 batch 32 Densenet161 batch 16</td><td>3658</td><td>1012 744</td><td>776 616</td><td>81%</td><td>0.558</td><td>0.789</td><td>42%</td></tr><tr><td>Densenet169 batch 32</td><td>4826</td><td>998</td><td>848</td><td>83% 82%</td><td>0.511 0.714</td><td>0.708</td><td>39%</td></tr><tr><td>Densenet201 batch 16</td><td>3164</td><td>600</td><td>582</td><td>82%</td><td>0.449</td><td>1.022</td><td>43%</td></tr><tr><td>Inceptionv3 batch 32</td><td>2976</td><td>1026</td><td>910</td><td></td><td></td><td>0.651</td><td>45%</td></tr><tr><td></td><td></td><td></td><td></td><td>69%</td><td>0.563</td><td>0.763</td><td>35%</td></tr><tr><td>CustomNet batch 64</td><td>3233</td><td>Not Applicable</td><td>1353</td><td>58%</td><td>1.226</td><td>1.648</td><td>34%</td></tr></table>
All experiments were conducted in Pytorch. To remove irrelevant GPU memory cost, such as model and Pytorch CUDA interface cost, all training memory costs were measured with two different input sizes and compute the difference between two measurements. For example, to measure the memory cost of Alexnet with input size $[ B a t c h S i z e , C h a n n e l , W i d t h , H e i g h t ] = [ 1 6 , 3 , 2 2 4 , 2 2 4 ] .$ , we first record the training memory of input [16, 3, 224, 224] as $r _ { 1 }$ , and input [32, 3, 224, 224] as $r _ { 2 }$ . The actual memory cost given [16, 3, 224, 224] input is measured as $r _ { 2 } \mathrm { ~ - ~ } r _ { 1 }$ . To use existing DNN implementations, the input of Inception net is $[ B a t c h S i z e , 3 , 3 0 0 , 3 0 0 ]$ , and the input of all other networks is $[ B a t c h S i z e , 3 , 2 2 4 , 2 \bar { 2 4 } ]$ . We also measure the training time (time of 1 training iteration) for the regular approach and our approach. Each time is measured as the average of 20 iterations. Our approach has the same training time as Chen’s approach and its manual version, see “Space Efficient Training Time” in Table 1.
Table. 1 shows that Re-forwarding cuts down huge amount of memory from the regular approach at reasonable time overheads: $2 6 \%$ space off and $4 0 \%$ time overhead for Alexnet, around $4 0 \%$ space off and $4 0 \%$ time overhead for $\mathrm { V g g }$ series. For Resnet series, the deeper network, the more memory was cut down. On the deepest Resnet152, $8 0 \%$ space off was achieved with only $3 9 \%$ time overhead. For Densenet series, more than $8 0 \%$ space off was achieved with around $4 0 \%$ time overhead. Notice that, Chen et al. (2016) only works on linear networks. Its results on non-linear networks were manually synthesized. Re-forwarding directly works on non-linear networks and constantly outperformed Chen et al. (2016) and its “manual” version. This supports our claim that Re-forwarding is optimal.
# 6 CONCLUSION
Re-forwarding is a fundamental approach that explores trade-off between memory and computation power of GPUs. By saving tensors at a subset of layers during forward, and conducting extra local forwards for backward, Re-forwarding makes it possible to train very heavy DNNs with finite GPU memory. To our knowledge, our theoretical and algorithmic results are the first top-down work that achieve an optimal memory solution for arbitrary computation graphs in DNNs. Re-forwarding can be further embedded and optimized with any low-level techniques such as distributed computing, GPU/CPU swapping, computation graph optimization and liveness analysis.
# 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.
Alekh Agarwal and John C Duchi. Distributed delayed stochastic optimization. In Advances in Neural Information Processing Systems, pp. 873–881, 2011.
Alekh Agarwal, Olivier Chapelle, Miroslav Dud´ık, and John Langford. A reliable effective terascale linear learning system. The Journal of Machine Learning Research, 15(1):1111–1133, 2014.
Alfred V Aho, Ravi Sethi, and Jeffrey D Ullman. Compilers, principles, techniques. Addison Wesley, 7(8):9, 1986.
Fred´ eric Bastien, Pascal Lamblin, Razvan Pascanu, James Bergstra, Ian Goodfellow, Arnaud Berg- ´ eron, Nicolas Bouchard, David Warde-Farley, and Yoshua Bengio. Theano: new features and speed improvements. arXiv preprint arXiv:1211.5590, 2012.
James Bergstra, Olivier Breuleux, Fred´ eric Bastien, Pascal Lamblin, Razvan Pascanu, Guillaume ´ Desjardins, Joseph Turian, David Warde-Farley, and Yoshua Bengio. Theano: A cpu and gpu math compiler in python. In Proc. 9th Python in Science Conf, volume 1, 2010.
Tianqi Chen, Mu Li, Yutian Li, Min Lin, Naiyan Wang, Minjie Wang, Tianjun Xiao, Bing Xu, Chiyuan Zhang, and Zheng Zhang. Mxnet: A flexible and efficient machine learning library for heterogeneous distributed systems. arXiv preprint arXiv:1512.01274, 2015.
Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016.
Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In Advances in neural information processing systems, pp. 1223–1231, 2012.
Kensho Hara, Hirokatsu Kataoka, and Yutaka Satoh. Learning spatio-temporal features with 3d residual networks for action recognition. In Proceedings of the ICCV Workshop on Action, Gesture, and Emotion Recognition, volume 2, pp. 4, 2017.
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.
Gao Huang, Zhuang Liu, Kilian Q Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, volume 1, pp. 3, 2017.
Shuiwang Ji, Wei Xu, Ming Yang, and Kai Yu. 3d convolutional neural networks for human action recognition. IEEE transactions on pattern analysis and machine intelligence, 35(1):221–231, 2013.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
John Langford, Alexander J Smola, and Martin Zinkevich. Slow learners are fast. Advances in Neural Information Processing Systems, 22:2331–2339, 2009.
Ryan Mcdonald, Mehryar Mohri, Nathan Silberman, Dan Walker, and Gideon S Mann. Efficient large-scale distributed training of conditional maximum entropy models. In Advances in Neural Information Processing Systems, pp. 1231–1239, 2009.
Ryan McDonald, Keith Hall, and Gideon Mann. Distributed training strategies for the structured perceptron. In Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pp. 456–464. Association for Computational Linguistics, 2010.
Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. CoRR, abs/1804.02767, 2018. URL http://arxiv.org/abs/1804.02767.
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems, pp. 91–99, 2015.
Minsoo Rhu, Natalia Gimelshein, Jason Clemons, Arslan Zulfiqar, and Stephen W Keckler. vdnn: Virtualized deep neural networks for scalable, memory-efficient neural network design. In Microarchitecture (MICRO), 2016 49th Annual IEEE/ACM International Symposium on, pp. 1–13. IEEE, 2016.
Qinfeng Shi, James Petterson, Gideon Dror, John Langford, Alex Smola, Alex Strehl, and Vishy Vishwanathan. Hash kernels. In Artificial intelligence and statistics, pp. 496–503, 2009.
Zheng Shou, Jonathan Chan, Alireza Zareian, Kazuyuki Miyazawa, and Shih-Fu Chang. Cdc: convolutional-de-convolutional networks for precise temporal action localization in untrimmed videos. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1417–1426. IEEE, 2017.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Bharat Singh, Hengduo Li, Abhishek Sharma, and Larry S. Davis. R-FCN-3000 at 30fps: Decoupling detection and classification. CoRR, abs/1712.01802, 2017. URL http://arxiv.org/ abs/1712.01802.
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2818–2826, 2016.
Linnan Wang, Jinmian Ye, Yiyang Zhao, Wei Wu, Ang Li, Shuaiwen Leon Song, Zenglin Xu, and Tim Kraska. Superneurons: Dynamic gpu memory management for training deep neural networks. arXiv preprint arXiv:1801.04380, 2018.
Dong Yu, Adam Eversole, Mike Seltzer, Kaisheng Yao, Zhiheng Huang, Brian Guenter, Oleksii Kuchaiev, Yu Zhang, Frank Seide, Huaming Wang, et al. An introduction to computational networks and the computational network toolkit. Microsoft Technical Report MSR-TR-2014–112, 2014.
Martin Zinkevich, Markus Weimer, Lihong Li, and Alex J Smola. Parallelized stochastic gradient descent. In Advances in neural information processing systems, pp. 2595–2603, 2010.
# A PROOF
A.1 LEMMAS
Lemma 1. If $s _ { i j } \cap s _ { k t } \neq \emptyset$ and $s _ { i j } \notin s _ { k t }$ and $s _ { k t } \notin s _ { i j }$ , then $s _ { i j } \cap s _ { k t } = s _ { k j }$ or $s _ { i j } \cap s _ { k t } = s _ { i t }$
Proof. Let $[ s _ { i j } ] \cap [ s _ { k t } ] = s = \{ v , e \}$ . Let $v _ { p }$ be the source vertex of $s$ , $v _ { q }$ be the target vertex of $s$ . If $v _ { p } \neq v _ { i }$ and $v _ { p } \ne v _ { k }$ and $v _ { q } \neq v _ { j }$ and $v _ { q } \ne v _ { t }$ , then $v _ { i } , v _ { k }$ has path to $v _ { p }$ and $v _ { j } , v _ { t }$ has path from $v _ { q }$ . Therefore, $v _ { p }$ has at least 2 immediate parents $v _ { a } , v _ { b }$ with $v _ { a } \in [ s _ { i j } ] , \bar { v _ { a } } \notin [ \bar { s _ { k t } } ] , v _ { b } \in [ s _ { k t } ] , v _ { b } \notin$ $\left[ s _ { i j } \right]$ . If so, the independence of $s _ { i j }$ and $s _ { k t }$ is violated. Therefore, $v _ { p }$ must be $v _ { i }$ or $v _ { k }$ .
Same on $v _ { q } , v _ { q }$ must be $v _ { j }$ or $v _ { t }$
If $v _ { p } = v _ { i } , v _ { q } = v _ { j }$ , then $s _ { i j } \subset s _ { k t }$ . If $v _ { p } = v _ { k } , v _ { q } = v _ { t }$ , then $s _ { k t } \subset s _ { i j }$ . Therefore, $v _ { p } = v _ { i } , v _ { q } = v _ { t }$ or $v _ { p } = v _ { k } , v _ { q } = v _ { j }$ . Suppose $v _ { p } = v _ { k } , v _ { q } = v _ { j }$ , let’s prove $s$ is a closed set.
With $s \subset s _ { k t }$ , $\forall v _ { 1 } \in s$ , $v _ { 1 }$ has no edge with $v _ { 2 } \notin [ s _ { k t } ]$ . With $s \subset s _ { i j } , \forall v _ { 1 } \in s , v _ { 1 }$ has no edge with $v _ { 2 } \notin [ s _ { i j } ]$ . Therefore, $\forall v _ { 1 } \in s$ , $v _ { 1 }$ has no edge with $\bar { v _ { 2 } } \notin [ s ]$ . The independence of $s$ is guaranteed.
In the discussion before, we can see the source vertex $v _ { p }$ of $s$ must be either $v _ { i }$ or $v _ { k }$ . If $v _ { i }$ and $v _ { k }$ are both the source vertices of $s$ , then $v _ { i } \in [ s _ { k t } ]$ and $v _ { k } \in [ s _ { i j } ]$ , $v _ { i }$ has path to $v _ { k }$ and $v _ { k }$ has path to $v _ { i }$ , which will force $v _ { i } = v _ { k }$ because the $s _ { i j }$ , $s _ { k t }$ is acyclic. Same on $v _ { q }$ , $s$ can only have 1 source vertex and 1 target vertex. Therefore, $s$ is closed set.
Therefore, $s _ { i j } \cap s _ { k t } = s _ { k j }$ or $s _ { i j } \cap s _ { k t } = s _ { i t }$
Lemma 2. The intersection of two closets $s = s _ { i } \cap s _ { j } \neq \emptyset$ is also a closet
Proof. Given the independence of $s _ { i }$ and $s _ { j }$ , the independence of $s$ is obvious. The remaining thing is whether $s$ only has 1 source vertex and 1 target vertex. In the proof of Lemma 1, we can see any source or target vertex of $s$ will eventually become source or target vertex of $s _ { i }$ and $s _ { j }$ . With simple discussion, we can have this lemma. □
Lemma 3. If $s _ { i j } \cap s _ { k t } = s _ { k j } \neq \emptyset$ , then $v _ { k }$ is the splitting vertex of $s _ { i j }$ and $v _ { j }$ is the splitting vertex of $s _ { k t }$
Proof. Let’s first prove that $v _ { k }$ is the splitting vertex of $s _ { i j }$
Let $s = s _ { i j } - \left[ s _ { k j } \right)$ . Obviously, $s _ { i j } = s \cup s _ { k j } \cup \{ v _ { k } \}$ and $s \cap s _ { k j } = \emptyset$ . We only need to prove that $s$ is closed set. For convenience, let’s denote $[ \bar { s } ] = s \cup \{ v _ { i } , v _ { k } \}$
$v _ { i }$ is obviously the only source vertex of $[ s ]$ because $v _ { i }$ is source vertex of $\left[ s _ { i j } \right]$ . We discuss the target vertex here. If $v _ { k }$ is not the target vertex of $[ s ]$ , as $v _ { k } \in [ s ]$ , $v _ { k }$ must have path to the target vertex $v$ of [s] and $v$ also has path to $v _ { j }$ as $v \in s _ { i j }$ . Because $v \notin [ s _ { k j } ]$ , in the path from $v$ to $v _ { j }$ , there exists an edge that connects a vertex $v _ { 1 } \in s$ with a vertex $v _ { 2 } \in s _ { k t }$ which violates the independence of $s _ { k t }$ . Therefore, the target vertex of [s] can only be $v _ { k }$ .
As $s \subset [ s _ { i j } )$ , $\forall v _ { 1 } \in s$ , $v _ { 1 }$ has no edge with $v _ { 2 } \notin [ s _ { i j } )$ . As $s _ { k j }$ is close, $\forall v _ { 1 } \in s , v _ { 1 }$ has no edge with $v _ { 2 } \in s _ { k j }$ . $\forall v _ { 1 } \in s$ , $v _ { 1 }$ can only have edge with $v _ { 2 } \in [ s ]$ . Thus the independence of $s$ is guaranteed. Therefore, $s$ is closed set, $v _ { k }$ is the splitting vertex of $s _ { i j }$ .
Same on $v _ { j } , v _ { j }$ is the splitting vertex of $s _ { k t }$
Lemma 4. If $s _ { i j }$ has $n$ splitting vertices $\{ v _ { 1 } , v _ { 2 } , . . . , v _ { n } \}$ , then $s _ { i j } ~ = ~ s _ { i 1 } \cup s _ { 1 2 } \cup \ldots \cup s _ { n j } \cup$ $\{ v _ { 1 } , v _ { 2 } , . . . , v _ { n } \}$
Proof. If $n = 2$ , the splitting vertices are $v _ { 1 } , v _ { 2 }$ , $s _ { i j } = s _ { i 1 } \cup s _ { 1 j } \cup \{ v _ { 1 } \} = s _ { i 2 } \cup s _ { 2 j } \cup \{ v _ { 2 } \}$ . Let $v _ { 1 } \in s _ { i 2 } , v _ { 1 } \neq v _ { 2 }$ , then $s _ { 1 j } \cap s _ { i 2 } = s _ { 1 2 } \neq \emptyset$ . According to Lemma 3, $v _ { 1 }$ is splitting vertex of $s _ { i 2 }$ and $v _ { 2 }$ is splitting vertex of $s _ { 1 j }$ . Therefore, $s _ { i j } = s _ { i 1 } \cup s _ { 1 2 } \cup s _ { 2 j } \cup \{ v _ { 1 } , v _ { 2 } \}$ .
For $n > 2$ , the lemma can be proved by repetitively using the conclusion in $n = 2$ .
Lemma 5. If the non-branched $s _ { i j }$ has a maximal split $\{ [ s _ { p q } ] \}$ , and $| \{ [ s _ { p q } ] \} | > 2$ , denote $\{ v \}$ as all the endpoint vertices of $[ s ] \in \{ [ s _ { p q } ] \}$ . Then $\forall v \in \{ v \} , v \neq v _ { i } , v _ { j }$ , $v$ is the endpoint vertex of at least 3 members of the maximal split.
Proof. If $v _ { b }$ is the endpoint vertex of only 2 members of the maximal split, suppose the 2 members are $s _ { a b }$ and $s _ { b c }$ . If so, $s _ { a b }$ and $s _ { b c }$ can be merged into $s _ { a c }$ . If $s _ { a c } \neq s _ { i j }$ , this violates the definition of maximal split. Otherwise, it violates the condition that $s _ { i j }$ is non-branched and $| \{ [ s _ { p q } ] \} | > 2$ . It is impossible that the 2 members are $s _ { a b }$ and $s _ { c b }$ because in this way $v _ { b }$ has no path to $v _ { j }$ and violates the definition of closed set. If $v _ { b }$ is the endpoint vertex of only 1 member of the maximal split, then $v _ { b }$ must be either $v _ { i }$ or $v _ { j }$ . Therefore, this lemma is proved.
Lemma 6. Any member of a maximal split can not be the subset of another closed set $s \subsetneq s _ { i j }$
Proof. Suppose the source vertex of $s$ is $v _ { 1 }$ and target vertex is $v _ { 2 }$ , a member $s _ { x y }$ of the maximal split is inside $s$ .
Suppose a member $s _ { a b }$ of the maximal split has its source vertex $v _ { a }$ inside $s$ and target vertex $v _ { b }$ outside $s$ . Then the boundary vertex (the vertex that has edges to the non-overlapping parts of both sets) must be $v _ { 2 }$ , otherwise the independence of $s$ will be violated. Notice that $v _ { 2 }$ is inside $s _ { a b }$ and the independence of $s _ { a b }$ needs to be guaranteed, for $\forall v _ { p } \in s , v _ { p } \notin s \cap s _ { a b } , v _ { q } \in s \cap s _ { a b } ,$ $v _ { p }$ has no edge with $v _ { q }$ . Therefore, $v _ { a }$ is a splitting vertex of $s$ .
Similarly, if $s _ { b a }$ has its target vertex $v _ { a }$ inside $s$ and source vertex $v _ { b }$ outside $s$ , the boundary vertex must be $v _ { 1 }$ and $v _ { a }$ is a splitting vertex of $s$ .
For the closed set $s$ , from the discussion above, we know that there are at most 2 members of the maximal split that can overlap with $s$ . Other members must be either completely inside $s$ or completely outside $s$ . Let’s discuss the number of members that overlaps with $s$ .
If there are 0 member that overlaps with $s$ , $s$ is the union of a subset of members of the maximal split, which violates the definition of maximal split.
If there is 1 member that overlaps with $s$ , suppose the corresponding splitting vertex is $v _ { b }$ , and the boundary vertex is actually $v _ { 2 }$ . Then $s _ { 1 b }$ is a closed set containing $s _ { x y }$ and corresponds to the situation of 0 member overlapping. $s _ { 1 b }$ is the union of a subset of members of the maximal split, and violates the definition of maximal split.
If there are 2 members that overlaps with $s$ , suppose they generate two different splitting vertex $v _ { a }$ and $v _ { b }$ . Then $s _ { a b }$ is a closed set containing $s _ { x y }$ and corresponds to the situation of 0 member overlapping. $s _ { a b }$ is the union of a subset of members of the maximal split, and violates the definition of maximal split.
If they generate the same splitting vertex $v _ { b }$ , from lemma 5, $v _ { b }$ is also the endpoint vertex of at least 1 other member $s _ { a b }$ which has to be inside $s$ . Suppose the two overlapping members are $s _ { c b }$ that contains $v _ { 1 }$ , and $s _ { b d }$ that contains $v _ { 2 }$ . As the source vertex of $s$ , $v _ { 1 }$ has path to $v _ { b }$ and $v _ { 1 }$ has path to $v _ { a }$ , which implies $v _ { b }$ has path to $v _ { a }$ . As the target vertex of $s$ , $v _ { 2 }$ has path from $v _ { b }$ and $v _ { 2 }$ has path from $v _ { a }$ , which implies $v _ { b }$ has path from $v _ { a }$ . This conflicts with the fact that $s$ is acyclic. Therefore, this case is not possible.
Therefore, this lemma is proved.
Lemma 7. If non-branched $s _ { i j }$ has at least 1 vertex but has 0 splitting vertex, then its maximal split has length $> 2$
Proof. As $s _ { i j }$ is not branched, the members of its maximal split cannot have the starting vertex as $v _ { i }$ and the ending vertex as $v _ { j }$ at the same time. If $s _ { i j }$ has at least 1 vertex, and its maximal split has length 2, then its maximal split must be $\{ [ s _ { i k } ] , [ s _ { k j } ] \}$ , and $v _ { k }$ will be the splitting vertex of $s _ { i j }$ , which violates that $s _ { i j }$ has no splitting vertex.
If $s _ { i j }$ has at least 1 vertex without splitting vertex, it has at least 2 edges and cannot have a trivial length 1 maximal split. Therefore, its maximal split has length $> 2$ □
# A.2 UNIQUENESS OF DIVISION TREE
To prove this uniqueness, we simply discuss the division uniqueness of closed set type 1, 2 and 3.
A.2.1 UNIQUENESS OF DIVISION OF CLOSED SET TYPE 1
Proof. By the definition of this division and Lemma 4, the uniqueness of the division is equivalent to the uniqueness of the splitting vertex set of a closed set type 1. The splitting vertex set is obviously unique. □
# A.2.2 UNIQUENESS OF DIVISION OF CLOSED SET TYPE 2
Proof. If there exists another division, there must be a branch member $s _ { i j } ^ { 1 }$ in division 1 and a branch member $s _ { i j } ^ { 2 }$ in division 2, where $s _ { i j } ^ { 1 } \cap s _ { i j } ^ { 2 } \neq \emptyset$ and $s _ { i j } ^ { 1 } \neq s _ { i j } ^ { 2 }$ .
Denote $s = s _ { i j } ^ { 1 } \cap s _ { i j } ^ { 2 }$ . By Lemma 1 and 2, $s = s _ { i j } ^ { 3 }$ is also a closed set. As $s _ { i j } ^ { 1 }$ and $s _ { i j } ^ { 2 }$ cannot be divided into more branches, $s = s _ { i j } ^ { 1 } = s _ { i j } ^ { 2 }$ . Therefore, the division of closed set type 2 is unique.
# A.2.3 UNIQUENESS OF DIVISION OF CLOSED SET TYPE 3
Proof. As the closed set in the division tree has at least 1 vertex, with Lemma 7, we know that the division, i.e. maximal split of a closed set type $3 \ s _ { i j }$ within the division tree will have length $> 2$ . Denote this maximal split as $\{ [ s _ { p q } ] \}$ , we only need to prove this maximal split is unique.
Suppose there is a another different maximal split $\{ [ s _ { p q } ^ { \prime } ] \}$ , let us only check the difference between $\{ [ s _ { p q } ] \}$ and $\{ [ s _ { p q } ^ { \prime } ] \}$ . Denote $\{ [ s _ { k t } ] \}$ and $\{ [ s _ { k t } ^ { \prime } ] \}$ with $\{ [ s _ { p q } ] \} - \{ [ s _ { k t } ] \} = \{ [ s _ { p q } ^ { \prime } ] \} - \{ [ s _ { k t } ^ { \prime } ] \}$ and $\mathbb { A } s \in \{ [ s _ { k t } ] \} , \dot { s ^ { \prime } } \in \{ [ s _ { k t } ^ { \prime } ] \} , s = s ^ { \prime }$ . As $\{ [ s _ { p q } ] \} - \{ [ s _ { k t } ] \} = \{ [ s _ { p q } ^ { \prime } ] \} - \{ [ s _ { k t } ^ { \prime } ] \}$ , we have $\cup \{ [ s _ { k t } ] \} =$ $\cup \{ [ s _ { k t } ^ { \prime } ] \}$
Obviously, $| \{ [ s _ { k t } ] \} | \ge 2$ and $| \{ [ s _ { k t } ^ { \prime } ] \} | \ge 2$ . Denote $\{ v \}$ as all the endpoint vertices of $[ s ] \in \{ [ s _ { k t } ] \}$ , and $\{ v ^ { \prime } \}$ for $\{ [ s _ { k t } ^ { \prime } ] \}$ . Obviously $\{ v \} \neq \emptyset$ and $\{ v ^ { \prime } \} \ne \bar { \emptyset }$ . As $s _ { i j }$ is non-branched, $\{ v \} \cup \{ v _ { i } , v _ { j } \} -$ $\{ v _ { i } , v _ { j } \} \neq \emptyset$ and $\{ v ^ { \prime } \} \cup \{ v _ { i } , v _ { j } \} - \{ v _ { i } , v _ { j } \} \neq \emptyset$ .
Suppose $s _ { a b }$ $, s _ { b c } \in \{ [ s _ { k t } ] \}$ , according to Lemma 5, there’s at least 1 other member that has $v _ { b }$ as endpoint vertex. Suppose the other endpoint of this member is $v _ { d }$ . Let’s discuss whether $v _ { b } \in \{ v ^ { \prime } \}$ and whether $v _ { d } \in \cup \{ [ s _ { k t } ] \}$ .
If $v _ { d } \not \in \cup \{ [ s _ { k t } ] \}$ , then $v _ { b }$ must occur in $\{ v ^ { \prime } \}$ . Otherwise, $v _ { b }$ would be inside a closed set which would be violated by $v _ { d }$ . Given $v _ { b } \in \{ v ^ { \prime } \}$ , as $s _ { a b } \notin \{ [ s _ { k t } ^ { \prime } ] \}$ , suppose $s _ { e b } \in \{ [ s _ { k t } ^ { \prime } ] \}$ and $s _ { a b } \cap s _ { e b } \neq \emptyset$ . If $v _ { a } \in s _ { e b }$ , from Lemma 1, $s _ { e b }$ cannot be close. If $v _ { e } \in s _ { a b }$ , from Lemma 5, $s _ { a b }$ cannot be close. In this case, there cannot exist another different maximal split.
If $v _ { d } \in \cup \{ [ s _ { k t } ] \}$ , then $s _ { b d } \in \{ \left[ s _ { k t } \right] \}$ . If $v _ { b } \in \{ v ^ { \prime } \}$ , we can use the same logic above to show this is impossible. Therefore, $v _ { b } \notin \{ v ^ { \prime } \}$ and $s _ { b d }$ is included by a closed set $s$ . From Lemma 6, this is impossible. In this case, there cannot exist another different maximal split.
In all the cases, there cannot exist another different maximal split. Therefore, the maximal split is unique. □
# A.3 COMPLETENESS OF DIVISION TREE
Similar with the uniqueness, the completeness of division tree is equivalent to the completeness of the division of a closed set. To prove this completeness, we simply discuss the division completeness of closed set type 1, 2 and 3.
An equivalent statement of the division completeness is: there doesn’t exist a closed set whose head is in one member of the division and whose tail is in another member of the division.
# A.3.1 COMPLETENESS OF DIVISION OF CLOSED SET TYPE 1
Proof. Suppose there exists a closed set $s$ whose head $v _ { p }$ is in one member $s _ { 1 }$ and whose tail $v _ { q }$ is in another member $s _ { 2 }$ .
If $v _ { p }$ is not an endpoint of $s _ { 1 }$ , then according to Lemma 3, $v _ { p }$ is also a splitting vertex in $s _ { 1 }$ and can break $s _ { 1 }$ into smaller segments, which makes $v _ { p }$ also the splitting vertex of the whole closed set. However, $v _ { p }$ is not the splitting vertex of the whole closed set $s _ { i j }$ . This also applies to $v _ { q }$ . Therefore, the division of closed set type 1 is complete. □
# A.3.2 COMPLETENESS OF DIVISION OF CLOSED SET TYPE 2
Proof. Suppose there exists a closed set $s$ whose head $v _ { p }$ is in one branch $s _ { i j } ^ { 1 }$ and whose tail $v _ { q }$ is in another branch $s _ { i j } ^ { 2 }$ . As $s$ crosses $s _ { i j } ^ { 1 }$ and $s _ { i j } ^ { 2 }$ , there exists a boundary vertex $v$ in $s$ , which belongs to $[ s _ { i j } ^ { 1 } ]$ and has direct connection with a vertex outside $[ s _ { i j } ^ { 1 } ]$ . If $v$ is not $v _ { i }$ or $v _ { j }$ , it will violate the independence of $s _ { i j }$ . If $v = v _ { i }$ , as $v _ { i }$ is the head of both $s _ { i j } ^ { 1 }$ and $s _ { i j } ^ { 2 }$ , it cannot be the boundary vertex, same when $v = v _ { j }$ . Therefore, there cannot exist such a closed set $s$ . The division of closed set type 2 is complete. □
# A.3.3 COMPLETENESS OF DIVISION OF CLOSED SET TYPE 3
Proof. Suppose there exists a closed set $s$ whose head $v _ { p }$ is in one member $s _ { 1 }$ and whose tail $v _ { q }$ is in another member $s _ { 2 }$ . Same with closed set type 2, the boundary vertex $v$ has to be the endpoint vertex of $s _ { 1 }$ or the independence of $s _ { 1 }$ will be violated. According to Lemma 5, $v$ is the endpoint vertex of at least 3 members, meaning that $v$ will at least have 1 connection with another closed set $s _ { 3 }$ . To maintain the independence of $s$ , $s$ has to include $s _ { 3 }$ as well. However, $s _ { 3 }$ also has its endpoints. This will propagate until $s$ becomes the whole closed set. Therefore, there cannot exist such a closed set $s$ . The division of closed set type 3 is complete. □
# B COMPLEXITY ANALYSIS
# B.1 ALGORITHM 1
Suppose there are $N$ vertices in the computation graph. There are $O ( N ^ { 2 } )$ vertex pairs. For each vertex pair, the time cost is mainly on constructing accessibility graph and finding the shortest path. Denote the source vertex of the whole computation graph as $v _ { 0 }$ . To construct an accessibility graph, first we traverse the linear computation graph, record the accumulated sum $l ( v _ { 0 } , v _ { i } )$ for each vertex $v _ { i }$ , and form a table of $l ( v _ { i } , v _ { j } ) { \ ' } = l ( v _ { 0 } , { \bar { v } } _ { j } ) { \ ' } - l ( v _ { 0 } , v _ { i } ) - l ( v _ { i } )$ . These steps will cost $O ( N ^ { 2 } )$ . Then we traverse each $( v _ { i } , v _ { j } )$ pair to form the edges of the accessibility graph, which also cost $O ( N ^ { 2 } )$ . Solving the shortest path problem in accessibility graph will also cost $O ( N ^ { 2 } )$ as the accessibility graph has $N$ vertices. Therefore, the overall time complexity of Algorithm 1 would be $O ( N ^ { 4 } )$ .
The space complexity would be $O ( N ^ { 2 } )$ for the table of $l ( v _ { i } , v _ { j } )$ and the accessibility graph itself.
# B.2 ALGORITHM 2
Suppose there are $N$ vertices in the closed set $s _ { i j }$ . In step 1, getting $\{ v _ { i n } \}$ and $\{ v _ { o u t } \}$ will cost $O ( N )$ time for traversing the ancestors and descendents of $v _ { t }$ . In our implementation, an array $a$ of length $N$ is used to represent $\{ v _ { i n } \}$ and $\{ v _ { o u t } \}$ : $a _ { i } = 1$ indicates $v _ { i } \in \overline { { \{ v _ { i n } \} } }$ , $a _ { i } = 2$ indicates $v _ { i } \in \{ v _ { o u t } \}$ and $a _ { i } = 0$ indicates $v _ { i } \notin \{ v _ { i n } \} \cup \{ v _ { o u t } \}$ . Then the union check and intersection check in step 2 can be done in $O ( N )$ . The connection check in step 2 traverses the edges and costs $O ( N ^ { 2 } )$ . Other steps are $O ( 1 )$ . Therefore, the overall time complexity of Algorithm 2 would be $O ( N ^ { 2 } )$ .
The space complexity would be $O ( N )$ for the array to represent $\{ v _ { i n } \}$ and $\{ v _ { o u t } \}$
# B.3 ALGORITHM 3
Suppose there are $N$ vertices in the closed set $s _ { i j }$ . The most time consuming part will be from step 5 to step 13. Other steps are $O ( 1 )$ . In step 5 to step 13, every edge between two vertices in $s _ { i j }$ is at most visited once and there are $O ( N ^ { 2 } )$ edges. Therefore, the overall time complexity of Algorithm 3 would be $O ( N ^ { 2 } )$ .
In our implementation, an array of length $N$ is used to represent the vertex set $s = \{ v _ { k } \}$ . Therefore, the space complexity would be $O ( N )$ .
# B.4 ALGORITHM 4
Suppose there are $N$ vertices in the closed set $s _ { i j }$ and there are $O ( N ^ { 2 } )$ vertex pairs. For each vertex pair, the connection check in step 2-4 will cost $O ( N ^ { 2 } )$ , similar to the connection check in Algorithm 2. Thus step 1-4 will cost $O ( N ^ { 4 } )$ . In our implementation, for each vertex in the closed set $s _ { i j }$ , we select the largest formed closed set $s _ { k t }$ that contains this vertex. The closed set number is then reduced to $O ( N )$ and step 5-6 can be done in $O ( N ^ { 3 } )$ . Therefore, the overall time complexity of Algorithm 4 would be $O ( N ^ { 4 } )$
As $O ( N ^ { 2 } )$ closed sets can be formed in step 1-4 and each closed set is a smaller DAG with $O ( N )$ vertices and cost $O ( N ^ { 2 } )$ space, the space complexity would be $O ( N ^ { 4 } )$ for all these closed sets.
# B.5 ALGORITHM 5
Step 1 is similar to step 1-4 in Algorithm 4 with $s _ { i j }$ being the whole computation graph. Therefore, the overall time complexity for step 1 is $O ( N ^ { 4 } )$ .
In step 2, the complexity of building division tree is related to the complexity of getting the division of a closed set. For closed set type 1, Algorithm 2 is called for each vertex to get all splitting vertices. Thus getting the division of closed set type 1 cost $O ( N ^ { 3 } )$ time. For closed set type 2, Algorithm 3 is used to solve for its division and costs $O ( N ^ { 2 } )$ time. For type 3, Algorithm 4 is called to solve for its division. Notice that we have already stored all possible closed sets in step 1, step 1-4 in Algorithm 4 can be skipped and thus the time complexity of getting the division of closed set type 3 is reduced to $O ( N ^ { 3 } )$ . Therefore, getting the division of an arbitrary closed set costs $O ( N ^ { 3 } )$ time. In depth $i$ of the division tree, suppose there are $k$ closed sets, and the number of vertices of $j$ th closed sets is $a _ { j }$ . To build depth $i + 1$ of the division tree, we need to get the division of all these closed sets, which will cost $\textstyle \sum _ { j } O ( a _ { j } ^ { 3 } )$ . As $\textstyle \sum _ { j } a _ { j } \leq N$ , we have $\begin{array} { r } { \sum _ { j } O ( a _ { j } ^ { 3 } ) \le O ( N ^ { 3 } ) } \end{array}$ . As the depth of division tree is at most $N$ , the overall time complexity of step 2 would be $O ( N ^ { 4 } )$ .
For step 3-10, if the computation graph is linear, the ACG solver will reduce to LCG solver and has complexity $O ( N ^ { 4 } )$ . If the computation graph is non-linear, the length of $\{ m \}$ would be $O ( N ^ { 2 } )$ for there are $O ( N ^ { 2 } )$ vertex pair. For a max term $m$ , from step 4-10, the actual time costing part will be step 6 which calls the LCG solver, and other steps would be $O ( 1 )$ . Suppose the LCG solver is called $k$ times, solving problems of $a _ { 1 } , a _ { 2 } , . . . , a _ { k }$ vertices. The total complexity of this would be $O ( a _ { 1 } ^ { 4 } ) + O ( a _ { 2 } ^ { 4 } ) + \ldots + \bar { O } ( a _ { k } ^ { 4 } )$ . Notice that $a _ { 1 } + a _ { 2 } + \ldots + a _ { k } \leq N$ for the fact that any vertex in the computation graph would not be solved twice by LCG solver, we have $a _ { 1 } ^ { 4 } + a _ { 2 } ^ { 4 } + \ldots + a _ { k } ^ { 4 } \leq N ^ { 4 }$ . Therefore the time complexity of step 3-10 is ${ \cal O } \dot { ( } N ^ { 4 } )$ .
Step 1 would cost $O ( N ^ { 4 } )$ space to store all the possible closed sets. Step 2 would cost $O ( N ^ { 2 } )$ space for the division tree. Step 3-10 would cost $\dot { O } ( N ^ { 2 } )$ space for calling LCG solver.
In conclusion, the overall time complexity of Algorithm 5 is $O ( N ^ { 4 } )$ and the overall space complexity of Algorithm 5 is $O ( N ^ { 4 } )$ .
Table 2: Actual Runtime of ACG Solver and Theoretical Analysis
<table><tr><td>Linear network</td><td>Number of vertices</td><td>Runtime (s)</td><td>Measured Memory Cutoff</td><td>TheoreticalMemory Cutoff</td></tr><tr><td>Alexnet Vgg11</td><td>12 17</td><td>0.03 0.09</td><td>26% 39%</td><td>42% 50%</td></tr><tr><td>Vgg13 Vgg16</td><td>19 22</td><td>0.15 0.26</td><td>38% 42%</td><td>47%</td></tr><tr><td>Vgg19</td><td>25</td><td>0.44</td><td>48%</td><td>51%</td></tr><tr><td>Non-linear networkNumber of vertices</td><td></td><td>Runtime (s)</td><td>Measured Memory Cutoff</td><td>53%</td></tr><tr><td>Resnet18 Resnet34</td><td>51 91</td><td>0.09</td><td>46%</td><td>TheoreticalMemory Cutoff 63%</td></tr><tr><td>Resnet50</td><td>125</td><td>0.53 1.27</td><td>60% 65%</td><td>73% 75%</td></tr><tr><td>Resnet101 Resnet152</td><td>244</td><td>12.40</td><td>75%</td><td>81%</td></tr><tr><td>Densenet121</td><td>363 306</td><td>59.34 293.75</td><td>80%</td><td>84%</td></tr><tr><td>Densenet161</td><td>406</td><td>1537.82</td><td>81%</td><td>81%</td></tr><tr><td>Densenet169</td><td>426</td><td>2356.47</td><td>83% 82%</td><td>84%</td></tr><tr><td>Densenet201</td><td>506</td><td>7335.35</td><td>82%</td><td>84%</td></tr><tr><td>Inceptionv3</td><td>219</td><td>7.68</td><td>69%</td><td>86%</td></tr><tr><td>Custom</td><td>35</td><td>0.05</td><td>58%</td><td>76% 68%</td></tr></table>
# C RUNTIME AND THEORETICAL ANALYSIS
The number of vertices in the computation graph and the runtime of ACG Solver (Algorithm 5) for each network are listed in Table 2. All the runtimes were measured on a single core of CPU i7-8700.
Notice that the runtime is measured on only 1 cpu core, it can be massively reduced by parallelization on multiple cpu cores. The runtime can also be further reduced through a better implementation as our implementation is a prototype.
Although it might be concerning that the runtime is too much for some deep networks, it is still relatively small compared to training processes which might cost days or even weeks. More importantly, solving the optimal solution for a network is an one-time effort. The optimal solutions for all popular networks will be released online for people to use without taking the time to run ACG solver.
To see how well the reality matches with the theory, we also compare the measured memory cut off and theoretical memory cut off (given by Algorithm 5) in Table 2. Observe that all the measured memory cut off are slightly lower than theoretical memory cut off. This is because, in implementation, we assume that the whole input tensors of each operation are always stored for backward. In reality, some operations only need to store small tensors for backward. For example, batchnormalization only needs a few statistics for backward and doesn’t need the whole input tensor.
# D VISUALIZATION
We visualize the computation graph of Alexnet, vgg11, vgg13, vgg16 ,vgg19 and CustomNet and the solution of our approach (in green) and the solution of Chen’s approach (in red). In the computation graphs, the cost of each vertex and the actual operation of each edge are also marked. The cost of each vertex is the size of this tensor during forward given the input as [1, 3, 224, 224] $( [ 1 , 3 , 3 0 0 , 3 0 0 ]$ for inception v3). For example, in Alexnet, the input is [1, 3, 224, 224] and thus the source vertex has the cost $1 5 0 5 2 8 = 1 \times 3 \times 2 2 4 \times 2 2 4$ . After 2D convolution and relu, the tensor becomes [1, 64, 55, 55] and thus the second vertex has the cost $1 9 3 6 0 0 = 1 \times 6 4 \times 5 5 \times 5 5$ .
 Figure 6: Endpoint vertices found on Alexnet
 Figure 7: Endpoint vertices found on vgg11
 Figure 8: Endpoint vertices found on vgg13
 Figure 9: Endpoint vertices found on vgg16
 Figure 10: Endpoint vertices found on CustomNet, Selected vertices(green) of our approach, Chen’s approach not applicable123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163# CHARACTERIZING SPARSE CONNECTIVITY PATTERNS IN NEURAL NETWORKS
Anonymous authors Paper under double-blind review
# ABSTRACT
We propose a novel way of reducing the number of parameters in the storagehungry fully connected layers of a neural network by using pre-defined sparsity, where the majority of connections are absent prior to starting training. Our results indicate that convolutional neural networks can operate without any loss of accuracy at less than $0 . 5 \%$ classification layer connection density, or less than $5 \%$ overall network connection density. We also investigate the effects of pre-defining the sparsity of networks with only fully connected layers. Based on our sparsifying technique, we introduce the ‘scatter’ metric to characterize the quality of a particular connection pattern. As proof of concept, we show results on CIFAR, MNIST and a new dataset on classifying Morse code symbols, which highlights some interesting trends and limits of sparse connection patterns.
# 1 INTRODUCTION
Neural networks (NNs) in machine learning systems are critical drivers of new technologies such as image processing and speech recognition. Modern NNs are gigantic in size with millions of parameters, such as the ones described in Alexnet (Krizhevsky et al., 2012), Overfeat (Sermanet et al., 2013) and ResNet (He et al., 2016). They therefore require an enormous amount of memory and silicon processing during usage. Optimizing a network to improve performance typically involves making it deeper and adding more parameters (Simonyan & Zisserman, 2015; Szegedy et al., 2015; Huang et al., 2016), which further exacerbates the problem of large storage complexity. While the convolutional (conv) layers in these networks do feature extraction, there are usually fully connected layers at the end performing classification. We shall henceforth refer to these layers as connected layers $( C L s )$ , of which fully connected layers $( F C L s )$ are a special case. Owing to their high density of connections, the majority of network parameters are concentrated in FCLs. For example, the FCLs in Alexnet account for $9 5 . 7 \%$ of the network parameters (Zhang et al., 2016).
We shall refer to the spaces between CLs as CL junctions (or simply junctions), which are occupied by connections, or weights. Given the trend in modern NNs, we raise the question – “How necessary is it to have FCLs?” or, in other words, “What if most of the junction connections never existed? Would the resulting sparsely connected layers (SCLs), when trained and tested, still give competitive performance?” As an example, consider a network with 2 CLs of 100 neurons each and the junction between them has 1000 weights instead of the expected 10,000. Then this is a sparse network with connection density of $10 \%$ . Given such a sparse architecture, a natural question to ask is “How can the existing 1000 weights be best distributed so that network performance is maximized?”
In this regard, the present work makes the following contributions. In Section 2, we formalize the concept of sparsity, or its opposite measure density, and explore its effects on different network types. We show that CL parameters are largely redundant and a network pre-defined to be sparse before starting training does not result in any performance degradation. For certain network architectures, this leads to CL parameter reduction by a factor of more than 450, or an overall parameter reduction by a factor of more than 20. In Section 2.4, we discuss techniques to distribute connections across junctions when given an overall network density. Finally, in Section 3, we formalize pre-defined sparse connectivity patterns using adjacency matrices and introduce the scatter metric. Our results show that scatter is a quick and useful indicator of how good a sparse network is.
# 2 PRE-DEFINED SPARSITY
As an example of the footprint of modern NNs, AlexNet has a weight size of $2 3 4 \mathrm { M B }$ and requires 635 million arithmetic operations only for feedforward processing (Zhang et al., 2016). It has been shown that NNs, particularly their FCLs, have an excess of parameters and tend to overfit to the training data (Denil et al., 2013), resulting in inferior performance on test data. The following paragraph describes several previous works that have attempted to reduce parameters in NNs.
Dropout (deletion) of random neurons (Srivastava et al., 2014) trains multiple differently configured networks, which are finally combined to regain the original full size network. Chen et al. (2015) randomly forced the same value on collections of weights, but acknowledged that “a significant number of nodes [get] disconnected from neighboring layers.” Other sparsifying techniques such as pruning and quantization (Han et al., 2016; 2015; Zhou et al., 2016; Gong et al., 2014) first train the complete network, and then perform further computations to delete parameters. Sindhwani et al. (2015) used low rank matrices to impose structure on network parameters. Srinivas et al. (2016) proposed a regularizer to reduce parameters in the network, but acknowledged that this increased training complexity. In general, all these architectures deal with FCLs at some point of time during their usage cycle and therefore, do not permanently solve the parameter explosion problem of NNs.
# 2.1 OUR METHODOLOGY
Our attempt to simplify NNs is to pre-define the level of sparsity, or connection density, in a network prior to the start of training. This means that our network always has fewer connections than its FCL counterpart; the weights which are absent never make an appearance during training or inference. In our notation, a NN will have $J$ junctions, i.e. $J + 1$ layers, with $\{ N _ { 1 } , \stackrel { \textstyle - } { N } _ { 2 } , \cdot \cdot \cdot \stackrel { \textstyle - } { , } N _ { J + 1 } \}$ being the number of neurons in each layer. $N _ { i }$ and $N _ { i + 1 }$ are respectively the number of neurons in the earlier (left) and later (right) layers of junction $i$ . Every left neuron has a fixed number of edges going from it to the right, and every right neuron has a fixed number of edges coming into it from the left. These numbers are defined as fan-out $( f o _ { i } )$ and fan-in $( f i _ { i } )$ , respectively. For conventional FCLs, $f o _ { i } = N _ { i + 1 }$ and $f i _ { i } = N _ { i }$ . We propose SCLs where $f o _ { i } < N _ { i + 1 }$ and $f i _ { i } < N _ { i }$ , such that $N _ { i } \times f o _ { i } = N _ { i + 1 } \times f i _ { i } = W _ { i }$ , the number of weights in junction $i$ . Having a fixed $f o _ { i }$ and $f i _ { i }$ ensures that all neurons in a junction contribute equally and none of them get disconnected, since that would lead to a loss of information. The connection density in junction $i$ is given as $W _ { i } / ( N _ { i } N _ { i + 1 } )$ and the overall CL connection density is defined as $\textstyle \left( \sum _ { i = 1 } ^ { J } W _ { i } \right) / \left( \sum _ { i = 1 } ^ { J } N _ { i } N _ { i + 1 } \right)$ .
Note that earlier works such as Dey et al. (2017b;a) have proposed hardware architectures that leverage pre-defined sparsity to speed up training. However, a complete analysis of methods to pre-define connections, its possible gains on different kinds of modern deep NNs and a test of its limits via a metric quantifying its goodness has been lacking. Bourely et al. (2017) introduced a metric based on eigenvalues, but ran limited tests on MNIST. The following subsections analyze our method of pre-defined sparsity in more detail. We experimented with networks operating on CIFAR, MNIST and Morse code symbol classification – a new dataset described in Dey $( 2 0 1 7 ) ^ { \bar { 1 } }$ .
# 2.2 NETWORK EXPERIMENTS
# 2.2.1 CIFAR
We used the original CIFAR10 and CIFAR100 datasets without data augmentation. Our network has 6 conv layers with number of filters equal to [64, 64, 128, 128, 256, 256]. Each has window size $3 { \tt X } 3$ . The outputs are batch-normalized before applying ReLU non-linearity. A max-pooling layer of pool size 2x2 succeeds every pair of conv layers. This structure finally results in a layer of 4096 neurons, which is followed by the CLs. We used the Adam optimizer, ReLU-activated hidden layers and softmax output layer – choices which we maintained for all networks unless otherwise specified.
Our results in Section 2.4 indicate that later CL junctions (i.e. closer to the outputs) should be denser than earlier ones (i.e. closer to the inputs). Moreover, since most CL networks have a tapering structure where $N _ { i }$ monotonically decreases as $i$ increases, more parameter savings can be achieved by making earlier layers less dense. Accordingly we did a grid search and picked CL junction densities as given in Table 1. The phrase ‘conv $+ 2 \mathrm { C L s } ^ { \prime }$ ’ denotes $2 \mathrm { C L }$ junctions corresponding to a CL neuron configuration of (4096, 512, 16) for CIFAR10, (4096, 512, 128) for $\mathbf { C I F A R 1 0 0 } ^ { \tilde { 2 } }$ , and (3136, 784, 10) for MNIST (see Section 2.2.2). For ‘con $\mathbf { v } + 3 { \mathbf { C L s } } ^ { \prime }$ , an additional 256-neuron layer precedes the output. ‘MNIST CL’ and ‘Morse CL’ refer to the CL only networks described subsequently, for which we have only shown some of the more important configurations in Table 1.
As an example, consider the first network in ‘CIFAR10 conv $+ 2 \mathrm { C L s }$ ’ which has $f o _ { 1 } = f o _ { 2 } = 1$ . This means that the individual junction densities are $( 4 0 9 6 \times 1 ) / ( 4 0 9 6 \times 5 1 2 ) = 0 . 2 \%$ and $( 5 1 2 \times$ 1 $) / ( 5 1 2 \times 1 6 ) = 6 . 3 \%$ , to give an overall CL density of $( 4 0 9 6 \times 1 + 5 1 2 \times 1 ) / ( 4 0 9 6 \times 5 1 2 + 5 1 2 \times$ $1 6 ) = 0 . 2 2 \%$ . In other words, while FCLs would have been $100 \%$ dense with 2, 097, $1 5 2 + 8 1 9 2 =$ 2, 105, 344 weights, the SCLs use $4 0 9 6 + 5 1 2 = 4 6 0 8$ weights, which is 457 times less. Note that weights in the sparse junction are distributed as fixed, but randomly generated patterns, with the constraints of fixed fan-in and fan-out.
Table 1: Densities for some of our sparse networks
<table><tr><td rowspan=1 colspan=1>Net</td><td rowspan=1 colspan=1>Junctionfan-outs</td><td rowspan=1 colspan=1>CL JunctionDensities (%)</td><td rowspan=1 colspan=1>Overall CLDensity (%)</td><td rowspan=1 colspan=1>Net</td><td rowspan=1 colspan=1>Junctionfan-outs</td><td rowspan=1 colspan=1>CL JunctionDensities (%)</td><td rowspan=1 colspan=1>Overall CLDensity (%)</td></tr><tr><td rowspan=1 colspan=1>CIFAR10conv+2CLs</td><td rowspan=1 colspan=1>1,11,8</td><td rowspan=1 colspan=1>0.2,6.30.2,50</td><td rowspan=1 colspan=1>0.220.39</td><td rowspan=1 colspan=1>CIFAR10conv+3CLs</td><td rowspan=1 colspan=1>1,1,11,1,81,2,16</td><td rowspan=1 colspan=1>0.2,0.4,6.30.2,0.4,500.2,0.8,100</td><td rowspan=1 colspan=1>0.220.30.41</td></tr><tr><td rowspan=1 colspan=1>CIFAR100conv+2CLs</td><td rowspan=1 colspan=1>1,11.81,32</td><td rowspan=1 colspan=1>0.2,0.80.2,6.30.2,25</td><td rowspan=1 colspan=1>0.210.380.95</td><td rowspan=1 colspan=1>CIFAR100conv+3CLs</td><td rowspan=1 colspan=1>1,1,11,1,161,2,32</td><td rowspan=1 colspan=1>0.2,0.4,0.80.2,0.4,130.2,0.8,25</td><td rowspan=1 colspan=1>0.220.390.59</td></tr><tr><td rowspan=2 colspan=1>MNISTconv+2CLs</td><td rowspan=2 colspan=1>1,54,1016,10</td><td rowspan=2 colspan=1>0.1,500.5,1002,100</td><td rowspan=2 colspan=1>0.290.832.35</td><td rowspan=1 colspan=1>MNIST CL(x=224)</td><td rowspan=1 colspan=1>4,10112,10</td><td rowspan=1 colspan=1>1.79,10050,100</td><td rowspan=1 colspan=1>3.0250.63</td></tr><tr><td rowspan=1 colspan=1>Morse CL</td><td rowspan=1 colspan=1>512,32</td><td rowspan=1 colspan=1>50,50</td><td rowspan=1 colspan=1>50</td></tr></table>
 Figure 1: Performance results of pre-defined sparsity for (a)–(c) CIFAR10, and (d)–(f) CIFAR100, trained for 30 epochs using different network densities and varying number of CLs. (a),(b),(d),(e) Validation accuracy across epochs. (c),(f) Best validation accuracies after 1, 5 and 30 epochs.
Figure 1 shows the results for CIFAR. Subfigures (a), (b), (d) and (e) show classification performance on validation data as the network is trained for 30 epochs (note that the final accuracies stayed almost constant after 20 epochs). The different lines correspond to different overall CL densities. Subfigures (c) and (f) show the best validation accuracies after 1, 5 and 30 epochs for the different CL densities. We see that the final accuracies (the numbers at the top of each column) show negligible performance degradation for these extremely low levels of density, not to mention some cases where SCLs outperform FCLs. These results point to the promise of sparsity. Also notice from subfigures (c) and (f) that SCLs generally start training quicker than FCLs, as evidenced by their higher accuracies after 1 epoch of training. See Appendix Section 5.3 for more discussion.
# 2.2.2 MNIST
We used 2 different kinds of networks when experimenting on MNIST (no data augmentation). The first was ‘conv+2CLs’ – 2 conv layers having 32 and 64 filters of size 5x5 each, alternating with $2 \mathbf { x } 2$ max pooling layers. This results in a layer of 3136 neurons, which is followed by 2 CLs having 784 and 10 neurons, i.e. 2 junctions overall. Fig. 2(a) and (b) show the results. Due to the simplicity of the overall network, performance starts degrading at higher densities compared to CIFAR. However, a network with CL density $2 . 3 5 \%$ still matches FCLs in performance. Note that the total number of weights $( \mathrm { c o n v + S C L s } )$ ) is 0.11M for this network, which is only $4 . 3 7 \%$ of the original $( \mathrm { c o n v + F C L s } )$ .
The second was a family of networks with only CLs, either having a single junction with a neuron configuration of (1024, 16), or 2 junctions configured as $( 7 8 4 , x , 1 0 )$ , where $x$ varies. The results are shown in Fig. 2(c), which offers two insights. Firstly, performance drops off at higher densities for CL only MNIST networks as compared to the one with conv layers. However, half the parameters can still be dropped without appreciable performance degradation. This aspect is further discussed in Section 2.3. Secondly, large SCLs perform better than small FCLs with similar number of parameters. Considering the black-circled points as an example, performance drops when switching from 224 hidden neurons at $12 . 5 \%$ density to 112 at $2 5 \%$ to 56 at $50 \%$ to 28 at $100 \%$ , even though all these networks have similar number of parameters. So increasing the number of hidden neurons is desirable, albeit with diminishing returns.
 Figure 2: (a)–(b) Performance results of pre-defined sparsity on an MNIST conv network with different densities, each trained for 30 epochs. (c) Performance vs. connection density for different MNIST CL only networks, each trained for 100 epochs.
# 2.2.3 MORSE
The Morse code dataset presents a harder challenge for sparsity. It only has 64-valued inputs (as compared to 784 for MNIST and 3072 for CIFAR), so each input neuron encodes a significant amount of information. The outputs are Morse codewords and there are 64 classes. Distinctions between inputs belonging to different classes is small. For example, the input pattern for the Morse codeword ‘. can be easily confused with the codeword ‘. . -’. As a result, performance degrades quickly as connections are removed. Our network had 64 input and output neurons and 1024 hidden layer neurons, i.e. 3 CLs and 2 junctions, trained using stochastic gradient descent. The results are shown in Fig. 3(a). As with MNIST CL only, $50 \%$ density can be achieved with negligible degradation in accuracy.
# 2.3 ANALYZING THE RESULTS OF PRE-DEFINED SPARSITY
Our results indicate that for deep networks having several conv layers, there is severe redundancy in the CLs. As a result, they can be made extremely sparse without hampering network performance, which leads to significant memory savings. If the network only has CLs, the amount of density reduction achievable without performance degradation is smaller. This can be explained using the argument of relative importance. For a network which extensively extracts features and processes its raw input data via conv filters, the input to the CLs can already substantially discriminate between inputs belonging to different classes. As a result, the importance of the CLs’ functioning is less as compared to a network where they process the raw inputs.
 Figure 3: (a) Performance vs. connection density for a Morse CL only 2 junction network. (b) and (c) Performance results by varying individual junction densities while overall density is fixed at (b) $2 5 \%$ (c) $50 \%$ . All cases trained for 30 epochs.
The computational savings by sparsifying CLs, however, are not as large because the conv layers dominate the computational complexity. Other types of NNs, such as restricted Boltzmann machines, have higher prominence of CLs than CNNs and would thus benefit more from our approach. Table 2 shows the overall memory and computational gains obtained from pre-defining CLs to be sparse for our networks. The number of SCL parameters (params) are calculated by taking the minimum overall CL density at which there is no accuracy loss. Note that the number of operations (ops) for CLs is nearly the same as their number of parameters, hence are not explicitly shown.
Table 2: Savings in some of our NN architectures due to pre-defined sparsity
<table><tr><td rowspan=1 colspan=1>Net</td><td rowspan=1 colspan=1>CLs/TotalLayers</td><td rowspan=1 colspan=1>ConvParams(M)</td><td rowspan=1 colspan=1>ConvOps(B)</td><td rowspan=1 colspan=1>FC CLParams(M)</td><td rowspan=1 colspan=1>SparseCL Par-ams (M)</td><td rowspan=1 colspan=1>OverallParam %Reduction</td><td rowspan=1 colspan=1>OverallOp%Reduction</td></tr><tr><td rowspan=1 colspan=1>Morse CL</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0.131</td><td rowspan=1 colspan=1>0.066</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1>MNIST CL (x = 224)</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0.178</td><td rowspan=1 colspan=1>0.089</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1>MNIST conv+2CLs</td><td rowspan=1 colspan=1>2/6</td><td rowspan=1 colspan=1>0.05</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>2.47</td><td rowspan=1 colspan=1>0.06</td><td rowspan=1 colspan=1>95.63</td><td rowspan=1 colspan=1>18.29</td></tr><tr><td rowspan=1 colspan=1>CIFAR10 conv+2CLs</td><td rowspan=1 colspan=1>2/17</td><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>0.15</td><td rowspan=1 colspan=1>2.11</td><td rowspan=1 colspan=1>0.005</td><td rowspan=1 colspan=1>64.63</td><td rowspan=1 colspan=1>1.35</td></tr><tr><td rowspan=1 colspan=1>CIFAR100 conv+2CLs</td><td rowspan=1 colspan=1>2/17</td><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>0.15</td><td rowspan=1 colspan=1>2.16</td><td rowspan=1 colspan=1>0.02</td><td rowspan=1 colspan=1>64.76</td><td rowspan=1 colspan=1>1.38</td></tr><tr><td rowspan=1 colspan=1>CIFAR10 conv+3CLs</td><td rowspan=1 colspan=1>3/18</td><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>0.15</td><td rowspan=1 colspan=1>2.23</td><td rowspan=1 colspan=1>0.009</td><td rowspan=1 colspan=1>65.83</td><td rowspan=1 colspan=1>1.43</td></tr><tr><td rowspan=1 colspan=1>CIFAR100 conv+3CLs</td><td rowspan=1 colspan=1>3/18</td><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>0.15</td><td rowspan=1 colspan=1>2.26</td><td rowspan=1 colspan=1>0.013</td><td rowspan=1 colspan=1>65.99</td><td rowspan=1 colspan=1>1.45</td></tr></table>
# 2.4 DISTRIBUTING INDIVIDUAL JUNCTION DENSITIES
Note that the Morse code network has symmetric junctions since each will have $6 4 \times 1 0 2 4 = 6 5 ,$ , 536 weights to give a total of 131,072 FCL weights. Consider an example where overall density of $50 \%$ (i.e. 65,536 total SCL weights) is desired. This can be achieved in multiple ways, such as making both junctions $50 \%$ dense, i.e. 32,768 weights in each. Here we explore if individual junction densities contribute equally to network performance.
Figures 3(b) and (c) sweep junction 1 and 2 connectivity densities on the $\mathbf { X }$ -axis such that the resulting overall density is fixed at $2 5 \%$ for (b) and $50 \%$ for (c). The black vertical line denotes where the densities are equal. Note that peak performance in both cases is achieved to the left of the black line, such as in (c) where junction 2 is $7 5 \%$ dense and junction 1 is $2 5 \%$ dense. This suggests that later junctions need more connections than earlier ones. See Appendix Section 5.1 for more details.
# 3 CONNECTIVITY PATTERNS
We now introduce adjacency matrices to describe junction connection patterns. Let $A _ { i } \in$ $\{ 0 , 1 \} ^ { N _ { i + 1 } \times N _ { i } }$ be the (simplified) adjacency matrix of junction $i$ , such that element $[ A _ { i } ] _ { j , k }$ indicates whether there is a connection between the $j$ th right neuron and $k$ th left neuron. $A _ { i }$ will have $f i _ { i }$ 1’s on each row and $f o _ { i }$ 1’s on each column. These adjacency matrices can be multiplied to yield the effective connectwhere element n between any 2 junctions denotes the number of pa $X$ and fro $Y$ , i.he . t $\begin{array} { r } { A _ { X : Y } = \prod _ { i = Y } ^ { X } A _ { i } \in \mathbb { Z } _ { \geq 0 } ^ { N _ { Y + 1 } \times N _ { X } } } \end{array}$ $[ A _ { X : Y } ] _ { j , k }$ $k$ $X$ $j$ ron in layer $( Y + 1 )$ . For the special case where $X = 1$ and $Y = J$ (total number of junctions), we obtain the input-output adjacency matrix $A _ { 1 : J }$ . As a simple example, consider the $( 8 , 4 , 4 )$ network shown in Fig. 4 where $f o _ { 1 } = 1$ and $f o _ { 2 } = 2$ , which implies that $f i _ { 1 } = f i _ { 2 } = 2$ . $A _ { 1 }$ and $A _ { 2 }$ are adjacency matrices of single junctions. We obtain the input-output adjacency matrix $A _ { 1 : 2 } = A _ { 2 } A _ { 1 }$ , equivalent $f o _ { 1 : 2 } = f o _ { 1 } f o _ { 2 } = 2$ , and equivalent $f i _ { 1 : 2 } = f i _ { 1 } f i _ { 2 } = 4$ . Note that this equivalent junction 1:2 is only an abstract concept that aids visualizing how neurons connect from the inputs to the outputs. It has no relation to the overall network density.
 Figure 4: An example of adjacency matrices and equivalent junctions.
We now attempt to characterize the quality of a sparse connection pattern, i.e. we try to find the best possible way to connect neurons to optimize performance. Since sparsity gives good performance, we hypothesize that there exists redundancy / correlated information between neurons. Intuitively, we assume that left neurons of a junction can be grouped into windows depending on the dimensionality of the left layer output. For example, the input layer in an MNIST CL only network would have 2D windows, each of which might correspond to a fraction of the image, as shown in Fig. 5(a). When outputs from a CL have an additional dimension for features, such as in CIFAR or the MNIST conv network, each window is a cuboid capturing fractions of both spatial extent and features, as shown in Fig. 5(b). Given such windows, we will try to maximize the number of left windows to which each right neuron connects, the idea being that each right neuron should get some information from all portions of the left layer in order to capture global view. To realize the importance of this, consider the MNIST output neuron representing digit 2. Let’s say the sparse connection pattern is such that when the connections to output 3 are traced back to the input layer, they all come from the top half of the image. This would be undesirable since the top half of an image of a 2 can be mistaken for a 3. A good sparse connection pattern will try to avoid such scenarios by spreading the connections to any right neuron across as many input windows as possible. The problem can also be mirrored so that every left neuron connects to as many different right windows as possible. This ensures that local information from left neurons is spread to different parts of the right layer. The grouping of right windows will depend on the dimensionality of the input to the right layer.
The window size is chosen to be the minimum possible such that the ideal number of connections from or to it remains integral. The example from Fig. 4 is reproduced in Fig. 6. Since $f i _ { 1 } = 2$ , the inputs must be grouped into 2 windows so that ideally 1 connection from each reaches every hidden neuron. If instead the inputs are grouped into 4 windows, the ideal number would be half of a connection, which is not achievable. In order to achieve the minimum window size, we let the number of left windows be $f i$ and the number of right windows be $f o$ . So in junction $i$ , the number of neurons in each left and right window ileft- and right-window adjacency matrices $N _ { i } / f i _ { i }$ $N _ { i + 1 } / f o _ { i }$ en we constructby summing up $A _ { i } ^ { w _ { i l } } \in \mathbb { Z } _ { \geq 0 } ^ { N _ { i + 1 } \times f i _ { i } }$ $A _ { i } ^ { w _ { i r } } \in \mathbb { Z } _ { \geq 0 } ^ { f o _ { i } \times N _ { i } }$ as shown in Fig. 5(c). The window adjacency matrices describe connectivity between windows and neurons on the opposite side. Ideally, every window adjacency matrix for a single junction should be the all 1s matrix, which signifies exactly 1 connection from every window to
 Figure 5: (a) Example of 16 2D windows for an MNIST input image. (b) Example of 3D windows when the output from a layer also includes features. (c) Construction of window adjacency matrices.
 Figure 6: Window adjacency matrices and scatter. Green neurons indicate ideal connectivity. The hidden layer is split into 2 to show separate constructions of $A _ { 1 } ^ { w _ { 1 r } }$ and $A _ { 2 } ^ { w _ { 2 l } }$
every neuron on the opposite side. Note that these matrices can also be constructed for multiple junctions, i.e. $A _ { X : Y } ^ { w _ { X l } }$ and $A _ { X : Y } ^ { w _ { Y } }$ , by multiplying matrices for individual junctions. See Appendix Section 5.2 for more discussion.
# 3.1 SCATTER
Scatter is a proxy for the performance of a NN. It is useful because it can be computed in a fraction of a second and used to predict how good or bad a sparse network is without spending time training it. To compute scatter, we count the number of entries greater than or equal to 1 in the window adjacency matrix. If a particular window gets more than its fair share of connections to a neuron on the opposite side, then it is depriving some other window from getting its fair share. This should not be encouraged, so we treat entries greater than 1 the same as 1. Scatter is the average of the count, i.e. for junction $i$ :
$$S _ { i f } = \frac { 1 } { f i _ { i } N _ { i + 1 } } \sum _ { j = 1 } ^ { N _ { i + 1 } } \sum _ { k = 1 } ^ { f i _ { i } } \mathbb { I } \Big ( [ A _ { i } ^ { w _ { i } } ] _ { j , k } \geq 1 \Big ) , \qquad S _ { i b } = \frac { 1 } { N _ { i } f o _ { i } } \sum _ { j = 1 } ^ { f o _ { i } } \sum _ { k = 1 } ^ { N _ { i } } \mathbb { I } \Big ( [ A _ { i } ^ { w _ { i } } ] _ { j , k } \geq 1 \Big ) .$$
Subscripts $f$ and $b$ denote forward (left windows to right neurons) and backward (right neurons to left windows), indicating the direction of data flow. As an example, we consider $A _ { 1 } ^ { w _ { 1 l } }$ in Fig. 6, which has a scatter value $S _ { 1 f } = 6 / 8 = 0 . 7 5$ . The other scatter values can be computed similarly to form the scatter vector $\bar { S } = [ S _ { 1 f } , S _ { 1 b } , S _ { 2 f } , S _ { 2 b } , S _ { f } , S _ { b } ]$ , where the final 2 values correspond to junction 1:2. Notice that $\bar { S }$ will be all 1s for FCLs, which is the ideal case. Incorporating sparsity leads to reduced $\bar { S }$ values. The final scatter metric $S \in [ 0 , 1 ]$ is the minimum value in $\bar { S }$ , i.e. 0.75 for Fig. 6. Our experiments indicate that any low value in $\bar { S }$ leads to bad performance, so we picked the critical minimum value.
# 3.2 ANALYSIS AND RESULTS OF SCATTER
We ran experiments to evaluate scatter using a) the Morse CL only network with $f o \ = \ 1 2 8 , 8$ , b) an MNIST CL only network with (1024, 64, 16) neuron configuration and $f o = 1 , 4$ , and c) the ‘conv $+ 2 \mathrm { C L s } ^ { \prime }$ CIFAR10 network with $f o = 1 , 2$ . We found that high scatter indicates good performance and the correlation is stronger for networks where CLs have more importance, i.e. CL only networks as opposed to conv. This is shown in the performance vs. scatter plots in Fig. 7, where (a) and (b) show the performance predicting ability of scatter better than (c). Note that the random connection patterns used so far have the highest scatter and occur as the rightmost points in each subfigure. The other points are obtained by specifically planning connections. We found that when 1 junction was planned to give corresponding high values in $\bar { S }$ , it invariably led to low values for another junction, leading to a low $S$ . This explains why random patterns generally perform well.
 Figure 7: Network performance vs. scatter for CL only networks of (a) Morse (b) MNIST, and convolutional network with $2 \mathrm { C L }$ junctions of (c) CIFAR10. All minimum values that need to be considered to differentiate between connection patterns are bolded.
$\bar { S }$ is shown alongside each point. When $S$ is equal for different connection patterns, the next minimum value in $\breve { \bar { S } }$ needs to be considered to differentiate the networks, and so on. Considering the Morse results, the leftmost 3 points all have $\begin{array} { r } { S = \frac { 1 } { 8 } } \end{array}$ , but the number of occurrences of $\frac { 1 } { 8 }$ in $\bar { S }$ is 3 for the lowest point $8 \%$ accuracy), 2 for the second lowest ( $12 \%$ accuracy) and 1 for the highest point $46 \%$ accuracy). For the MNIST results, both the leftmost points have a single minimum value of $\textstyle { \frac { 1 } { 1 6 } }$ in $\bar { S }$ , but the lower has two occurrences of $\textstyle { \frac { 1 } { 4 } }$ while the upper has one.
We draw several insights from these results. Firstly, although we defined $S$ as a single value for convenience, there may arise cases when other (non-minimum) elements in $\bar { S }$ are important. Secondly, perhaps contrary to intuition, the concept of windows and scatter is important for all CLs, not simply the first. As shown in Fig. 7a), a network with $\begin{array} { r } { S _ { 1 b } = \frac { 1 } { 8 } } \end{array}$ performs equally poorly as a network with $\begin{array} { r } { S _ { 2 f } = ~ \frac { 1 } { 8 } } \end{array}$ . Thirdly, scatter is a sufficient metric for performance, not necessary. A network with a high $S$ value will perform well, but a network with a slightly lower $S$ than another cannot be conclusively dismissed as being worse. But if a network has multiple low values in $\bar { S }$ , it should be rejected. Finally, carefully choosing which neurons to group in a window will increase the predictive power of scatter. A priori knowledge of the dataset will lead to better window choices.
# 4 CONCLUSION AND FUTURE WORK
This paper discusses the merits of pre-defining sparsity in CLs of neural networks, which leads to significant reduction in parameters without performance loss. In general, the smaller the fraction of CLs in a network, the more redundancy there exists in their parameters. If we can achieve similar results (i.e., $0 . 2 \%$ density) on Alexnet for example, we would obtain $9 5 \%$ reduction in overall parameters. Coupled with hardware acceleration designed for pre-defined sparse networks, we believe our approach will lead to more aggressive exploration of network structure. Network connectivity can be guided by the scatter metric, which is closely related to performance, and by optimally distributing connections across junctions. Future work would involve extension to conv layers, since recent CNNs have lower values for the ratio of number of CLs to number of conv layers.
REFERENCES Alfred Bourely, John Patrick Boueri, and Krzysztof Choromonski. Sparse neural network topologies. In arXiv:1706.05683, 2017. Wenlin Chen, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. Compressing neural networks with the hashing trick. In Proc. ICML, pp. 2285–2294. JMLR.org, 2015. Misha Denil, Babak Shakibi, Laurent Dinh, Marc’aurelio Ranzato, and Nando D. Freitas. Predicting parameters in deep learning. In Proc. NIPS, pp. 2148–2156, 2013. Sourya Dey. Morse code dataset for artificial neural networks, Oct 2017. URL https://cobaltfolly.wordpress.com/2017/10/15/ morse-code-dataset-for-artificial-neural-networks/. Sourya Dey, Peter A. Beerel, and Keith M. Chugg. Interleaver design for deep neural networks. In Proc. Asilomar Conference on Signals, Systems and Computers. IEEE, 2017a. Sourya Dey, Yinan Shao, Keith M. Chugg, and Peter A. Beerel. Accelerating training of deep neural networks via sparse edge processing. In Proc. ICANN, pp. 273–280. Springer, 2017b. Yunchao Gong, Liu Liu, Ming Yang, and Lubomir D. Bourdev. Compressing deep convolutional networks using vector quantization. In arXiv:1412.6115, 2014. Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Proc. NIPS, pp. 1135–1143, 2015. Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. In Proc. ICLR, 2016. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. CVPR, pp. 770–778, June 2016. Gao Huang, Zhuang Liu, Kilian Q. Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. In arXiv:1608.06993, 2016. Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Proc. NIPS, pp. 1097–1105, 2012. Pierre Sermanet, David Eigen, Xiang Zhang, Michael Mathieu, Rob Fergus, and Yann LeCun. ¨ Overfeat: Integrated recognition, localization and detection using convolutional networks. In arXiv:1312.6229, 2013. Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In Proc. ICLR, 2015. Vikas Sindhwani, Tara Sainath, and Sanjiv Kumar. Structured transforms for small-footprint deep learning. In Proc. NIPS, pp. 3088–3096. Curran Associates, Inc., 2015. Suraj Srinivas, Akshayvarun Subramanya, and R. Venkatesh Babu. Training sparse neural networks. In arXiv:1611.06694, 2016. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929–1958, 2014. C. Szegedy, Wei Liu, Yangqing Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In Proc. CVPR, pp. 1–9, 2015. Chen Zhang, Di Wu, Jiayu Sun, Guangyu Sun, Guojie Luo, and Jason Cong. Energy-efficient CNN implementation on a deeply pipelined FPGA cluster. In Proc. ISLPED, pp. 326–331. ACM, 2016. Xichuan Zhou, Shengli Li, Kai Qin, Kunping Li, Fang Tang, Shengdong Hu, Shujun Liu, and Zhi Lin. Deep adaptive network: An efficient deep neural network with sparse binary connections. In arXiv:1604.06154, 2016.
# 5 APPENDIX
# 5.1 MORE ON DISTRIBUTING INDIVIDUAL JUNCTION DENSITIES
Section 2.4 showed that when overall CL density is fixed, it is desirable to make junction 2 denser than junction 1. It is also interesting to note, however, that performance falls off more sharply when junction 1 density is reduced to the bare minimum as compared to treating junction 2 similarly. This is not shown in Fig. 3 due to space constraints. We found that when junction 1 had the minimum possible density and junction 2 had the maximum possible while still satisfying the fixed overall, the accuracy was about $36 \%$ for both subfigures (b) and (c). When the densities were flipped, the accuracies were $67 \%$ for subfigure (b) and $7 5 \%$ for (c) in Figure 3.
# 5.2 DENSE CASES OF WINDOW ADJACENCY MATRICES
As stated in Section 3.1, window output matrices for several junctions can be constructed by multiplying the individual matrices for each component junction. Consider the Morse network as described in Section 3.2. Note that $f o _ { 1 : 2 } = 1 2 8 \times 8 = 1 0 2 4$ and $f i _ { 1 : 2 } = 8 \times 1 2 8 = 1 0 2 4$ . Thus, for the equivalent junction 1:2 which has $N _ { 1 } = 6 4$ left neurons and $N _ { 3 } = 6 4$ right neurons, we have $f o _ { 1 : 2 } > N _ { 3 }$ and $f i _ { 1 : 2 } > N _ { 1 }$ . So in this case the number of neurons in each window will be rounded up to 1, and both the ideal window adjacency matrices $A _ { 1 : 2 } ^ { w _ { 1 l } }$ and $A _ { 1 : 2 } ^ { w _ { 2 r } }$ will be all 16’s matrices since the ideal number of connections from each window to a neuron on the opposite side is $1 0 2 4 / 6 4 = 1 6$ . This is a result of the network having sufficient density so that several paths exist from every input neuron to every output neuron.
# 5.3 POSSIBLE REASONS FOR SCLS CONVERGING FASTER THAN FCLS
Training a neural network is essentially an exercise in finding the minimum of the cost function, which is a function of all the network parameters. The graph for cost as a function of parameters may have saddle points which masquerade as minima. It could also be poorly conditioned, wherein the gradient of cost with respect to two different parameters have widely different magnitudes, making simultaneous optimization difficult. These effects are non-idealities and training the network often takes more time because of the length of the trajectory needed to overcome these and arrive at the optimum point. The probability of encountering these non-idealities increases as the number of network parameters increase, i.e. less parameters leads to a higher ratio of minima : saddle points, which can make the network converge faster. We hypothesize that SCLs train faster than FCLs due to the former having fewer parameters.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345# GENERATIVE MULTI-ADVERSARIAL NETWORKS
Ishan Durugkar∗, Ian Gemp∗, Sridhar Mahadevan
College of Information and Computer Sciences University of Massachusetts, Amherst Amherst, MA 01060, USA {idurugkar,imgemp,mahadeva}@cs.umass.edu
# ABSTRACT
Generative adversarial networks (GANs) are a framework for producing a generative model by way of a two-player minimax game. In this paper, we propose the Generative Multi-Adversarial Network (GMAN), a framework that extends GANs to multiple discriminators. In previous work, the successful training of GANs requires modifying the minimax objective to accelerate training early on. In contrast, GMAN can be reliably trained with the original, untampered objective. We explore a number of design perspectives with the discriminator role ranging from formidable adversary to forgiving teacher. Image generation tasks comparing the proposed framework to standard GANs demonstrate GMAN produces higher quality samples in a fraction of the iterations when measured by a pairwise GAM-type metric.
# 1 INTRODUCTION
Generative adversarial networks (Goodfellow et al. (2014)) (GANs) are a framework for producing a generative model by way of a two-player minimax game. One player, the generator, attempts to generate realistic data samples by transforming noisy samples, $z$ , drawn from a simple distribution (e.g., $z \sim \mathcal { N } ( 0 , 1 ) )$ using a transformation function $G _ { \theta } ( z )$ with learned weights, $\theta$ . The generator receives feedback as to how realistic its synthetic sample is from another player, the discriminator, which attempts to discern between synthetic data samples produced by the generator and samples drawn from an actual dataset using a function $D _ { \omega } ( x )$ with learned weights, $\omega$ .
The GAN framework is one of the more recent successes in a line of research on adversarial training in machine learning (Schmidhuber (1992); Bagnell (2005); Ajakan et al. (2014)) where games between learners are carefully crafted so that Nash equilibria coincide with some set of desired optimality criteria. Preliminary work on GANs focused on generating images (e.g., MNIST (LeCun et al. (1998)), CIFAR (Krizhevsky (2009))), however, GANs have proven useful in a variety of application domains including learning censored representations (Edwards & Storkey (2015)), imitating expert policies (Ho & Ermon (2016)), and domain transfer (Yoo et al. (2016)). Work extending GANs to semi-supervised learning (Chen et al. (2016); Mirza & Osindero (2014); Gauthier (2014); Springenberg (2015)), inference (Makhzani et al. (2015); Dumoulin et al. (2016)), feature learning (Donahue et al. (2016)), and improved image generation (Im et al. (2016); Denton et al. (2015); Radford et al. (2015)) have shown promise as well.
Despite these successes, GANs are reputably difficult to train. While research is still underway to improve training techniques and heuristics (Salimans et al. (2016)), most approaches have focused on understanding and generalizing GANs theoretically with the aim of exploring more tractable formulations (Zhao et al. (2016); Li et al. (2015); Uehara et al. (2016); Nowozin et al. (2016)).
In this paper, we theoretically and empirically justify generalizing the GAN framework to multiple discriminators. We review GANs and summarize our extension in Section 2. In Sections 3 and 4, we present our $N$ -discriminator extension to the GAN framework (Generative Multi-Adversarial Networks) with several variants which range the role of the discriminator from formidable adversary to forgiving teacher. Section 4.2 explains how this extension makes training with the untampered minimax objective tractable. In Section 5, we define an intuitive metric (GMAM) to quantify GMAN performance and evaluate our framework on a variety of image generation tasks. Section 6 concludes with a summary of our contributions and directions for future research.
Contributions—To summarize, our main contributions are: i) a multi-discriminator GAN framework, GMAN, that allows training with the original, untampered minimax objective; ii) a generative multi-adversarial metric (GMAM) to perform pairwise evaluation of separately trained frameworks; iii) a particular instance of GMAN, $\mathrm { G M A N ^ { * } }$ , that allows the generator to automatically regulate training and reach higher performance (as measured by GMAM) in a fraction of the training time required for the standard GAN model.
# 2 GENERATIVE ADVERSARIAL NETWORKS TO GMAN
The original formulation of a GAN is a minimax game between a generator, $G _ { \theta } ( z ) : z \to x$ , and a discriminator, $D _ { \omega } ( x ) : x [ 0 , 1 ]$ ,
$$\underset { G } { \mathrm { m i n } } \underset { D \in \mathcal { D } } { \mathrm { m a x } } V ( D , G ) = \mathbb { E } _ { x \sim p _ { d a t a } ( x ) } \Big [ \log ( D ( x ) ) \Big ] + \mathbb { E } _ { z \sim p _ { z } ( z ) } \Big [ \log ( 1 - D ( G ( z ) ) ) \Big ] ,$$
where $p _ { d a t a } ( x )$ is the true data distribution and $p _ { z } ( z )$ is a simple (usually fixed) distribution that is easy to draw samples from (e.g., $\mathcal { N } ( 0 , 1 ) )$ ). We differentiate between the function space of discriminators, $\mathcal { D }$ , and elements of this space, $D$ . Let $p _ { G } ( x )$ be the distribution induced by the generator, $G _ { \theta } ( z )$ . We assume $D , G$ to be deep neural networks as is typically the case.
In their original work, Goodfellow et al. (2014) proved that given sufficient network capacities and an oracle providing the optimal discriminator, $D ^ { * } = a r g \operatorname* { m a x } _ { \mathcal { D } } V ( D , G )$ , gradient descent on $p _ { G } ( x )$ will recover the desired globally optimal solution, $p _ { G } ( x ) = p _ { d a t a } ( x )$ , so that the generator distribution exactly matches the data distribution. In practice, they replaced the second term, $\log ( 1 -$ $D ( G ( z ) ) )$ , with $- \log ( D ( G ( z ) ) )$ to enhance gradient signals at the start of the game; note this is no longer a zero-sum game. Part of their convergence and optimality proof involves using the oracle, $D ^ { * }$ , to reduce the minimax game to a minimization over $G$ only:
$$\operatorname* { m i n } _ { G } V ( D ^ { * } , G ) = \operatorname* { m i n } _ { G } \Big \{ C ( G ) = - \log ( 4 ) + 2 \cdot J S D ( p _ { d a t a } | | p _ { G } ) \Big \}$$
where $J S D$ denotes Jensen-Shannon divergence. Minimizing $C ( G )$ necessarily minimizes $J S D$ , however, we rarely know $D ^ { * }$ and so we instead minimize $V ( D , G )$ , which is only a lower bound.
This perspective of minimizing the distance between the distributions, $p _ { d a t a }$ and $p _ { G }$ , motivated Li et al. (2015) to develop a generative model that matches all moments of $p _ { G } ( x )$ with $p _ { d a t a } ( x )$ (at optimality) by minimizing maximum mean discrepancy (MMD). Another approach, EBGAN, (Zhao et al. (2016)) explores a larger class of games (non-zero-sum games) which generalize the generator and discriminator objectives to take real-valued “energies” as input instead of probabilities. Nowozin et al. (2016) and then Uehara et al. (2016) extended the $J S D$ perspective on GANs to more general divergences, specifically $f$ -divergences and then Bregman-divergences respectively.
In general, these approaches focus on exploring fundamental reformulations of $V ( D , G )$ . Similarly, our work focuses on a fundamental reformulation, however, our aim is to provide a framework that accelerates training of the generator to a more robust state irrespective of the choice of $V$ .
# 2.1 GMAN: A MULTI-ADVERSARIAL EXTENSION
We propose introducing multiple discriminators, which brings with it a number of design possibilities. We explore approaches ranging between two extremes: 1) a more discriminating $D$ (better approximating $\operatorname* { m a x } _ { \mathcal { D } } V ( D , G ) )$ and 2) a $D$ better matched to the generator’s capabilities. Mathematically, we reformulate $G$ ’s objective as $\operatorname* { m i n } _ { G }$ max $F ( V ( D _ { 1 } , G ) , \dots , V ( D _ { N } , { \bar { G } } ) )$ for different choices of $F$ (see Figure 1). Each $D _ { i }$ is still expected to independently maximize its own $V ( D _ { i } , G )$ (i.e. no cooperation). We sometimes abbreviate $V ( D _ { i } , G )$ with $V _ { i }$ and $F ( V _ { 1 } , \dots , V _ { N } )$ with $F _ { G } ( V _ { i } )$ .
# 3 A FORMIDABLE ADVERSARY
Here, we consider multi-discriminator variants that attempt to better approximate $\operatorname* { m a x } _ { D } V ( D , G )$ , providing a harsher critic to the generator.
 Figure 1: (GMAN) The generator trains using feedback aggregated over multiple discriminators. If $F : = \mathrm { m a x }$ , $G$ trains against the best discriminator. If $F : = { \mathrm { m e a n } }$ , $G$ trains against an ensemble. We explore other alternatives to $F$ in Sections 4.1 & 4.4 that improve on both these options.
# 3.1 MAXIMIZING V(D,G)
For a fixed $G$ , maximizing $F _ { G } ( V _ { i } )$ with $F : = \mathrm { m a x }$ and $N$ randomly instantiated copies of our discriminator is functionally equivalent to optimizing $V$ (e.g., stochastic gradient ascent) with random restarts in parallel and then presenting $\mathrm { m a x } _ { i \in \{ 1 , . . . , N \} } V ( D _ { i } , G )$ as the loss to the generator —a very pragmatic approach to the difficulties presented by the non-convexity of $V$ caused by the deep net. Requiring the generator to minimize the max forces $G$ to generate high fidelity samples that must hold up under the scrutiny of all $N$ discriminators, each potentially representing a distinct max.
In practice, $\operatorname* { m a x } _ { D _ { i } \in \mathcal { D } } V ( D _ { i } , G )$ is not performed to convergence (or global optimality), so the above problem is oversimplified. Furthermore, introducing $N$ discriminators affects the dynamics of the game which affects the trajectories of the discriminators. This prevents us from claiming $\operatorname* { m a x } \{ V _ { 1 } ( t ) , \ldots , V _ { N } ( t ) \} > \operatorname* { m a x } \{ V _ { 1 } ^ { \prime } ( t ) \} \forall t$ even if we initalize $D _ { 1 } ( 0 ) = \mathbf { \bar { \cal { D } } } _ { 1 } ^ { \prime } ( 0 )$ as it is unlikely that $D _ { 1 } ( t ) = D _ { 1 } ^ { \prime } ( t )$ at some time $t$ after the start of the game.
# 3.2 BOOSTING
We can also consider taking the max over $N$ discriminators as a form of boosting for the discriminator’s online classification problem (online because $G$ can produce an infinite data stream). The boosted discriminator is given a sample $x _ { t }$ and must predict whether it came from the generator or the dataset. The booster then makes its prediction using the predictions of the $N$ weaker $D _ { i }$ .
There are a few differences between taking the max (case 1) and online boosting (case 2). In case 1, our booster is limited to selecting a single weak discriminator (i.e. a pure strategy), while in case 2, many boosting algorithms more generally use linear combinations of the discriminators. Moreover, in case 2, a booster must make a prediction before receiving a loss function. In case 1, we assume access to the loss function at prediction time, which allows us to compute the max.
It is possible to train the weak discriminators using boosting and then ignore the booster’s prediction by instead presenting max $\{ V _ { i } \}$ . We explore both variants in our experiments, using the adaptive algorithm proposed in Beygelzimer et al. (2015). Unfortunately, boosting failed to produce promising results on the image generation tasks. It is possible that boosting produces too strong an adversary for learning which motivates the next section. Boosting results appear in Appendix A.7.
# 4 A FORGIVING TEACHER
The previous perspectives focus on improving the discriminator with the goal of presenting a better approximation of $\operatorname* { m a x } _ { \mathcal { D } } V ( D , G )$ to the generator. Our next perspective asks the question, “Is $\operatorname* { m a x } _ { \mathcal { D } } V ( D , G )$ too harsh a critic?”
# 4.1 Soft-DISCRIMINATOR
In practice, training against a far superior discriminator can impede the generator’s learning. This is because the generator is unlikely to generate any samples considered “realistic” by the discriminator’s standards, and so the generator will receive uniformly negative feedback. This is problematic because the information contained in the gradient derived from negative feedback only dictates where to drive down $p _ { G } ( x )$ , not specifically where to increase $p _ { G } ( x )$ . Furthermore, driving down $p _ { G } ( x )$ necessarily increases $p _ { G } ( x )$ in other regions of $\mathcal { X }$ (to maintain $\textstyle \int _ { \mathcal { X } } p _ { G } ( x ) = 1 )$ ) which may or may not contain samples from the true dataset (whack-a-mole dilemma). In contrast, a generator is more likely to see positive feedback against a more lenient discriminator, which may better guide a generator towards amassing $p _ { G } ( x )$ in approximately correct regions of $\mathcal { X }$ .
For this reason, we explore a variety of functions that allow us to soften the max operator. We choose to focus on soft versions of the three classical Pythagorean means parameterized by $\lambda$ where $\lambda = 0$ corresponds to the mean and the max is recovered as $\lambda \to \infty$ :
$$\begin{array} { l } { { \mathrm { { A M } } _ { s o f t } ( V , \lambda ) = \displaystyle \sum _ { i } ^ { N } w _ { i } V _ { i } } } \\ { ~ } \\ { { \mathrm { { G M } } _ { s o f t } ( V , \lambda ) = - \exp \Big ( \displaystyle \sum _ { i } ^ { N } w _ { i } \log ( - V _ { i } ) \Big ) } } \\ { { { } } } \\ { { { \mathrm { H M } } _ { s o f t } ( V , \lambda ) = \Big ( \displaystyle \sum _ { i } ^ { N } w _ { i } V _ { i } ^ { - 1 } \Big ) ^ { - 1 } } } \end{array}$$
where $w _ { i } = e ^ { \lambda V _ { i } } / \Sigma _ { j } e ^ { \lambda V _ { j } }$ with $\lambda \ge 0 , V _ { i } < 0$ . Using a softmax also has the well known advantage of being differentiable (as opposed to subdifferentiable for max). Note that we only require continuity to guarantee that computing the softmax is actually equivalent to computing $V ( \tilde { D } , G )$ where $\tilde { D }$ is some convex combination of $D _ { i }$ (see Appendix A.5).
# 4.2 USING THE ORIGINAL MINIMAX OBJECTIVE
To illustrate the effect the softmax has on training, observe that the component of $A M _ { s o f t } ( V , 0 )$ relevant to generator training can be rewritten as
$$\frac { 1 } { N } \sum _ { i } ^ { N } \mathbb { E } _ { x \sim p _ { G } ( x ) } \Big [ \log ( 1 - D _ { i } ( x ) ) \Big ] = \frac { 1 } { N } \mathbb { E } _ { x \sim p _ { G } ( x ) } \Big [ \log ( z ) \Big ] .$$
where $\begin{array} { r } { z = \prod _ { i } ^ { N } ( 1 - D _ { i } ( x ) ) } \end{array}$ . Note that the generator gradient, | ∂ log(z)∂z |, is minimized at z = 1 over $z \in ( 0 , 1 ] ^ { 1 }$ . From this form, it is clear that $z = 1$ if and only if $D _ { i } = 0 \forall i$ , so $G$ only receives a vanishing gradient if all $D _ { i }$ agree that the sample is fake; this is especially unlikely for large $N$ . In other words, $G$ only needs to fool a single $D _ { i }$ to receive constructive feedback. This result allows the generator to successfully minimize the original generator objective, $\log ( 1 - D )$ . This is in contrast to the more popular $- \log ( D )$ introduced to artificially enhance gradients at the start of training.
At the beginning of training, when $\operatorname* { m a x } _ { D _ { i } } V ( D _ { i } , G )$ is likely too harsh a critic for the generator, we can set $\lambda$ closer to zero to use the mean, increasing the odds of providing constructive feedback to the generator. In addition, the discriminators have the added benefit of functioning as an ensemble, reducing the variance of the feedback presented to the generator, which is especially important when the discriminators are far from optimal and are still learning a reasonable decision boundary. As training progresses and the discriminators improve, we can increase $\lambda$ to become more critical of the generator for more refined training.
# 4.3 MAINTAINING MULTIPLE HYPOTHESES
We argue for this ensemble approach on a more fundamental level as well. Here, we draw on the density ratio estimation perspective of GANs (Uehara et al. (2016)). The original GAN proof assumes we have access to $p _ { d a t a } ( x )$ , if only implicitly. In most cases of interest, the discriminator only has access to a finite dataset sampled from $p _ { d a t a } ( x )$ ; therefore, when computing expectations of $\dot { V } ( D , G )$ , we only draw samples from our finite dataset. This is equivalent to training a GAN with $p _ { d a t a } ( x ) = \tilde { p } _ { d a t a }$ which is a distribution consisting of point masses on all the data points in the dataset. For the sake of argument, let’s assume we are training a discriminator and generator, each with infinite capacity. In this case, the global optimum $( p _ { G } ( x ) = \tilde { p } _ { d a t a ( x ) } )$ fails to capture any of the interesting structure from $p _ { d a t a } ( x )$ , the true distribution we are trying to learn. Therefore, it is actually critical that we avoid this global optimum.
 Figure 2: Consider a dataset consisting of the nine 1-dimensional samples in black. Their corresponding probability mass function is given in light gray. After training GMAN, three discriminators converge to distinct local optima which implicitly define distributions over the data (red, blue, yellow). Each discriminator may specialize in discriminating a region of the data space (placing more diffuse mass in other regions). Averaging over the three discriminators results in the distribution in black, which we expect has higher likelihood under reasonable assumptions on the structure of the true distribution.
In practice, this degenerate result is avoided by employing learners with limited capacity and corrupting data samples with noise (i.e., dropout), but we might better accomplish this by simultaneously training a variety of limited capacity discriminators. With this approach, we might obtain a diverse set of seemingly tenable hypotheses for the true $p _ { d a t a } ( x )$ . Averaging over these multiple locally optimal discriminators increases the entropy of $\tilde { p } _ { d a t a } ( x )$ by diffusing the probability mass over the data space (see Figure 2 for an example).
# 4.4 AUTOMATING REGULATION
The problem of keeping the discriminator and generator in balance has been widely recognized in previous work with GANs. Issues with unstable dynamics, oscillatory behavior, and generator collapse are not uncommon. In addition, the discriminator is often times able to achieve a high degree of classification accuracy (producing a single scalar) before the generator has made sufficient progress on the arguably more difficult generative task (producing a high dimensional sample). Salimans et al. (2016) suggested label smoothing to reduce the vulnerability of the generator to a relatively superior discriminator. Here, we explore an approach that enables the generator to automatically temper the performance of the discriminator when necessary, but still encourages the generator to challenge itself against more accurate adversaries. Specifically, we augment the generator objective:
$$\operatorname* { m i n } _ { G , \lambda > 0 } F _ { G } ( V _ { i } ) - f ( \lambda )$$
where $f ( \lambda )$ is monotonically increasing in $\lambda$ which appears in the softmax equations, (3)—(5). In experiments, we simply set $f ( \lambda ) = c \lambda$ with $c$ a constant (e.g., 0.001). The generator is incentivized to increase $\lambda$ to reduce its objective at the expense of competing against the best available adversary $D ^ { * }$ (see Appendix A.6).
# 5 EVALUATION
Evaluating GANs is still an open problem. In their original work, Goodfellow et al. (2014) report log likelihood estimates from Gaussian Parzen windows, which they admit, has high variance and is known not to perform well in high dimensions. Theis et al. (2016) recommend avoiding Parzen windows and argue that generative models should be evaluated with respect to their intended application. Salimans et al. (2016) suggest an Inception score, however, it assumes labels exist for the dataset. Recently, Im et al. (2016) introduced the Generative Adversarial Metric (GAM) for making pairwise comparisons between independently trained GAN models. The core idea behind their approach is given two generator, discriminator pairs $( G _ { 1 } , D _ { 1 } )$ and $( G _ { 2 } , D _ { 2 } )$ , we should be able to learn their relative performance by judging each generator under the opponent’s discriminator.
# 5.1 METRIC
In GMAN, the opponent may have multiple discriminators, which makes it unclear how to perform the swaps needed for GAM. We introduce a variant of GAM, the generative multi-adversarial metric (GMAM), that is amenable to training with multiple discriminators,
$$\mathrm { G M A M } = \log \Big ( \frac { F _ { G _ { b } } ^ { a } ( V _ { i } ^ { a } ) } { F _ { G _ { a } } ^ { a } ( V _ { i } ^ { a } ) } \Big / \frac { F _ { G _ { a } } ^ { b } ( V _ { i } ^ { b } ) } { F _ { G _ { b } } ^ { b } ( V _ { i } ^ { b } ) } \Big ) .$$
where $a$ and $b$ refer to the two GMAN variants (see Section 3 for notation $F _ { G } ( V _ { i } ) ,$ ). The idea here is similar. If $G _ { 2 }$ performs better than $G _ { 1 }$ with respect to both $D _ { 1 }$ and $D _ { 2 }$ , then $\mathrm { G M A M { > } 0 }$ (remember $V { \le } 0$ always). If $G _ { 1 }$ performs better in both cases, GMAM $< 0$ , otherwise, the result is indeterminate.
# 5.2 EXPERIMENTS
We evaluate the aforementioned variations of GMAN on a variety of image generation tasks: MNIST (LeCun et al. (1998)), CIFAR-10 (Krizhevsky (2009)) and CelebA (Liu et al. (2015)). We focus on rates of convergence to steady state along with quality of the steady state generator according to the GMAM metric. To summarize, loosely in order of increasing discriminator leniency, we compare
• F-boost: A single AdaBoost.OL-boosted discriminator (see Appendix A.7). • P-boost: $D _ { i }$ is trained according to AdaBoost.OL. A max over the weak learner losses is presented to the generator instead of the boosted prediction (see Appendix A.7). • GMAN-max: max $\{ V _ { i } \}$ is presented to the generator. • GAN: Standard GAN with a single discriminator (see Appendix A.2). • mod-GAN: GAN with modified objective (generator minimizes − $\log ( D ( G ( z ) ) )$ . • GMAN- $\lambda$ : GMAN with $F$ : $=$ arithmetic softmax with parameter $\lambda$ . • GMAN∗: The arithmetic softmax is controlled by the generator through $\lambda$ .
All generator and discriminator models are deep (de)convolutional networks (Radford et al. (2015)), and aside from the boosted variants, all are trained with Adam (Kingma & Ba (2014)) and batch normalization (Ioffe & Szegedy (2015)). Discriminators convert the real-valued outputs of their rksivedis $( \epsilon \dot { + } \frac { 1 - 2 \epsilon } { 1 + e ^ { - z } } )$ ies with squashed-sigmoids to prevent saturating logarithms in the min. See Appendix A.8 for further details. We test GMAN systems with We maintain discriminator diversity by varying dropout and network de $N =$ $\{ 2 , 5 \}$
# 5.2.1 MNIST
Figure 3 reveals that increasing the number of discriminators reduces the number of iterations to steady-state by $2 \mathbf { x }$ on MNIST; increasing $N$ (the size of the discriminator ensemble) also has the added benefit of reducing the variance the minimax objective over runs. Figure 4 displays the variance of the same objective over a sliding time window, reaffirming GMAN’s acceleration to steadystate. Figure 5 corroborates this conclusion with recognizable digits appearing approximately an epoch before the single discriminator run; digits at steady-state appear slightly sharper as well.
Our GMAM metric (see Table 1) agrees with the relative quality of images in Figure 5 with GMAN∗ achieving the best overall performance. Figure 6 reveals GMAN∗’s attempt to regulate the difficulty
<table><tr><td></td><td>Score</td><td>Variant</td><td>GMAN*</td><td>GMAN-0</td><td>GMAN-max</td><td>mod-GAN</td></tr><tr><td rowspan="4">←Feneg</td><td>0.127</td><td>GMAN*</td><td></td><td>-0.020±0.009</td><td>-0.028 ± 0.019</td><td>-0.089± 0.036</td></tr><tr><td>0.007</td><td>GMAN-0</td><td>0.020 ±0.009</td><td></td><td>-0.013 ± 0.015</td><td>-0.018 ± 0.027</td></tr><tr><td>-0.034</td><td>GMAN-max</td><td>0.028 ± 0.019</td><td>0.013 ± 0.015</td><td></td><td>-0.011 ± 0.024</td></tr><tr><td>-0.122</td><td>mod-GAN</td><td>0.089 ± 0.036</td><td>0.018 ± 0.027</td><td>0.011 ± 0.024</td><td></td></tr></table>
Table 1: Pairwise GMAM metric means with stdev for select models on MNIST. For each column, a positive GMAM indicates better performance relative to the row opponent; negative implies worse. Scores are obtained by summing each variant’s column.
 Figure 3: Generator objective, $F$ , averaged over 5 training runs on MNIST. Increasing the number of discriminators accelerates convergence of $F$ to steady state (solid line) and reduces its variance, $\scriptstyle { \dot { \sigma } } ^ { 2 }$ (filled shadow $\pm 1 \sigma )$ . Figure 4 provides alternative evidence of GMAN∗’s accelerated convergence.
 Figure 4: Stdev, $\sigma$ , of the generator objective over a sliding window of 500 iterations. Lower values indicate a more steady-state. $\mathrm { G M A N ^ { * } }$ with $N = 5$ achieves steady-state at ${ \approx } 2 \mathbf { x }$ speed of GAN $N = 1$ ). Note Figure 3’s filled shadows reveal stdev of $F$ over runs, while this plot shows stdev over time.
 Figure 5: Comparison of image quality across epochs for $N = \{ 1 , 2 , 5 \}$ using GMAN-0 on MNIST.
of the game to accelerate learning. Figure 7 displays the GMAM scores comparing fixed $\lambda$ ’s to the variable $\lambda$ controlled by $\mathrm { G M A N ^ { * } }$ .
<table><tr><td></td><td>Score</td><td>入 (N=5)</td><td>*</td><td>入=1</td><td>入=0</td></tr><tr><td rowspan="3">1eeieg</td><td>0.028</td><td>*</td><td>=</td><td>-0.008 ±0.009</td><td rowspan="3">-0.019 ±0.010 -0.008 ±0.010</td></tr><tr><td>0.001</td><td>入=1</td><td>0.008 ±0.009</td><td></td></tr><tr><td>-0.025</td><td>入=0</td><td>0.019 ±0.010</td><td>0.008 ±0.010</td></tr></table>
 Figure 6: GMAN∗ regulates difficulty of the game by adjusting $\lambda$ . Initially, $G$ reduces $\lambda$ to ease learning and then gradually increases $\lambda$ for a more challenging learning environment. Figure 7: Pairwise $\frac { \mathbf { G } \mathbf { M } \mathbf { A } \mathbf { M } } { s t d e \nu ( \mathbf { G } \mathbf { M } \mathbf { A } \mathbf { M } ) }$ for GMAN- $\lambda$ and GMAN∗ $( \lambda ^ { * } )$ over 5 runs on MNIST.
# 5.2.2 CELEBA & CIFAR-10
We see similar accelerated convergence behavior for the CelebA dataset in Figure 8.
 Figure 8: Image quality improvement across number of generators at same number of iterations for GMAN-0 on CelebA.
 Figure 9 displays images generated by GMAN-0 on CIFAR-10. See Appendix A.3 for more results. Figure 9: Images generated by GMAN-0 on the CIFAR-10 dataset.
We also found that GMAN is robust to mode collapse. We believe this is because the generator must appease a diverse set of discriminators in each minibatch. Emitting a single sample will score well for one discriminator at the expense of the rest of the discriminators. Current solutions (e.g., minibatch discrimination) are quadratic in batch size. GMAN, however, is linear in batch size.
# 6 CONCLUSION
We introduced multiple discriminators into the GAN framework and explored discriminator roles ranging from a formidable adversary to a forgiving teacher. Allowing the generator to automatically tune its learning schedule $\mathbf { ( G M A N ^ { * } }$ ) outperformed GANs with a single discriminator on MNIST. In general, GMAN variants achieved faster convergence to a higher quality steady state on a variety of tasks as measured by a GAM-type metric (GMAM). In addition, GMAN makes using the original GAN objective possible by increasing the odds of the generator receiving constructive feedback.
In future work, we will look at more sophisticated mechanisms for letting the generator control the game as well as other ways to ensure diversity among the discriminators. Introducing multiple generators is conceptually an obvious next step, however, we expect difficulties to arise from more complex game dynamics. For this reason, game theory and game design will likely be important.
# ACKNOWLEDGMENTS
We acknowledge helpful conversations with Stefan Dernbach, Archan Ray, Luke Vilnis, Ben Turtel, Stephen Giguere, Rajarshi Das, and Subhransu Maji. We also thank NVIDIA for donating a K40 GPU. This material is based upon work supported by the National Science Foundation under Grant Nos. IIS-1564032. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the NSF.
# BIBLIOGRAPHY
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.
Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, and Mario Marchand. Domain-adversarial neural networks. arXiv preprint arXiv:1412.4446, 2014.
J Andrew Bagnell. Robust supervised learning. In Proceedings Of The National Conference On Artificial Intelligence, volume 20, pp. 714. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2005.
Alina Beygelzimer, Satyen Kale, and Haipeng Luo. Optimal and adaptive algorithms for online boosting. arXiv preprint arXiv:1502.02651, 2015.
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.
Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in neural information processing systems, pp. 1486–1494, 2015.
Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. ¨ arXiv preprint arXiv:1605.09782, 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.
Harrison Edwards and Amos Storkey. Censoring representations with an adversary. arXiv preprint arXiv:1511.05897, 2015.
Jon Gauthier. Conditional generative adversarial nets for convolutional face generation. Class Project for Stanford CS231N: Convolutional Neural Networks for Visual Recognition, Winter semester, 2014, 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.
Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. arXiv preprint arXiv:1606.03476, 2016.
Daniel Jiwoong Im, Chris Dongjoo Kim, Hui Jiang, and Roland Memisevic. Generating images with recurrent adversarial networks. arXiv preprint arXiv:1602.05110, 2016.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Alex Krizhevsky. Learning multiple layers of features from tiny images. Master’s Thesis, 2009.
Yann LeCun, Corinna Cortes, and Christopher JC Burges. The mnist database of handwritten digits, 1998.
Yujia Li, Kevin Swersky, and Richard Zemel. Generative moment matching networks. In International Conference on Machine Learning, pp. 1718–1727, 2015.
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, and Ian Goodfellow. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2015.
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. arXiv preprint arXiv:1606.00709, 2016.
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
Siamak Ravanbakhsh, Francois Lanusse, Rachel Mandelbaum, Jeff Schneider, and Barnabas Poczos. Enabling dark energy science with deep generative models of galaxy images. arXiv preprint arXiv:1609.05796, 2016.
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
Jurgen Schmidhuber. Learning factorial codes by predictability minimization. ¨ Neural Computation, 4(6):863–879, 1992.
Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative¨ models. arXiv preprint arXiv:1511.01844v3, 2016.
Masatoshi Uehara, Issei Sato, Masahiro Suzuki, Kotaro Nakayama, and Yutaka Matsuo. Generative adversarial nets from a density ratio estimation perspective. arXiv preprint arXiv:1610.02920, 2016.
Donggeun Yoo, Namil Kim, Sunggyun Park, Anthony S Paek, and In So Kweon. Pixel-level domain transfer. arXiv preprint arXiv:1603.07442, 2016.
Matthew D Zeiler, Dilip Krishnan, Graham W Taylor, and Rob Fergus. Deconvolutional networks. In Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on, pp. 2528–2535. IEEE, 2010.
Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
# A APPENDIX
# A.1 ACCELERATED CONVERGENCE & REDUCED VARIANCE
See Figures 10, 11, 12, and 13.
 Figure 10: Generator objective, $F$ , averaged over 5 training runs on CelebA. Increasing $N$ (# of $D$ ) accelerates convergence of $F$ to steady state (solid line) and reduces its variance, $\sigma ^ { 2 }$ (filled shadow $\pm 1 \sigma$ ). Figure 11 provides alternative evidence of GMAN-0’s accelerated convergence.
 Figure 11: Stdev, $\sigma$ , of the generator objective over a sliding window of 500 iterations. Lower values indicate a more steady-state. GMAN-0 with $N = 5$ achieves steady-state at ${ \approx } 2 \mathbf { x }$ speed of GAN $( N = 1 )$ ). Note Figure $1 0 ^ { \circ } \mathrm { s }$ filled shadows reveal stdev of $F$ over runs, while this plot shows stdev over time.
 Figure 12: Generator objective, $F$ , averaged over 5 training runs on CIFAR-10. Increasing $N$ (# of $D$ ) accelerates convergence of $F$ to steady state (solid line) and reduces its variance, $\textstyle { \bar { \sigma } } ^ { 2 }$ (filled shadow $\pm 1 \sigma$ ). Figure 13 provides alternative evidence of GMAN-0’s accelerated convergence.
 Figure 13: Stdev, $\sigma$ , of the generator objective over a sliding window of 500 iterations. Lower values indicate a more steady-state. GMAN-0 with $N = 5$ achieves steady-state at ${ \approx } 2 \mathbf { x }$ speed of GAN $N = 1$ ). Note Figure 12’s filled shadows reveal stdev of $F$ over runs, while this plot shows stdev over time.
# A.2 ADDITIONAL GMAM TABLES
See Tables 2, 3, 4, 5, 6. Increasing the number of discriminators from 2 to 5 on CIFAR-10 significantly improves scores over the standard GAN both in terms of the GMAM metric and Inception scores.
# A.3 GENERATED IMAGES
See Figures 14 and 15.
<table><tr><td></td><td>Score</td><td>Variant</td><td>GMAN*</td><td>GMAN-1</td><td>GAN</td><td>GMAN-0</td><td>GMAN-max</td><td>mod-GAN</td></tr><tr><td rowspan="6">←Feneg</td><td>0.184 0.067</td><td>GMAN*</td><td>=</td><td>-0.007</td><td>-0.040</td><td>-0.020</td><td>-0.028</td><td>-0.089</td></tr><tr><td>0.030</td><td>GMAN-1</td><td>0.007</td><td>1</td><td>-0.008</td><td>-0.008</td><td>-0.021</td><td>-0.037</td></tr><tr><td></td><td>GAN</td><td>0.040</td><td>0.008</td><td>-</td><td>0.002</td><td>-0.018</td><td>-0.058</td></tr><tr><td>0.005</td><td>GMAN-0</td><td>0.020</td><td>0.008</td><td>0.002</td><td>-</td><td>-0.013</td><td>-0.018</td></tr><tr><td>-0.091</td><td>GMAN-max</td><td>0.028</td><td>0.021</td><td>0.018</td><td>0.013</td><td>-</td><td>-0.011</td></tr><tr><td>-0.213</td><td>mod-GAN</td><td>0.089</td><td>0.037</td><td>0.058</td><td>0.018</td><td>0.011</td><td>=</td></tr></table>
Table 2: Pairwise GMAM metric means for select models on MNIST. For each column, a positive GMAM indicates better performance relative to the row opponent; negative implies worse. Scores are obtained by summing each column.
<table><tr><td></td><td>Score</td><td>Variant</td><td>GMAN-0</td><td>GMAN-1</td><td>GMAN*</td><td>mod-GAN</td></tr><tr><td rowspan="4">Beeneg</td><td>0.172</td><td>GMAN-0</td><td>1</td><td>-0.022</td><td>-0.062</td><td>-0.088</td></tr><tr><td>0.050</td><td>GMAN-1</td><td>0.022</td><td></td><td>0.006</td><td>-0.078</td></tr><tr><td>-0.055</td><td>GMAN*</td><td>0.062</td><td>-0.006</td><td>=</td><td>-0.001</td></tr><tr><td>-0.167</td><td>mod-GAN</td><td>0.088</td><td>0.078</td><td>0.001</td><td>=</td></tr></table>
Table 3: Pairwise GMAM metric means for select models on CIFAR-10. For each column, a positive GMAM indicates better performance relative to the row opponent; negative implies worse. Scores are obtained by summing each column. GMAN variants were trained with two discriminators.
Table 4: Inception score means with standard deviations for select models on CIFAR-10. Higher scores are better. GMAN variants were trained with two discriminators.
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>GMAN-0</td><td rowspan=1 colspan=1>GMAN-1</td><td rowspan=1 colspan=1>mod-GAN</td><td rowspan=1 colspan=1>GMAN*</td></tr><tr><td rowspan=1 colspan=1>Score</td><td rowspan=1 colspan=1>5.878± 0.193</td><td rowspan=1 colspan=1>5.765 ± 0.168</td><td rowspan=1 colspan=1>5.738± 0.176</td><td rowspan=1 colspan=1>5.539± 0.099</td></tr></table>
<table><tr><td></td><td>Score</td><td>Variant</td><td>GMAN-0</td><td>GMAN*</td><td>GMAN-1</td><td>mod-GAN</td></tr><tr><td rowspan="5">FFeeeg</td><td>0.180</td><td>GMAN-0</td><td>=</td><td>-0.008</td><td>-0.041</td><td>-0.132</td></tr><tr><td>0.122</td><td>GMAN*</td><td>0.008</td><td>=</td><td>-0.038</td><td>-0.092</td></tr><tr><td>0.010</td><td>GMAN-1</td><td>0.041</td><td>0.038</td><td></td><td>-0.089</td></tr><tr><td>-0.313</td><td>mod-GAN</td><td>0.132</td><td>0.092</td><td>0.089</td><td>1</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
Table 5: Pairwise GMAM metric means for select models on CIFAR-10. For each column, a positive GMAM indicates better performance relative to the row opponent; negative implies worse. Scores are obtained by summing each column. GMAN variants were trained with five discriminators.
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>GMAN-1</td><td rowspan=1 colspan=1>GMAN-0</td><td rowspan=1 colspan=1>GMAN*</td><td rowspan=1 colspan=1>mod-GAN</td></tr><tr><td rowspan=1 colspan=1>Score</td><td rowspan=1 colspan=1>6.001± 0.194</td><td rowspan=1 colspan=1>5.957 ± 0.135</td><td rowspan=1 colspan=1>5.955 ± 0.153</td><td rowspan=1 colspan=1>5.738 ± 0.176</td></tr></table>
Table 6: Inception score means with standard deviations for select models on CIFAR-10. Higher scores are better. GMAN variants were trained with five discriminators.
 Figure 14: Sample of pictures generated on CelebA cropped dataset.
 Figure 15: Sample of pictures generated by GMAN-0 on CIFAR dataset.
# A.4 SOMEWHAT RELATED WORK
A GAN framework with two discriminators appeared in Yoo et al. (2016), however, it is applicable only in a semi-supervised case where a label can be assigned to subsets of the dataset (e.g., $\mathcal { X } \ = \ \{ \mathcal { X } _ { 1 } = \operatorname { D o m a i n } \ 1 , \mathcal { X } _ { 2 } = \operatorname { D o m a i n } \ 2 , \ldots \} .$ ). In contrast, our framework applies to an unsupervised scenario where an obvious partition of the dataset is unknown. Furthermore, extending GMAN to the semi-supervised domain-adaptation scenario would suggest multiple discriminators per domain, therefore our line of research is strictly orthogonal to that of their multi-domain discriminator approach. Also, note that assigning a discriminator to each domain is akin to prescribing a new discriminator to each value of a conditional variable in conditional GANs (Mirza & Osindero (2014)). In this case, we interpret GMAN as introducing multiple conditional discriminators and not a discriminator for each of the possibly exponentially many conditional labels.
In Section 4.4, we describe an approach to customize adversarial training to better suit the development of the generator. An approach with similar conceptual underpinnings was described in Ravanbakhsh et al. (2016), however, similar to the above, it is only admissible in a semi-supervised scenario whereas our applies to the unsupervised case.
# A.5 Softmax REPRESENTABILITY
Let soft $n a x ( V _ { i } ) = \hat { V } \in [ \operatorname* { m i n } _ { V _ { i } } , \operatorname* { m a x } _ { V _ { i } } ]$ . Also let $a = a r g \operatorname* { m i n } _ { i } V _ { i }$ , $b = a r g \operatorname* { m a x } _ { i } V _ { i }$ , and $\gamma ( t ) =$ $V ( ( 1 - t ) D _ { a } + t D _ { b } )$ so that $\nu ( 0 ) = V _ { a }$ and $\nu ( 1 ) = V _ { b }$ . The softmax and minimax objective $V ( D _ { i } , G )$ are both continuous in their inputs, so by the intermediate value theorem, we have that $\exists { \hat { t } } \in [ 0 , 1 ]$ s.t. $\mathcal { V } ( \hat { t } ) = \hat { V }$ , which implies $\exists \hat { D } \in \mathcal { D }$ s.t. $V ( \hat { D } , G ) = \hat { V }$ . This result implies that the softmax (and any other continuous substitute) can be interpreted as returning $V ( \hat { D } , G )$ for some $\hat { D }$ selected by computing an another, unknown function over the space of the discriminators. This result holds even if $\hat { D }$ is not representable by the architecture chosen for $D$ ’s neural network.
# A.6 UNCONSTRAINED OPTIMIZATION
To convert GMAN∗ minimax formulation to an unconstrained minimax formulation, we introduce an auxiliary variable, $\Lambda$ , define $\lambda ( \Lambda ) = \log ( 1 + e ^ { \Lambda } )$ , and let the generator minimize over $\Lambda \in \mathbb { R }$ .
# A.7 BOOSTING WITH AdaBoost.OL
AdaBoost.OL (Beygelzimer et al. (2015)) does not require knowledge of the weak learner’s slight edge over random guessing $( P ( { \mathrm { c o r r e c t 1 a b e l } } ) = 0 . 5 + \gamma \in ( 0 , 0 . 5 ] )$ , and in fact, allows $\gamma < 0$ . This is crucial because our weak learners are deep nets with unknown, possibly negative, $\gamma$ ’s.
 Figure 16: Sample of pictures generated across 4 independent runs on MNIST with F-boost (similar results with P-boost).
# A.8 EXPERIMENTAL SETUP
All experiments were conducted using an architecture similar to DCGAN (Radford et al. (2015)). We use convolutional transpose layers (Zeiler et al. (2010)) for $G$ and strided convolutions for $D$ except for the input of $G$ and the last layer of $D$ . We use the single step gradient method as in (Nowozin et al. (2016)), and batch normalization (Ioffe & Szegedy (2015)) was used in each of the generator layers. The different discriminators were trained with varying dropout rates from [0.3, 0.7]. Variations in the discriminators were effected in two ways. We varied the architecture by varying the number of filters in the discriminator layers (reduced by factors of 2, 4 and so on), as well as varying dropout rates. Secondly we also decorrelated the samples that the disriminators were training on by splitting the minibatch across the discriminators. The code was written in Tensorflow (Abadi et al. (2016)) and run on Nvidia GTX 980 GPUs. Code to reproduce experiments and plots is at https://github.com/iDurugkar/GMAN. Specifics for the MNIST architecture and training are:
• Generator latent variables z ∼ U (−1, 1)100 • Generator convolution transpose layers: $\left( 4 , 4 , 1 2 8 \right) , \left( 8 , 8 , 6 4 \right) , \left( 1 6 , 1 6 , 3 2 \right) , \left( 3 2 , 3 2 , 1 \right)$ • Base Discriminator architecture: $\left( 3 2 , 3 2 , 1 \right) , \left( 1 6 , 1 6 , 3 2 \right) , \left( 8 , 8 , 6 4 \right) , \left( 4 , 4 , 1 2 8 \right) .$ • Variants have either convolution 3 $( 4 , 4 , 1 2 8 )$ removed or all the filter sizes are divided by 2 or 4. That is, $\left( 3 2 , 3 2 , 1 \right) , \left( 1 6 , 1 6 , 1 6 \right) , \left( 8 , 8 , 3 2 \right) , \left( 4 , 4 , 6 4 \right)$ or $\left( 3 2 , 3 2 , 1 \right) , \left( 1 6 , 1 6 , 8 \right) , \left( 8 , 8 , 1 6 \right) , \left( 4 , 4 , 3 2 \right)$ . • ReLu activations for all the hidden units. Tanh activation at the output units of the generator. Sigmoid at the output of the Discriminator. • Training was performed with Adam (Kingma & Ba (2014)) $( l r = 2 \times 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 5 )$ ). • MNIST was trained for 20 epochs with a minibatch of size 100. • CelebA and CIFAR were trained over 24000 iterations with a minibatch of size 100.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496# UNDERSTANDING AND ROBUSTIFYING DIFFERENTIABLE ARCHITECTURE SEARCH
Arber $\mathbf { Z e l a } ^ { 1 }$ , Thomas Elsken2,1, Tonmoy Saikia1, Yassine Marrakchi1, Thomas Brox1 & Frank Hutter1,2 1Department of Computer Science, University of Freiburg {zelaa, saikiat, marrakch, brox, fh}@cs.uni-freiburg.de 2Bosch Center for Artificial Intelligence Thomas.Elsken@de.bosch.com
# ABSTRACT
Differentiable Architecture Search (DARTS) has attracted a lot of attention due to its simplicity and small search costs achieved by a continuous relaxation and an approximation of the resulting bi-level optimization problem. However, DARTS does not work robustly for new problems: we identify a wide range of search spaces for which DARTS yields degenerate architectures with very poor test performance. We study this failure mode and show that, while DARTS successfully minimizes validation loss, the found solutions generalize poorly when they coincide with high validation loss curvature in the architecture space. We show that by adding one of various types of regularization we can robustify DARTS to find solutions with less curvature and better generalization properties. Based on these observations, we propose several simple variations of DARTS that perform substantially more robustly in practice. Our observations are robust across five search spaces on three image classification tasks and also hold for the very different domains of disparity estimation (a dense regression task) and language modelling.
# 1 INTRODUCTION
Neural Architecture Search (NAS), the process of automatically designing neural network architectures, has recently attracted attention by achieving state-of-the-art performance on a variety of tasks (Zoph & Le, 2017; Real et al., 2019). Differentiable architecture search (DARTS) (Liu et al., 2019) significantly improved the efficiency of NAS over prior work, reducing its costs to the same order of magnitude as training a single neural network. This expanded the scope of NAS substantially, allowing it to also be applied on more expensive problems, such as semantic segmentation (Chenxi et al., 2019) or disparity estimation (Saikia et al., 2019).
However, several researchers have also reported DARTS to not work well, in some cases even no better than random search (Li & Talwalkar, 2019; Sciuto et al., 2019). Why is this? How can these seemingly contradicting results be explained? The overall goal of this paper is to understand and overcome such failure modes of DARTS. To this end, we make the following contributions:
1. We identify 12 NAS benchmarks based on four search spaces in which standard DARTS yields degenerate architectures with poor test performance across several datasets (Section 3). 2. By computing the eigenspectrum of the Hessian of the validation loss with respect to the architectural parameters, we show that there is a strong correlation between its dominant eigenvalue and the architecture’s generalization error. Based on this finding, we propose a simple variation of DARTS with early stopping that performs substantially more robustly (Section 4). 3. We show that, related to previous work on sharp/flat local minima, regularizing the inner objective of DARTS more strongly allows it to find solutions with smaller Hessian spectrum and better generalization properties. Based on these insights, we propose two practical robustifications of DARTS that overcome its failure modes in all our 12 NAS benchmarks (Section 5).
Our findings are robust across a wide range of NAS benchmarks based on image recognition and also hold for the very different domains of language modelling (PTB) and disparity estimation. They consolidate the findings of the various results in the literature and lead to a substantially more robust version of DARTS. We provide our implementation and scripts to facilitate reproducibility1.
# 2 BACKGROUND AND RELATED WORK
# 2.1 RELATION BETWEEN FLAT/SHARP MINIMA AND GENERALIZATION PERFORMANCE
Already Hochreiter & Schmidhuber (1997) observed that flat minima of the training loss yield better generalization performance than sharp minima. Recent work (Keskar et al., 2016; Yao et al., 2018) focuses more on the settings of large/small batch size training, where observations show that small batch training tends to get attracted to flatter minima and generalizes better. Similarly, Nguyen et al. (2018) observed that this phenomenon manifests also in the hyperparameter space. They showed that whenever the hyperparameters overfit the validation data, the minima lie in a sharper region of the space. This motivated us to conduct a similar analysis in the context of differentiable architecture search later in Section 4.1, where we see the same effect in the space of neural network architectures.
# 2.2 BI-LEVEL OPTIMIZATION
We start by a short introduction of the bi-level optimization problem (Colson et al., 2007). These are problems which contain two optimization tasks, nested within each other.
Definition 2.1. Given the outer objective function $F : \mathbb { R } ^ { P } \times \mathbb { R } ^ { N } \to \mathbb { R }$ and the inner objective function $f : \mathbb { R } ^ { P } \times \mathbb { R } ^ { N } \to \mathbb { R }$ , the bi-level optimization problem is given by
$$\begin{array} { r l } & { \underset { y \in \mathbb { R } ^ { P } } { \operatorname* { m i n } } F ( y , \theta ^ { * } ( y ) ) } \\ & { s . t . \quad \theta ^ { * } ( y ) \in \underset { \theta \in \mathbb { R } ^ { N } } { \arg \operatorname* { m i n } } f ( y , \theta ) , } \end{array}$$
where $y \in \mathbb { R } ^ { P }$ and $\boldsymbol { \theta } \in \mathbb { R } ^ { N }$ are the outer and inner variables, respectively. One may also see the bi-level problem as a constrained optimization problem, with the inner problem as a constraint.
In general, even in the case when the inner objective (2) is strongly convex and has an unique minimizer $\theta ^ { * } ( y ) = \arg \operatorname* { m i n } _ { \theta \in \mathbb { R } ^ { N } } f ( y , \theta )$ , it is not possible to directly optimize the outer objective (1). A possible method around this issue is to use the implicit function theorem to retrieve the derivative of the solution map (or response map) $\theta ^ { * } ( y ) \in \mathbb { F } \subseteq \mathbb { R } ^ { N }$ w.r.t. $y$ (Bengio, 2000; Pedregosa, 2016; Beirami et al., 2017). Another strategy is to approximate the inner problem with a dynamical system (Domke, 2012; Maclaurin et al., 2015; Franceschi et al., 2017; 2018), where the optimization dynamics could, e.g., describe gradient descent. In the case that the minimizer of the inner problem is unique, under some conditions the set of minimizers of this approximate problem will indeed converge to the minimizers of the bilevel problem (1) (see Franceschi et al. (2018)).
# 2.3 NEURAL ARCHITECTURE SEARCH
Neural Architecture Search (NAS) denotes the process of automatically designing neural network architectures in order to overcome the cumbersome trial-and-error process when designing architectures manually. We briefly review NAS here and refer to the recent survey by Elsken et al. (2019b) for a more thorough overview. Prior work mostly employs either reinforcement learning techniques (Baker et al., 2017a; Zoph & Le, 2017; Zhong et al., 2018; Zoph et al., 2018) or evolutionary algorithms (Stanley & Miikkulainen, 2002; Liu et al., 2018b; Miikkulainen et al., 2017; Real et al., 2017; 2019) to optimize the discrete architecture space. As these methods are often very expensive, various works focus on reducing the search costs by, e.g., employing network morphisms (Cai et al., 2018a;b; Elsken et al., 2017; 2019a), weight sharing within search models (Saxena & Verbeek, 2016; Bender et al., 2018; Pham et al., 2018) or multi-fidelity optimization (Baker et al., 2017b; Falkner et al., 2018; Li et al., 2017; Zela et al., 2018), but their applicability still often remains restricted to rather simple tasks and small datasets.
# 2.4 DIFFERENTIABLE ARCHITECTURE SEARCH (DARTS)
A recent line of work focuses on relaxing the discrete neural architecture search problem to a continuous one that can be solved by gradient descent (Liu et al., 2019; Xie et al., 2019; Casale et al., 2019; Cai et al., 2019). In DARTS (Liu et al., 2019), this is achieved by simply using a weighted sum of possible candidate operations for each layer, whereas the real-valued weights then effectively parametrize the network’s architecture. We will now review DARTS in more detail, as our work builds directly upon it.
Continuous relaxation of the search space. In agreement with prior work (Zoph et al., 2018; Real et al., 2019), DARTS optimizes only substructures called cells that are stacked to define the full network architecture. Each cell contains $N$ nodes organized in a directed acyclic graph. The graph contains two inputs nodes (given by the outputs of the previous two cells), a set of intermediate nodes, and one output node (given by concatenating all intermediate nodes). Each intermediate node $x ^ { ( j ) }$ represents a feature map. See Figure 1 for an illustration of such a cell. Instead of applying a single operation to a specific node during architecture search, Liu et al. (2019) relax the decision which operation to choose by computing the intermediate node as a mixture of candidate operations, applied to predecessor nodes x(i), i < j, x(j) = Pi<j Po∈O exp(αi,jo )Po0∈O exp(αi,j0 ) o , where $\mathcal { O }$ denotes the set of all candidate operations (e.g., $3 \times 3$ convolution, skip connection, $3 \times 3$ max pooling, etc.) and $\alpha = ( \alpha _ { o } ^ { i , j } ) _ { i , j , o }$ serves as a real-valued parameterization of the architecture.
Gradient-based optimization of the search space. DARTS then optimizes both the weights of the search network (often called the weight-sharing or one-shot model, since the weights of all individual subgraphs/architectures are shared) and architectural parameters by alternating gradient descent. The network weights and the architecture parameters are optimized on the training and validation set, respectively. This can be interpreted as solving the bi-level optimization problem (1), (2), where $F$ and $f$ are the validation and training loss, $\mathcal { L } _ { v a l i d }$ and $\mathcal { L } _ { t r a i n }$ , respectively, while $y$ and $\theta$ denote the architectural parameters $\alpha$ and network weights $w$ , respectively. Note that DARTS only approximates the lower-level solution by a single gradient step (see Appendix A for more details).
At the end of the search phase, a discrete cell is obtained by choosing the $k$ most important incoming operations for each intermediate node while all others are pruned. Importance is measured by the operation weighting factor $\frac { \exp ( \alpha _ { o } ^ { i , j } ) } { \sum _ { o ^ { \prime } \in \mathcal { O } } \exp ( \alpha _ { o ^ { \prime } } ^ { i , j } ) }$ .
# 3 WHEN DARTS FAILS
We now describe various search spaces and demonstrate that standard DARTS fails on them. We start with four search spaces similar to the original CIFAR-10 search space but simpler, and evaluate across three different datasets (CIFAR-10, CIFAR-100 and SVHN). They are quite standard in that they use the same macro architecture as the original DARTS paper (Liu et al., 2018a), consisting of normal and reduction cells; however, they only allow a subset of operators for the cell search space:
S1: This search space uses a different set of only two operators per edge, which we identified using an offline process that iteratively dropped the operations from the original DARTS search space with the least importance. This pre-optimized space has the advantage of being quite small while still including many strong architectures. We refer to Appendix B for details on its construction and an illustration (Figure 9). S2: In this space, the set of candidate operations per edge is $\{ 3 \times 3$ SepConv, SkipConnect}. We choose these operations since they are the most frequent ones in the discovered cells reported by Liu et al. (2019). S3: In this space, the set of candidate operations per edge is $\{ 3 \times 3$ SepConv, SkipConnect, $Z e r o \}$ , where the Zero operation simply replaces every value in the input feature map by zeros. S4: In this space, the set of candidate operations per edge is $\{ 3 \times 3 ~ S e p C o n \nu , N o i s e \}$ , where the Noise operation simply replaces every value from the input feature map by noise $\epsilon \sim \mathcal { N } ( 0 , \bar { 1 } )$ . This is the only space out of S1-S4 that is not a strict subspace of the
 Figure 1: The poor cells standard DARTS finds on spaces S1-S4. For all spaces, DARTS chooses mostly parameter-less operations (skip connection) or even the harmful Noise operation. Shown are the normal cells on CIFAR-10; see Appendix G for reduction cells and other datasets.
original DARTS space; we intentionally added the Noise operation, which actively harms performance and should therefore not be selected by DARTS.
We ran DARTS on each of these spaces, using exactly the same setup as Liu et al. (2019). Figure 1 shows the poor cells DARTS selected on these search spaces for CIFAR-10 (see Appendix G for analogous results on the other datasets). Already visually, one might suspect that the found cells are suboptimal: the parameter-less skip connections dominate in almost all the edges for spaces S1-S3, and for S4 even the harmful Noise operation was selected for five out of eight operations. Table 1 (first column) confirms the very poor performance standard DARTS yields on all of these search spaces and on different datasets. We note that Liu et al. (2019) and Xie et al. (2019) argue that the Zero operation can help to search for the architecture topology and choice of operators jointly, but in our experiments it did not help to reduce the importance weight of the skip connection (compare Figure 1b vs. Figure 1c).
We emphasize that search spaces S1-S3 are very natural, and, as strict subspaces of the original space, should merely be easier to search than that. They are in no way special or constructed in an adversarial manner. Only S4 was constructed specifically to show-case the failure mode of DARTS selecting the obviously suboptimal Noise operator.
S5: Very small search space with known global optimum. Knowing the global minimum has the advantage that one can benchmark the performance of algorithms by measuring the regret of chosen points with respect to the known global minimum. Therefore, we created another search space with only one intermediate node for both normal and reduction cells, and 3 operation choices in each edge, namely $3 \times 3$ SepConv, SkipConnection, and $3 \times 3$ MaxPooling. The total number of possible architectures in this space is 81, all of which we evaluated a-priori. We dub this space S5.
We ran DARTS on this search space three times for each dataset and compared its result to the baseline of Random Search with weight sharing (RS-ws) by Li & Talwalkar (2019). Figure 2 shows the test regret of the architectures selected by DARTS (blue) and RS-ws (green) throughout the search. DARTS manages to find an architecture close to the global minimum, but around epoch 40 the test performance deteriorated. Note that the search model validation error (dashed red line) did not deteriorate but rather converged, indicating that the architectural parameters are overfitting to the validation set. In contrast, RS-ws stays relatively constant throughout the search; when evaluating only the final architecture found, RS-ws indeed outperformed DARTS.
 Figure 2: Test regret of found architectures and validation error of the search model when running DARTS on S5 and CIFAR-10. DARTS finds the global minimum but starts overfitting the architectural parameters to the validation set in the end.
S6: encoder-decoder architecture for disparity estimation. To study whether our findings generalize beyond image recognition, we also analyzed a search space for a very different problem: finding encoder-decoder architectures for the dense regression task of disparity estimation; please refer to Appendix E for details. We base this search space on AutoDispNet (Saikia et al., 2019), which used DARTS for a space containing normal, downsampling and upsampling cells. We again constructed a reduced space. Similarly to the image classification search spaces, we found the normal cell to be mainly composed of parameter-less operations (see Figure 25 in Appendix G). As expected, this causes a large generalization error (see first row in Table 2 of our later experiments).
 Figure 3: (left) validation error of search model; (middle) test error of the architectures deemed by DARTS optimal (right) dominant eigenvalue of $\nabla _ { \alpha } ^ { 2 } \mathcal { L } _ { v a l i d }$ throughout DARTS search. Solid line and shaded areas show mean and standard deviation of 3 independent runs. All experiments conducted on CIFAR-10.
# 4 THE ROLE OF DOMINANT EIGENVALUES OF $\nabla _ { \alpha } ^ { 2 } \mathcal { L } _ { v a l i d }$
We now analyze why DARTS fails in all these cases. Motivated by Section 2.1, we will have a closer look at the largest eigenvalue $\lambda _ { m a x } ^ { \alpha }$ of the Hessian matrix of validation loss $\nabla _ { \alpha } ^ { 2 } \mathcal { L } _ { v a l i d }$ w.r.t. the architectural parameters $\alpha$ .
# 4.1 LARGE ARCHITECTURAL EIGENVALUES AND GENERALIZATION PERFORMANCE
One may hypothesize that DARTS performs poorly because its approximate solution of the bi-level optimization problem by iterative optimization fails, but we actually observe validation errors to progress nicely: Figure 3 (left) shows that the search model validation error converges in all cases, even though the cell structures selected here are the ones in Figure 1.
Rather, the architectures DARTS finds do not generalize well. This can be seen in Figure 3 (middle). There, every 5 epochs, we evaluated the architecture deemed by DARTS to be optimal according to the $\alpha$ values. Note that whenever evaluating on the test set, we retrain from scratch the architecture obtained after applying the argmax to the architectural weights $\alpha$ . As one can notice, the architectures start to degenerate after a certain number of search epochs, similarly to the results shown in Figure 2. We hypothesized that this might be related to sharp local minima as discussed in Section 2.1. To test this hypothesis, we computed the full Hessian $\nabla _ { \alpha } ^ { 2 } \mathcal { L } _ { v a l i d }$ of the validation loss w.r.t. the architectural parameters on a randomly sampled mini-batch. Fshows that the dominant eigenvalue $\lambda _ { m a x } ^ { \alpha }$ 3 (right)(which serves as a proxy for the sharpness) indeed increases in standard DARTS, along with the test error (middle) of the final architectures, while the validation error still decreases (left). We also studied the correlation between $\lambda _ { m a x } ^ { \alpha }$ and test error more directly, by measuring these two quantities for 24 different architectures (obtained via standard DARTS and the regularized versions we discuss in Section 5). For the example of space S1 on CIFAR-10, Figure 4 shows that λαmax i ndeed strongly correlates with test error (with a Pearson correlation coefficient of 0.867).
 Figure 4: Correlation between dominant eigenvalue of $\nabla _ { \alpha } ^ { 2 } \mathcal { L } _ { v a l i d }$ and test error of corresponding architectures.
 Figure 6: Local average (LA) of the dominant eigenvalue $\lambda _ { m a x } ^ { \alpha }$ throughout DARTS search. Markers denote the early stopping point based on the criterion in Section 4.3. Each line also corresponds to one of the runs in Table 1.
One reason why DARTS performs poorly when the architectural eigenvalues are large (and thus the minimum is sharp) might be the pruning step at the end of DARTS: the optimal, continuous $\alpha ^ { * }$ from the search is pruned to obtain a discrete $\alpha ^ { d i s c }$ , somewhere in the neighbourhood of $\alpha ^ { * }$ . In the case of a sharp minimum $\alpha ^ { * }$ , $\alpha ^ { d i s c }$ might have a loss function value significantly higher than the minimum $\alpha ^ { * }$ , while in the case of a flat minimum, $\alpha ^ { d i s c }$ is expected to have a similar loss function value. This is hypothetically illustrated in Figure 5a, where the $y .$ -axis indicates the search model validation loss and the $x$ -axis the $\alpha$ values.
To investigate this hypothesis, we measured the performance drop: $\mathcal { L } _ { v a l i d } ( \alpha ^ { d i s c } , w ^ { * } ) - \mathcal { L } _ { v a l i d } ( { \alpha ^ { * } } , { \bf \dot { w } ^ { * } } )$ w.r.t. to the search model weights incurred by this discretization step and correlated it with $\lambda _ { m a x } ^ { \alpha }$ . The results in Figure 5b show that, indeed, low curvature never led to large performance drops (here we actually compute the accuracy drop rather than the loss function difference, but we observed a similar relationship). Having identified this relationship, we now move on to avoid high curvature.
 Figure 5: (a) Hypothetical illustration of the loss function change in the case of flat vs. sharp minima. (b) Drop in accuracy after discretizing the search model vs. the sharpness of minima (by means of $\lambda _ { m a x } ^ { \alpha }$ ).
# 4.3 EARLY STOPPING
# BASED ON LARGE EIGENVALUES OF $\nabla _ { \alpha } ^ { 2 } \mathcal { L } _ { v a l i d }$
We propose a simple early stopping methods to avoid large curvature and thus poor generalization. We emphasize that simply stopping the search based on validation performance (as one would do in the case of training a network) does not apply here as NAS directly optimizes validation performance, which – as we have seen in Figure 2 – keeps on improving.
Instead, we propose to track $\lambda _ { m a x } ^ { \alpha }$ over the course of architecture search and stop whenever it increases too much. To implement this idea, we use a simple heuristic that worked off-the-shelf without any tuning. Let $\bar { \lambda } _ { m a x } ^ { \bar { \alpha } } ( i )$ denote the value of $\lambda _ { m a x } ^ { \alpha }$ smoothed over $k = 5$ epochs around $i$ ; then, we stop if $\overline { { \lambda } } _ { m a x } ^ { \alpha } ( i - k ) / \overline { { \lambda } } _ { m a x } ^ { \alpha } ( i ) < 0 . 7 5$ and return the architecture from epoch $i - k$ .
 Figure 7: Effect of regularization strength via ScheduledDropPath (during the search phase) on the test performance of DARTS (solid lines) and DARTS-ES (dashed-lines). Results for each of the search spaces and datasets.
By this early stopping heuristic, we do not only avoid exploding eigenvalues, which are correlated with poor generalization (see Figure 4), but also shorten the time of the search.
Table 1: Performance of DARTS and DARTS-ES. (mean $\pm$ std for 3 runs each).
Table 1 shows the results for running DARTS with this early stopping criterion (DARTS-ES) across S1-S4 and all three image classification datasets. Figure 6 shows the local average of the eigenvalue trajectory throughout the search and the point where the DARTS search early stops for each of the settings in Table 1. Note that we never use the test data when applying the early stopping mechanism. Early stopping significantly improved DARTS for all settings without ever harming it.
<table><tr><td rowspan=1 colspan=2>Benchmark</td><td rowspan=1 colspan=1>DARTS</td><td rowspan=1 colspan=1>DARTS-ES</td></tr><tr><td rowspan=4 colspan=1>C10</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>4.66 ± 0.71</td><td rowspan=1 colspan=1>3.05± 0.07</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>4.42 ± 0.40</td><td rowspan=1 colspan=1>3.41 ± 0.14</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>4.12 ± 0.85</td><td rowspan=1 colspan=1>3.71 ± 1.14</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>6.95±0.18</td><td rowspan=1 colspan=1>4.17 ± 0.21</td></tr><tr><td rowspan=4 colspan=1>C100</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>29.93 ± 0.41</td><td rowspan=1 colspan=1>28.90±0.81</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>28.75±0.92</td><td rowspan=1 colspan=1>24.68±1.43</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>29.01 ± 0.24</td><td rowspan=1 colspan=1>26.99 ± 1.79</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>24.77 ± 1.51</td><td rowspan=1 colspan=1>23.90±2.01</td></tr><tr><td rowspan=4 colspan=1>SVHN</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>9.88±5.50</td><td rowspan=1 colspan=1>2.80±0.09</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>3.69 ±0.12</td><td rowspan=1 colspan=1>2.68± 0.18</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>4.00 ± 1.01</td><td rowspan=1 colspan=1>2.78± 0.29</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>2.90±0.02</td><td rowspan=1 colspan=1>2.55±0.15</td></tr></table>
# 5 REGULARIZATION OF INNER OBJECTIVE IMPROVES GENERALIZATION OF ARCHITECTURES
As we saw in Section 4.1, sharper minima (by means of large eigenvalues) of the validation loss lead to poor generalization performance. In our bi-level optimization setting, the outer variables’ trajectory depends on the inner optimization procedure. Therefore, we hypothesized that modifying the landscape of the inner objective $\mathcal { L } _ { t r a i n }$ could redirect the outer variables $\alpha$ to flatter areas of the architectural space. We study two ways of regularization (data augmentation in Section 5.1 and $L _ { 2 }$ regularization in Section 5.2) and find that both, along with the early stopping criterion from Section 4.3, make DARTS more robust in practice. We emphasize that we do not alter the regularization of the final training and evaluation phase, but solely that of the search phase. The setting we use for all experiments in this paper to obtain the final test performance is described in Appendix C.
# 5.1 REGULARIZATION VIA DATA AUGMENTATION
We first investigate the effect of regularizing via data augmentation, namely masking out parts of the input and intermediate feature maps via Cutout (CO, DeVries & Taylor (2017)) and ScheduledDropPath (DP, Zoph et al. (2018)) (ScheduledDropPath is a regularization technique, but we list it here since we apply it together with Cutout), respectively, during architecture search. We ran DARTS with CO and DP (with and without our early stopping criterion, DARTS-ES) with different maximum DP probabilities on all three image classification datasets and search spaces S1-S4.
Figure 7 summarizes the results: regularization improves the test performance of DARTS and DARTS-ES in all cases, sometimes very substantially, and at the same time kept the dominant eigenvalue relatively low (Figure 13). This also directly results in smaller drops in accuracy after pruning, as discussed in Section 4.2; indeed, the search runs plotted in Figure 5b are the same as in this section. Figure 17 in the appendix explicitly shows how regularization relates to the accuracy drops. We also refer to further results in the appendix: Figure 11 (showing test vs. validation error) and Table 5 (showing that overfitting of the architectural parameters is reduced).
 Figure 8: Effect of $L _ { 2 }$ regularization of the inner objective during architecture search for DARTS (solid lines) and DARTS-ES (dashed).
Similar observations hold for disparity estimation on S6, where we vary the strength of standard data augmentation methods, such as shearing or brightness change, rather then masking parts of features, which is unreasonable for this task. The augmentation strength is described by an “augmentation scaling factor” (Appendix E). Table 2 summarizes the results. We report the average end point error (EPE), which is the Euclidean distance between the predicted and ground truth disparity maps. Data augmentation avoided the degenerate architectures and substantially improved results.
# 5.2 INCREASED $L _ { 2 }$ REGULARIZATION
As a second type of regularization, we also tested different $L _ { 2 }$ regularization factors $3 i \cdot 1 0 ^ { - 4 }$ for $i \in$ $\{ 1 , 3 , 9 , 2 7 , 8 1 \}$ . Standard DARTS in fact does already include a small amount of $L _ { 2 }$ regularization; $i = 1$ yields its default. Figure 8 shows that DARTS’ test performance (solid lines) can be significantly improved by higher $L _ { 2 }$ factors across all datasets and spaces, while keeping the dominant eigenvalue low (Figure 14). DARTS with early stopping (dashed lines) also benefits from additional regularization. Again, we observe the implicit regularization effect on the outer objective which reduces the overfitting of the architectural parameters. We again refer to
Table 2: Effect of regularization for disparity estimation. Search was conducted on FlyingThings3D (FT) and then evaluated on both FT and Sintel. Lower is better.
<table><tr><td>Aug. Scale</td><td>Searchmodel valid EPE</td><td>FT test EPE</td><td>Sintel test EPE</td><td>Params (M)</td></tr><tr><td>0.0</td><td>4.49</td><td>3.83</td><td>5.69</td><td>9.65</td></tr><tr><td>0.1</td><td>3.53</td><td>3.75</td><td>5.97</td><td>9.65</td></tr><tr><td>0.5</td><td>3.28</td><td>3.37</td><td>5.22</td><td>9.43</td></tr><tr><td>1.0</td><td>4.61</td><td>3.12</td><td>5.47</td><td>12.46</td></tr><tr><td>1.5</td><td>5.23</td><td>2.60</td><td>4.15</td><td>12.57</td></tr><tr><td>2.0</td><td>7.45</td><td>2.33</td><td>3.76</td><td>12.25</td></tr><tr><td>L2 reg. factor</td><td>Searchmodel valid</td><td>FT test EPE</td><td>Sintel test</td><td>Params</td></tr><tr><td>3×10-4</td><td>EPE 3.95</td><td>3.25</td><td>EPE 6.13</td><td>(M) 11.00</td></tr><tr><td>9×10-4</td><td>5.97</td><td>2.30</td><td>4.12</td><td>13.92</td></tr><tr><td>27×10-4</td><td>4.25</td><td>2.72</td><td>4.83</td><td>10.29</td></tr><tr><td>81×10-4</td><td>4.61</td><td>2.34</td><td>3.85</td><td>12.16</td></tr></table>
Table 2 for disparity estimation; Appendix F shows similar results for language modelling (Penn TreeBank).
# 5.3 PRACTICAL ROBUSTIFICATION OF DARTS BY REGULARIZING THE INNER OBJECTIVE
Based on the insights from the aforementioned analysis and empirical results, we now propose two alternative simple modifications to make DARTS more robust in practice without having to manually tune its regularization hyperparameters.
DARTS with adaptive regularization One option is to adapt DARTS’ regularization hyperparameters in an automated way, in order to keep the architectural weights in areas of the validation loss objective with smaller curvature. The simplest off-the-shelf procedure towards this desiderata would be to increase the regularization strength whenever the dominant eigenvalue starts increasing rapidly. Algorithm 1 (DARTS-ADA, Appendix D.1) shows such a procedure. We use the same stopping criterion as in DARTS-ES (Section 4.3), roll back DARTS to the epoch when this criterion is met, and continue the search with a larger regularization value $R$ for the remaining epochs (larger by a factor of $\eta$ ). This procedure is repeated whenever the criterion is met, unless the regularization value exceeds some maximum predefined value $R _ { m a x }$ .
Multiple DARTS runs with different regularization strength Liu et al. (2019) already suggested to run the search phase of DARTS four times, resulting in four architectures, and to return the best of these four architectures w.r.t. validation performance when retrained from scratch for a limited number of epochs. We propose to use the same procedure, with the only difference that the four runs use different amounts of regularization. The resulting RobustDARTS (R-DARTS) method is conceptually very simple, trivial to implement and likely to work well if any of the tried regularization strengths works well.
Table 3 evaluates the performance of our practical robustifications of DARTS, DARTS-ADA and R-DARTS (based on either L2 or ScheduledDropPath regularization), by comparing them to the original DARTS, DARTS-ES and Random Search with weight sharing (RS-ws). For each of these methods, as proposed in the DARTS paper (Liu et al., 2019), we ran the search four independent times with different random seeds and selected the architecture used for the final evaluation based on a validation run as described above.
Table 3: Empirical evaluation of practical robustified versions of DARTS. Each entry is the test error after retraining the selected architecture as usual. The best method for each setting is boldface and underlined, the second best boldface.
<table><tr><td rowspan=1 colspan=2>Benchmark</td><td rowspan=1 colspan=1>RS-ws</td><td rowspan=1 colspan=1>DARTS</td><td rowspan=1 colspan=1>R-DARTS(DP)</td><td rowspan=1 colspan=1>R-DARTS(L2)</td><td rowspan=1 colspan=1>DARTS-ES</td><td rowspan=1 colspan=1>DARTS-ADA</td></tr><tr><td rowspan=4 colspan=1>C10</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>3.23</td><td rowspan=1 colspan=1>3.84</td><td rowspan=1 colspan=1>3.11</td><td rowspan=1 colspan=1>2.78</td><td rowspan=1 colspan=1>3.01</td><td rowspan=1 colspan=1>3.10</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>3.66</td><td rowspan=1 colspan=1>4.85</td><td rowspan=1 colspan=1>3.48</td><td rowspan=1 colspan=1>3.31</td><td rowspan=1 colspan=1>3.26</td><td rowspan=1 colspan=1>3.35</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>2.95</td><td rowspan=1 colspan=1>3.34</td><td rowspan=1 colspan=1>2.93</td><td rowspan=1 colspan=1>2.51</td><td rowspan=1 colspan=1>2.74</td><td rowspan=1 colspan=1>2.59</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>8.07</td><td rowspan=1 colspan=1>7.20</td><td rowspan=1 colspan=1>3.58</td><td rowspan=1 colspan=1>3.56</td><td rowspan=1 colspan=1>3.71</td><td rowspan=1 colspan=1>4.84</td></tr><tr><td rowspan=4 colspan=1>C100</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>23.30</td><td rowspan=1 colspan=1>29.46</td><td rowspan=1 colspan=1>25.93</td><td rowspan=1 colspan=1>24.25</td><td rowspan=1 colspan=1>28.37</td><td rowspan=1 colspan=1>24.03</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>21.21</td><td rowspan=1 colspan=1>26.05</td><td rowspan=1 colspan=1>22.30</td><td rowspan=1 colspan=1>22.24</td><td rowspan=1 colspan=1>23.25</td><td rowspan=1 colspan=1>23.52</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>23.75</td><td rowspan=1 colspan=1>28.90</td><td rowspan=1 colspan=1>22.36</td><td rowspan=1 colspan=1>23.99</td><td rowspan=1 colspan=1>23.73</td><td rowspan=1 colspan=1>23.37</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>28.19</td><td rowspan=1 colspan=1>22.85</td><td rowspan=1 colspan=1>22.18</td><td rowspan=1 colspan=1>21.94</td><td rowspan=1 colspan=1>21.26</td><td rowspan=1 colspan=1>23.20</td></tr><tr><td rowspan=3 colspan=1>SVHN</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>2.59</td><td rowspan=1 colspan=1>4.58</td><td rowspan=1 colspan=1>2.55</td><td rowspan=1 colspan=1>4.79</td><td rowspan=1 colspan=1>2.72</td><td rowspan=1 colspan=1>2.53</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>2.72</td><td rowspan=1 colspan=1>3.53</td><td rowspan=1 colspan=1>2.52</td><td rowspan=1 colspan=1>2.51</td><td rowspan=1 colspan=1>2.60</td><td rowspan=1 colspan=1>2.54</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>2.87</td><td rowspan=1 colspan=1>3.41</td><td rowspan=1 colspan=1>2.49</td><td rowspan=1 colspan=1>2.48</td><td rowspan=1 colspan=1>2.50</td><td rowspan=1 colspan=1>2.50</td></tr></table>
As the table shows, in accordance with Li & Talwalkar (2019), RS-ws often outperformed the original DARTS; however, with our robustifications, DARTS typically performs substantially better than RS-ws. DARTS-ADA consistently improved over standard DARTS for all benchmarks, indicating that a gradual increase of regularization during search prevents ending up in the bad regions of the architectural space. Finally, RobustDARTS yielded the best performance and since it is also easier to implement than DARTS-ES and DARTS-ADA, it is the method that we recommend to be used in practice.
Finally, since the evaluations in this paper have so far focussed on smaller subspaces of the original DARTS search space, the reader may wonder how well RobustDARTS works on the full search spaces. As Table 4 shows, RobustDARTS performed similarly to DARTS for the two original benchmarks from the DARTS paper (PTB and CIFAR-10), on which DARTS was developed and is well tuned; however, even when only changing the dataset to CIFAR-100 or SVHN, RobustDARTS already performed significantly better than DARTS, underlining its robustness.
Table 4: DARTS vs. RobustDARTS on the original DARTS search spaces. We show mean $\pm$ stddev for 5 repetitions (based on 4 fresh subruns each as in Table 3); for the more expensive PTB we could only afford 1 such repetition.
<table><tr><td rowspan=1 colspan=1>Benchmark</td><td rowspan=1 colspan=1>DARTS</td><td rowspan=1 colspan=1>R-DARTS(L2)</td></tr><tr><td rowspan=1 colspan=1>C10</td><td rowspan=1 colspan=1>2.91± 0.25</td><td rowspan=1 colspan=1>2.95 ± 0.21</td></tr><tr><td rowspan=1 colspan=1>C100</td><td rowspan=1 colspan=1>20.58 ± 0.44</td><td rowspan=1 colspan=1>18.01 ± 0.26</td></tr><tr><td rowspan=1 colspan=1>SVHN</td><td rowspan=1 colspan=1>2.46±0.09</td><td rowspan=1 colspan=1>2.17 ± 0.09</td></tr><tr><td rowspan=1 colspan=1>PTB</td><td rowspan=1 colspan=1>58.64</td><td rowspan=1 colspan=1>57.59</td></tr></table>
# 6 CONCLUSIONS
We showed that the generalization performance of architectures found by DARTS is related to the eigenvalues of the Hessian matrix of the validation loss w.r.t. the architectural parameters. Standard DARTS often results in degenerate architectures with large eigenvalues and poor generalization. Based on this observation, we proposed a simple early stopping criterion for DARTS based on tracking the largest eigenvalue. Our empirical results also show that properly regularizing the inner objective helps controlling the eigenvalue and therefore improves generalization. Our findings substantially improve our understanding of DARTS’ failure modes and lead to much more robust versions. They are consistent across many different search spaces on image recognition tasks and also for the very different domains of language modelling and disparity estimation. Our code is available for reproducibility.
# ACKNOWLEDGMENTS
The authors acknowledge funding by the Robert Bosch GmbH, support by the European Research Council (ERC) under the European Unions Horizon 2020 research and innovation programme through grant no. 716721, and by BMBF grant DeToL.
# REFERENCES
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. In International Conference on Learning Representations, 2017a.
Bowen Baker, Otkrist Gupta, Ramesh Raskar, and Nikhil Naik. Accelerating Neural Architecture Search using Performance Prediction. In NIPS Workshop on Meta-Learning, 2017b.
Ahmad Beirami, Meisam Razaviyayn, Shahin Shahrampour, and Vahid Tarokh. On optimal generalizability in parametric learning. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 3455–3465. Curran Associates, Inc., 2017.
Gabriel Bender, Pieter-Jan Kindermans, Barret Zoph, Vijay Vasudevan, and Quoc Le. Understanding and simplifying one-shot architecture search. In International Conference on Machine Learning, 2018.
Y. Bengio. Gradient-based optimization of hyperparameters. Neural Computation, 12(8):1889– 1900, Aug 2000. ISSN 0899-7667. doi: 10.1162/089976600300015187.
D. J. Butler, J. Wulff, G. B. Stanley, and M. J. Black. A naturalistic open source movie for optical flow evaluation. In A. Fitzgibbon et al. (Eds.) (ed.), European Conf. on Computer Vision (ECCV), Part IV, LNCS 7577, pp. 611–625. Springer-Verlag, October 2012.
Han Cai, Tianyao Chen, Weinan Zhang, Yong Yu, and Jun Wang. Efficient architecture search by network transformation. In AAAI, 2018a.
Han Cai, Jiacheng Yang, Weinan Zhang, Song Han, and Yong Yu. Path-Level Network Transformation for Efficient Architecture Search. In International Conference on Machine Learning, June 2018b.
Han Cai, Ligeng Zhu, and Song Han. ProxylessNAS: Direct neural architecture search on target task and hardware. In International Conference on Learning Representations, 2019.
Francesco Casale, Jonathan Gordon, and Nicolo Fusi. Probabilistic neural architecture search. arXiv preprint, 2019.
Liu Chenxi, Chen Liang Chieh, Schroff Florian, Adam Hartwig, Hua Wei, Yuille Alan L., and Fei Fei Li. Auto-deeplab: Hierarchical neural architecture search for semantic image segmentation. In Conference on Computer Vision and Pattern Recognition, 2019.
Benot Colson, Patrice Marcotte, and Gilles Savard. An overview of bilevel optimization, 2007.
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
Justin Domke. Generic methods for optimization-based modeling. In Neil D. Lawrence and Mark Girolami (eds.), Proceedings of the Fifteenth International Conference on Artificial Intelligence and Statistics, volume 22 of Proceedings of Machine Learning Research, pp. 318–326, La Palma, Canary Islands, 21–23 Apr 2012. PMLR.
A. Dosovitskiy, P. Fischer, E. Ilg, P. Hausser, C. Hazırbas¸, V. Golkov, P. v.d. Smagt, D. Cremers, ¨ and T. Brox. Flownet: Learning optical flow with convolutional networks. In IEEE International Conference on Computer Vision (ICCV), 2015.
Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Simple And Efficient Architecture Search for Convolutional Neural Networks. In NIPS Workshop on Meta-Learning, 2017.
Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Efficient multi-objective neural architecture search via lamarckian evolution. In International Conference on Learning Representations, 2019a.
Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Neural architecture search: A survey. Journal of Machine Learning Research, 20(55):1–21, 2019b.
Stefan Falkner, Aaron Klein, and Frank Hutter. BOHB: Robust and efficient hyperparameter optimization at scale. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1437–1446, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL ¨ http://proceedings.mlr.press/v80/falkner18a.html.
Luca Franceschi, Michele Donini, Paolo Frasconi, and Massimiliano Pontil. Forward and reverse gradient-based hyperparameter optimization. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1165–1173, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
Luca Franceschi, Paolo Frasconi, Saverio Salzo, Riccardo Grazzi, and Massimiliano Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1568–1577, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
Sepp Hochreiter and Jurgen Schmidhuber. Flat minima. ¨ Neural Comput., 9(1):1–42, January 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.1.1.
Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv preprint arXiv:1609.04836, 2016.
L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and A. Talwalkar. Hyperband: Bandit-based configuration evaluation for hyperparameter optimization. In Proceedings of the International Conference on Learning Representations (ICLR’17), 2017. Published online: iclr.cc.
Liam Li and Ameet Talwalkar. Random search and reproducibility for neural architecture search. CoRR, abs/1902.07638, 2019.
H. Liu, K. Simonyan, O. Vinyals, C.Fernando, and K. Kavukcuoglu. Hierarchical representations for efficient architecture search. In International Conference on Learning Representations (ICLR) 2018 Conference Track, April 2018a.
Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical Representations for Efficient Architecture Search. In International Conference on Learning Representations, 2018b.
Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: Differentiable architecture search. In International Conference on Learning Representations, 2019.
Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 2113–2122, Lille, France, 07–09 Jul 2015. PMLR.
N. Mayer, E. Ilg, P. Hausser, P. Fischer, D. Cremers, A. Dosovitskiy, and T. Brox. A large ¨ dataset to train convolutional networks for disparity, optical flow, and scene flow estimation. In IEEE International Conference on Computer Vision and Pattern Recognition (CVPR), 2016. arXiv:1512.02134.
Risto Miikkulainen, Jason Liang, Elliot Meyerson, Aditya Rawal, Dan Fink, Olivier Francon, Bala Raju, Hormoz Shahrzad, Arshak Navruzyan, Nigel Duffy, and Babak Hodjat. Evolving Deep Neural Networks. In arXiv:1703.00548, March 2017.
Thanh Dai Nguyen, Sunil Gupta, Santu Rana, and Svetha Venkatesh. Stable bayesian optimization. International Journal of Data Science and Analytics, 6(4):327–339, Dec 2018. ISSN 2364-4168. doi: 10.1007/s41060-018-0119-9.
Fabian Pedregosa. Hyperparameter optimization with approximate gradient. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 737–746, New York, New York, USA, 20–22 Jun 2016. PMLR.
Hieu Pham, Melody Y. Guan, Barret Zoph, Quoc V. Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. In International Conference on Machine Learning, 2018.
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Jie Tan, Quoc V. Le, and Alexey Kurakin. Large-scale evolution of image classifiers. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 2902–2911, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Aging Evolution for Image Classifier Architecture Search. In AAAI, 2019.
T. Saikia, Y. Marrakchi, A. Zela, F. Hutter, and T. Brox. Autodispnet: Improving disparity estimation with automl. In IEEE International Conference on Computer Vision (ICCV), 2019. URL http: //lmb.informatik.uni-freiburg.de/Publications/2019/SMB19.
Shreyas Saxena and Jakob Verbeek. Convolutional neural fabrics. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4053–4061. Curran Associates, Inc., 2016.
Christian Sciuto, Kaicheng Yu, Martin Jaggi, Claudiu Musat, and Mathieu Salzmann. Evaluating the search phase of neural architecture search. arXiv preprint, 2019.
Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary Computation, 10:99–127, 2002.
Sirui Xie, Hehui Zheng, Chunxiao Liu, and Liang Lin. SNAS: stochastic neural architecture search. In International Conference on Learning Representations, 2019.
Zhewei Yao, Amir Gholami, Qi Lei, Kurt Keutzer, and Michael W Mahoney. Hessian-based analysis of large batch training and robustness to adversaries. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 4949–4959. Curran Associates, Inc., 2018.
Arber Zela, Aaron Klein, Stefan Falkner, and Frank Hutter. Towards automated deep learning: Efficient joint neural architecture and hyperparameter search. In ICML 2018 Workshop on AutoML (AutoML 2018), July 2018.
Zhao Zhong, Jingchen Yan, Wei Wu, Jing Shao, and Cheng-Lin Liu. Practical block-wise neural network architecture generation. In CVPR. IEEE Computer Society, 2018.
Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations, 2017.
Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V. Le. Learning transferable architectures for scalable image recognition. In Conference on Computer Vision and Pattern Recognition, 2018.
# A MORE DETAIL ON DARTS
Here we present a detailed description of DARTS architectural update steps. We firstly provide the general formalism which computes the gradient of the outer level problem in (1) by means of the implicit function theorem. Afterwards, we present how DARTS computes the gradient used to update the architectural parameters $\alpha$ .
# A.1 DERIVATIVE WITH SMOOTHED NON-QUADRATIC LOWER LEVEL PROBLEM
Consider the general definition of the bi-level optimization problem as given by (1) and (2). Given that $f$ is twice continuously differentiable and that all stationary points are local minimas, one can make use of the implicit function theorem to find the derivative of the solution map $\theta ^ { * } ( y )$ w.r.t. $y$ (Bengio, 2000). Under the smoothness assumption, the optimality condition of the lower level (2) is $\nabla _ { \boldsymbol { \theta } } f ( y , \boldsymbol { \theta } ) = \mathbf { 0 }$ , which defines an implicit function $\theta ^ { * } ( y )$ . With the assumption that $\mathrm { m i n } _ { \boldsymbol { \theta } } f ( \boldsymbol { y } , \boldsymbol { \theta } )$ has a solution, there exists a $( y , \theta ^ { * } )$ such that $\nabla _ { \theta } f ( y , \theta ^ { * } ) = \mathbf { 0 }$ . Under the condition that $\nabla _ { \theta } f ( y , \theta ^ { * } ) = 0$ is continuously differentiable and that $\theta ^ { * } ( y )$ is continuously differentiable at $y$ , implicitly differentiating the last equality from both sides w.r.t. y and applying the chain rule, yields:
$$\frac { \partial ( \nabla _ { \theta } f ) } { \partial \theta } ( y , \theta ^ { * } ) \cdot \frac { \partial \theta ^ { * } } { \partial y } ( y ) + \frac { \partial ( \nabla _ { \theta } f ) } { \partial y } ( y , \theta ^ { * } ) = { \bf 0 } .$$
Assuming that the Hessian $\nabla _ { { \theta } } ^ { 2 } f ( y , { \theta } ^ { * } )$ is invertible, we can rewrite (3) as follows:
$$\frac { \partial \theta ^ { * } } { \partial y } ( y ) = - \Big ( \nabla _ { \theta } ^ { 2 } f ( y , \theta ^ { * } ) \Big ) ^ { - 1 } \cdot \frac { \partial ( \nabla _ { \theta } f ) } { \partial y } ( y , \theta ^ { * } ) .$$
Applying the chain rule to (1) for computing the total derivative of $F$ with respect to $y$ yields:
$$\frac { d F } { d y } = \frac { \partial F } { \partial \theta } \cdot \frac { \partial \theta ^ { * } } { \partial y } + \frac { \partial F } { \partial y } ,$$
where we have omitted the evaluation at $( y , \theta ^ { * } )$ . Substituting (4) into (5) and reordering yields:
$$\frac { d F } { d y } = \frac { \partial F } { \partial y } - \frac { \partial F } { \partial \theta } \cdot \left( \nabla _ { \theta } ^ { 2 } f \right) ^ { - 1 } \cdot \frac { \partial ^ { 2 } f } { \partial \theta \partial y } .$$
equation 6 computes the gradient of $F$ , given the function $\theta ^ { * } ( y )$ , which maps outer variables to the inner variables minimizing the inner problem. However, in most of the cases obtaining such a mapping is computationally expensive, therefore different heuristics have been proposed to approximate $d F / d y$ (Maclaurin et al., 2015; Pedregosa, 2016; Franceschi et al., 2017; 2018).
# A.2 DARTS ARCHITECTURAL GRADIENT COMPUTATION
DARTS optimization procedure is defined as a bi-level optimization problem where $\mathcal { L } _ { v a l i d }$ is the outer objective (1) and $\mathcal { L } _ { t r a i n }$ is the inner objective (2):
$$\begin{array} { r l } & { \underset { \alpha } { \operatorname* { m i n } } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ( \alpha ) ) } \\ & { s . t . \quad w ^ { * } ( \alpha ) = \underset { w } { \arg \operatorname* { m i n } } \mathcal { L } _ { t r a i n } ( \alpha , w ) , } \end{array}$$
where both losses are determined by both the architecture parameters $\alpha$ (outer variables) and the network weights $w$ (inner variables). Based on Appendix A.1, under some conditions, the total derivative of $\mathcal { L } _ { v a l i d }$ w.r.t. $\alpha$ evaluated on $( \alpha , w ^ { * } ( \alpha ) )$ would be:
$$\frac { d \mathcal { L } _ { v a l i d } } { d \alpha } = \nabla _ { \alpha } \mathcal { L } _ { v a l i d } - \nabla _ { w } \mathcal { L } _ { v a l i d } \big ( \nabla _ { w } ^ { 2 } \mathcal { L } _ { t r a i n } \big ) ^ { - 1 } \nabla _ { \alpha , w } ^ { 2 } \mathcal { L } _ { t r a i n } ,$$
where ∇α = , $\begin{array} { r } { \nabla _ { w } = \frac { \partial } { \partial w } } \\ { . } \end{array}$ and $\begin{array} { r } { \nabla _ { \alpha , w } ^ { 2 } = \frac { \partial ^ { 2 } } { \partial \alpha \partial w } } \end{array}$ = ∂2∂α∂w . Computing the inverse of the Hessian is in general not possible considering the high dimensionality of the model parameters $w$ , therefore resolving to gradient-based iterative algorithms for finding $w ^ { * }$ is necessary. However, this would also require to optimize the model parameters $w$ till convergence each time $\alpha$ is updated. If our model is a deep neural network it is clear that this computation is expensive, therefore Liu et al. (2019) propose to approximate $w ^ { * } ( \alpha )$ by updating the current model parameters $w$ using a single gradient descent step:
$$\begin{array} { r } { w ^ { * } ( \alpha ) \approx w - \xi \nabla _ { w } \mathcal { L } _ { t r a i n } ( \alpha , w ) , } \end{array}$$
where $\xi$ is the learning rate for the virtual gradient step DARTS takes with respect to the model weights $w$ . From equation 10 the gradient of $w ^ { * } ( \alpha )$ with respect to $\alpha$ is
$$\frac { \partial w ^ { * } } { \partial \alpha } ( \alpha ) = - \xi \nabla _ { \alpha , w } ^ { 2 } \mathcal { L } _ { t r a i n } ( \alpha , w ) ,$$
By setting the evaluation point $\boldsymbol { w ^ { * } } = \boldsymbol { w } - \xi \nabla _ { \boldsymbol { w } } \mathcal { L } _ { t r a i n } ( \alpha , \boldsymbol { w } )$ and following the same derivation as in Appendix A.1, we obtain the DARTS architectural gradient approximation:
$$\frac { d \mathcal { L } _ { v a l i d } } { d \alpha } ( \alpha ) = \nabla _ { \alpha } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ) - \xi \nabla _ { w } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ) \nabla _ { \alpha , w } ^ { 2 } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { * } ) ,$$
where the inverse Hessian however contains again an e $\nabla _ { w } ^ { 2 } \mathcal { L } _ { t r a i n } ^ { - 1 }$ in (9) is replaced by the learning rate ector-matrix product. Liu et al. (2019) re $\xi$ . This expressionuce the complexity by using the finite difference approximation around $w ^ { \pm } = w \pm \epsilon \nabla _ { w } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } )$ for some small $\epsilon = 0 . 0 1 / \left. \nabla _ { w } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ) \right. _ { 2 }$ to compute the gradient of $\nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { * } )$ with respect to $w$ as
$$\begin{array} { r l r } & { } & { \nabla _ { \alpha , w } ^ { 2 } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { * } ) \approx \frac { \nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { + } ) - \nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { - } ) } { 2 \epsilon \nabla _ { w } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ) } \qquad \Leftrightarrow } \\ & { } & { \nabla _ { w } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ) \nabla _ { \alpha , w } ^ { 2 } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { * } ) \approx \frac { \nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { + } ) - \nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { - } ) } { 2 \epsilon } . } \end{array}$$
In the end, combining equation 12 and equation 13 gives the gradient to compute the architectural updates in DARTS:
$$\frac { d \mathcal { L } _ { v a l i d } } { d \alpha } ( \alpha ) = \nabla _ { \alpha } \mathcal { L } _ { v a l i d } ( \alpha , w ^ { * } ) - \frac { \xi } { 2 \epsilon } \big ( \nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { + } ) - \nabla _ { \alpha } \mathcal { L } _ { t r a i n } ( \alpha , w ^ { - } ) \big )$$
In all our experiments we always use $\xi = \eta$ (also called second order approximation in Liu et al. (2019)), where $\eta$ is the learning rate used in SGD for updating the parameters $w$ .
# B CONSTRUCTION OF S1 FROM SECTION 3
We ran DARTS two times on the default search space to find the two most important operations per mixed operation. Initially, every mixed operation consists of 8 operations. After the first DARTS run, we drop the 4 (out of 8) least important ones. In the second DARTS run, we drop the 2 (out of the remaining 4) least important ones. S1 is then defined to contain only the two remaining most important operations per mixed op. Refer to Figure 9 for an illustration of this pre-optimized space.
# C FINAL ARCHITECTURE EVALUATION
Similar to the original DARTS paper (Liu et al., 2019), the architecture found during the search are scaled up by increasing the number of filters and cells and retrained from scratch to obtain the final test performance. For CIFAR-100 and SVHN we use 16 number of initial filters and 8 cells when training architectures from scratch for all the experiments we conduct. The rest of the settings is the same as in Liu et al. (2019).
On CIFAR-10, when scaling the ScheduledDropPath drop probability, we use the same settings for training from scratch the found architectures as in the original DARTS paper, i.e. 36 initial filters and 20 stacked cells. However, for search space S2 and S4 we reduce the number of initial filters to 16 in order to avoid memory issues, since the cells found with more regularization usually are composed only with separable convolutions. When scaling the $L _ { 2 }$ factor on CIFAR-10 experiments we use 16 initial filters and 8 stacked cells, except the experiments on S1, where the settings are the same as in Liu et al. (2019), i.e. 36 initial filters and 20 stacked cells.
 (a) Normal cell space
 Figure 9: Search space S1.
Note that although altering the regularization factors during DARTS search, when training the final architectures from scratch we always use the same values for them as in Liu et al. (2019), i.e. ScheduledDropPath maximum drop probability linearly increases from 0 towards 0.2 throughout training, Cutout is always enabled with cutout probability 1.0, and the $L _ { 2 }$ regularization factor is set to $3 \cdot 1 \bar { 0 } ^ { - 4 }$ .
# D ADDITIONAL EMPIRICAL RESULTS
 Figure 10: Test regret and validation error of the search (one-shot) model when running DARTS on S5 and CIFAR-10 with different $L _ { 2 }$ regularization values. The architectural parameters’ overfit reduces as we increase the $L _ { 2 }$ factor and successfully finds the global minimum. However, we notice that the architectural parameters start underfitting as we increase to much the $L _ { 2 }$ factor, i.e. both validation and test error increase.
Table 5: Validation (train) and test accuracy on CIFAR-10 of the search and final evaluation models, respectively. The values in the last column show the maximum eigenvalue $\lambda _ { m a x } ^ { \alpha }$ (computed on a random sampled mini-batch) of the Hessian, at the end of search for different maximum drop path probability). The four blocks in the table state results for the search spaces S1-S4, respectively.
<table><tr><td rowspan="2"></td><td rowspan="2">Drop Prob.</td><td colspan="3">Valid acc.</td><td colspan="3">Test acc.</td><td colspan="3">Params</td><td colspan="3">Xmax</td></tr><tr><td>seed 1</td><td>seed2</td><td>seed 3</td><td>seed 1</td><td>seed 2</td><td>seed 3</td><td>seed 1</td><td>seed 2</td><td>seed 3</td><td>seed 1</td><td>seed 2</td><td>seed 3</td></tr><tr><td rowspan="4">S1</td><td>0.0</td><td>87.22</td><td>87.01</td><td>86.98</td><td>96.16</td><td>94.43</td><td>95.43</td><td>2.24</td><td>1.93</td><td>2.03</td><td>1.023</td><td>0.835</td><td>0.698</td></tr><tr><td>0.2</td><td>84.24</td><td>84.32</td><td>84.22</td><td>96.39</td><td>96.66</td><td>96.20</td><td>2.63</td><td>2.84</td><td>2.48</td><td>0.148</td><td>0.264</td><td>0.228</td></tr><tr><td>0.4</td><td>82.28</td><td>82.18</td><td>82.79</td><td>96.44</td><td>96.94</td><td>96.76</td><td>2.63</td><td>2.99</td><td>3.17</td><td>0.192</td><td>0.199</td><td>0.149</td></tr><tr><td>0.6</td><td>79.17</td><td>79.18</td><td>78.84</td><td>96.89</td><td>96.93</td><td>96.96</td><td>3.38</td><td>3.02</td><td>3.17</td><td>0.300</td><td>0.255</td><td>0.256</td></tr><tr><td rowspan="4">S2</td><td>0.0</td><td>88.49</td><td>88.40</td><td>88.35</td><td>95.15</td><td>95.48</td><td>96.11</td><td>0.93</td><td>0.86</td><td>0.97</td><td>0.684</td><td>0.409</td><td>0.268</td></tr><tr><td>0.2</td><td>85.29</td><td>84.81</td><td>85.36</td><td>95.15</td><td>95.40</td><td>96.14</td><td>1.28</td><td>1.44</td><td>1.36</td><td>0.270</td><td>0.217</td><td>0.145</td></tr><tr><td>0.4</td><td>82.03</td><td>82.66</td><td>83.20</td><td>96.34</td><td>96.50</td><td>96.44</td><td>1.28</td><td>1.28</td><td>1.36</td><td>0.304</td><td>0.411</td><td>0.282</td></tr><tr><td>0.6</td><td>79.86</td><td>80.19</td><td>79.70</td><td>96.52</td><td>96.35</td><td>96.29</td><td>1.21</td><td>1.28</td><td>1.36</td><td>0.292</td><td>0.295</td><td>0.281</td></tr><tr><td rowspan="4">S3</td><td>0.0</td><td>88.78</td><td>89.15</td><td>88.67</td><td>94.70</td><td>96.27</td><td>96.66</td><td>2.21</td><td>2.43</td><td>2.85</td><td>0.496</td><td>0.535</td><td>0.446</td></tr><tr><td>0.2</td><td>85.61</td><td>85.60</td><td>85.50</td><td>96.78</td><td>96.84</td><td>96.74</td><td>3.62</td><td>4.04</td><td>2.99</td><td>0.179</td><td>0.185</td><td>0.202</td></tr><tr><td>0.4</td><td>83.03</td><td>83.24</td><td>83.43</td><td>97.07</td><td>96.85</td><td>96.48</td><td>4.10</td><td>3.74</td><td>3.38</td><td>0.156</td><td>0.370</td><td>0.184</td></tr><tr><td>0.6</td><td>79.86</td><td>80.03</td><td>79.68</td><td>96.91</td><td>94.56</td><td>96.44</td><td>4.46</td><td>2.30</td><td>2.66</td><td>0.239</td><td>0.275</td><td>0.280</td></tr><tr><td rowspan="4">S4</td><td>0.0</td><td>86.33</td><td>86.72</td><td>86.46</td><td>92.80</td><td>93.22</td><td>93.14</td><td>1.05</td><td>1.13</td><td>1.05</td><td>0.400</td><td>0.442</td><td>0.314</td></tr><tr><td>0.2</td><td>81.01</td><td>82.43</td><td>82.03</td><td>95.84</td><td>96.08</td><td>96.15</td><td>1.44</td><td>1.44</td><td>1.44</td><td>0.070</td><td>0.054</td><td>0.079</td></tr><tr><td>0.4</td><td>79.49</td><td>79.67</td><td>78.96</td><td>96.11</td><td>96.30</td><td>96.28</td><td>1.44</td><td>1.44</td><td>1.44</td><td>0.064</td><td>0.057</td><td>0.049</td></tr><tr><td>0.6</td><td>74.54</td><td>74.74</td><td>74.37</td><td>96.42</td><td>96.36</td><td>96.64</td><td>1.44</td><td>1.44</td><td>1.44</td><td>0.057</td><td>0.060</td><td>0.066</td></tr></table>
# D.1 ADAPTIVE DARTS DETAILS
We evaluated DARTS-ADA (Section 5.3) with $R = 3 \cdot 1 0 ^ { - 4 }$ (DARTS default), $R _ { m a x } = 3 \cdot 1 0 ^ { - 2 }$ and $\eta = 1 0$ on all the search spaces and datasets we use for image classification. The results are shown in Table 3 (DARTS-ADA). The function train and eval conducts the normal DARTS search for one epoch and returns the architecture at the end of that epoch’s updates and the stop value if a decision was made to stop the search and rollback to stop epoch.
# Algorithm 1: DARTS ADA
/\* E: epochs to search; $R$ : initial regularization value; $R _ { m a x }$ : maximal regularization value; stop criter: stopping criterion; η: regularization increase factor \*/ Input : E, $R$ , $R _ { m a x }$ , stop criter, η $/ \star$ start search for E epochs \*/ for epoch in $E$ do $/ \star$ run DARTS for one epoch and return stop $^ { \prime = }$ True together with the stop epoch \*/ $/ \star$ and the architecture at stop epoch if the criterion is met \*/ stop, stop epoch, arch train and eval(stop criter); if stop & $R \leq R _ { m a x }$ then /\* start DARTS from stop epoch with a larger R \*/ arch DARTS ADA(E - stop epoch, $\eta \cdot R$ , $R _ { m a x }$ , stop criter, η); break end end
 Output: arch Figure 11: Test errors of architectures along with the validation error of the search (one-shot) model for each dataset and space when scaling the ScheduledDropPath drop probability. Note that these results (blue lines) are the same as the ones in Figure 8.
 Figure 12: Test errors of architectures along with the validation error of the search (one-shot) model for each dataset and space when scaling the $L _ { 2 }$ factor. Note that these results (blue lines) are the same as the ones in Figure 7.
 Figure 13: Local average of the dominant EV $\lambda _ { m a x } ^ { \alpha }$ throughout DARTS search (for different drop path prob. values). Markers denote the early stopping point based on the criterion in Section 4.3.
 Figure 14: Effect of $L _ { 2 }$ regularization no the EV trajectory. The figure is analogous to Figure 13.
 Figure 15: Effect of ScheduledDropPath and Cutout on the full eigenspectrum of the Hessian at the end of architecture search for each of the search spaces. Since most of the eigenvalues after the 30-th largest one are almost zero, we plot only the largest (based on magnitude) 30 eigenvalues here. We also provide the eigenvalue distribution for these 30 eigenvalues. Notice that not only the dominant eigenvalue is larger when $d p = 0$ but in general also the others.
 Figure 16: Effect of $L _ { 2 }$ regularization on the full eigenspectrum of the Hessian at the end of architecture search for each of the search spaces. Since most of the eigenvalues after the 30-th largest one are almost zero, we plot only the largest (based on magnitude) 30 eigenvalues here. We also provide the eigenvalue distribution for these 30 eigenvalues. Notice that not only the dominant eigenvalue is larger when $L _ { 2 } = 3 \cdot 1 0 ^ { - 4 }$ but in general also the others.
 Figure 17: Drop in accuracy after discretizing the search model for different spaces, datasets and drop path regularization strengths.. Example of some of the settings from Section 5.
 Figure 18: Effect of more regularization on the performance of found architectures by DARTS.
Table 6: Performance of architectures found by DARTS (-ES / -ADA) vs. RandomNAS with weight sharing. For each of the settings we repeat the search 3 times and report the mean $\pm$ std of the 3 found architectures retrained from scratch.
<table><tr><td rowspan=1 colspan=2>Setting</td><td rowspan=1 colspan=1>RandomNAS</td><td rowspan=1 colspan=1>DARTS</td><td rowspan=1 colspan=1>DARTS-ES</td><td rowspan=1 colspan=1>DARTS-ADA</td></tr><tr><td rowspan=4 colspan=1>C10</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>3.17 ± 0.15</td><td rowspan=1 colspan=1>4.66 ± 0.71</td><td rowspan=1 colspan=1>3.05 ± 0.07</td><td rowspan=1 colspan=1>3.03 ±0.08</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>3.46 ± 0.15</td><td rowspan=1 colspan=1>4.42 ± 0.40</td><td rowspan=1 colspan=1>3.41 ± 0.14</td><td rowspan=1 colspan=1>3.59 ± 0.31</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>2.92 ± 0.04</td><td rowspan=1 colspan=1>4.12 ± 0.85</td><td rowspan=1 colspan=1>3.71 ± 1.14</td><td rowspan=1 colspan=1>2.99 ± 0.34</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>89.39 ± 0.84</td><td rowspan=1 colspan=1>6.95±0.18</td><td rowspan=1 colspan=1>4.17 ± 0.21</td><td rowspan=1 colspan=1>3.89 ± 0.67</td></tr><tr><td rowspan=4 colspan=1>C100</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>25.81 ± 0.39</td><td rowspan=1 colspan=1>29.93 ± 0.41</td><td rowspan=1 colspan=1>28.90 ± 0.81</td><td rowspan=1 colspan=1>24.94 ± 0.81</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>22.88 ± 0.16</td><td rowspan=1 colspan=1>28.75 ± 0.92</td><td rowspan=1 colspan=1>24.68 ± 1.43</td><td rowspan=1 colspan=1>26.88 ± 1.11</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>24.58 ± 0.61</td><td rowspan=1 colspan=1>29.01 ± 0.24</td><td rowspan=1 colspan=1>26.99 ± 1.79</td><td rowspan=1 colspan=1>24.55± 0.63</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>30.01 ± 1.52</td><td rowspan=1 colspan=1>24.77 ± 1.51</td><td rowspan=1 colspan=1>23.90 ± 2.01</td><td rowspan=1 colspan=1>23.66 ± 0.90</td></tr><tr><td rowspan=4 colspan=1>SVHN</td><td rowspan=1 colspan=1>S1</td><td rowspan=1 colspan=1>2.64±0.09</td><td rowspan=1 colspan=1>9.88 ± 5.50</td><td rowspan=1 colspan=1>2.80± 0.09</td><td rowspan=1 colspan=1>2.59± 0.07</td></tr><tr><td rowspan=1 colspan=1>S2</td><td rowspan=1 colspan=1>2.57 ± 0.04</td><td rowspan=1 colspan=1>3.69 ± 0.12</td><td rowspan=1 colspan=1>2.68 ± 0.18</td><td rowspan=1 colspan=1>2.79 ± 0.22</td></tr><tr><td rowspan=1 colspan=1>S3</td><td rowspan=1 colspan=1>2.89±0.09</td><td rowspan=1 colspan=1>4.00 ± 1.01</td><td rowspan=1 colspan=1>2.78± 0.29</td><td rowspan=1 colspan=1>2.58 ± 0.07</td></tr><tr><td rowspan=1 colspan=1>S4</td><td rowspan=1 colspan=1>3.42 ± 0.04</td><td rowspan=1 colspan=1>2.90± 0.02</td><td rowspan=1 colspan=1>2.55 ± 0.15</td><td rowspan=1 colspan=1>2.52 ± 0.06</td></tr></table>
# D.2 A CLOSER LOOK AT THE EIGENVALUES
Over the course of all experiments from the paper, we tracked the largest eigenvalue across all configuration and datasets to see how they evolve during the search. Figures 13 and 14 shows the results across all the settings for image classification. It can be clearly seen that increasing the inner objective regularization, both in terms of $L _ { 2 }$ or data augmentation, helps controlling the largest eigenvalue and keeping it to a small value, which again helps explaining why the architectures found with stronger regularization generalize better. The markers on each line highlight the epochs where DARTS is early stopped. As one can see from Figure 4, there is indeed some correlation between the average dominant eigenvalue throughout the search and the test performance of the found architectures by DARTS.
Figures 15 and 16 (top 3 rows) show the full spectrum (sorted based on eigenvalue absolute values) at the end of search, whilst bottom 3 rows plot the distribution of eigenvalues in the eigenspectrum. As one can see, not only the dominant eigenvalue is larger compared to the cases when the regularization is stronger and the generalization of architectures is better, but also the other eigenvalues in the spectrum have larger absolute value, indicating a sharper objective landscape towards many dimensions. Furthermore, from the distribution plots note the presence of more negative eigenvalues whenever the architectures are degenerate (lower regularization value) indicating that DARTS gets stuck in a point with larger positive and negative curvature of the validation loss objective, associated with a more degenerate Hessian matrix.
# E DISPARITY ESTIMATION
# E.1 DATASETS
We use the FlyingThings3D dataset (Mayer et al., 2016) for training AutoDispNet. It consists of rendered stereo image pairs and their ground truth disparity maps. The dataset provides a training and testing split consisting of 21, 818 and 4248 samples respectively with an image resolution of $9 6 0 \times 5 4 0$ . We use the Sintel dataset ( Butler et al. (2012)) for testing our networks. Sintel is another synthetic dataset from derived from an animated movie which also provides ground truth disparity maps (1064 samples) with a resolution of $1 0 2 4 \times 4 3 6$ .
# E.2 TRAINING
We use the AutoDispNet-C architecture as described in Saikia et al. (2019). However, we use the smaller search which consists of three operations: $M a x P o o l 3 \times 3$ , $S e p C o n v 3 \times 3$ , and SkipConnect. For training the search network, images are downsampled by a factor of two and trained for $3 0 0 k$ mini-batch iterations. During search, we use SGD and ADAM to optimize the inner and outer objectives respectively. Differently from the original AutoDispNet we do not warmstart the search model weights before starting the architectural parameter updates. The extracted network is also trained for $3 0 0 k$ mini-batch iterations but full resolution images are used. Here, ADAM is used for optimization and the learning rate is annealed to 0 from $1 e - 4$ , using a cosine decay schedule.
# E.3 EFFECT OF REGULARIZATION ON THE INNER OBJECTIVE
To study the effect of regularization on the inner objective for AutoDispNet-C we use experiment with two types of regularization: data augmentation and of $L 2$ regularization on network weights.
We note that we could not test the early stopping method on AutoDispNet since AutoDispNet relies on custom operations to compute feature map correlation (Dosovitskiy et al., 2015) and resampling, for which second order derivatives are currently not available (which are required to compute the Hessian).
Data augmentation. Inspite of fairly large number of training samples in FlyingThings3D, data augmentation is crucial for good generalization performance. Disparity estimation networks employ spatial transformations such as translation, cropping, shearing and scaling. Additionally, appearance transformations such as additive Gaussian noise, changes in brightness, contrast, gamma and color are also applied. Parameters for such transformations are sampled from a uniform or Gaussian distribution (parameterized by a mean and variance). In our experiments, we vary the data augmentation strength by multiplying the variance of these parameter distributions by a fixed factor, which we dub the augmentation scaling factor. The extracted networks are evaluated with the same augmentation parameters. The results of increasing the augmentation strength of the inner objective can be seen in Table 2. We observe that as augmentation strength increases DARTS finds networks with more number of parameters and better test performance. The best test performance is obtained for the network with maximum augmentation for the inner objective. At the same time the search model validation error increases when scaling up the augmentation factor, which again enforces the argument that the overfitting of architectural parameters is reduced by this implicit regularizer.
L2 regularization. We study the effect of increasing regularization strength on the weights of the network. The results are shown in Table 2. Also in this case best test performance is obtained with the maximum regularization strength.
# F RESULTS ON PENN TREEBANK
Here we investigate the effect of more $L _ { 2 }$ regularization on the inner objective for searching recurrent cells on Penn Treebank (PTB). We again used a reduced search space with only $R e L U$ and identity mapping as possible operations. The rest of the settings is the same as in (Liu et al., 2019).
We run DARTS search four independent times with different random seeds, each with four $L _ { 2 }$ regularization factors, namely $5 \times 1 0 ^ { - 7 }$ (DARTS default), $1 5 \times 1 0 ^ { - 7 }$ , $4 5 \times 1 0 ^ { - 7 }$ and $1 3 5 \times 1 0 ^ { - 7 }$ . Figure 19 shows the test perplexity of the architectures found by DARTS with the aforementioned $L _ { 2 }$ regularization values. As we can see, a stronger regularization factor on the inner objective makes the search procedure more robust. The median perplexity of the discovered architectures gets better as we increase the $L _ { 2 }$ factor from $5 \times 1 0 ^ { - 7 }$ to $4 5 \times 1 { \bar { 0 } } ^ { - 7 }$ , while the search model (one-shot) validation mean perplexity increases. This observation is similar to the ones on image classification shown in Figure 10, showing again that properly regularizing the inner objective helps reduce overfitting the architectural parameters.
 Figure 19: Performance of recurrent cells found with different $L _ { 2 }$ regularization factors on the inner objective on PTB. We run DARTS 4 independent times with different random seeds, train each of them from scratch with the evaluation settings for 1600 epochs and report the median test perplexity. The blue dashed line denotes the validation perplexity of the search model.
# G DISCOVERED CELLS ON SEARCH SPACES S1-S4 FROM SECTION 3 ON OTHER DATASETS
 Figure 20: Reduction cells found by DARTS when ran on CIFAR-10 with its default hyperparameters on spaces S1-S4. These cells correspond with the normal ones in Figure 1.
 Figure 21: Normal cells found by DARTS on CIFAR-100 and SVHN when ran with its default hyperparameters on spaces S1-S4. Notice the dominance of parameter-less operations such as skip connection and pooling ops.
 Figure 22: Reduction cells found by DARTS on CIFAR-100 and SVHN when ran with its default hyperparameters on spaces S1-S4.
 Figure 23: Normal cells found by DARTS-ES when ran with DARTS default hyperparameters on spaces S1-S4.
 Figure 24: Reduction cells found by DARTS-ES when ran with DARTS default hyperparameters on spaces S1-S4.
 Figure 25: Cells found by AutoDispNet when ran on S6-d. These cells correspond to the results for augmentation scale 0.0 of Table 2.
 Figure 26: Cells found by AutoDispNet when ran on S6-d. These cells correspond to the results for augmentation scale 2.0 of Table 2.
 Figure 27: Cells found by AutoDispNet when ran on S6-d. These cells correspond to the results for $L _ { 2 } ^ { - } = 3 \cdot 1 0 ^ { - 4 }$ of Table 2.
 Figure 28: Cells found by AutoDispNet when ran on S6-d. These cells correspond to the results for $L _ { 2 } ^ { - } = 8 1 \cdot 1 0 ^ { - 4 }$ of Table 2.
 Figure 29: Normal (top row) and reduction (bottom) cells found by DARTS on CIFAR-10 when ran with its default hyperparameters on spaces S1-S4. Same as Figure 1 but with different random seed (seed 2).
 Figure 30: Normal (top row) and reduction (bottom) cells found by DARTS on CIFAR-10 when ran with its default hyperparameters on spaces S1-S4. Same as Figure 1 but with different random seed (seed 3).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329# LEARNING COMPOSITIONAL KOOPMAN OPERATORSFOR MODEL-BASED CONTROL
Yunzhu Li∗ Hao He∗ MIT CSAIL MIT CSAIL
Jiajun Wu MIT CSAIL
Dina Katabi MIT CSAIL
Antonio Torralba MIT CSAIL
# ABSTRACT
Finding an embedding space for a linear approximation of a nonlinear dynamical system enables efficient system identification and control synthesis. The Koopman operator theory lays the foundation for identifying the nonlinear-to-linear coordinate transformations with data-driven methods. Recently, researchers have proposed to use deep neural networks as a more expressive class of basis functions for calculating the Koopman operators. These approaches, however, assume a fixed dimensional state space; they are therefore not applicable to scenarios with a variable number of objects. In this paper, we propose to learn compositional Koopman operators, using graph neural networks to encode the state into objectcentric embeddings and using a block-wise linear transition matrix to regularize the shared structure across objects. The learned dynamics can quickly adapt to new environments of unknown physical parameters and produce control signals to achieve a specified goal. Our experiments on manipulating ropes and controlling soft robots show that the proposed method has better efficiency and generalization ability than existing baselines.
# 1 INTRODUCTION
Simulating and controlling complex dynamical systems, such as ropes or soft robots, relies on two key features of the dynamics model: first, it needs to be efficient for system identification and motor control; second, it needs to be generalizable to a complex, constantly evolving environments.
In practice, computational models for complex, nonlinear dynamical systems are often not efficient enough for real-time control (Mayne, 2000). The Koopman operator theory suggests that identifying nonlinear-to-linear coordinate transformations allows efficient linear approximation of nonlinear systems (Williams et al., 2015; Mauroy & Goncalves, 2016). Fast as they are, however, existing papers on Koopman operators focus on a single dynamical system, making it hard to generalize to cases where there are a variable number of components.
In contrast, recent advances in approximating dynamics models with deep nets have demonstrated its power in characterizing complex, generic environments. In particular, a few recent papers have explored the use of graph nets in dynamics modeling, taking into account the state of each object as well as their interactions. This allows their models to generalize to scenarios with a variable number of objects (Battaglia et al., 2016; Chang et al., 2017). Despite their strong generalization power, they are not as efficient in system identification and control, because deep nets are heavily over-parameterized, making optimization time-consuming and sample-inefficient.
In this paper, we propose compositional Koopman operators, integrating Koopman operators with graph networks for generalizable and efficient dynamics modeling. We build on the idea of encoding states into object-centric embeddings with graph neural networks, which ensures generalization power. But instead of using over-parameterized neural nets to model state transition, we identify the Koopman matrix and control matrix from data as a linear approximation of the nonlinear dynamical system. The linear approximation allows efficient system identification and control synthesis.
The main challenge of extending Koopman theory to multi-object systems is scalability. The number of parameters in the Koopman matrix scales quadratically with the number of objects, which harms the learning efficiency and leads to overfitting. To tackle this issue, we exploit the structure of the underlying system and use the same block-wise Koopman sub-matrix for object pairs of the same relation. This significantly reduces the number of parameters that need to be identified by making it independent of the size of the system.
 Figure 1: Overview of our model. A graph neural network $\phi$ takes in the current state of the physical system $\mathbf { \boldsymbol { x } } ^ { t }$ , and generates object-centric representations in the Koopman space $g ^ { t }$ . We then use the block-wise Koopman matrix $K$ and control matrix $L$ identified from equation 6 or equation 8 to predict the Koopman embeddings in the next time step $\mathbf g ^ { t + 1 }$ . Note that in $K$ and $L$ , object pairs of the same relation share the same sub-matrix. Another graph neural network $\psi$ maps $\mathbf g ^ { t + 1 }$ back to the original state space, i.e., $\boldsymbol { x } ^ { t + 1 }$ . The mapping between $g ^ { \hat { t } }$ and $\mathbf g ^ { t + 1 }$ is linear and is shared across all time steps, where we can iteratively apply $K$ and $L$ to the Koopman embeddings and roll multiple steps into the future. The formulation enables efficient system identification and control synthesis.
Our experiments include simulating and controlling ropes of variable lengths and soft robots of different shapes. The compositional Koopman operators are significantly more accurate than the state-of-the-art learned physics engines (Battaglia et al., 2016; Li et al., 2019b), and faster when adapting to new environments of unknown physical parameters. Our method also outperforms vanilla deep Koopman methods (Lusch et al., 2018; Morton et al., 2018) and Koopman models with manually-designed basis functions, which shows the advantages of using a structured Koopman matrix and graph neural networks. Please see our project page for demonstrating videos.
# 2 RELATED WORK
Koopman operators. The Koopman operator formalism of dynamical systems is rooted in the seminal works of Koopman and Von Neumann in the early 1930s (Koopman, 1931; Koopman & Neumann, 1932). The core idea is to map the state of a nonlinear dynamical system to an embedding space, over which we can linearly propagate into the future. Researchers have proposed various algorithms to explore the Koopman spectral properties from data. A large portion of them are in the class of dynamic mode decomposition (DMD) (Rowley et al., 2009; Schmid, 2010; Tu et al., 2014; Williams et al., 2015; Arbabi & Mezic, 2017). The linear representation will enable efficient prediction, estimation, and control using tools from linear dynamical systems (Williams et al., 2016; Proctor et al., 2018; Mauroy & Goncalves, 2019; Korda & Mezic´, 2018). People have been using hand-designed Koopman observables for various modeling and control tasks (Brunton et al., 2016; Kaiser et al., 2017; Abraham et al., 2017; Bruder et al., 2019b; Arbabi et al., 2018). Some recent works have applied the method to the real world and successfully control soft robots with great precision (Bruder et al., 2019a; Mamakoukas et al., 2019).
However, hand-crafted basis functions sometimes fail to generalize to more complex environments. Learning these functions from data using neural nets turns out to generate a more expressive invariant subspace (Lusch et al., 2018; Takeishi et al., 2017) and has achieved successes in fluid control (Morton et al., 2018). Morton et al. (2019) has also extended the framework to account for uncertainty in the system by inferring a distribution over observations. Our model differs by explicitly modeling the compositionality of the underlying system with graph networks. It generalizes better to environments of a variable number of objects or soft robots of different shapes.
Learning-based physical simulators. Battaglia et al. (2016) and Chang et al. (2017) first explored learning a simulator from data by approximating object interactions with neural networks. These models are no longer bounded to hard-coded physical rules, and can adapt to scenarios where the underlying physics is unknown. Please refer to Battaglia et al. (2018) for a full review. Recently, Mrowca et al. (2018) and Li et al. (2019a) extended these models to approximate particle dynamics of deformable shapes and fluids. Flexible as they are, these models become less efficient during model adaptation in complex scenarios, because the optimization of neural networks usually needs a lot of samples and compute, which limits its use in an online setting. Nagabandi et al. (2019a;b) proposed to use meta-learning for online adaptation, and have shown to be effective in simulated robots and a real legged millirobot. However, it is not clear whether their methods can generalize to systems with variable numbers of instances. The use of graph nets and Koopman operators in our model allows better generalization ability and enables efficient system identification as we only need to identify the transition matrices, which is essentially a least-square problem and can be solved very efficiently.
People have also used the learned physics engines for planning and control. Many previous papers in this direction learn a latent dynamics model together with a policy in a model-based reinforcement learning setup (Racaniere et al. \` , 2017; Hamrick et al., 2017; Pascanu et al., 2017; Hafner et al., 2019); a few alternatives use the learned model in model-predictive control (MPC) (Sanchez-Gonzalez et al., 2018; Li et al., 2019b; Janner et al., 2019). In this paper, we leverage the fact that the embeddings in the Koopman space are propagating linearly through time, which allows us to formulate the control problem as quadratic programming and optimize the control signals much more efficiently.
# 3 APPROACH
We first present the basics of Koopman operators: for a nonlinear dynamical system, the Koopman observation functions can map the state space to an embedding space where the dynamics become linear. We then discuss the compositional nature of physical systems and show how graph networks can be used to capture the compositionality.
# 3.1 THE KOOPMAN OPERATORS
Let $\pmb { x } ^ { t } \in \mathcal { X } \subset \mathbb { R } ^ { n }$ be the state vector for the system at time step $t$ . We consider a non-linear discrete-time dynamical system described by ${ \pmb x } ^ { t + 1 } = F ( { \pmb x } ^ { t } )$ . The Koopman operator (Koopman, 1931), denoted as $\mathcal { K } : \mathcal { F } \mathcal { F }$ , is a linear transformation defined by $\kappa g \triangleq g \circ F$ , where $\mathcal { F }$ is the collection of all functions (also referred to as observables) that form an infinite-dimensional Hilbert space. For every function $g : \mathcal { X } \mathbb { R }$ belonging to $\mathcal { F }$ , we have
$$( \mathcal { K } g ) ( \pmb { x } ^ { t } ) = g ( F ( \pmb { x } ^ { t } ) ) = g ( \pmb { x } ^ { t + 1 } ) ,$$
making the function space $\mathcal { F }$ invariant under the action of the Koopman operator.
Although the theory guarantees the existence of the Koopman operator, its use in practice is limited by its infinite dimensionality. Most often, we assume there is an invariant subspace $\mathcal { G }$ of the Koopman operator. It spans by a set of base observation functions $\{ g _ { 1 } , \cdots , g _ { m } \}$ and satisfies that $\kappa g \in \mathcal G$ for any $g \in { \mathcal { G } }$ . With a slightly abuse of the notation, we now use $\bar { g } ( \pmb { x } ^ { \hat { t } } ) : \mathbb { R } ^ { n } \mathbb { R } ^ { m }$ to represent $[ g _ { 1 } ( { \pmb x } ^ { t } ) , \cdot \cdot \cdot , g _ { m } ( { \pmb x } ^ { t } ) ] ^ { T }$ . By constraining the Koopman operator on this invariant subspace, we get a finite-dimensional linear operator $K \in \mathbb { R } ^ { m \times m }$ that we refer as the Koopman matrix.
Traditionally, people hand-craft base observation functions from the knowledge of underlying physics. The system identification problem is then reduced to finding the Koopman matrix $K$ , which can be solved by linear regression given historical data of the system. Recently, researchers have also explored data-driven methods that automatically find the Koopman invariant subspace via representing the base observation functions $g ( { \pmb x } )$ via deep neural networks.
Although the original Koopman theory does not consider the system with external control inputs, researchers have found that linearly injecting control signals to the Koopman observation space can give us good numerical performance (Brunton et al., 2016; Bruder et al., 2019a). Mathematically, considering a dynamical system, $\pmb { x } ^ { t + 1 } = F ( \pmb { x } ^ { t } , \pmb { u } ^ { t } )$ , with an external control input ${ \mathbf { } } _ { { \mathbf { } } { \mathbf { } } } { \mathbf { } } _ { { \mathbf { } } } t$ , we aim to find the Koopman observation functions and the linear dynamics model in the form of
$$g ( \pmb { x } ^ { t + 1 } ) = K g ( \pmb { x } ^ { t } ) + L \pmb { u } ^ { t } ,$$
where the coefficient matrix $L$ is referred to as the control matrix.
# 3.2 COMPOSITIONAL KOOPMAN OPERATORS
The dynamics of a physical system are governed by physical rules, which are usually shared across different subcomponents in the system. Explicitly modeling such compositionality enables more efficient system identification and control synthesis and provides better generalization ability.
Motivating example. Consider a system with $N$ balls moving in a 2D plane, each pair connected by a linear spring. Assume all balls have mass 1 and all springs share the same stiffness coefficient $k$ . We denote the $i$ ’s ball’s position as $( x _ { i } , y _ { i } )$ and its velocity as $( { \dot { x } } _ { i } , { \dot { y } } _ { i } )$ . For ball $i$ , equation 3 describes its dynamics, where $\mathbf { \Phi } _ { \pmb { x } _ { i } } \triangleq [ x _ { i } , y _ { i } , \dot { x } _ { i } , \dot { y } _ { i } ] ^ { T }$ denotes ball $i$ ’s state:
$$\begin{array}{c} \dot { v } _ { i } = \left[ \begin{array} { c } { \dot { x } _ { i } } \\ { \dot { y } _ { i } } \\ { \dot { x } _ { i } } \\ { \dot { y } _ { i } } \end{array} \right] = \left[ \begin{array} { c c c c c } { \dot { x } _ { i } } & { 0 } & { 1 } & { 0 } \\ { \dot { y } _ { i } } & { 0 } & { 0 } & { 1 } \\ { \sum _ { j = 1 } ^ { N } k ( x _ { j } - x _ { i } ) } \\ { \sum _ { j = 1 } ^ { N } k ( y _ { j } - y _ { i } ) } \end{array} \right] = \underbrace { \left[ \begin{array} { c c c c c } { 0 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 1 } \\ { k - N k } & { 0 } & { 0 } & { 0 } \\ { 0 } & { k - N k } & { 0 } & { 0 } \end{array} \right] } _ { \triangleq \mathcal { A } } \left[ \begin{array} { c } { x _ { i } } \\ { y _ { i } } \\ { \dot { x } _ { i } } \end{array} \right] + \sum _ { j \neq i } \left[ \underbrace { 0 } _ { k } _ { 0 } \begin{ c c c c } { 0 } & { 0 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 0 } \\ { k } & { 0 } & { 0 } & { 0 } \\ { 0 } & { k } & { 0 } & { 0 } \end{array} \right] \left[ \begin{array} { c } { x _ { j } } \\ { y _ { j } } \\ { \dot { x } _ { j } } \end{array} \right]$$
We can represent the state of the whole system using the union of every ball’s state, where ${ \textbf { \em x } } =$ $[ \pmb { x } _ { 1 } , \cdots , \pmb { \dot { x } } _ { N } ] ^ { T }$ . Then the transition matrix is essentially a block matrix, where the matrix parameters are shared among the diagonal or off-diagonal blocks as shown in equation 4:
$${ \dot { \pmb x } } = \left[ \begin{array} { c } { \dot { \pmb x } _ { 1 } } \\ { \dot { \pmb x } _ { 2 } } \\ { \vdots } \\ { \dot { \pmb x } _ { N } } \end{array} \right] = \left[ \begin{array} { c c c c } { { \cal A } } & { { \cal B } } & { \cdots } & { { \cal B } } \\ { { \cal B } } & { { \cal A } } & { \cdots } & { { \cal B } } \\ { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { { \cal B } } & { { \cal B } } & { \cdots } & { { \cal A } } \end{array} \right] \left[ \begin{array} { c } { { \pmb x } _ { 1 } } \\ { { \pmb x } _ { 2 } } \\ { \vdots } \\ { { \pmb x } _ { N } } \end{array} \right] .$$
Based on the linear spring system, we make three observations for multi-object systems.
The system state is composed of the state of each individual object. The dimension of the whole system scales linearly with the number of objects. We formulate the system state by concatenating the state of every object, corresponding to an object-centric state representation. • The transition matrix has a block-wise substructure. After assuming an object-centric state representation, the transition matrix naturally has a block-wise structure as shown in equation 4. • The same physical interactions share the same transition block. The blocks in the transition matrix encode actual interactions and generalize across systems. $A$ and $B$ govern the dynamics of the linear spring system, and are shared by systems with a different number of objects.
These observations inspire us to exploit the structure of multi-object systems, instead of learning separate models for systems that contains different numbers of balls.
Compositional Koopman operators. Motivated by the linear spring system, we want to inject a good inductive bias to incorporate compositionality when applying the Koopman theory. This allows better generalization ability and more efficient system identification and better controller design. Figure 1 shows an overview of our model.
Considering a system with $N$ objects, we denote $\mathbf { \boldsymbol { x } } ^ { t }$ as the system state at time $t$ and $\boldsymbol { x } _ { i } ^ { t }$ is the state of the $\romannumeral 1$ ’th object. We further denote $\mathbf { \boldsymbol { g } } ^ { t } \triangleq \mathbf { \boldsymbol { g } } ( \mathbf { \boldsymbol { x } } ^ { t } )$ as the embedding of the state in the Koopman invariant space. In the rest of the paper, we call $g ^ { t }$ the Koopman embedding. Based on the observation we made in the case of linear spring system, we propose the following assumptions on the compositional structure of the Koopman embedding and the Koopman matrix.
• The Koopman embedding of the system is composed of the Koopman embedding of every objects. Similar to the decomposition in the state space, we assume the Koopman embedding can be divided into object-centric sub-embeddings, i.e. $\pmb { g } ^ { t } \in \mathbb { R } ^ { N m }$ denoting the concatenation of $g _ { 1 } ^ { t } , \cdots , g _ { N } ^ { t }$ , where we use $\pmb { g } _ { i } ^ { t } = g _ { i } ( \pmb { x } ^ { t } ) \in \mathbb { R } ^ { m }$ as the Koopman embedding for the $i ^ { \because }$ ’th object.
The Koopman matrix has a block-wise structure. It is natural to think the Koopman matrix is composed of block matrices after assuming an object-centric Koopman embeddings. In equation 5, $K _ { i j } \ \in \mathbb { R } ^ { m \times m }$ and $L _ { i j } \in \mathbb { R } ^ { m \times l }$ are blocks of the Koopman matrix and the control matrix, where $l$ is the dimension of the action for each object and $\pmb { u } ^ { t } \in \mathbb { R } ^ { N l }$ is the concatenation of $\boldsymbol { \mathbf { \mathit { u } } } _ { 1 } ^ { t } , \cdots , \boldsymbol { \mathbf { \mathit { u } } } _ { N } ^ { t }$ denoting the total control signal at time $t$ :
$$\left[ \begin{array} { c } { { { \bf g } _ { 1 } ^ { t + 1 } } } \\ { { \vdots } } \\ { { \vdots } } \\ { { { \bf g } _ { N } ^ { t + 1 } } } \end{array} \right] = \left[ \begin{array} { c c c c } { { { \cal K } _ { 1 1 } } } & { { \cdots } } & { { { \cal K } _ { 1 N } } } \\ { { \vdots } } & { { \ddots } } & { { \vdots } } \\ { { { \cal K } _ { N 1 } } } & { { \cdots } } & { { { \cal K } _ { N N } } } \end{array} \right] \left[ \begin{array} { c } { { { \bf g } _ { 1 } ^ { t } } } \\ { { \vdots } } \\ { { { \bf g } _ { N } ^ { t } } } \end{array} \right] + \left[ \begin{array} { c c c c } { { { \cal L } _ { 1 1 } } } & { { \cdots } } & { { { \cal L } _ { 1 N } } } \\ { { \vdots } } & { { \ddots } } & { { \vdots } } \\ { { { \cal L } _ { N 1 } } } & { { \cdots } } & { { { \cal L } _ { N N } } } \end{array} \right] \left[ \begin{array} { c } { { { \bf u } _ { 1 } ^ { t } } } \\ { { \vdots } } \\ { { \vdots } } \\ { { { \bf u } _ { N } ^ { t } } } \end{array} \right] .$$
As we have seen in the case of linear spring system, those matrix blocks are not independent, but some of them share the same set of values.
• The same physical interactions shall share the same transition block. The equivalence between the blocks should reflect the equivalence of the interactions, where we use the same transition sub-matrix for object pairs of the same relation. For example, if the system is composed of $N$ identical objects interacting with the same relation, then, by symmetry, all the diagonal blocks should be the same, while all the off-diagonal blocks should also be the same. The repetitive structure allows us to efficiently identify the values using least squares regression.
# 3.3 LEARNING THE KOOPMAN EMBEDDINGS USING GRAPH NEURAL NETWORKS
For a graph that contains , where vertic $N$ nt the syesent obj m at time s and ed $t$ us $G ^ { t } = ( O ^ { t } , R )$ $O ^ { t } = \{ o _ { i } ^ { t } \} _ { i = 1 } ^ { N }$ $\bar { R \mathbf { \Psi } } = \{ r _ { k } \} _ { k = 1 } ^ { N ^ { 2 } }$ represent pair-wise relations. Specifically, ${ \pmb O } _ { i } ^ { t } = ( \bar { \pmb x } _ { i } ^ { t } , { \pmb a } _ { i } ^ { o } )$ $\boldsymbol { x } _ { i } ^ { t }$ is the state of object $i$ and $\pmb { a } _ { i } ^ { o }$ is a one-hot vector indicating the object type, e.g., fixed or movable. For relation, we have $\pmb { r } _ { k } = ( u _ { k } , v _ { k } , \pmb { a } _ { k } ^ { r } ) , 1 \leq u _ { k } , v _ { k } \leq N$ , where $u _ { k }$ and $v _ { k }$ are integers denoting the end points of this directed edge, and $\pmb { a } _ { k } ^ { r }$ is a one-hot vector denoting the type of the relation $k$ .
We use a graph neural network similar to Interaction Networks (IN) (Battaglia et al., 2016) to generate object-centric Koopman embeddings. IN defines an object function $f _ { O }$ and a relation function $f _ { R }$ to model objects and their relations in a compositional way. Similar to a message passing procedure, we calculate the edge effect $\pmb { e } _ { k } ^ { t } = f _ { R } ( \bar { \pmb { o } } _ { u _ { k } } ^ { t } , \pmb { o } _ { v _ { k } } ^ { t } , \pmb { a } _ { k } ^ { r } ) _ { k = 1 \dots N ^ { 2 } }$ , and node effect $\begin{array} { r } { \pmb { g } _ { i } ^ { t } = f _ { O } ( \pmb { o } _ { i } ^ { t } , \sum _ { k \in \mathcal { N } _ { i } } \pmb { e } _ { k } ^ { t } ) _ { i = 1 \dots N } } \end{array}$ , where ${ \mathcal { N } } _ { i }$ denotes the relations that point to the object $i$ and $\{ g _ { i } ^ { t } \}$ are the derived Koopman embeddings. We use this graph neural network, denoted as $\phi$ , to represent our Koopman observation function.
System identification. For a sequence of observations $\widetilde { \pmb { x } } = \{ \pmb { x } ^ { 1 } , \cdots , \pmb { x } ^ { T } \}$ from time 1 to time $T$ , we first map them to the Koopman space as $\widetilde { \pmb { g } } = [ \pmb { g } ^ { 1 } , \dotsb { \mathrm { ~ , ~ } } \pmb { g } ^ { T } ]$ using the graph encoder $\phi$ , where $g ^ { t } = \phi ( \pmb { x } ^ { t } )$ . We use $\pmb { g } ^ { i : j }$ eto denote the sub-sequence $[ \pmb { g } ^ { i } , \cdots , \pmb { g } ^ { j } ]$ . To identify the Koopman matrix, we solve the linear regression $\operatorname* { m i n } _ { K } { \| K g ^ { 1 : T - 1 } - g ^ { \overleftarrow { 2 } : T } \| _ { 2 } }$ . As a result, $K { \dot { = } } g ^ { 2 : T } ( { \dot { g } } ^ { 1 : T - 1 } ) ^ { \dagger }$ will asymptotically approach the Koopman operator $\kappa$ with an increasing $T$ . For cases where there are control inputs $\widetilde { \pmb { u } } = [ \pmb { u } ^ { 1 } , \dotsb , \pmb { u } ^ { T - 1 } ]$ , the calculation of the Koopman matrix and the control matrix is eessentially solving a least squares problem w.r.t. the objective
$$\operatorname* { m i n } _ { K , L } | | K g ^ { 1 : T - 1 } + L \widetilde { \pmb { u } } - \pmb { g } ^ { 2 : T } | | _ { 2 } .$$
As we mentioned in the Section 3.2, the dimension of the Koopman space is linear to the number of objects in the system, i.e., $\widetilde { \pmb g } \in \mathbb R ^ { N m \times T }$ and $K \in \mathbb { R } ^ { N m \times N m }$ . If we do not enforce any structure on the Koopman matrix $K$ e, we will have to identify $N ^ { 2 } m ^ { 2 }$ parameters. Instead, we can significantly reduce the number by leveraging the assumption on the structure of $K$ . Assume we know some blocks $( \{ K _ { i j } \} )$ of the matrix $K$ are shared and in total there are $h$ different kinds of blocks, which we denote as $\hat { K } \in \mathbb { R } ^ { h \times m \times m }$ . Then, the number of parameter to be identified reduce to $h m ^ { 2 }$ . Usually, $h$ does not depend on $N$ , and is much smaller than $N ^ { 2 }$ . Now, for each block $K _ { i j }$ , we have a one-hot vector $\sigma _ { i j } \in \{ 0 , 1 \} ^ { h }$ indicating its type, i.e., $K _ { i j } = \sigma _ { i j } \hat { K } \in \mathbb { R } ^ { m \times m }$ . Finally, as shown in equation 7, we represent the Koopman matrix as the product of the index tensor $\sigma$ and the parameter tensor $\hat { K }$ :
$$K = \sigma \otimes { \hat { K } } = \left[ \begin{array} { c c c } { \sigma _ { 1 1 } { \hat { K } } } & { \cdots } & { \sigma _ { 1 N } { \hat { K } } } \\ { \vdots } & { \ddots } & { \vdots } \\ { \sigma _ { N 1 } { \hat { K } } } & { \cdots } & { \sigma _ { N N } { \hat { K } } } \end{array} \right] , \mathrm { w h e r e } \sigma = \left[ \begin{array} { c c c } { \sigma _ { 1 1 } } & { \cdots } & { \sigma _ { 1 N } } \\ { \vdots } & { \ddots } & { \vdots } \\ { \sigma _ { N 1 } } & { \cdots } & { \sigma _ { N N } } \end{array} \right] \in \mathbb { R } ^ { N \times N \times h } .$$
Similar to the Koopman matrix, we assume the same block structure in the control matrix $L$ and denote its parameter as $\hat { L } \in \mathbb { R } ^ { h \times m \times l }$ . The least squares problem of identifying $\hat { K }$ and $\hat { L }$ becomes
$$\operatorname* { m i n } _ { \hat { K } , \hat { L } } \| ( \sigma \otimes \hat { K } ) \pmb { g } ^ { 1 : T - 1 } + ( \sigma \otimes \hat { L } ) \widetilde { \pmb { u } } - \pmb { g } ^ { 2 : T } \| _ { 2 } ,$$
where $\sigma \otimes \hat { K } \in \mathbb { R } ^ { N m \times N m }$ , $\sigma \otimes \hat { L } \in \mathbb { R } ^ { N m \times N l }$ , $\pmb { g } ^ { 1 : T - 1 } \in \mathbb { R } ^ { N m \times ( T - 1 ) }$ and $\widetilde { \pmb { u } } \in \mathbb { R } ^ { N l \times ( T - 1 ) }$ . Since ethe linear least squares problems described in equation 6 and equation 8 have analytical solutions, performing system identification using our method is very efficient.
Training GNN models. To make predictions on the states, we use a graph decoder $\psi$ to map the Koopman embeddings back to the original state space. In total, we have three losses to train the graph encoder and decoder. The first term is the auto-encoding loss
$$\mathcal { L } _ { \mathrm { a e } } = \frac { 1 } { T } \sum _ { i } ^ { T } \| \psi ( \phi ( \pmb { x } ^ { i } ) ) - \pmb { x } ^ { i } \| .$$
The second term is the prediction loss. To calculate it, we rollout in the Koopman space and denote the embeddings as $\hat { \pmb g } ^ { 1 } \overset { ^ { } } { = } \pmb g ^ { 1 }$ , and $\hat { \pmb { g } } ^ { t + 1 } = K \hat { \pmb { g } } ^ { t } + L \pmb { u } ^ { t }$ , for $t = 1 , \cdots , T - 1$ . The prediction loss is defined as the difference between the decoded states and the actual states, i.e.,
$$\mathcal { L } _ { \mathrm { p r e d } } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } \Vert \psi ( \hat { \pmb g } ^ { i } ) - \pmb x ^ { i } \Vert .$$
Third, we employ a metric loss to encourage the Koopman embeddings preserving the distance in the original state space. The loss is defined as the absolute error between the distances measured in the Koopman space and that in the original space, i.e.,
$${ \mathcal { L } } _ { \mathrm { m e t r i c } } = \sum _ { i j } \left| \left\| { \pmb { g } } ^ { i } - { \pmb { g } } ^ { j } \right\| - \left\| { \pmb { x } } ^ { i } - { \pmb { x } } ^ { j } \right\| \right| .$$
Having Koopman embeddings that perserves the distance in the state space is important as we are using the distance in the Koopman space to define the cost function for downstream control tasks.
The final training loss is simply the combination of all the terms above: $\mathcal { L } = \mathcal { L } _ { \mathrm { a e } } + \lambda _ { 1 } \mathcal { L } _ { \mathrm { p r e d } } + \lambda _ { 2 } \mathcal { L } _ { \mathrm { m e t r i c } }$ . We then minimize the loss $\mathcal { L }$ by optimizing the parameters in the graph encoder $\phi$ and graph decoder $\psi$ using stochastic gradient descent. Once the model is trained, it can be used for system identification, future prediction, and control synthesis.
# 3.4 CONTROL
For a control task, the goal is to synthesize a sequence of control inputs $\mathbf { \pmb { u } } ^ { 1 : T }$ that minimize $C =$ $\textstyle \sum _ { t = 1 } ^ { T } c _ { t } ( \pmb { x } ^ { t } , \pmb { u } ^ { t } )$ , the total incurred cost, where $c _ { t } ( \pmb { x } ^ { t } , \pmb { u } ^ { t } )$ is the instantaneous cost. For example, considering the control task of reaching a desired state $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } } ^ { * }$ at time $T$ , we can design the following instantaneous cost, $c _ { t } ( \pmb { x } ^ { t } , \pmb { u } ^ { t } ) = \mathbb { 1 } _ { [ t = T ] } \bar { \lVert \pmb { x } ^ { t } - \pmb { x } ^ { * } \rVert _ { 2 } ^ { 2 } + \lambda \lVert \pmb { u } ^ { t } \rVert _ { 2 } ^ { 2 } }$ . The first term promotes the control sequence that matches the state to the goal, while the second term regularizes the control signals.
Open-loop control via quadratic programming (QP). Our model maps the original nonlinear dynamics to a linear dynamical system. We can then solve the control task by solving a linear control problem. With the assumption that the Koopman embeddings preserve the distance measure, we define the control cost as $c _ { t } ( { \pmb g } ^ { t } , { \pmb u } ^ { t } ) = \mathbb { 1 } _ { [ t = T ] } \| { \pmb g } ^ { t } - { \pmb g } ^ { * } \| _ { 2 } ^ { 2 } + \lambda \| { \pmb u } ^ { t } \| _ { 2 } ^ { 2 }$ . As a result, we reduce the problem to minimizing a quadratic cost function $\begin{array} { r } { C = \sum _ { t = 1 } ^ { T } c _ { t } ( g ^ { t } , \pmb { u } ^ { t } ) } \end{array}$ over variables $\{ g ^ { t } , \pmb { u } ^ { t } \} _ { t = 1 } ^ { T }$ , where $\pmb { g } ^ { 1 } = \phi ( \pmb { x } ^ { 1 } )$ and ${ \pmb g } ^ { * } = \phi ( { \pmb x } ^ { * } )$
Model predictive control (MPC). Solving the QP gives us control signals, which might not be good enough for long-term control as the prediction error accumulates. We can combine it with Model Predictive Control, assuming feedback from the environment every $\tau$ steps.
# 4 EXPERIMENTS
Environments. We evaluate our method by assessing how well it can simulate and control ropes and soft robots. Specifically, we consider three environments. (1) Rope (Figure 2a): the top mass of a rope is fixed to a specific height. We apply force to the top mass to move it in a horizontal line. The rest of the masses are free to move according to internal force and gravity. (2) Soft (Figure 2b): we aim to control a soft robot that is consist of soft blocks. Blocks in dark grey are rigid and those in light blue are soft blocks. Each one of the dark blue blocks is soft but have an actuator inside that can contract or expand the block. One of the blocks is pinned to the ground, as shown using the red dots. (3) Swim (Figure 2c): instead of pinning the soft robot to the ground, we let the robot swim in fluids. The colors shown in this environment have the same meaning as in Soft.
 Figure 2: Qualitative results. Top: our model prediction matches the ground truth over a long period. Bottom: for control, we use red dots or frames to indicate the goal. We apply the control signals generated from our identified model to the original simulator, which allows the agent to achieve the goal accurately. Please refer to our supplementary video for more results.
Observation space. In the Rope environment, each mass on the rope is considered as an object. The observation of each mass is its position and velocity in the 2D plane, which has a dimension of 4. In total, a rope with $N$ masses has an observation space of dimension $4 N$ . In both the Soft and the Swim environments, each quadrilateral is considered as an object. For each quadrilateral, we have access to the positions and velocities of the four corners. Thus for a soft robot containing $N$ quadrilaterals, we have a $4 \times 4 \times N = 1 6 N$ dimensional observation.
Baselines. We compare our model to the following baselines: Interaction Networks (Battaglia et al., 2016) (IN), Propagation Networks (Li et al., 2019b) (PN) and Koopman method with handcrafted Koopman base functions (KPM). IN and PN are the state-of-the-art learning-based physical simulators, and we evaluate their adaptation ability by finetuning their parameters on a small sequence of observations from the testing environment. Similar to our method, KPM fits a linear dynamics in the Koopman space. Instead of learning Koopman observations from data, KPM uses polynomials of the original states as the basis functions. In our setting, we set the maximum order of the polynomials to be three to make the dimension of the hand-crafted Koopman embeddings match our model’s.
Data generation. We generate 10,000 episodes for Rope and 50,000 episodes for Soft and Swim. Among them, $9 0 \%$ are used for training, and the rest for testing. Each episode has 100 time steps. In the dataset, the physical systems have a various number of objects from 5 to 9, i.e. the ropes have 5 to 9 masses while the soft robots in Soft and Swim environments have 5 to 9 quadrilaterals. To evaluate the model’s extrapolating generalization ability, for each environment, we generate an extra dataset with the same size as the test set while containing systems consist of 10 to 14 objects.
 Figure 3: Quantitative results on simulation. The $x$ axis shows time steps. The solid lines indicate medians and the transparent regions are the interquartile ranges of simulation errors. Our method significantly outperforms the baselines in all testing environments.
 Figure 4: Quantitative results on control and ablation studies on model hyperparameters. Left: box-plots show the distributions of control errors. The yellow line in the box indicates the median. Our model consistently achieves smaller errors in all environments against KPM. Right: our model’s simulation errors with different amount of data for system identification (d) and different dimensions of the Koopman space (e).
Training and evaluation protocols. All models are trained using Adam optimizer (Kingma & Ba, 2015) with a learning rate of $1 0 ^ { - 4 }$ and a batch size of 8. $\lambda _ { 1 }$ and $\lambda _ { 2 }$ are 1.0 and 0.3, respectively, for our model. For both our model and the baselines, we apply 400K iterations of gradient steps in the Rope environment and 580K iterations in the Soft and Swim environment. Our model is trained on the sub-sequence of length 64 from the training set, and IN/PN aims at minimizing the L1 distance between their prediction and the ground truth. During test time, the models have to adapt to a new environment of unknown physical parameters, where they have access to a short sequence of observations and the opportunity to adjust their models’ parameters. Our model uses 8 episodes to identify the transition matrix via least-square regression. IN/PN update the model’s parameters by minimizing the distance between the model’s prediction and the actual observation using a gradient step of length $1 0 ^ { - 4 }$ for 5 iterations. For evaluation, we use two metrics: simulation error and control error. For a given episode, the simulation error at time step $t$ is defined as the mean squared error between the model prediction $\hat { \mathbf { x } } ^ { t }$ and the ground truth $\mathbf { \boldsymbol { x } } ^ { t }$ . For control, we pick the initial frame $\mathbf { \boldsymbol { x } } ^ { 0 }$ and the $t ^ { \star }$ th frame $\mathbf { \boldsymbol { x } } ^ { t }$ from a episode. Then we ask the model to generate a control sequence of length $t$ to transfer the system from the initial state $\mathbf { \boldsymbol { x } } ^ { 0 }$ to the target state $\mathbf { \boldsymbol { x } } ^ { t }$ . The control error is defined as the mean squared distance between the target state and the state of the system at time $t$ .
# 4.1 SIMULATION
Figure 2 shows qualitative results on simulation. Our model accurately predicts system dynamics for more than 100 steps. For Rope, the small prediction error comes from the slight delay of the force propagation inside the rope; hence, the tail of the rope usually has a larger error. For Soft, our model captures the interaction between the body parts and generates accurate prediction over the global movements of the robot. The error mainly comes from the misalignment of some local components.
We evaluate the models by predicting 100 steps into the future on 500 trajectories and Figure 3 shows quantitative results. IN and PN do not work well in the Rope and Swim environments due to insufficient system identification ability. The KPM baseline performs poorly in the Rope and
Soft environments indicating the limited power of polynomial Koopman base functions. Our model significantly outperforms all the baselines.
# 4.2 CONTROL
We compare our model with KPM, the Koopman baseline using polynomial basis. In Rope, we ask the models to perform open-loop control where it only solves the QP once at the beginning. The length of the control sequence is 40. When it comes to Soft/Swim, each model is asked to generate control signals of 64 steps, and we allow the model to receive feedback after 32 steps. Thus every model has a second chance to correct its control sequence by solving the QP again at the time step 32.
As shown in Figure 2, our model leverages the inertia of the rope and matches the target state accurately. As for controlling a soft body swinging on the ground or swimming in the water, our model can move each part (the boxes) of the body to the exact target position. The small control error comes from the slight misalignment of the orientation and the size of the body parts. Figure 4 shows that quantitatively our model outperforms KPM, too.
# 4.3 ABLATION STUDY
Structure of the Koopman matrix. We explore three different structures of the Koopman matrix, Block, Diag and None, to understand its effect on the learned dynamics. None assumes no structure in the Koopman matrix. Diag assumes a diagonal block structure of $K$ : all off-diagonal blocks $( K _ { i j }$ where $i \neq j$ ) are zeros and all diagonal blocks share the same values. Block predefines a block-wise structure, decided by the relation between the objects as introduced in Section 3.3.
Table 1 includes our model’s simulation error and control error with different Koopman matrix structures in Rope. All models are trained in the Rope environment with 5 to 9 masses. Besides the result on the test set, we also report models’ extrapolation performance in parentheses, where the model is evaluated on systems with more masses than training, i.e., 10 to 14 masses.
Table 1: Ablation study results on the Koopman matrix structure (Rope environment). For simulation, we show the Mean Squared Error between the prediction and the ground truth at $T = 1 0 0$ , whereas for control, we show the performance with a horizon of length 40. The numbers in parentheses show the performance on extrapolation.
Our model with Block structure consistently achieves a smaller error in all settings. Diag assumes an overly simplified structure, leading to larger errors and failing to make reasonable controls. None has comparable simulation errors but larger control errors. Without the structure in the Koopman matrix, it overfits the data and makes the resulting linear dynamics less amiable to the control.
<table><tr><td></td><td>Simulation</td><td>Control</td></tr><tr><td>Diag</td><td>0.133 (0.174)</td><td>2.337 (2.809)</td></tr><tr><td>None</td><td>0.117 (0.083)</td><td>1.522 (1.288)</td></tr><tr><td>Block</td><td>0.105 (0.075)</td><td>0.854 (1.101)</td></tr></table>
Hyperparameters. In our main experiments, we set the dimension of the Koopman embedding to $m = 3 2$ per object. Online system identification requires 800 data samples for each training/test case. To understand our model’s performance under different hyperparameters, we vary the dimension of the Koopman embedding from 8 to 64 and the number of data samples used for system identification from 200 to 1,600. Figure 4d shows that more data for system identification leads to better simulation results. Figure 4e shows that dimension 16 gives the best results on simulation. It may suggest that the intrinsic dimension of the Koopman invariant space of the Rope system is around 16 per object.
# 5 CONCLUSION
Compositionality is common in our daily life. Many ordinary objects contain repetitive subcomponents: ropes and soft robots, as shown in this paper, granular materials such as coffee beans and lego blocks, and deformable objects such as cloth and modeling clay. These objects are known to be very challenging for manipulation using traditional methods, while our formulation opens up a new direction by combining deep Koopman operators with graph neural networks. By leveraging the compositional structure in the Koopman operator via graph neural nets, our model can efficiently manipulate deformable objects such as ropes and soft robots, and generalize to systems with variable numbers of components. We hope this work could encourage more endeavors in modeling larger and more complex systems by integrating the power of the Koopman theory and the expressiveness of neural networks.
# REFERENCES
Ian Abraham, Gerardo De La Torre, and Todd D Murphey. Model-based control using koopman operators. In RSS, 2017.
Hassan Arbabi and Igor Mezic. Ergodic theory, dynamic mode decomposition, and computation of spectral properties of the koopman operator. SIAM Journal on Applied Dynamical Systems, 16(4): 2096–2126, 2017.
Hassan Arbabi, Milan Korda, and Igor Mezic. A data-driven koopman model predictive control framework for nonlinear flows. In CDC, 2018.
Peter W. Battaglia, Razvan Pascanu, Matthew Lai, Danilo Rezende, and Koray Kavukcuoglu. Interaction networks for learning about objects, relations and physics. In NeurIPS, 2016.
Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv:1806.01261, 2018.
Daniel Bruder, Brent Gillespie, C David Remy, and Ram Vasudevan. Modeling and control of soft robots using the koopman operator and model predictive control. In RSS, 2019a.
Daniel Bruder, C David Remy, and Ram Vasudevan. Nonlinear system identification of soft robot dynamics using koopman operator theory. In ICRA, 2019b.
Steven L Brunton, Bingni W Brunton, Joshua L Proctor, and J Nathan Kutz. Koopman invariant subspaces and finite linear representations of nonlinear dynamical systems for control. PloS one, 11(2):e0150171, 2016.
Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. In ICLR, 2017.
Herve Delingette. Toward realistic soft-tissue modeling in medical simulation. Proceedings of the IEEE, 86(3):512–523, 1998.
Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In ICML, 2019.
Jessica B Hamrick, Andrew J Ballard, Razvan Pascanu, Oriol Vinyals, Nicolas Heess, and Peter W Battaglia. Metacontrol for adaptive imagination-based optimization. In ICLR, 2017.
Michael Janner, Sergey Levine, William T Freeman, Joshua B Tenenbaum, Chelsea Finn, and Jiajun Wu. Reasoning about physical interactions with object-oriented prediction and planning. In ICLR, 2019.
Eurika Kaiser, J Nathan Kutz, and Steven L Brunton. Data-driven discovery of koopman eigenfunctions for control. arXiv:1707.01146, 2017.
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
Bernard O Koopman. Hamiltonian systems and transformation in hilbert space. PNAS, 17(5):315, 1931.
BO Koopman and J v Neumann. Dynamical systems of continuous spectra. PNAS, 18(3):255, 1932.
Milan Korda and Igor Mezic. Linear predictors for nonlinear dynamical systems: Koopman operator ´ meets model predictive control. Automatica, 93:149–160, 2018.
Yunzhu Li, Jiajun Wu, Russ Tedrake, Joshua B Tenenbaum, and Antonio Torralba. Learning particle dynamics for manipulating rigid bodies, deformable objects, and fluids. In ICLR, 2019a.
Yunzhu Li, Jiajun Wu, Jun-Yan Zhu, Joshua B Tenenbaum, Antonio Torralba, and Russ Tedrake. Propagation networks for model-based control under partial observation. In ICRA, 2019b.
Bethany Lusch, J Nathan Kutz, and Steven L Brunton. Deep learning for universal linear embeddings of nonlinear dynamics. Nature Communications, 9(1):4950, 2018.
Giorgos Mamakoukas, Maria Castano, Xiaobo Tan, and Todd Murphey. Local koopman operators for data-driven control of robotic systems. In RSS, 2019.
Alexandre Mauroy and Jorge Goncalves. Linear identification of nonlinear systems: A lifting technique based on the koopman operator. In CDC, 2016.
Alexandre Mauroy and Jorge Goncalves. Koopman-based lifting techniques for nonlinear systems identification. IEEE Transactions on Automatic Control, 2019.
David Mayne. Nonlinear model predictive control: Challenges and opportunities. In Nonlinear Model Predictive Control, pp. 23–44. Springer, 2000.
Jeremy Morton, Freddie D Witherden, Antony Jameson, and Mykel J Kochenderfer. Deep dynamical modeling and control of unsteady fluid flows. In NeurIPS, 2018.
Jeremy Morton, Freddie D Witherden, and Mykel J Kochenderfer. Deep variational koopman models: Inferring koopman observations for uncertainty-aware dynamics modeling and control. In IJCAI, 2019.
Damian Mrowca, Chengxu Zhuang, Elias Wang, Nick Haber, Li Fei-Fei, Joshua B Tenenbaum, and Daniel LK Yamins. Flexible neural representation for physics prediction. In NeurIPS, 2018.
Anusha Nagabandi, Ignasi Clavera, Simin Liu, Ronald S Fearing, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Learning to adapt in dynamic, real-world environments through meta-reinforcement learning. In ICLR, 2019a.
Anusha Nagabandi, Chelsea Finn, and Sergey Levine. Deep online learning via meta-learning: Continual adaptation for model-based rl. In ICLR, 2019b.
Razvan Pascanu, Yujia Li, Oriol Vinyals, Nicolas Heess, Lars Buesing, Sebastien Racaniere, David \` Reichert, Theophane Weber, Daan Wierstra, and Peter Battaglia. Learning model-based planning ´ from scratch. arXiv:1707.06170, 2017.
Joshua L Proctor, Steven L Brunton, and J Nathan Kutz. Generalizing koopman theory to allow for inputs and control. SIAM Journal on Applied Dynamical Systems, 17(1):909–930, 2018.
Sebastien Racani ´ ere, Th \` eophane Weber, David Reichert, Lars Buesing, Arthur Guez, Danilo Jimenez ´ Rezende, Adria Puigdom \` enech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, Razvan Pascanu, \` Peter Battaglia, David Silver, and Daan Wierstra. Imagination-augmented agents for deep reinforcement learning. In NeurIPS, 2017.
Clarence W Rowley, Igor Mezic, Shervin Bagheri, Philipp Schlatter, and Dan S Henningson. Spectral ´ analysis of nonlinear flows. Journal of Fluid Mechanics, 641:115–127, 2009.
Alvaro Sanchez-Gonzalez, Nicolas Heess, Jost Tobias Springenberg, Josh Merel, Martin Riedmiller, Raia Hadsell, and Peter Battaglia. Graph networks as learnable physics engines for inference and control. In ICML, 2018.
Peter J Schmid. Dynamic mode decomposition of numerical and experimental data. Journal of Fluid Mechanics, 656:5–28, 2010.
Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In NeurIPS, 2012.
Naoya Takeishi, Yoshinobu Kawahara, and Takehisa Yairi. Learning koopman invariant subspaces for dynamic mode decomposition. In NeurIPS, 2017.
Jonathan H Tu, Clarence W Rowley, Dirk M Luchtenburg, Steven L Brunton, and J Nathan Kutz. On dynamic mode decomposition: Theory and applications. Journal of Computational Dynamics, 1 (2):391–421, 2014.
Matthew O Williams, Ioannis G Kevrekidis, and Clarence W Rowley. A data–driven approximation of the koopman operator: Extending dynamic mode decomposition. Journal of Nonlinear Science, 25(6):1307–1346, 2015.
Matthew O Williams, Maziar S Hemati, Scott TM Dawson, Ioannis G Kevrekidis, and Clarence W Rowley. Extending data-driven koopman analysis to actuated systems. IFAC-PapersOnLine, 49 (18):704–709, 2016.
# A ENVIRONMENT AND MODEL DETAILS
Interaction types. In our experiments, interactions are considered different if the types are different or the objects involved have different physical properties.
In the Rope environment, the top mass has a fixed height and is considered differently from the other masses. Thus, we have 2 types of self-interactions for the top mass and the non-top masses. In addition, we have 8 types of interactions between different objects. The objects on a relation could be either top mass or non-top mass. It is a combination of 4. And the interaction may happen between two nearby masses or masses that are two-hop away. In total, the number of interactions between different objects is $4 \times 2 = 8$ .
In the Soft environments, there are four types of quadrilaterals: rigid, soft, actuated, and fixed. We have four types of self-interactions correspondingly. For the interactions between objects, we add edges between two quadrilaterals only if they are connected by a point or edge. Connection from different directions are considered as different relations. There are 8 different directions, up, down, left, right, up-left, down-left, up-right, down-right. The relation types also encode the type of receiver object. Thus, in total, there are $( 8 + 1 ) \times 4 = 3 6$ types of relations between different objects.
In the Swim environment, there are three types of quadrilaterals: rigid, soft, and actuated. Similar to the Soft environment, we use different edge types for different connecting directions; hence, the number of edge type is $( 8 + 1 ) \times 3 = 2 7$ .
# B ADDITIONAL EXPERIMENTS
Comparison with a classical physical simulator optimized using back-box optimization. We have performed comparisons with a classical physical simulator optimized using black-box optimization (Delingette, 1998) by assuming different levels of knowledge over the ground truth model.
If we assume that we know the ground truth model, where we only need to identify relevant physical parameters during the system identification stage, Bayesian Optimization (Snoek et al., 2012) (BO) can give us a reasonable estimate of the physical parameters. However, BO requires much more time to achieve a comparable performance with our method in the Rope environment: 0.43 vs. 180 seconds averaged over 100 trails (Ours vs. BO).
If we are unsure about the ground truth model and we approximate the system using a set of points linked by springs and dampers, BO does not work as well. In our additional experiments, we approximate the Rope environment using a chained spring-mass system, say $n$ masses and $n - 1$ springs. While taking much more time, BO still cannot give us a satisfying result: simulation error 0.046 vs. 0.084 and control error 0.854 vs. 2.547 (Ours vs. BO).
Ablation study on the effectiveness of the metric loss. The internal linear structure allows us to solve the control problem using quadratic programming, where the objective function for control is defined in the embedding space (Section 3.4); hence, it is desirable to have Koopman embeddings that preserve the distance in the original state space. In Section 3.3, we introduce a metric loss to promote learning a Koopman embedding that keeps the distance measurement.
To demonstrate the effect of the metric loss, we compare the models trained with and without the metric loss. We establish the comparison using two measurements, the distance preservation and the prediction accuracy. To evaluate how well the Koopman embeddings preserve the distance, we compute the distribution of the log-ratio of the distance in the Koopman space and in the original state space, i.e., $\log \left( { \frac { \| { \pmb { g } } ^ { i } - { \pmb { g } } ^ { j } \| _ { 2 } } { \| { \pmb { x } } ^ { i } - { \pmb { x } } ^ { j } \| _ { 2 } } } \right)$ . For the model prediction accuracy, we show the simulation errors.
We perform the experiments in the Rope environment and show the result in Figure 5. On the left, we show the ratio of distance in the learned Koopman space and the distance in the original state space. The model trained with metric loss has a log distance ratio that significantly more concentrates on 0. It means the metric loss effectively regularizes the model to preserve the distance. On the right, we show the simulation errors of the two models, which indicate that two models have comparable prediction performance. Metric loss effectively enhances the property of distance-preserving while not making a big sacrifice on the accuracy of the dynamics modeling.
 Figure 5: Ablation study on the metric loss in the Rope environment. (a) shows the distributions of the logarithm distance ratio, i.e, $\log \left( { \frac { \| { \pmb { g } } ^ { i } - { \pmb { g } } ^ { j } \| _ { 2 } } { \| { \pmb { x } } ^ { i } - { \pmb { x } } ^ { j } \| _ { 2 } } } \right)$ The model trained with metric loss has a distance ratio much more concentrated to 1, which indicates it preserves the distance much better than the counterpart. (b) illustrates the simulation error of two models, where their performance is on par. (c) shows that the model trained using the metric loss performs better control.
 Figure 6: Modeling rope with known physical parameters. We show the comparison between our model and IN/PN in scenarios where we have access to the ground truth physical parameters. In this case, IN and PN slightly outperform our method due to the internal linear structure in our model. However, in the real world, we do not always know the physical parameters and their values, which makes our method preferable when adapting to new environments.
Experiments in a known physical parameter setting. Our setting is different from the settings in the original IN and PN papers that we do not assume we know the physical parameters and their values, such as stiffness, mass, and gravity. Instead, the parameters are embedded in the transition matrices during the system identification stage (Section 3.3). If the model has access to the underlying physical parameters, as expected, IN and PN slightly outperform our method as the internal linear structure limits our model’s expressiveness, as shown in Figure 6. In the real world, however, the underlying physical parameters are not always known, which makes our model a better choice when adapting to unseen environments.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264# EXCITATION DROPOUT: ENCOURAGING PLASTICITYIN DEEP NEURAL NETWORKS
Anonymous authors Paper under double-blind review
# ABSTRACT
We propose a guided dropout regularizer for deep networks based on the evidence of a network prediction: the firing of neurons in specific paths. In this work, we utilize the evidence at each neuron to determine the probability of dropout, rather than dropping out neurons uniformly at random as in standard dropout. In essence, we dropout with higher probability those neurons which contribute more to decision making at training time. This approach penalizes high saliency neurons that are most relevant for model prediction, i.e. those having stronger evidence. By dropping such high-saliency neurons, the network is forced to learn alternative paths in order to maintain loss minimization, resulting in a plasticity-like behavior, a characteristic of human brains too. We demonstrate better generalization ability, an increased utilization of network neurons, and a higher resilience to network compression using several metrics over four image/video recognition benchmarks.
# 1 INTRODUCTION
Dropout [Hinton et al. (2012); Srivastava et al. (2014)] is a classical regularization technique that is used in many state-of-the-art deep neural networks, typically applied to fully-connected layers. Standard Dropout selects a fraction of neurons to randomly drop out by zeroing their forward signal. In this work, we propose a scheme for biasing this selection. Our scheme utilizes the contribution of neurons to the prediction made by the network at a certain training iteration stage.
Dropout can be interpreted as model averaging technique that avoids overfitting on training data, allowing for better generalization on unseen test data. A recent variant of dropout that targets improved generalization ability is Curriculum Dropout [Morerio et al. (2017)]. It targets adjusting the dropout rate by exponentially increasing the unit suppression rate during training, answering the question How many neurons to drop out over time? Like Standard Dropout [Hinton et al. (2012); Srivastava et al. (2014)], Curriculum Dropout selects the neurons to be dropped randomly. In this work, however, we target at determining how the dropped neurons are selected, answering the question Which neurons to drop out?
Our approach is inspired by brain plasticity [Hebb (2005); Song et al. (2000); Mittal et al. (2018); Miconi et al. (2018)]. We deliberately, and temporarily, paralyze/injure neurons to enforce learning alternative paths in a deep network. At training time, neurons that are more relevant to the current prediction are given a higher dropout probability. The relevance of a neuron for making a certain prediction is quantified using Excitation Backprop, a top-down saliency approach proposed by Zhang et al. (2016). Excitation Backprop conveniently yields a probability distribution at each layer that reflects neuron saliency, or neuron contribution to the prediction being made. This is utilized in the pipeline of our approach, named Excitation Dropout, which is summarized in Fig. 1.
In particular, we study how this approach improves generalization through utilizing more network’s neurons for image classification. We report an increased recognition rate for both CNN models that are fine-tuned and trained from scratch. This improvement is validated on four image/video recognition datasets, and ranges from $1 . 1 \% - 6 . 3 \%$ over state-of-the-art Curriculum Dropout.
Next, we examine the effect of our approach on network utilization. Mittal et al. (2018) and Ma et al. (2017) introduce metrics that measure network utilization. We show a consistent increased network utilization using Excitation Dropout on four image/video recognition datasets. For example, averaged over all four benchmarks, we get $7 6 . 5 5 \%$ reduction in conservative filters, filters whose parameters do not change significantly during training, as compared to Standard Dropout.
 Figure 1: Training pipeline of Excitation Dropout. Step 1: A minibatch goes through the standard forward pass. Step 2: Backward EB is performed until the specified dropout layer; this gives a neuron saliency map at the dropout layer in the form of a probability distribution. Step 3: The probability distribution is used to generate a binary mask for each image of the batch based on a Bernoulli distribution determining whether each neuron will be dropped out or not. Step 4: A forward pass is performed from the specified dropout layer to the end of the network, zeroing the activations of the dropped out neurons. Step 5: The standard backward pass is performed to update model weights.
Finally, we study network resilience to neuron dropping at test time. We observe that training with Excitation Dropout leads to models that are a lot more robust when layers are shrunk/compressed by removing units. We demonstrate this when dropping the most relevant neurons, the least relevant neurons, and with a random dropping selection. This can be quite desirable for compressing/distilling [Hinton et al. (2015)] a model, e.g. for deployment on mobile devices.
In summary, by encouraging plasticity-like behavior, our contributions are threefold:
1. Better generalization on test data. 2. Higher utilization of network neurons. 3. Resilience to network compression.
# 2 RELATED WORK
Dropout was first introduced by Hinton et al. (2012) and Srivastava et al. (2014) as a way to prevent neural units from co-adapting too much on the training data by randomly omitting subsets of neurons at each iteration of the training phase.
Some follow-up works have explored different schemes for determining how much dropout is applied to neurons/weights. Wager et al. (2013) described the dropout mechanism in terms of an adaptive regularization, establishing a connection to the AdaGrad algorithm. Inspired by information theoretic principles, Achille & Soatto (2018) propose Information Dropout, a generalization dropout which can be automatically adapted to the data. Kingma et al. (2015) showed that a relationship between dropout and Bayesian inference can be extended when the dropout rates are directly learned from the data. Kang et al. (2017) introduces Shakeout which instead of randomly discarding units as dropout does, it randomly enhances or reverses each units contribution to the next layer. Wan et al. (2013) introduced the DropConnect framework, adding dynamic sparsity on the weights of a deep model. DropConnect generalized Standard Dropout by randomly dropping the weights rather than the neuron activations in the network. Rennie et al. (2014) proposed a time scheduling for the retaining probability for the neurons in the network. The presented adaptive regularization scheme smoothly decreased in time the number of neurons turned off during training.
Recently, Morerio et al. (2017) proposed Curriculum Dropout to adjust the dropout rate in the opposite direction, exponentially increasing unit suppression rate during training, leading to a better generalization on unseen data.
Other works focus on which neurons to drop out. Dropout is usually applied to fully-connected layers of a deep network. Conversely, Wu & Gu (2015) studied the effect of dropout in convolutional and pooling layers. The selection of neurons to drop depends on the layer where they reside. In contrast, we select neurons within a layer based on their contribution. Wang & Manning (2013) demonstrate that sampling neurons from a Gaussian approximation gave an order of magnitude speedup and more stability during training. Li et al. (2016) proposed to use multinomial sampling for dropout, i.e. keeping neurons according to a multinomial distribution with specific probabilities for different neurons. Ba & Frey (2013) jointly trained a binary belief network with a neural network to regularize its hidden units by selectively setting activations to zero accordingly to their magnitude. While this takes into consideration the magnitude of the forward activations, it does not take into consideration the relationship of these activations to the ground-truth. In contrast, we drop neurons based on how they contribute to a network’s decision.
We compare our results against Morerio et al. (2017). To the best of our knowledge, we are the first to probabilistically select neurons to dropout based on their task-relevance.
# 3 METHOD
# 3.1 BACKGROUND
Saliency maps that quantize the importance of class-specific neurons for an input image are instrumental to our proposed scheme. Popular approaches include Class Activation Maps (CAM) [Zhou et al. (2016)], Gradient-weighted Class Activation Mapping (Grad-CAM) [Selvaraju et al. (2017)], and Excitation Backprop (EB) [Zhang et al. (2017)]. A thorough analysis of all saliency methods is out of the scope of this work, and the saliency problem in general is far from solved. We choose to use EB since it produces a valid probability distribution for each network layer. The saliency maps obtained using this approach are evaluated for spatial localization of objects and demonstrate the ability of pointing to the right region of an image [Zhang et al. (2017)].
In a standard CNN, the forward activation of neuron $a _ { j }$ is computed by $\begin{array} { r } { \widehat { a } _ { j } = \phi ( \sum _ { i } w _ { i j } \widehat { a } _ { i } + b _ { i } ) } \end{array}$ , where $\widehat { a } _ { i }$ is the activation coming from the previous layer, $\phi$ b bis a nonlinear activation function, $w _ { i j }$ and $b _ { i }$ bare the weight from neuron $i$ to neuron $j$ and the added bias at layer $i$ , respectively. EB devises a backpropagation formulation able to reconstruct the evidence used by a deep model to make decisions. It computes the probability of each neuron recursively using conditional probabilities $P ( a _ { i } | a _ { j } )$ in a top-down order starting from a probability distribution over the output units, as follows:
$$P ( a _ { i } ) = \sum _ { a _ { j } \in \mathcal { P } _ { i } } P ( a _ { i } | a _ { j } ) P ( a _ { j } )$$
where $\mathcal { P } _ { i }$ is the parent node set of $a _ { i }$ . EB passes top-down signals through excitatory connections having non-negative activations, excluding from the competition inhibitory ones. EB is designed with an assumption of non-negative activations. Most modern CNNs use ReLU activation functions, which satisfy this assumption. Therefore, negative weights can be assumed to not positively contribute to the final prediction. Assuming $C _ { j }$ the child node set of $a _ { j }$ , for each $a _ { i } \in C _ { j }$ , the conditional winning probability $P ( a _ { i } | a _ { j } )$ is defined as
$$P ( a _ { i } | a _ { j } ) = \left\{ \begin{array} { l l } { Z _ { j } \widehat { a } _ { i } w _ { i j } , } & { \mathrm { i f } \ w _ { i j } \geq 0 , } \\ { 0 , } & { \mathrm { o t h e r w i s e } } \end{array} \right.$$
where $Z _ { j }$ is a normalization factor such that $\begin{array} { r } { \sum _ { a _ { i } \in \mathcal { C } _ { j } } P ( a _ { i } | a _ { j } ) = 1 } \end{array}$ . Recursively propagating the top-down signal and preserving the sum of backpropagated probabilities, it is possible to highlight the salient neurons in each layer using Eqn. 1, i.e. neurons that mostly contribute to a specific task. We will refer to the distribution of $P ( a _ { i } )$ as $p _ { E B } ( a _ { i } )$ .
 Figure 2: The retaining probability, $p$ , as a function of the Excitation Backprop probability $p _ { E B }$ . This plot was created using $N = 1 0$ and a base retaining probability $P = 0 . 5$ . In this case, when the saliency of neurons is uniform, i.e. $p _ { E B } = 0 . 1$ , then $p = P$ as marked in the figure.
# 3.2 EXCITATION DROPOUT
In the standard formulation of dropout [Hinton et al. (2012); Srivastava et al. (2014)], the suppression of a neuron in a given layer is modeled by a Bernoulli random variable $0 < p \leq 1$ where $p$ is defined as the probability of retaining a neuron. Given a specific layer where dropout is applied, during the training phase, each neuron is turned off with a probability $1 - p$ .
We argue for a different approach that is guided in the way it selects neurons to be dropped. In a training iteration, certain paths have high excitation contributing to the resulting classification, while other regions of the network have low response. We encourage learning alternative paths (plasticity) through the temporary damaging of the currently highly excited path. We re-define the probability of retaining a neuron as a function of its contribution in the currently highly excited path
$$p = 1 - \frac { ( 1 - P ) * ( N - 1 ) * p _ { E B } } { ( ( 1 - P ) * N - 1 ) * p _ { E B } + P }$$
where $p _ { E B }$ is the probability backpropagated through the EB formulation (Eqn. 1) in layer $l$ , $P$ is the base probability of retaining a neuron when all neurons are equally contributing to the prediction and $N$ is the number of neurons in a fully-connected layer $l$ or the number of filters in a convolutional layer $l$ . The retaining probability defined in Eqn. 3 drops neurons which contribute the most to the recognition of a specific class, with higher probability. Dropping out highly relevant neurons, we retain less relevant ones and thus encourage them to awaken. We also study how this compares to dropping the least relevant neurons (Adaptive Dropout by Ba & Frey (2013)) in the Appendix.
Fig. 2 shows $p$ as a function of $p _ { E B }$ . To gain some intuition for Eqn. 3, we can look more closely at the graph: 1) If neuron $a _ { i }$ has $p _ { E B } ( a _ { i } ) = 1$ : This results in a retaining probability of $p = 0$ . We do not want to keep a neuron which has a high contribution to the correct label. 2) If neuron $a _ { i }$ has $p _ { E B } ( a _ { i } ) = 0$ : This results in a retaining probability of $p = 1$ . We want to keep a neuron which has not contributed to the correct classification of an image. 3) If neuron $a _ { i }$ has $\dot { p } _ { E B } ( a _ { i } ) = 1 / N$ , i.e. $p _ { E B }$ is a uniform probability distribution: This results in a retaining probability $p = P$ . We want to keep a neuron with base probability $P$ since all neurons contribute equally.
Eqn. 3 provides a dropout probability for each neuron, which is then used as the parameter of a Bernoulli distribution giving a binary dropout mask. During training, each image in a batch leads to different excitatory connections in the network and therefore has a different $p _ { E B }$ distribution, consequently leading to a different dropout mask. Fig. 1 presents the pipeline of Excitation Dropout at training time, and a run-time analysis is presented in the Appendix.
# 4 EXPERIMENTS
In this section, we present how Excitation Dropout improves the generalization ability on four image/video recognition datasets in fully connected layers of different architectures. We then present an analysis of how Excitation Dropout affects the utilization of network neurons on the same datasets. Finally, we examine the resilience of a model trained using Excitation Dropout to network compression.
 Figure 3: We compare the test accuracy of different dropout training strategies on four image/video recognition datasets: Cifar10, Cifar100, Caltech256, UCF101. Results presented here are averaged over five trained models and the standard deviation is depicted around the mean curve using a lighter shade. Excitation Dropout performs best after convergence compared to the other strategies.
# 4.1 DATASETS AND ARCHITECTURES
We present results on four image/video recognition datasets. Cifar10 and Cifar100 [Krizhevsky (2009)] are image recognition datasets, each consisting of $6 0 0 0 0 3 2 \times 3 2$ tiny RGB natural images. Cifar10 images are distributed over 10 classes with 6000 images per class, and Cifar100 images are distributed over 100 classes with 600 images per class. Training and test splits contain $5 0 K$ and $1 0 K$ images, respectively. We feed the network with the original image dimensions. Caltech256 [Griffin et al. (2007)] is an image recognition dataset consisting 31000 RGB images divided in 256 classes. We consider five different random splits of 50 train images and 20 testing images for each class. Images were reshaped to $1 2 8 \times 1 2 8$ pixel to feed the network. UCF101 [Soomro et al. (2012)] is a video action recognition dataset based on 13320 actions belonging to 101 action classes. For this dataset we consider a frame-based action recognition task. The images are resized to $2 2 4 \times 2 2 4$ and $2 2 7 \times 2 2 7$ to fit the input layers of the VGG and AlexNet architectures, respectively.
We present results on four architectures. Relatively shallow architectures are trained from scratch, and deeper popular architectures are fine-tuned after being pre-trained on ImageNet [Deng et al. (2009)]. Models trained from scratch: We train the CNN-2 architecture used in Morerio et al. (2017), the state-of-the-art dropout variant, for comparison purposes. This architecture consists of three convolutional and two fully-connected layers (see Appendix). We train this network from scratch for $1 0 0 K$ iterations on the datasets: Cifar-10, Cifar-100 and Caltech-256. We use minibatches of 100 images and fix the learning rate to be $1 0 ^ { - 3 }$ , decreasing to $1 0 ^ { - 4 }$ after $2 5 K$ iterations.
Fine-tuned models: We fine-tune the commonly used architectures: AlexNet [Krizhevsky et al. (2012)], VGG16 and VGG19 [Simonyan & Zisserman (2014)] pre-trained on ImageNet. We finetune the models for a frame by frame action recognition task on UCF101. The learning rate is fixed to $1 0 ^ { - 3 }$ for all the processes. We fine-tune AlexNet for $5 K$ while VGG16 and VGG19 for $3 0 K$ iterations. We use a batch size of 128 and 50 images for AlexNet and VGG16/19, respectively.
<table><tr><td>Architecture</td><td>No Dropout (%)</td><td>Standard Dropout (%)</td><td>Curriculum Dropout (%)</td><td>Excitation Dropout (%)</td></tr><tr><td>VGG16</td><td>69.37</td><td>71.93 (+2.56%)</td><td>72.14 (+2.77%)</td><td>73.23 (+3.86%)</td></tr><tr><td>VGG19</td><td>71.32</td><td>72.52 (+1.29%)</td><td>73.18 (+1.86%)</td><td>74.34 (+3.02%)</td></tr><tr><td>AlexNet</td><td>62.89</td><td>64.50 (+1.61%)</td><td>64.55 (+1.66%)</td><td>67.56 (+4.67%)</td></tr></table>
Table 1: Test accuracy comparison between No, Standard, Curriculum and Excitation Dropout in the $f c 6$ layer of three architectures: AlexNet, VGG16 and VGG19, fine-tuned for the action recognition task on UCF101. The numbers reported are the final test accuracies together with the improvements (in parenthesis) with respect to No Dropout, averaged over five trained models.
Table 2: Different metrics to reflect the usage of network capacity in the first fully-connected layer of the CNN-2 architecture consisting of 2048 neurons and the VGG16 consisting of 4096 neurons. Results presented here are averaged over five trained models for each of the datasets: Cifar10, Cifar100, Caltech256 and UCF101 $\sigma$ in brackets). Excitation Dropout consistently produces more neurons with non-zero activations, has a more spread saliency map leading to a lower saliency peak, has a higher entropy of both activations and saliency, and has a lower number of conservative filters; all reflecting an improved utilization of the network neurons using Excitation Dropout.
<table><tr><td>Dataset</td><td>Metric</td><td>Standard Dropout</td><td>Curriculum Dropout</td><td>Excitation Dropout</td></tr><tr><td rowspan="4">Cripfi</td><td># Neurons ON Peak pEB</td><td>1194 (±153) 0.011 (±0.004)</td><td>1169 (±61) 0.009 (±0.001)</td><td>1325 (±61) 0.003 (±0.0002)</td></tr><tr><td>Entropy of Activations</td><td>3.55 (±0.72)</td><td>3.50 (±0.12)</td><td></td></tr><tr><td>Entropy of pEB</td><td></td><td></td><td>4.29 (±0.28)</td></tr><tr><td>Conservative Filters△=0.25</td><td>3.28 (±0.56) 1204 (±37)</td><td>3.32 (±0.13) 959 (±34)</td><td>4.26 (±0.26) 124(±22)</td></tr><tr><td rowspan="4">cormfi</td><td># Neurons ON Peak pEB</td><td>453 (±183) 0.011 (±0.0004)</td><td>460 (±75) 0.012 (±0.0004)</td><td>943 (±131) 0.005 (±0.0005)</td></tr><tr><td>Entropy of Activations</td><td>1.67 (±0.31)</td><td>1.70 (±0.29)</td><td>3.21 (±0.44)</td></tr><tr><td>Entropy of pEB</td><td>1.64 (±0.27)</td><td>1.67 (±0.26)</td><td>3.17 (±0.41)</td></tr><tr><td>Conservative Filters△=0.30</td><td>2048 (±51)</td><td>2038 (±44)</td><td>14 (±13)</td></tr><tr><td rowspan="5">Ceresst5</td><td># Neurons ON Peak pEB</td><td>412 (±126) 0.014 (±0.0007)</td><td>471 (±146)</td><td>702 (±171)</td></tr><tr><td></td><td></td><td>0.013 (±0.0006)</td><td>0.007 (±0.0003)</td></tr><tr><td>Entropy of Activations</td><td>1.63 (±0.32)</td><td>1.84 (±0.35)</td><td>2.63 (±0.23)</td></tr><tr><td>Entropy of pEB</td><td>1.58 (±0.29)</td><td>1.77 (±0.31)</td><td>2.59 (±0.22)</td></tr><tr><td>Conservative Filters△=1.25</td><td>2048 (±46)</td><td>2048 (±49)</td><td>1671 (±31)</td></tr><tr><td rowspan="5">IUIIIN</td><td># Neurons ON Peak pEB</td><td>1120 (±25)</td><td>1143 (±22)</td><td>1404 (±37)</td></tr><tr><td></td><td>0.007 (±0.0002)</td><td>0.007 (±0.0002)</td><td>0.004 (±0.0002)</td></tr><tr><td>Entropy of Activations</td><td>2.04 (±0.23)</td><td>2.08 (±0.21)</td><td>2.51 (±0.18)</td></tr><tr><td>Entropy of pEB</td><td>1.92 (±0.22)</td><td>1.95 (±0.20)</td><td>2.42 (±0.18)</td></tr><tr><td>Conservative Filters△=0.15</td><td>3599 (±66)</td><td>3859 (±53)</td><td>44(±36)</td></tr></table>
# 4.2 SETUP AND RESULTS: GENERALIZATION
In this section we compare the performance of Excitation Dropout to that of No Dropout, Standard Dropout, and Curriculum Dropout [Morerio et al. (2017)]. We train a CNN-2 model from scratch on the datasets: Cifar10, Cifar100, Caltech256. Fig. 3 depicts the test accuracies over training iterations for the three datasets averaged over five trained models. After convergence, Excitation Dropout demonstrates a significant improvement in performance compared to other methods. We hypothesize that Excitation Dropout takes longer to converge due to the additional loop (Steps 2-4 in Fig. 1) introduced in the learning process, and due to the learning of the alternative paths. We note that Excitation Dropout, during training, uses a different binary mask for each image in a minibatch, while in Standard Dropout, one random mask is employed per minibatch. To prove that it is precisely the fact that masks reflective of the particular input give rise to a boost in accuracy, and not the fact that different masks are used for different images, we add a comparison with Standard Dropout having a different random mask for each image. We refer to this accuracy as ‘Standard Dropout $^ +$ Mask/Img’ in the plots. As expected, the latter approach is comparable to Standard Dropout in performance.
 Figure 4: Visualizations for a VGG16 network fine-tuned on UCF101. The middle columns display the saliency map over the same video frame of the action HorseRiding while incrementally switching off the most $k$ relevant/salient neurons $( k = 0 , 1 0 0 , 2 0 0 , \ldots , 5 0 0 )$ in the $f c 6$ layer at test time. Excitation Dropout shows more robustness when more neurons are switched off. This is demonstrated through its ability to recover more of the saliency map even when a high percentage of the most salient neurons is dropped-out. This ability reflects the alternative learnt paths. Histograms of the leftmost and rightmost saliency maps are presented to demonstrate that Excitation Dropout has a wider range of saliency values.
Next, we evaluate the effectiveness of Excitation Dropout on popular network architectures that employ dropout layers: AlexNet, VGG16, VGG19. This is done by fine-tuning on the video recognition dataset UCF101. Fig. 3 shows superior Excitation Dropout performance on AlexNet fine-tuned on UCF101. Table 1 presents more comparative results on other deep architectures by reporting the accuracy after convergence. Again, Excitation Dropout demonstrates higher generalizability on the test data for all architectures.
For fair comparison, we set $p = 0 . 5$ for Standard Dropout and $P = 0 . 5$ for the base retaining probability of Excitation Dropout in all experiments1. We perform dropout in the first fully-connected layer of the networks (fc1 for CNN-2 and $f c 6$ for AlexNet and VGGs) for Standard, Curriculum, and Excitation Dropout. For Curriculum Dropout we fix the parameter $\gamma$ to $5 * 1 0 ^ { - 4 }$ as in Morerio et al. (2017).
# 4.3 SETUP AND RESULTS: UTILIZATION OF NETWORK NEURONS
In this section we examine how Excitation Dropout expands the network’s utilization of neurons through the learnt alternative paths for a certain task.
Mittal et al. (2018) introduced scoring functions to rank the filters in specific network layers including the average percentage of zero activations, a metric to count how many neurons have zero activations, and the entropy of activations, a metric to measure how much information is contained in the neurons of a layer. We analogously compute the Neurons ON which is the average number of non-zero activations, the entropy of $p _ { E B }$ which is higher when the probability distribution is spread out over more neurons in a layer. We also compute the peak $p _ { E B }$ which is expected to be lower on a more spread distribution. Moreover, Ma et al. (2017) introduced conservative filters: filters whose parameters do not change significantly during training. Conservative filters reduce the effective number of parameters in a CNN and may limit the CNNs modeling capacity for the target task.
 Figure 5: Robustness of predicted ground-truth class probabilities as more neurons are droppedout for UCF101 test images. We fine-tune VGG16 with Excitation, Curriculum, Standard, and No Dropout at the $f c 6$ layer, averaging results over five trained models. The standard deviation is depicted around the mean curve using a lighter shade. At test time, we switch off starting from the most relevant neurons with respect to $p _ { c }$ (left), from the least relevant neurons with respect to $p _ { c }$ (center), and $k$ random neurons (right). In all scenarios, Excitation Dropout shows more robustness to network compression (dropping $f c$ neurons $\equiv$ removing filters).
A conservative filter is a filter $k$ in layer $n$ whose weights have changed by $\Delta _ { n } ^ { k } = \| \hat { w } _ { n } ^ { k } - w _ { n } ^ { k } \|$ , where $\Delta _ { n } ^ { k }$ is less than a threshold $\Delta$ (empirically set).
We evaluate the presented metrics for Excitation Dropout and compare against Standard and Curriculum Dropout in Table 2. This is done on the same datasets and architectures considered in Sec. 4.2. All metrics are computed for the first fully-connected layer of the CNN-2 and VGG16 nets consisting of 2048 and 4096 neurons, respectively. We compute each metric over the test set of each dataset. Excitation Dropout consistently outperforms Standard and Curriculum Dropout in all the metrics over all datasets. Excitation Dropout shows a higher number of active neurons, a higher entropy over activations, a probability distribution $p _ { E B }$ that is more spread (higher entropy over $p _ { E B } )$ among the neurons of the layer, leading to a lower peak probability of $p _ { E B }$ and therefore less specialized neurons. Averaging models having less specialized neurons results in higher robustness to information loss. We also observe a significantly smaller number of conservative filters when using Excitation Dropout. Fewer filters remain unchanged, i.e. do not sufficiently learn anything far from the random initialization. These results show that the models trained with Excitation Dropout were trained to be more informative, i.e. the contribution for the final classification task is provided by a higher number of neurons in the network, reflecting the alternative learnt paths. An analysis of such metrics over the training iterations is presented in the Appendix.
# 4.4 SETUP AND RESULTS: RESILIENCE TO COMPRESSION
In this section, we simulate ‘Brain Damage’ by dropping out neurons at test time. Fig. 4 demonstrates how a network utilizes the learnt alternative paths to capture the evidence of the class HorseRiding in a video frame of the UCF101 dataset. Given a VGG16 model fine-tuned with Excitation, Curriculum, Standard, and No Dropout at the $f c 6$ layer, we show the excitation saliency map obtained at the conv5-1 layer as we drop out a fixed number of the most relevant neurons from the same layer dropout is performed upon during training. A neuron is considered to be more relevant if it has a higher $p _ { E B }$ . In the first column of frames of Fig. 4, the original saliency maps for the different models are shown. As already highlighted in Table 2, the original saliency map obtained from the model trained with Excitation Dropout is more spread as compared to that of the other schemes, which present more pronounced red peaks. In the following columns of Fig. 4, we present the saliency maps the model is able to restore when the 100, 200, 300, 400, 500 most relevant neurons are dropped-out. Despite the increasing number of relevant neurons being dropped-out, Excitation Dropout is capable of restoring more of the saliency map contributing to HorseRiding. This means that the network with Excitation Dropout was trained to find alternative paths which belong to the same HorseRiding-relevant cues of the image. Despite the fact that we are considering the worst-case scenario, where we are switching off the most relevant neurons at test time, Excitation Dropout shows most robustness. More examples are presented in the Appendix.
While Fig. 4 visualizes one example qualitatively, Fig. 5 presents a complete quantitative analysis on the entire test set after training is complete. We study how the predicted ground-truth (GT) probability changes as more neurons are dropped-out at test time. On the left we present the worst case when the neurons dropped are the most relevant to the prediction. The horizontal axis in the graph represents $p _ { c }$ , where $0 \leq p _ { c } \leq 1$ is the cumulative sum of $p _ { E B }$ of neurons which will be switched off starting from the most ‘important’. The analysis is performed for $p _ { c } = \{ 0 , 0 . 0 5 , \hdots , 0 . 9 0 , 0 . 9 5 \}$ . In the center, we present an analogous analysis starting to drop from the ‘least’ relevant neurons. On the right, we present the random case (more realistic) when $k$ neurons $( k = 0 , 1 2 8 , 2 5 6 , \ldots , 4 0 9 6 )$ are randomly switched off. As we drop more neurons, Excitation Dropout (purple curves) is capable of maintaining a much less steep decline of GT probability, indicating more robustness against network compression. Cifar10, Cifar100, and Caltech256 show similar behavior (see analogous plots in the Appendix).
# 5 CONCLUSION
We propose a new regularization scheme that encourages the learning of alternative paths in a neural network by deliberately paralyzing high-saliency neurons that contribute more to a network’s prediction during training. In experiments on four image/video recognition datasets, and on different architectures, we demonstrate that our approach yields better generalization on unseen data, higher utilization of network neurons, and higher resilience to network compression.
# REFERENCES
Alessandro Achille and Stefano Soatto. Information dropout: Learning optimal representations through noisy computation. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 2018.
Jimmy Ba and Brendan Frey. Adaptive dropout for training deep neural networks. In Advances in Neural Information Processing Systems (NIPS), 2013.
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proc. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2009.
G. Griffin, A. Holub, and P. Perona. Caltech-256 object category dataset. Technical Report 7694, California Institute of Technology, 2007. URL http://authors.library.caltech. edu/7694.
Donald Olding Hebb. The organization of behavior: A neuropsychological theory. Psychology Press, 2005.
Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2015.
Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. CoRR, abs/1207.0580, 2012.
Guoliang Kang, Jun Li, and Dacheng Tao. Shakeout: A new approach to regularized deep neural network training. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 2017.
Diederik P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems (NIPS), 2015.
Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems (NIPS), pp. 1097–1105, 2012.
Zhe Li, Boqing Gong, and Tianbao Yang. Improved dropout for shallow and deep learning. In Advances in Neural Information Processing Systems (NIPS), 2016.
Shugao Ma, Sarah Adel Bargal, Jianming Zhang, Leonid Sigal, and Stan Sclaroff. Do less and achieve more: Training CNNs for action recognition utilizing action images from the web. Pattern Recognition, 2017.
Thomas Miconi, Jeff Clune, and Kenneth O Stanley. Differentiable plasticity: training plastic neural networks with backpropagation. arXiv preprint arXiv:1804.02464, 2018.
Deepak Mittal, Shweta Bhardwaj, Mitesh M Khapra, and Balaraman Ravindran. Recovering from random pruning: On the plasticity of deep convolutional neural networks. Winter Conference on Applications of Computer Vision, 2018.
Pietro Morerio, Jacopo Cavazza, Riccardo Volpi, Rene Vidal, and Vittorio Murino. Curriculum dropout. In Proc. IEEE International Conference on Computer Vision (ICCV), 2017.
Steven J Rennie, Vaibhava Goel, and Samuel Thomas. Annealed dropout training of deep networks. In Spoken Language Technology Workshop (SLT), 2014 IEEE, pp. 159–164. IEEE, 2014.
Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proc. IEEE International Conference on Computer Vision (ICCV), 2017.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Sen Song, Kenneth D Miller, and Larry F Abbott. Competitive hebbian learning through spiketiming-dependent synaptic plasticity. Nature neuroscience, 3(9):919, 2000.
Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. UCF101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research (JMLR), 15(1):1929–1958, 2014.
Stefan Wager, Sida Wang, and Percy S Liang. Dropout training as adaptive regularization. In Advances in Neural Information Processing Systems (NIPS), 2013.
Li Wan, Matthew Zeiler, Sixin Zhang, Yann Le Cun, and Rob Fergus. Regularization of neural networks using dropconnect. In Proc. International Conference on Machine Learning (ICML), 2013.
Sida Wang and Christopher Manning. Fast dropout training. In Proc. International Conference on Machine Learning (ICML), pp. 118–126, 2013.
Haibing Wu and Xiaodong Gu. Towards dropout training for convolutional neural networks. Neural Networks, 71:1–10, 2015.
Jianming Zhang, Zhe Lin, Jonathan Brandt, Xiaohui Shen, and Stan Sclaroff. Top-down neural attention by excitation backprop. In Proc. European Conference on Computer Vision (ECCV), 2016.
Jianming Zhang, Sarah Adel Bargal, Zhe Lin, Jonathan Brandt, Xiaohui Shen, and Stan Sclaroff. Top-down neural attention by excitation backprop. International Journal of Computer Vision (IJCV), pp. 1–19, 2017.
Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proc. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
# APPENDIX
CNN-2 architecture. Table 3 shows the details of the CNN-2 architecture adopted for Cifar10, Cifar100, and Caltech256 experiments. The size of the softmax layer depends upon the number of classes for each dataset.
Table 3: Details of the CNN-2 architecture used for experiments on the Cifar10, Cifar100, and Caltech-256 datasets.
<table><tr><td>Layer Type</td><td>Layer Size</td><td>Filter Size</td><td>Padding/Stride</td></tr><tr><td>conv</td><td>96 filters</td><td>5x5</td><td>2/1</td></tr><tr><td>max pool</td><td></td><td>3x3</td><td>0/2</td></tr><tr><td>conv</td><td>128 filters</td><td>5x5</td><td>2/1</td></tr><tr><td>max pool</td><td></td><td>3x3</td><td>0/2</td></tr><tr><td>conv</td><td>256 filters</td><td>5x5</td><td>2/1</td></tr><tr><td>max pool</td><td></td><td>3x3</td><td>0/2</td></tr><tr><td>fc</td><td>2048 units</td><td></td><td></td></tr><tr><td>fc</td><td>2048 units</td><td></td><td></td></tr><tr><td>softmax</td><td>#classes</td><td></td><td></td></tr></table>
Least vs. most relevant neurons. Popular dropout methods (e.g. Adaptive Dropout Ba & Frey (2013)) drop useless neurons with low activations during training. In this work we motivate and demonstrate that dropping neurons based on their Excitation Backprop (EB) probability has added benefits. Please note that we are not simply considering neuron activation. We demonstrate the performance of Excitation Dropout compared to the variant Adaptive Dropout [Ba & Frey (2013)] in Table 4. In essence, Adaptive and Excitation Dropout are opposites by dropping the least and most important neurons, respectively.
<table><tr><td>Dataset</td><td>Adaptive Dropout</td><td>Excitation Dropout</td></tr><tr><td>Cifar10</td><td>76.82%</td><td>81.94%</td></tr><tr><td>Cifar100</td><td>44.55%</td><td>52.04%</td></tr><tr><td>Caltech256</td><td>23.32%</td><td>35.77%</td></tr><tr><td>UCF101</td><td>71.76%</td><td>73.23%</td></tr></table>
Table 4: Accuracy comparison between Adaptive Dropout and Excitation Dropout. The numbers reported in this table are the average test set accuracy over five trained models for each dataset.
Model complexity. Excitation Dropout consistently outperforms Standard Dropout (SD), with zero increase in test-time computational complexity. In training, there is a moderate increase in computation: in the worst case, Excitation Dropout will take double (same O-notation complexity) the training time of SD. This will happen when the utilized Excitation Dropout maps are at the first layer of the network. If a middle layer map is used, Excitation Dropout requires an additional partial forward-backward pass. We use maps of fc layers close to the end of the network to reduce this overhead. Table 5 presents a run-time analysis for the two main architectures used in this work and compares it to that of Standard Dropout.
Table 5: Run-time comparison: Average time of 100 iterations (in seconds, batch size $\scriptstyle = 5 0$ ) for a Caffe python layer on a GTX Titan X GPU and Intel(R) Xeon(R) CPU E5-2650 v3 ${ \textcircled { a } } ~ 2 . 3 0 \mathrm { G H z }$ . In parenthesis is the percentage increase with respect to SD.
<table><tr><td></td><td>Standard Dropout</td><td>Excitation Dropout</td></tr><tr><td rowspan="2">CNN-2 (1 iter) Run-time VGG16 (1 iter)</td><td>0.1532 ± 0.0064</td><td>0.1885 ± 0.0070 (+23%)</td></tr><tr><td>2.2928 士 0.0297</td><td>2.8202 ± 0.0312 (+23%)</td></tr></table>
Sensitivity analysis. In this section we present a sensitivity analysis over the dropout rate hyperparameter. In our work, we implement Excitation Dropout with a base retaining probability $P$ , and we compare that to standard dropout with a retaining probability $p$ , where $P = p$ . If Excitation
Dropout produced a uniform probability distribution over the desired layer, then every node would have a retain probability equal to the base probability $P$ . For completeness, we add a sensitivity analysis of the parameters $p$ and $P$ in Table 6.
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Dropout Scheme</td><td rowspan=1 colspan=1>0.25Dropout</td><td rowspan=1 colspan=1>0.5Dropout</td><td rowspan=1 colspan=1>0.75Dropout</td></tr><tr><td rowspan=1 colspan=1>Cifar10</td><td rowspan=1 colspan=1>StandardExcitation</td><td rowspan=1 colspan=1>79.16%81.38%</td><td rowspan=1 colspan=1>80.13%81.94%</td><td rowspan=1 colspan=1>81.19%81.55%</td></tr><tr><td rowspan=1 colspan=1>Cifar100</td><td rowspan=1 colspan=1>StandardExcitation</td><td rowspan=1 colspan=1>48.44%53.23%</td><td rowspan=1 colspan=1>50.36%52.04%</td><td rowspan=1 colspan=1>51.64%51.87%</td></tr><tr><td rowspan=1 colspan=1>Caltech256</td><td rowspan=1 colspan=1>StandardExcitation</td><td rowspan=1 colspan=1>26.23%33.60%</td><td rowspan=1 colspan=1>28.73%35.77%</td><td rowspan=1 colspan=1>32.51%36.81%</td></tr><tr><td rowspan=1 colspan=1>UCF101</td><td rowspan=1 colspan=1>StandardExcitation</td><td rowspan=1 colspan=1>71.01%73.56%</td><td rowspan=1 colspan=1>71.93%73.23%</td><td rowspan=1 colspan=1>72.92%73.06%</td></tr></table>
Table 6: Hyper-parameter sensitivity analysis for the Standard Dropout probability, and the Excitation Dropout base dropout probability. The accuracy is reported on the test set of each dataset. The retaining probability $p$ or $P$ is one minus the dropout rate.
Excitation Dropout in Convolutional Layers. Excitation Dropout is a generic formulation that can be applied to any neural network layer. For a convolutional layer, a generic convolutional activation map is in the form of $[ w , h , N ]$ , where $N$ is the number of feature maps while $w$ and $h$ are the spatial dimensions. To apply Excitation Dropout to a convolutional layer, first $p _ { E B }$ is computed for each feature map $N$ as the sum of $p _ { E B }$ across spatial locations $w$ and $h$ . Specific 2D feature maps are then dropped-out following Eqn. 3. We test Excitation Dropout at conv3 of the CNN-2 architecture and obtain the following accuracy results for Cifar10: No Dropout $7 6 . 9 1 \%$ ; Excitation Dropout at conv3 $7 8 . 0 1 \%$ ; Excitation Dropout at $f c 1 8 1 . 9 4 \%$ . Again, we observe an improvement respect to No Dropout, but consistent with the literature [Hinton et al. (2012); Srivastava et al. (2014)], the improvement is not as large as using dropout in fully connected layers.
Validation on Multiple Architectures. In this section we report additional results for Caltech256 and Cifar10 datasets considering different architectures. Table 7 reports the results of fine-tuning the deep architectures AlexNet, VGG16 and VGG19 on Caltech256 for the task of image classification. Finally, we adopt the WideResNet (WRN-28-10) architecture, a ResNet style architecture which combines batch normalization and dropout regularization techniques. WideResNet is used to obtain state-of-the-art results on Cifar10. We replace the Standard Dropout layer in the network with Excitation Dropout obtaining $3 . 8 8 \%$ test error on Cifar10 (vs. $4 . 1 7 \%$ Zagoruyko et al.s published result, BMVC16). Therefore, Excitation Dropout gives state-of-the-art result on Cifar10.
<table><tr><td>Architecture</td><td>No Dropout (%)</td><td>Standard Dropout (%)</td><td>Curriculum Dropout (%)</td><td>Excitation Dropout (%)</td></tr><tr><td>VGG16</td><td>77.97</td><td>79.11 (+1.14%)</td><td>79.31 (+1.34%)</td><td>79.92 (+1.95%)</td></tr><tr><td>VGG19</td><td>77.98</td><td>79.46 (+1.48%)</td><td>79.66 (+1.68%)</td><td>80.65 (+2.67%)</td></tr><tr><td>AlexNet</td><td>66.48</td><td>68.10 (+1.62%)</td><td>68.71 (+2.23%)</td><td>69.66 (+3.18%)</td></tr></table>
Table 7: Test accuracy comparison between No, Standard, Curriculum, and Excitation Dropout in the $f c 6$ layer of three architectures: AlexNet, VGG16 and VGG19, fine-tuned for the image recognition task on Caltech256. The numbers reported are the final test accuracies together with the improvements (in parenthesis) with respect to No Dropout, averaged over five trained models.
Additional Visualizations. In this section, we present more visualizations similar to that of Fig. 4 in the main manuscript. Visualizations for a VGG16 network fine-tuned on UCF101 for the actions: PlayingFlute, PlayingSitar, and GolfSwing are presented in Fig.s 6,7,8, respectively. Every column displays the saliency map over the same video frame of an action while incrementally switching off the most $k$ relevant neurons $( k = 0 , 1 0 0 , 2 0 0 , \ldots , 5 0 0 )$ . Excitation Dropout is more robust over higher number of switched off neurons. This is demonstrated through its ability to recover the saliency map even when a high percentage of the most salient neurons is dropped-out. This is done through the alternative learnt paths, which are reflected in the higher number of non-zero activations that remain after dropout compared to other dropout strategies.
 Figure 6: Despite the increasing number of relevant neurons being dropped out at test time, Excitation Dropout is capable of restoring more of the saliency map contributing to the specific class: PlayingFlute
Additional Plots. In this section we present the $f c$ compression results for three additional datasets: Cifar10, Cifar100, and Caltech256 (Fig. 9), using CNN-2. We study how the predicted ground-truth (GT) probability changes as more neurons are dropped-out at test time. On the left we present the worst case when the neurons dropped are the most relevant to the prediction. The horizontal axis in the graph represents $p _ { c }$ , where $0 ~ \leq ~ p _ { c } ~ \leq ~ 1$ is the cumulative sum of $p _ { E B }$ of neurons which will be switched off starting from the most ‘important’. The analysis is performed for $\mathit { p _ { c } } =$ $\{ 0 , 0 . 0 5 , \hdots , 0 . 9 0 , 0 . 9 5 \}$ . In the center, we present an analogous analysis starting to drop from the ‘least’ relevant neurons. On the right, we present the random case (more realistic) when $k$ neurons $( k \ : = \ : 0 , 1 2 8 , 2 5 6 , \ldots , 2 0 4 8 )$ are randomly switched off. As we drop more neurons, Excitation Dropout (purple curves) is capable of maintaining a much less steep decline of GT probability.
Metric Analysis During Training. In this section we report an extended analysis of the metrics: # Neurons ON, Peak $p _ { E B }$ , Entropy of Activations, and Entropy of $p _ { E B }$ during training. Excitation Dropout shows a higher number of active neurons, a higher entropy over activations, a probability distribution $p _ { E B }$ that is more spread (higher entropy over $p _ { E B } .$ ) among the neurons of the layer, leading to a lower peak probability of $p _ { E B }$ and therefore less specialized neurons. These results are observed to have consistent trends over all training iterations for all datasets considered (see Fig.s 10, 11, 12, and 13)
 Figure 7: Despite the increasing number of relevant neurons being dropped out at test time, Excitation Dropout is capable of restoring more of the saliency map contributing to the specific class: PlayingSitar
 Figure 8: Despite the increasing number of relevant neurons being dropped out at test time, Excitation Dropout is capable of restoring more of the saliency map contributing to the specific class: GolfSwing
 Figure 9: Robustness of predicted ground-truth class probabilities as more neurons are dropped out for each dataset’s test images. We train CNN-2 from scratch with Excitation, Curriculum, Standard, and No Dropout at the $f c 1$ layer, averaging results over five trained models. The standard deviation is depicted around the mean curve using a lighter shade. Left: the most relevant neurons with respect to the $p _ { c }$ threshold are switched off. Center: the least relevant neurons with respect to the $p _ { c }$ threshold are switched off. Right: $k$ neurons are randomly switched off. In all scenarios, Excitation Dropout shows more robustness to network compression (dropping $f c$ neurons $\equiv$ removing filters).
 Figure 10: Cifar10. # Neurons ON, Peak $p _ { E B }$ , Entropy of Activations, and Entropy of $p _ { E B }$ over time during training.
 Figure 11: Cifar100. # Neurons ON, Peak $p _ { E B }$ , Entropy of Activations, and Entropy of $p _ { E B }$ over time during training.
 Figure 12: Caltech256. # Neurons ON, Peak $p _ { E B }$ , Entropy of Activations, and Entropy of ${ p } _ { E B }$ over time during training.
 Figure 13: UCF101. # Neurons ON, Peak $p _ { E B }$ , Entropy of Activations, and Entropy of $p _ { E B }$ over time during training.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385# USING HINDSIGHT TO ANCHOR PAST KNOWLEDGE INCONTINUAL LEARNING
Anonymous authors Paper under double-blind review
# ABSTRACT
In continual learning, the learner faces a stream of data whose distribution changes over time. Modern neural networks are known to suffer under this setting, as they quickly forget previously acquired knowledge. To address such catastrophic forgetting, many continual learning methods implement different types of experience replay, re-learning on past data stored in a small buffer known as episodic memory. In this work, we complement experience replay with a meta-learning technique that we call “anchoring”: the learner updates its knowledge on the current task, while keeping predictions on some anchor points of past tasks intact. These anchor points are learned using gradient-based optimization as to maximize forgetting of the current task, in hindsight, when the learner is fine-tuned on the episodic memory of past tasks. Experiments on several supervised learning benchmarks for continual learning demonstrate that our approach improves the standard experience replay in terms of both accuracy and forgetting metrics and for various sizes of episodic memories.
# 1 INTRODUCTION
This manuscript studies the problem of continual learning, where a machine learning model experiences a sequence of tasks. Each of these tasks is presented as a stream of input-output pairs, where each pair is drawn from the corresponding task probability distribution. Since the length of the learning experience is not specified a-priori, the learner can only assume a single pass over the data, and store nothing but a few examples into a fixed-size episodic memory. At all times during the lifetime of the model, predictions on examples from all tasks can be requested. Addressing continual learning is an important research problem, since it would waive the long-obsolete assumption of “identically and independently distributed data” impeding progress towards artificial intelligence, and allow the deployment of models learning in-the-wild. However, continual learning presents one major challenge, catastrophic forgetting (McCloskey & Cohen, 1989). That is, as the learner experiences new tasks, it quickly forgets previously acquired knowledge. This is a hindrance for state-of-the-art deep learning models, where all parameters are updated after observing each example.
Continual learning has received increasing attention from the scientific community during the last decade. The state of the art in algorithms for continual learning fall into three categories. First, regularization-based approaches reduce forgetting by restricting the updates in parameters that were important for previous tasks (Kirkpatrick et al., 2016; Aljundi et al., 2018; Chaudhry et al., 2018; Nguyen et al., 2018). However, when the number of tasks are large, the regularization of past tasks becomes obsolete, leading to representation drift (Titsias et al., 2019). Second, modular approaches (Rusu et al., 2016; Lee et al., 2017) add new modules to the learner as new tasks are learned. While modular architectures overcome forgetting by design, the memory complexity of these approaches scales with the number of tasks. Third, memory-based methods (Lopez-Paz & Ranzato, 2017; Hayes et al., 2018; Isele & Cosgun, 2018; Riemer et al., 2019; Chaudhry et al., 2019a), store a few examples from past tasks in a so-called episodic memory, to be revisited when training for a new task. Memory-based methods are the reigning state of the art, but remain a far-cry from the achievable performance by a simple multi-task learning baseline accessing all data at once. Despite intense research efforts, such gap in performance renders the problem of continual learning an open research question.
Contribution We propose Hindsight Anchor Learning (HAL), a continual learning approach to improve the performance of memory-based continual learning algorithms. HAL leverages metalearning to regularize the training objective with one representational point per class per task, called anchor. Since it is desirable to preserve the performance of a learner during its lifetime, HAL constructs anchors as to maximize forgetting on the current task throughout the learning experience. We estimate the amount of forgetting that the learner would suffer on those anchors when learning future tasks in hindsight: that is, by measuring forgetting on a temporary predictor that has been fine-tuned on the episodic memories of past tasks. Then, the main parameter update of HAL is to minimize the loss on the currently observed mini-batch, while keeping the predictions at all anchors invariant.
Results We compare HAL to EWC (Kirkpatrick et al., 2016), AGEM (Chaudhry et al., 2019a), experience replay (Hayes et al., 2018; Riemer et al., 2019), and MER (Riemer et al., 2019), across four standard benchmarks in continual learning (MNIST permutations, MNIST rotations, split CIFAR100, and split miniImageNet). In these experiments, HAL achieves state-of-the-art performance, improving accuracy by $5 \%$ and reducing forgetting by $20 \%$ . We show that these results hold for various sizes of episodic memories (between 1 and 5 examples per class per task). Finally, we perform an ablation study to show that learning anchors in hindsight is a critical factor to achieve state-of-the-art performance.
We now begin our exposition by reviewing the continual learning setup. The rest of the manuscript then presents our new algorithm HAL (Section 3), showcases its empirical performance (Section 4), surveys the related literature (Section 5), and offers some concluding remarks (Section 6).
# 2 CONTINUAL LEARNING SETUP
In continual learning, we experience a stream of data triplets $( x _ { i } , y _ { i } , t _ { i } )$ , each containing an input $x _ { i }$ , a target $y _ { i }$ , and a task identifier $t _ { i } \in \mathcal { T } = \{ 1 , . . . , T \}$ . Each input-target pair $( x _ { i } , y _ { i } ) \in \mathcal { X } \times \mathcal { Y } _ { t _ { i } }$ is an identically and independently distributed example drawn from some unknown distribution $P ( X _ { t _ { i } } , Y _ { t _ { i } } )$ , representing the $t _ { i }$ -th learning task. Without loss of generality, we assume that the tasks are experienced in order $( t _ { i } \leq t _ { j }$ for all $i \leq j$ ), and that the number of total tasks $T$ is not known a priori. Under this setup, our goal is to estimate a predictor $f = ( w \circ \phi ) : \mathcal { X } \times \mathcal { T } \mathcal { Y }$ , composed by a featurizer $\phi : \mathcal { X } \to \mathcal { H }$ and a classifier $w : \mathcal { H } \to \mathcal { V }$ , that minimizes the multi-task error
$$\frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } _ { ( x , y ) \sim P _ { t } } \left[ \ell ( f ( x , t ) , y ) \right] ,$$
where $\mathcal { V } = \cup _ { t \in T } \mathcal { V } _ { t }$ , and $\ell : \mathcal { V } \times \mathcal { V } \mathbb { R }$ is a suitable loss function.
In the sequel, and similarly to prior literature in continual learning (Lopez-Paz & Ranzato, 2017; Hayes et al., 2018; Riemer et al., 2019; Chaudhry et al., 2019a), we consider streams of data, which are experienced only once. Therefore, the learner cannot store or revisit any but a small amount of data triplets chosen to be stored in its episodic memory $\mathcal { M }$ . More specifically, we consider tiny “ring” episodic memories, which contain the last $m$ observed examples per class for each of the experienced tasks, where $m \in \{ 1 , 3 , 5 \}$ . That is, considering as variables the number of experienced tasks $t$ and examples $n$ , we study continual learning algorithms with a $O ( t )$ memory footprint.
Following Lopez-Paz & Ranzato (2017), we monitor two statistics to evaluate the quality of continual learning algorithms: final average accuracy, and final maximum forgetting. First, the final average accuracy of a predictor is defined as
$$\mathrm { A c c u r a c y } = \frac { 1 } { T } \sum _ { j = 1 } ^ { T } a _ { T , j } ,$$
where $a _ { i , j }$ denotes the test accuracy on task $j$ after the model finished experiencing task $i$ . That is, the final average accuracy measures the test performance of the predictor at each of the tasks after the continual learning experience has finished. Second, the final maximum forgetting is defined as
$$\mathrm { F o r g e t t i n g } = \frac { 1 } { T - 1 } \sum _ { j = 1 } ^ { T - 1 } \operatorname* { m a x } _ { l \in \{ 1 , \dots , T - 1 \} } ( a _ { l , j } - a _ { T , j } ) ,$$
that is, the decrease in performance at each of the tasks between their peak accuracy and their accuracy after the continual learning experience has finished.
Finally, following Chaudhry et al. (2019a), we use the first $k < T$ tasks to cross-validate the hyperparameters of each of the considered continual learning algorithms. These first $k$ tasks are not considered when computing the final average accuracy and maximum forgetting metrics.
# 3 HINSDIGHT ANCHOR LEARNING (HAL)
Our starting point to describe our proposed continual learning algorithm is the current state of the art methods based on experience replay (Hayes et al., 2018; Riemer et al., 2019; Chaudhry et al., 2019b). These are predictors $f _ { \theta }$ that, during training, store a small amount of past observed triplets into an episodic memory $\boldsymbol { \mathcal { M } } = \{ ( x ^ { \prime } , y ^ { \prime } , t ^ { \prime } ) \bar \}$ . When facing a new mini-batch of observations $\tilde { \boldsymbol { B } } : \bar { = } \left\{ ( x , y , t ) \right\}$ from task $t$ , they employ the rule $\Dot { \theta ^ { * } } \theta - \alpha \cdot \nabla _ { \theta } \ell ( B \cup B _ { \mathcal { M } } )$ to update their parameters, where
$$\ell ( A ) = { \frac { 1 } { | { \mathcal { A } } | } } \sum _ { ( x , y , t ) \in A } \ell ( f _ { \theta } ( x , t ) , y )$$
denotes the average loss across a collection of triplets $\mathcal { A }$ , and $B _ { { \mathcal { M } } }$ is a mini-batch constructed by sampling triplets of previous tasks from $\mathcal { M }$ at random. In general, $p _ { { \mathcal { M } } }$ is constructed to have the same size as $\boldsymbol { B }$ , but can be smaller if the episodic memory $\mathcal { M }$ does not yet contain enough samples.
In the previous, the episodic memory $\mathcal { M }$ reminds the predictor about how to perform at past tasks using only a very small amount of datum. As such, the behaviour of the predictor outside the data stored in $\mathcal { M }$ is not guaranteed, and subject to worsen. Because of this reason, we would like to be more conservative, and propose to further fix the behaviour of the predictor at a collection of carefully constructed anchor points $e _ { t ^ { \prime } }$ , one per class per past task $t ^ { \prime }$ , after a parameter update1.
To implement this, we propose a two-step parameter update rule:
$$\begin{array} { r l } & { \tilde { \theta } \gets \theta - \alpha \cdot \nabla _ { \theta } \ell ( \mathcal { B } \cup \mathcal { B } _ { \mathcal { M } } ) , } \\ & { \theta \gets \theta - \alpha \cdot \nabla _ { \theta } \left( \ell ( \mathcal { B } \cup \mathcal { B } _ { \mathcal { M } } ) + \lambda \cdot \displaystyle \sum _ { t ^ { \prime } < t } \big ( f _ { \theta } ( e _ { t ^ { \prime } } , t ^ { \prime } ) - f _ { \tilde { \theta } } ( e _ { t ^ { \prime } } , t ^ { \prime } ) \big ) ^ { 2 } \right) . } \end{array}$$
The first step computes a temporary parameter vector $\tilde { \theta }$ by minimizing the loss at a minibatch from the current task $t$ , and the episodic memory of past tasks (this is the usual experience replay parameter update). The second step employs nested optimization to perform the final update of the parameter $\theta$ , which trades-off the minimization of $( a )$ the loss value at the current minibatch and the episodic memory, as well as $( b )$ the change in predictions at the anchor points for all past tasks. We use L2 over the unnormalized logits as a distance measure in Eq. 5, as we experimentally find it to be superior than cosine similarity or L1 distance. This two-step nested optimization bears a similarity to gradient-based meta-learning approach (Finn et al., 2017) where we restrict the inner update to only a single gradient step.
Next, let us discuss how to choose the anchor points. Recall that our objective is to preserve the performance of the current task throughout the entire continual learning experience. Ideally, we would like to choose each $e _ { t }$ as a tool to maximally suppress the amount of forgetting about current task throughout the entire learning experience. For this, we are interested in letting $e _ { t }$ be the example from task $t$ on which the loss would increase maximally had training with future tasks been performed. Such $e _ { t }$ would capture instances where the current task would be forgotten the most in future training. Then, requiring the predictions to remain invariant at such $e _ { t }$ , by using Eq. 5, would minimize forgetting on the current task. Mathematically, the desirable $e _ { t }$ and its label $y _ { t }$ is given by:
$$\left( e _ { t } , y _ { t } \right) \gets \underset { ( x , y ) \sim P _ { t } } { \arg \operatorname* { m a x } } \ \ell ( f _ { \theta _ { T } } ( x , t ) , y ) - \ell ( f _ { \theta _ { t } } ( x , t ) , y ) ,$$
where $\theta _ { t }$ is the parameter vector after training on task $t$ and $\theta _ { T }$ is the final parameter vector after the entire learning experience. Thus, keeping predictions intact on the pair $( e _ { t } , y _ { t } )$ above would
maximally preserve the performance of task $t$ . However, the idealistic Eq. 6 requires access to $( a )$ the entire distribution $P _ { t }$ as to compute the maximization, and (b) access to all future distributions $t ^ { \prime } > t$ as to compute the final parameter vector $\theta _ { T }$ . Both are unrealistic assumptions.
To circumvent $( a )$ , we can recast Eq. 6 as to learn $e _ { t }$ by initializing it at random and using $k$ gradient ascent updates for a given label $y _ { t }$ :
$$\begin{array} { r } { e _ { t } \gets e _ { t } + \alpha \cdot \nabla _ { e _ { t } } \left( \underbrace { \ell ( f _ { \theta _ { T } } ( e _ { t } , t ) , y _ { t } ) - \ell ( f _ { \theta _ { t } } ( e _ { t } , t ) , y _ { t } ) } _ { \mathrm { F o r g e t i n g l o s s } } - \gamma \underbrace { ( \phi ( e _ { t } ) - \phi _ { t } ) ^ { 2 } } _ { \mathrm { M e a n e m b e d d i n g l o s s } } \right) , } \end{array}$$
where we recall that $\phi$ denotes the feature extractor of the predictor, and $\phi _ { t }$ is the neural mean embedding (Smola et al., 2007) of all observed examples from task $t$ which regularizes the constructed $e _ { t }$ against the outliers. Since the feature extractor is updated after experiencing each data point, the mean embeddings $\phi _ { t }$ are computed as running averages. That is, after observing a minibatch $\boldsymbol { B } = \{ ( x , y , t ) \}$ of task $t$ , we update:
$$\phi _ { t } \beta \cdot \phi _ { t } + ( 1 - \beta ) \frac { 1 } { | \mathcal { B } | } \sum _ { x \in \mathcal { B } } \phi ( x ) ,$$
where $\phi _ { t }$ is initialized to zero at the beginning of the learning experience. In our experiments, we learn one $e _ { t }$ per class for each task. We fix the $y _ { t }$ to the corresponding class label, and discard $\phi _ { t }$ after training on task $t$ . Learning $e _ { t }$ in this manner circumvents the requirement of storing the entire distribution $P _ { t }$ for a task.
Still, Eq. 7 requires the parameter vector $\theta _ { T }$ , to be obtained in the distant future after all learning tasks have been experienced. To waive this impossible requirement, we will approximate the future by simulating the past. That is, instead of measuring the forgetting that would happen after the model is trained at future tasks, we will measure the forgetting that happens when the model is fine-tuned at past tasks. In this way, we say that forgetting is estimated in hindsight, using past experiences. More concretely, after training on task $t$ and obtaining the parameter vector $\theta _ { t }$ , we minimize the loss during one epoch on the episodic memory $\mathcal { M }$ to obtain the temporary parameter vector $\theta _ { \mathcal { M } }$ , and recast Eq. 7 as:
$$e _ { t } \gets e _ { t } + \alpha \cdot \nabla _ { e _ { t } } \left( \ell ( f _ { \theta _ { M } } ( e _ { t } , t ) , y _ { t } ) - \ell ( f _ { \theta _ { t } } ( e _ { t } , t ) , y _ { t } ) - \gamma ( \phi ( e _ { t } ) - \phi _ { t } ) ^ { 2 } \right) .$$
Our experiments show that the proposed approximation of future by replaying past data in hindsight reduces forgetting by $20 \%$ when compared to a standard experience replay baseline.
This completes the description of our proposed algorithm for continual learning, which combines experience replay with anchors learned in hindsight. We call our approach Hindsight Anchor Learning (HAL) and summarize the entire learning process as follows:
# Hindsight Anchor Learning (HAL)
• Initialize $\theta \sim P ( \theta )$ and $\{ e _ { t } \sim P ( e ) \} _ { t = 1 } ^ { T }$ from normal distributions $P ( \theta )$ and $P ( e )$
• Initialize $\mathcal { M } = \{ \}$ • For each task $t = 1 , \dots , T$ :
Initialize $\phi _ { t } = 0$ – For each minibatch $\boldsymbol { B }$ from task $t$ : $^ *$ Sample $B _ { { \mathcal { M } } }$ from $\mathcal { M }$ $^ *$ Update $\theta$ using Eq. 5 $^ *$ Update $\phi _ { t }$ using Eq. 8 $^ *$ Update $\mathcal { M }$ by adding $\boldsymbol { B }$ in a first-in first-out (FIFO) ring buffer Fine-tune on $\mathcal { M }$ to obtain $\theta _ { \mathcal { M } }$ Build $e _ { t }$ using Eq. $9 k$ times Discard $\phi _ { t }$
• Return θ.
# 4 EXPERIMENTS
We now evaluate the performance of HAL against a variety of state-of-the-art methods, across four popular continual learning benchmarks.
# 4.1 DATESETS AND TASKS
We perform experiments on four popular benchmarks for continual learning.
• Permuted MNIST is a variant of the MNIST dataset of handwritten digits (LeCun, 1998) where each task applies a fixed random pixel permutation to the original dataset. This benchmark contains 23 tasks, each with 1000 samples from 10 different classes. • Rotated MNIST is another variant of MNIST, where each task applies a fixed random image rotation (between 0 and 180 degrees) to the original dataset. This benchmark contains 23 tasks, each with 1000 samples from 10 different classes. • Split CIFAR is a variant of the CIFAR-100 dataset (Krizhevsky & Hinton, 2009; Zenke et al., 2017), where each task contains the data pertaining 5 random classes (without replacement) out of the total 100 classes. This benchmark contains 20 tasks, each with 250 samples per each of the 5 classes. • Split miniImageNet is a variant of the ImageNet dataset (Russakovsky et al., 2015; Vinyals et al., 2016), containing a subset of images and classes from the original dataset. This benchmark contains 20 tasks, each with 250 samples per each of the 5 classes.
For all datasets, the first 3 tasks are used for hyper-parameter optimization (grids available in Appendix B). The learners can perform multiple epochs on these three initial tasks, that are later discarded for evaluation.
# 4.2 BASELINES
We compare our proposed model HAL to the following baselines.
• Finetune is a single model trained continually on the stream of data, without any regularization or episodic memory. • EWC (Kirkpatrick et al., 2016) is a continual learning method that limits changes to parameters critical to past tasks, as measured by the Fisher information matrix. • AGEM (Chaudhry et al., 2019a) is a continual learning method improving on (Lopez-Paz & Ranzato, 2017), which uses an episodic memory of parameter gradients to limit forgetting. • MER (Riemer et al., 2019) is a continual learning method that combines episodic memories with meta-learning to limit forgetting. • ER-Ring (Chaudhry et al., 2019b) is a continual learning method that uses a ring buffer as episodic memory. • Multitask is an oracle baseline that has access to all data to optimize Eq. 1, useful to estimate an upper bound on the obtainable Accuracy (Eq. 2). • Clone-and-finetune is an oracle baseline training one independent model per task, where the model for task $t ^ { \prime }$ is initialized by cloning the parameters of the model for task $t ^ { \prime } - 1$ .
All baselines use the same neural network architectures: a perceptron with two hidden layers of 256 ReLU neurons in the MNIST experiments, and a ResNet18, with three times less feature maps across all layers, similar to Lopez-Paz & Ranzato (2017), their CIFAR and ImageNet experiments. The task identifiers are used to select the output head in the CIFAR and ImageNet experiments, while ignored in the MNIST experiments. Batch size is set to 10 for both the stream of data and episodic memories, across experiments and models. The size of episodic memories is set between 1 and 5 examples per class per task. The same unified code base runs all experiments, and is available at https://bit.ly/2mw8bsE.2
Table 1: Accuracy (Eq. 2) and Forgetting (Eq. 3) results of continual learning experiments. Averages and standard deviations are computed over five random seeds. When used, episodic memories contain up to one example per class per task. Last two rows are oracle baselines.
<table><tr><td>Method</td><td colspan="2">Permuted MNIST</td><td colspan="2">Rotated MNIST</td></tr><tr><td></td><td>Accuracy</td><td>Forgetting</td><td>Accuracy</td><td>Forgetting</td></tr><tr><td>Finetune</td><td>53.5 (±1.46)</td><td>0.29 (±0.01)</td><td>41.9 (±1.37)</td><td>0.50 (±0.01)</td></tr><tr><td>EWC</td><td>63.1 (±1.40)</td><td>0.18 (±0.01)</td><td>44.1 (±0.99)</td><td>0.47 (±0.01)</td></tr><tr><td>AGEM</td><td>62.1 (±1.39)</td><td>0.21 (±0.01)</td><td>50.9 (±0.92)</td><td>0.40 (±0.01)</td></tr><tr><td>MER</td><td>69.9 (±0.40)</td><td>0.14 (±0.01)</td><td>66.0 (±2.04)</td><td>0.23 (±0.01)</td></tr><tr><td>ER-Ring</td><td>70.2 (±0.56)</td><td>0.12 (±0.01)</td><td>65.9 (±0.41)</td><td>0.24 (±0.01)</td></tr><tr><td>HAL (ours)</td><td>73.6 (±0.31)</td><td>0.09 (±0.01)</td><td>68.4 (±0.72)</td><td>0.21 (±0.01)</td></tr><tr><td rowspan="2">Clone-and-finetune Multitask</td><td>81.4 (±0.35)</td><td>0.0</td><td>87.5 (±0.11)</td><td>0.0</td></tr><tr><td>83.0</td><td>0.0</td><td>83.3</td><td>0.0</td></tr><tr><td colspan="3"></td><td></td><td></td></tr><tr><td>Method</td><td>Split CIFAR</td><td></td><td>Split miniImageNet</td><td></td></tr><tr><td></td><td>Accuracy</td><td>Forgetting</td><td>Accuracy</td><td>Forgetting</td></tr><tr><td>Finetune</td><td>42.9 (±2.07)</td><td>0.25 (±0.03)</td><td>34.7 (±2.69)</td><td>0.26 (±0.03)</td></tr><tr><td>EWC</td><td>42.4 (±3.02)</td><td>0.26 (±0.02)</td><td>37.7 (±3.29)</td><td>0.21 (±0.03)</td></tr><tr><td>AGEM</td><td>54.9 (±2.92)</td><td>0.14 (±0.03)</td><td>48.2 (±2.49)</td><td>0.13 (±0.02)</td></tr><tr><td>MER</td><td>49.7 (±2.97)</td><td>0.19 (±0.03)</td><td>45.5 (±1.49)</td><td>0.15 (±0.01)</td></tr><tr><td>ER-Ring</td><td>56.2 (±1.93)</td><td>0.13 (±0.01)</td><td>49.0 (±2.61)</td><td>0.12 (±0.02)</td></tr><tr><td>HAL (ours)</td><td>60.4 (±0.54)</td><td>0.10 (±0.01)</td><td>51.6 (±2.02)</td><td>0.10 (±0.01)</td></tr><tr><td>Clone-and-finetune</td><td>60.3 (±0.55)</td><td>0.0</td><td>50.3 (±1.00)</td><td>0.0</td></tr><tr><td rowspan="2">Multitask</td><td>68.3</td><td>0.0</td><td>63.5</td><td>0.0</td></tr><tr><td></td><td></td><td></td><td></td></tr></table>
# 4.3 RESULTS
Table 1 summarizes the main results of our experiments. First, our proposed HAL is the method achieving maximum Accuracy (Eq. 2) and minimal Forgetting (Eq. 3) at all benchmarks. This does not include oracle baselines Multitask (which has access to all data simultaneously) and Clone-andfinetune (which trains a separate model per task). Second, the relative gains from the second-best method ER-Ring to HAL are significant, confirming that the anchoring objective (Eq. 5) allows experience-replay methods to generalize better from the same amount of episodic memory.
Figure 1 shows a more fine grained analysis of average accuracy as new tasks are learned on Permuted MNIST and Split CIFAR. HAL preserves the performance of a predictor more effectively than other baselines.
Table 2 shows the Accuracy of methods that employ an episodic memory, when we allow the size of this memory to increase; 3 or 5 examples per class per task, resulting in a total memory size of 600 or 1000 for MNIST experiments, and 255 or 425 for CIFAR and ImageNet experiments. The corresponding numbers for Forgetting are given in Appendix Table 4. HAL outperforms all competitors at all benchmarks.
Figure 2 provides the training time of all the continual learning baselines on MNIST benchmarks. Although HAL adds a overhead on top of experience replay baseline, it is significantly faster than, MER, another meta-learning approach to reduce forgetting.
Finally, Table 3 summarizes the results of an ablation study to better understand the impact of anchor selection. We compare selecting anchors as random noise (Random-Anchors), as a random example for the associated class and task (Data-Anchors), or our proposed optimization in hindsight procedure (HAL). Our results confirm that optimizing anchors in hindsight is the most effective strategy in terms of both accuracy and forgetting metrics.
 Figure 1: Evolution of Accuracy (Eq. 2) as new tasks are learned. When used, episodic memories contain up to one example per class per task.
Table 2: Accuracy (Eq. 2) results for large (3 to 5 examples per class per task) episodic memory sizes. Here we only compare methods that use an episodic memory. Averages and standard deviations are computed over five random seeds.
<table><tr><td>Method</td><td colspan="2">Permuted MNIST</td><td colspan="2">Rotated MNIST</td></tr><tr><td></td><td>|M|= 600</td><td>|M|= 1000</td><td>|M|= 600</td><td>|M|= 1000</td></tr><tr><td>AGEM</td><td>63.2 (±1.47)</td><td>64.1 (±0.74)</td><td>49.9 (±1.49)</td><td>53.0 (±1.52)</td></tr><tr><td>MER</td><td>74.9 (±0.49)</td><td>78.3 (±0.19)</td><td>76.5 (±0.30)</td><td>77.3 (±1.13)</td></tr><tr><td>ER-Ring</td><td>73.5 (±0.43)</td><td>75.8 (±0.24)</td><td>74.7 (±0.56)</td><td>76.5 (±0.48)</td></tr><tr><td>HAL (ours)</td><td>76.2 (±0.52)</td><td>78.4 (±0.27)</td><td>77.0 (±0.66)</td><td>78.7 (±0.97)</td></tr><tr><td colspan="5"></td></tr><tr><td>Method</td><td colspan="2">Split CIFAR</td><td colspan="2">Split miniImageNet</td></tr><tr><td></td><td>|M| = 255</td><td>|M| = 425</td><td>M|= 255</td><td>[M|= 425</td></tr><tr><td>AGEM</td><td>56.9 (±3.45)</td><td>59.9 (±2.64)</td><td>51.6 (±2.69)</td><td>54.3 (±1.56)</td></tr><tr><td>MER</td><td>57.7 (±2.59)</td><td>60.6 (±2.09)</td><td>49.4 (±3.43)</td><td>54.8 (±1.79)</td></tr><tr><td>ER-Ring</td><td>60.9 (±1.44)</td><td>62.6 (±1.77)</td><td>53.5 (±1.42)</td><td>54.2 (±3.23)</td></tr><tr><td>HAL (ours)</td><td>62.9 (±1.49)</td><td>64.4 (±2.15)</td><td>56.5 (±0.87)</td><td>57.2 (±1.54)</td></tr></table>
# 5 RELATED WORK
In continual learning (Ring, 1997), also called lifelong learning (Thrun, 1998), a learner addresses a sequence of changing tasks without storing the complete datasets of these tasks. This is in contrast to multitask learning (Caruana, 1997), where the learner assumes simultaneous access to data from all tasks. The main challenge in continual learning is to avoid catastrophic interference or forgetting (McCloskey & Cohen, 1989; McClelland et al., 1995; Goodfellow et al., 2013), that is, the learner forgetting previously acquired knowledge when learning new tasks. The state-of-the art methods in continual learning can be categorized into three classes.
First, regularization approaches discourage updating parameters important for past tasks (Kirkpatrick et al., 2016; Aljundi et al., 2018; Nguyen et al., 2018; Zenke et al., 2017). While efficient in terms of memory and computation, these ap
 Figure 2: Training time (s) of MNIST experiments for the entire continual learning experience. MER and HAL both use meta-learning objectives to reduce forgetting.
proaches suffer from brittleness due to feature drift as the number of tasks increases (Titsias et al.,
Table 3: Impact of anchor selection, where we compare random-noise anchors (Random-), one random example-per-class anchors (Data-), and our optimized anchor selection (HAL).
<table><tr><td>Anchor type</td><td colspan="2">Permuted MNIST</td><td colspan="2">Split CIFAR</td></tr><tr><td></td><td>Accuracy</td><td>Forgetting</td><td>Accuracy</td><td>Forgetting</td></tr><tr><td>ER-Ring</td><td>70.2</td><td>0.12</td><td>56.2</td><td>0.13</td></tr><tr><td>Random-Anchors</td><td>72.7</td><td>0.10</td><td>57.8</td><td>0.13</td></tr><tr><td>Data-Anchors</td><td>73.2</td><td>0.10</td><td>59.0</td><td>0.12</td></tr><tr><td>HAL (ours)</td><td>73.6</td><td>0.09</td><td>60.4</td><td>0.10</td></tr></table>
2019). Additionally, these approaches are only effective when we can perform multiple passes over each dataset (Chaudhry et al., 2019a), a case deemed unrealistic in this work.
Second, modular approaches use different parts of the prediction function for each new task (Fernando et al., 2017; Aljundi et al., 2017; Rosenbaum et al., 2018; Chang et al., 2018; Xu & Zhu, 2018; Ferran Alet, 2018). Modular approaches do not scale to a large number of tasks, as they require searching over combinatorial space of module architectures. Another modular approach (Rusu et al., 2016; Lee et al., 2017) adds new parts to the prediction function as new tasks are learned. By construction, modular approaches have zero forgetting, but their memory requirements increase with the number of tasks.
Third, episodic memory approaches maintain and revisit a small episodic memory of datum from past tasks. In some of these methods (Li & Hoiem, 2016; Rebuffi et al., 2017), examples in the episodic memory are replayed and predictions are kept invariant by means of distillation (Hinton et al., 2014). In other approaches (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2019a; Aljundi et al., 2019b) the episodic memory is used as an optimization constraint that discourages increases in loss at past tasks. More recently, several works (Hayes et al., 2018; Riemer et al., 2019; Rolnick et al., 2018; Chaudhry et al., 2019b) have shown that directly optimizing the loss on the episodic memory, also known as experience replay, is cheaper than constraint-based approaches and improves prediction performance. Our contribution in this paper has been to improve experience replay methods with task anchors learned in hindsight.
There are other definitions of continual learning, such as the one of task-free continual learning. The task-free formulation does not consider the notion of tasks, and instead works on undivided data streams (Aljundi et al., 2019a,b). We have focused on the task-based definition of continual learning and, similar to many recent works (Lopez-Paz & Ranzato, 2017; Hayes et al., 2018; Riemer et al., 2019; Chaudhry et al., 2019a), assumed that only a single pass through the data was possible.
Finally, our gradient-based learning of anchors bears a similarity to (Simonyan et al., 2014) and (Wang et al., 2018). In Simonyan et al. (2014), the authors use gradient ascent on class scores to find saliency maps of a classification model. Contrary to them, our proposed hindsight learning objective optimizes for the forgetting metric, as reducing it is necessary while learning continually. Dataset distillation (Wang et al., 2018) proposes to encode the entire dataset in a few synthetic points at a given parameter vector by a gradient-based optimization process. Their method requires access to the entire dataset of a task for optimization purposes. We, instead, learn anchors in hindsight from the replay buffer of past tasks after training for current task. While Wang et al. (2018) aim to replicate the performance of the entire dataset from the synthetic points, we focus on reducing forgetting of an already learned task.
# 6 CONCLUSION
We introduced HAL, a meta-learning objective for continual learning. In our approach, we learn one “anchor point” per class per task, where predictions are requested to remain invariant. These anchors are learned using gradient-based optimization, and represent points that would maximize the forgetting of the current task throughout the entire learning experience. We simulate the forgetting that would happen during the learning of future tasks in hindsight, that is, by taking temporary gradient steps across a small episodic memory of past tasks. As shown in our experiments, anchoring in hindsight complements and improves the performance of continual learning methods based on experience replay, achieving a new state of the art on four standard continual learning benchmarks.
# REFERENCES
Rahaf Aljundi, Punarjay Chakravarty, and Tinne Tuytelaars. Expert gate: Lifelong learning with a network of experts. In CVPR, pp. 7120–7129, 2017.
Rahaf Aljundi, Francesca Babiloni, Mohamed Elhoseiny, Marcus Rohrbach, and Tinne Tuytelaars. Memory aware synapses: Learning what (not) to forget. In ECCV, 2018.
Rahaf Aljundi, Klaas Kelchtermans, and Tinne Tuytelaars. Task-free continual learning. In CVPR, pp. 11254–11263, 2019a.
Rahaf Aljundi, Min Lin, Baptiste Goujaud, and Yoshua Bengio. Online continual learning with no task boundaries. arXiv preprint arXiv:1903.08671, 2019b.
Rich Caruana. Multitask learning. Machine learning, 28(1):41–75, 1997.
Michael Chang, Abhishek Gupta, Sergey Levine, and Thomas L. Griffiths. Automatically composing representation transformations as a means for generalization. In ICML workshop Neural Abstract Machines and Program Induction v2, 2018.
Arslan Chaudhry, Puneet K Dokania, Thalaiyasingam Ajanthan, and Philip HS Torr. Riemannian walk for incremental learning: Understanding forgetting and intransigence. In ECCV, 2018.
Arslan Chaudhry, Marc’Aurelio Ranzato, Marcus Rohrbach, and Mohamed Elhoseiny. Efficient lifelong learning with a-gem. In ICLR, 2019a.
Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K Dokania, Philip HS Torr, and Marc’Aurelio Ranzato. Continual learning with tiny episodic memories. arXiv preprint arXiv:1902.10486, 2019b.
Chrisantha Fernando, Dylan Banarse, Charles Blundell, Yori Zwols, David Ha, Andrei A Rusu, Alexander Pritzel, and Daan Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734, 2017.
Leslie P. Kaelbling Ferran Alet, Tomas Lozano-Perez. Modular meta-learning. arXiv preprint arXiv:1806.10166v1, 2018.
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML-Volume 70, pp. 1126–1135. JMLR. org, 2017.
Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013.
Tyler L Hayes, Nathan D Cahill, and Christopher Kanan. Memory efficient experience replay for streaming learning. arXiv preprint arXiv:1809.05922, 2018.
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. In NIPS, 2014.
David Isele and Akansel Cosgun. Selective experience replay for lifelong learning. arXiv preprint arXiv:1802.10269, 2018.
James Kirkpatrick, Razvan Pascanu, Neil C. Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. PNAS, 2016.
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. https://www.cs.toronto.edu/ kriz/cifar.html, 2009.
Yann LeCun. The mnist database of handwritten digits. http://yann.lecun.com/exdb/mnist/, 1998.
Jeongtae Lee, Jaehong Yun, Sungju Hwang, and Eunho Yang. Lifelong learning with dynamically expandable networks. arXiv preprint arXiv:1708.01547, 2017.
Zhizhong Li and Derek Hoiem. Learning without forgetting. In ECCV, pp. 614–629, 2016.
David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continuum learning. In NIPS, 2017.
James L McClelland, Bruce L McNaughton, and Randall C O’Reilly. Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419, 1995.
Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
Cuong V Nguyen, Yingzhen Li, Thang D Bui, and Richard E Turner. Variational continual learning. ICLR, 2018.
Alex Nichol and John Schulman. Reptile: a scalable metalearning algorithm. arXiv preprint arXiv:1803.02999, 2018, 2018.
S-V. Rebuffi, A. Kolesnikov, and C. H. Lampert. iCaRL: Incremental classifier and representation learning. In CVPR, 2017.
Matthew Riemer, Ignacio Cases, Robert Ajemian, Miao Liu, Irina Rish, Yuhai Tu, and Gerald Tesauro. Learning to learn without forgetting by maximizing transfer and minimizing interference. In ICLR, 2019.
Mark B Ring. Child: A first step towards continual learning. Machine Learning, 28(1):77–104, 1997.
David Rolnick, Arun Ahuja, Jonathan Schwarz, Timothy P. Lillicrap, and Greg Wayne. Experience replay for continual learning. CoRR, abs/1811.11682, 2018. URL http://arxiv.org/abs/ 1811.11682.
Clemens Rosenbaum, Tim Klinger, and Matthew Riemer. Routing networks: Adaptive selection of non-linear functions for multi-task learning. In ICLR, 2018.
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. IJCV, 115(3):211–252, 2015.
Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
K. Simonyan, A. Vedaldi, and A. Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In ICLR, 2014.
Alex Smola, Arthur Gretton, Le Song, and Bernhard Scholkopf. A hilbert space embedding for ¨ distributions. In ALT, pp. 13–31. Springer, 2007.
Sebastian Thrun. Lifelong learning algorithms. In Learning to learn, pp. 181–209. Springer, 1998.
Michalis K Titsias, Jonathan Schwarz, Alexander G de G Matthews, Razvan Pascanu, and Yee Whye Teh. Functional regularisation for continual learning using gaussian processes. arXiv preprint arXiv:1901.11356, 2019.
Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In NIPS, pp. 3630–3638, 2016.
Tongzhou Wang, Jun-Yan Zhu, Antonio Torralba, and Alexei A. Efros. Dataset distillation. arXiv preprint arXiv:1811.10959, 2018.
Ju Xu and Zhanxing Zhu. Reinforced continual learning. In arXiv preprint arXiv:1805.12369v1, 2018.
F. Zenke, B. Poole, and S. Ganguli. Continual learning through synaptic intelligence. In ICML, 2017.
# APPENDIX
In Section A, we are report the forgetting 3 metric when large episodic memories are used. Section B provides the grid considered for hyper-parameters. Section C provides pseudo-code for HAL.
# A MORE RESULTS
Table 4: Forgetting (Eq. 3) results for large (3 to 5 examples per class per task) episodic memory sizes. Here we only compare methods that use an episodic memory. Averages and standard deviations are computed over five random seeds.
<table><tr><td>Method</td><td colspan="3">Permuted MNIST</td><td colspan="3">Rotated MNIST</td></tr><tr><td></td><td>|M| = 600</td><td>|M| = 1000</td><td></td><td>|M|= 600</td><td></td><td>|M|= 1000</td></tr><tr><td>AGEM</td><td>0.20 (±0.01)</td><td>0.19</td><td>(±0.01)</td><td>0.41 1 (±0.01)</td><td></td><td>0.38 (±0.01)</td></tr><tr><td>MER</td><td>0.14 (±0.01)</td><td>0.09</td><td>(±0.01)</td><td>0.12</td><td>(±0.01)</td><td>0.11 (±0.01)</td></tr><tr><td>ER-Ring</td><td>0.09 (±0.01)</td><td></td><td>0.07 (±0.01)</td><td>0.15 (±0.01)</td><td></td><td>0.13 (±0.01)</td></tr><tr><td>HAL (ours)</td><td>0.07 (±0.01)</td><td></td><td>0.05 (±0.01)</td><td>0.12 (±0.01)</td><td></td><td>0.11 (±0.01)</td></tr></table>
<table><tr><td>Method</td><td colspan="2">Split CIFAR</td><td colspan="2">Split miniImageNet</td></tr><tr><td></td><td>M|= 255</td><td>|M|= 425</td><td>|M| = 255</td><td>|M| = 425</td></tr><tr><td>AGEM</td><td>0.13 (±0.03)</td><td>0.10 (±0.02)</td><td>0.10 (±0.02)</td><td>0.08 (±0.01)</td></tr><tr><td>MER</td><td>0.11 1(±0.01)</td><td>0.09 (±0.02)</td><td>0.12 (±0.02)</td><td>0.07 (±0.01)</td></tr><tr><td>ER-Ring</td><td>0.09 (±0.01)</td><td>0.06 (±0.01)</td><td>0.07 (±0.02)</td><td>0.08 (±0.02)</td></tr><tr><td>HAL (ours)</td><td>0.08 (±0.01)</td><td>0.06 (±0.01)</td><td>0.06 (±0.01)</td><td>0.06 (±0.01)</td></tr></table>
# B HYPER-PARAMETER SELECTION
In this section, we report the hyper-parameters grid considered for experiments. The best values for different benchmarks are given in parenthesis.
– learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0]
– learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0]
• Finetune – learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0]
• EWC – learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0] – regularization: [0.1, 1, 10 (MNIST perm, rot, CIFAR, miniImageNet), 100, 1000]
• AGEM – learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0] • MER – learning rate: [0.003, 0.01, 0.03 (MNIST, CIFAR, miniImageNet), 0.1, 0.3, 1.0] – within batch meta-learning rate: [0.01, 0.03, 0.1 (MNIST, CIFAR, miniImageNet), 0.3, 1.0] – current batch learning rate multiplier: [1, 2, 5 (CIFAR, miniImageNet), 10 (MNIST)]
# • ER-Ring
– learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0]
• HAL
– learning rate: [0.003, 0.01, 0.03 (CIFAR, miniImageNet), 0.1 (MNIST perm, rot), 0.3, 1.0] – regularization (λ): [0.01, 0.03, 0.1 (MNIST perm, rot), 0.3 (miniImageNet), 1 (CIFAR), 3, 10] – mean embedding strength (γ): [0.01, 0.03, 0.1 (MNIST perm, rot, CIFAR, miniImageNet), 0.3, 1, 3, 10]
# C HAL ALGORITHM
Algorithm 1 provides pseudo-code for HAL.
Algorithm 1 Training of HAL on sequential data $\mathcal { D } = \{ \mathcal { D } _ { 1 } , \cdot \cdot \cdot , \mathcal { D } _ { T } \}$ , with total replay buffer size ‘mem sz’, learning rate $\cdot _ { \alpha } ,$ , regularization strength $^ { \bullet } \lambda ^ { \bullet }$ , mean embedding decay $\cdot _ { \beta } ,$ , mean embedding strength $\cdot _ { \eta } ,$ .
1: procedure $\mathrm { H A L } ( { \mathcal { D } } , \mathrm { m e m . s z } , \alpha , \lambda , \beta )$ 2: M ← {} ∗ mem sz 3: {e1, · · · , eT } ← {} 4: for t ∈ {1, · · · , T } do 5: φt ← \~0 6: for B ∼ Dt do $\triangleright$ Sample a batch from current task 7: BM ∼ M $\triangleright$ Sample a batch from episodic memory 8: ˜θ ← θ − α · ∇θ \`(B ∪ BM) . Temporary parameter update 9: θ ← θ − α · ∇θ \`(B ∪ BM) + λ · Pt0<t (fθ (et0 , t0) − fθ˜(et0 , t0))2 . Anchoring objective (Eq. 5) 10: φt ← β · φt + (1 − β) · φ(B) $\triangleright$ Running average of mean embedding 11: M ← UpdateMemory(M, B) . Add samples to a ring buffer 12: end for 13: $e _ { t } , \theta \gets \mathrm { G e t A n c h o r s } ( \mathcal { M } , \theta , \phi _ { t } , \eta )$ . Get anchors for current task 14: end for 15: return θ, M 16: end procedure 1: procedure GETANCHORS $( \mathcal { M } , \theta _ { t } , \phi _ { t } , \gamma )$ 2: $\theta \theta _ { t }$ 3: for $B _ { \mathcal { M } } \sim \mathcal { M }$ do 4: $\theta \theta - \alpha \cdot \nabla _ { \theta } \ell ( B _ { \mathcal { M } } )$ $\triangleright$ Finetune $\theta _ { t }$ by taking SGD steps on the episodic memory 5: end for 6: $\theta _ { \mathcal { M } } \gets \theta$ . Store the updated parameter 7: et ← rand() . Initialize the task anchors 8: for 1, · · · , k do 9: $\begin{array} { r l } & { \textup { \texttt { t } } _ { 1 } , \cdots , \textup { \texttt { r a m } } } \\ & { \textup { \texttt { e } } _ { t } \gets e _ { t } + \alpha \cdot \nabla _ { e _ { t } } \left( \ell \big ( f _ { \theta _ { M } } \big ( e _ { t } , t \big ) , y _ { t } \big ) - \ell \big ( f _ { \theta _ { t } } \big ( e _ { t } , t \big ) , y _ { t } \big ) - \gamma \big ( \phi ( e _ { t } ) - \phi _ { t } \big ) ^ { 2 } \right) \ \triangleright \mathrm { M a s i m i z e ~ f o r g e t i n g } \ ( \mathbb { E } _ { 4 } , 9 ) } \end{array}$ 10: end for 11: return $e _ { t } , \theta _ { t }$ 12: end procedure
# D APPROXIMATION OF ANCHORING GRADIENT
Here we derive the approximation of anchoring objective (Eq. 5) gradient. In particular, we are more interested in the regularization part of the anchoring objective that involves second-order terms. We refer to this gradient as $g _ { a n c h }$ . We follow similar arguments as (Nichol & Schulman, 2018).
Let $\theta _ { 0 }$ be the parameter vector before the temporary update, $\ell _ { c e }$ be the cross-entropy loss, and $\ell _ { L 2 }$ be the L2 loss in the anchoring objective ( Eq. 5 in the main paper). We will use the following definitions:
$$\begin{array} { r l r l } { \overline { { g } } _ { 0 } = \ell _ { c e } ^ { \prime } ( \theta _ { 0 } ) } & & { \mathrm { ( g r a d i e n t ~ o f ~ c r o s s \mathrm { - } e n t r o p y ~ l o s s ~ a t ~ i n i t i a l ~ p o i n t ~ o n ~ } \mathcal { B } \cup \mathcal { B } _ { \mathcal { M } } ) } & \\ { \overline { { H } } _ { 0 } = \ell _ { c e } ^ { \prime \prime } ( \theta _ { 0 } ) } & & { \mathrm { ( H e s s i a n ~ o f ~ c r o s s \mathrm { - } e n t r o p y ~ l o s s ~ a t ~ i n i t i a l ~ p o i n t ~ o n ~ } \mathcal { B } \cup \mathcal { B } _ { \mathcal { M } } ) } & \\ { \overline { { g } } _ { 1 } = \ell _ { L 2 } ^ { \prime } ( \theta _ { 0 } ) } & & { \mathrm { ( g r a d i e n t ~ o f ~ L 2 ~ l o s s ~ a t ~ i n i t i a l ~ p o i n t ~ o n ~ a n c h o r s ) } } & \\ { \overline { { H } } _ { 1 } = \ell _ { L 2 } ^ { \prime \prime } ( \theta _ { 0 } ) } & & { \mathrm { ( g r a d i e n t ~ o f ~ L 2 ~ l o s s ~ a t ~ i n i t i a l ~ p o i n t ~ o n ~ a n c h o r s ) } } & \end{array}$$
Let $U _ { 0 } = \theta _ { 0 } - \alpha \overline { { g } } _ { 0 }$ be the operator giving a temporary update in the two-step process of (Eq. 5), and let $\theta _ { 1 }$ be the temporary update (note that $\tilde { \theta }$ is used in the main paper). The $g _ { a n c h }$ is given by:
$$\begin{array} { l } { { \displaystyle g _ { a n c h } = \frac { \partial } { \partial \theta _ { 0 } } \ell _ { L 2 } ( U _ { 0 } ) } } \\ { ~ } \\ { { \displaystyle ~ = U _ { 0 } ^ { \prime } \cdot \ell _ { L 2 } ^ { \prime } ( \theta _ { 1 } ) } } \\ { ~ } \\ { { \displaystyle ~ = \left( I - \alpha \overline { { { H } } } _ { 0 } \right) \cdot \ell _ { L 2 } ^ { \prime } ( \theta _ { 1 } ) } } \end{array}$$
Let’s calculate the first order Taylor’s approximation of $\ell _ { L 2 } ^ { \prime } ( \theta _ { 1 } )$
$$\begin{array} { r l } & { \ell _ { L 2 } ^ { \prime } ( \theta _ { 1 } ) = \ell _ { L 2 } ^ { \prime } ( \theta _ { 0 } ) + \ell _ { L 2 } ^ { \prime \prime } ( \theta _ { 0 } ) \cdot ( \theta _ { 1 } - \theta _ { 0 } ) + O ( | | \theta _ { 1 } - \theta _ { 0 } | | ^ { 2 } ) } \\ & { \qquad = \overline { { g } } _ { 1 } + \overline { { H } } _ { 1 } \cdot ( \theta _ { 0 } - \alpha \overline { { g } } _ { 0 } - \theta _ { 0 } ) + O ( \alpha ^ { 2 } ) } \\ & { \qquad = \overline { { g } } _ { 1 } - \alpha \overline { { H } } _ { 1 } \cdot \overline { { g } } _ { 0 } + O ( \alpha ^ { 2 } ) } \end{array}$$
Putting Eq. 11 in Eq. 10 and simplifying yields:
$$g _ { a n c h } = \overline { { { g } } } _ { 1 } - \alpha \overline { { { H } } } _ { 1 } \cdot \overline { { { g } } } _ { 0 } - \alpha \overline { { { H } } } _ { 0 } \cdot \overline { { { g } } } _ { 1 } + O ( \alpha ^ { 2 } )$$
This form is very similar to second-order MAML gradient formulation, Eq. 25 in (Nichol & Schulman, 2018). Further simplification of terms like $( \overline { { H } } _ { 1 } \cdot \overline { { g } } _ { 0 } )$ would yield inner product between the gradients $\overline { { g _ { 0 } } }$ and $\overline { { g _ { 1 } } }$ . However, unlike MAML (Finn et al., 2017), Reptile (Nichol & Schulman, 2018) or MER (Riemer et al., 2019), in anchoring objective these gradients correspond to different losses.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519# EFFICIENT EXPLORATION VIA STATE MARGINAL MATCHING
Anonymous authors Paper under double-blind review
# ABSTRACT
Reinforcement learning agents need to explore their unknown environments to solve the tasks given to them. The Bayes optimal solution to exploration is intractable for complex environments, and while several exploration methods have been proposed as approximations, it remains unclear what underlying objective is being optimized by existing exploration methods, or how they can be altered to incorporate prior knowledge about the task. Moreover, it is unclear how to acquire a single exploration strategy that will be useful for solving multiple downstream tasks. We address these shortcomings by learning a single exploration policy that can quickly solve a suite of downstream tasks in a multi-task setting, amortizing the cost of learning to explore. We recast exploration as a problem of State Marginal Matching (SMM), where we aim to learn a policy for which the state marginal distribution matches a given target state distribution, which can incorporate prior knowledge about the task. We optimize the objective by reducing it to a two-player, zero-sum game between a state density model and a parametric policy. Our theoretical analysis of this approach suggests that prior exploration methods do not learn a policy that does distribution matching, but acquire a replay buffer that performs distribution matching, an observation that potentially explains prior methods’ success in single-task settings. On both simulated and real-world tasks, we demonstrate that our algorithm explores faster and adapts more quickly than prior methods.1
# 1 INTRODUCTION
Reinforcement learning (RL) algorithms must be equipped with exploration mechanisms to effectively solve tasks with limited reward signals. These tasks arise in many real-world applications where providing human supervision is expensive. The inability of current RL algorithms to adequately explore limits their applicability to long-horizon control tasks.
A wealth of prior work has studied exploration for RL. While, in theory, the Bayes-optimal exploration strategy is optimal, it is intractable to compute exactly, motivating work on tractable heuristics for exploration. Exploration methods based on random actions have limited ability to cover a wide range of states. More sophisticated techniques, such as intrinsic motivation, accelerate learning in the single-task setting. However, these methods have two limitations. First, they do not explicitly define an objective to quantify “good exploration,” but rather argue that exploration arises implicitly through some iterative procedure. Lacking a well-defined optimization objective, it remains challenging to understand what these methods are doing and why they work. Similarly, the lack of a metric to quantify exploration, even if only for evaluation, makes it challenging to compare exploration methods and assess progress in this area. The second limitation is that these methods target the single-task setting. Because these methods aim to converge to the optimal policy for a particular task, it is challenging to repurpose these methods to solve multiple tasks.
We address these shortcomings by considering a multi-task setting, where many different reward functions can be provided for the same set of states and dynamics. Rather than exploring from scratch for each task, we aim to learn a single, task-agnostic exploration policy that can be adapted to many possible downstream reward functions, amortizing the cost of learning to explore. This exploration policy can be viewed as a prior on the policy for solving downstream tasks. Learning will consist of two phases: during training, we acquire this task-agnostic exploration policy; during testing, we use this exploration policy to quickly explore and maximize the task reward.
Learning a single exploration policy is considerably more difficult than doing exploration throughout the course of learning a single task. The latter is done by intrinsic motivation (Pathak et al., 2017; Tang et al., 2017; Oudeyer et al., 2007) and count-based exploration methods (Bellemare et al., 2016), which can effectively explore to find states with high reward, at which point the agent can decrease exploration and increase exploitation of those high-reward states. While these methods perform efficient exploration for learning a single task, the policy at any particular iteration is not a good exploration policy. For example, the final policy at convergence would only visit the high-reward states discovered for the current task.
What objective should be optimized to obtain a good exploration policy? We recast exploration as a problem of State Marginal Matching: given a desired state distribution, we learn a mixture of policies for which the state marginal distribution matches this desired distribution. Without any prior information, this objective reduces to maximizing the marginal state entropy $\mathcal { H } [ s ]$ , which encourages the policy to visit as many states as possible. The distribution matching objective also provides a convenient mechanism to incorporate prior knowledge about the task, whether in the form of safety constraints that the agent should obey; preferences for some states over other states; reward shaping; or the relative importance of each state dimension for a particular task.
We also propose an algorithm to optimize the State Marginal Matching (SMM) objective. First, we reduce the problem of SMM to a two-player, zero-sum game between a policy player and a density player. We find a Nash Equilibrium for this game using fictitious play (Brown, 1951), a classic procedure from game theory. Our resulting algorithm iteratively fits a state density model and then updates the policy to visit states with low density under this model. Our analysis of this approach sheds light on prior work on exploration. In particular, while the policy learned by existing exploration algorithms does not perform distribution matching, the replay buffer does, an observation that potentially explains the success of prior methods. On both simulated and real-world tasks, we demonstrate that our algorithm explores more effectively and adapts more quickly to new tasks than state-of-the-art baselines.
# 2 RELATED WORK
Most prior work on exploration has looked at exploration bonuses and intrinsic motivation. One class of exploration methods uses prediction error of some auxiliary task as an exploration bonus, which provides high (intrinsic) reward in states where the predictive model performs poorly (Pathak et al., 2017; Oudeyer et al., 2007; Schmidhuber, 1991; Houthooft et al., 2016; Burda et al., 2018). Another set of approaches (Tang et al., 2017; Bellemare et al., 2016; Schmidhuber, 2010) directly encourage the agent to visit novel states. While all methods effectively explore during the course of solving a single task (Taïga et al., 2019), the policy obtained at convergence is often not a good exploration policy (see Section 4). In contrast, our method converges to a highly-exploratory policy by maximizing state entropy in the training objective (Eq. 2).
Many exploration algorithms can be classified by whether they explore in the space of actions, policy parameters, goals, or states. Common exploration strategies including $\epsilon { \cdot }$ -greedy and Ornstein–Uhlenbeck noise (Lillicrap et al., 2015), as well as standard MaxEnt RL algorithms (Ziebart, 2010; Haarnoja et al., 2018), explore in the action space. Recent work (Fortunato et al., 2017; Plappert et al., 2017) shows that adding noise to the parameters of the policy can result in good exploration. Most closely related to our work are methods that perform exploration in the space of states or goals (Colas et al., 2018; Held et al., 2017; Nair et al., 2018; Pong et al., 2019; Hazan et al., 2018). In fact, Hazan et al. (2018) consider the same State Marginal Matching objective that we examine and propose a similar algorithm. In relation to Hazan et al. (2018), our main contributions are (1) empirically showing that exploration based on state-entropy is competitive with existing state-of-the-art exploration methods, and (2) explaining how existing exploration methods based on prediction error are implicitly maximizing this state-entropy objective. In Appendix C.1, we also discuss how goal-conditioned RL (Kaelbling, 1993; Schaul et al., 2015) can be viewed as a special case of State Marginal Matching when the goal-sampling distribution is learned jointly with the policy.
The problems of exploration and meta-reinforcement learning are tightly coupled. Meta-reinforcement learning algorithms (Duan et al., 2016; Finn et al., 2017; Rakelly et al., 2019; Mishra et al., 2017) must perform effective exploration if they hope to solve a downstream task. Some prior work has explicitly looked at the problem of learning to explore (Gupta et al., 2018; Xu et al., 2018). Our problem statement is similar to meta-learning, in that we also aim to learn a policy as a prior for solving downstream tasks. However, whereas meta-RL requires a distribution of task reward functions, our method will require only a single target state marginal distribution. Due to the simpler problem assumptions and training procedure, our method may be easier to apply in real-world domains.
Related to our approach are standard maximum action entropy algorithms (Haarnoja et al., 2018; Kappen et al., 2012; Rawlik et al., 2013; Ziebart et al., 2008; Theodorou & Todorov, 2012). While these algorithms are referred to as MaxEnt RL, they are maximizing entropy over actions, not states. These algorithms can be viewed as performing inference on a graphical model where the likelihood of a trajectory is given by its exponentiated reward (Toussaint & Storkey, 2006; Levine, 2018; Abdolmaleki et al., 2018). While distributions over trajectories induce distributions over states, computing the exact relationship requires integrating over all possible trajectories, an intractable problem for most MDPs. A related but distinct class of relative entropy methods use a similar entropy-based objective to limit the size of policy updates (Peters et al., 2010; Schulman et al., 2015).
Finally, the idea of distribution matching has been employed successfully in imitation learning (Ziebart et al., 2008; Ho & Ermon, 2016; Finn et al., 2016; Fu et al., 2017). Similar to some inverse RL algorithms (Ho & Ermon, 2016; Fu et al., 2018), our method iterates between learning a policy and learning a reward function, though our reward function is obtained via a density model instead of a discriminator. While inverse RL algorithms assume access to expert trajectories, we instead assume access to the density of the target state marginal distribution. In many realistic settings, such as robotic control with many degrees of freedom, providing fully-specified trajectories may be much more challenging than defining a target state marginal distribution. The latter only requires some aggregate statistics about expert behavior, and does not even need to be realizable by any policy.
In summary, our work unifies prior exploration methods as performing approximate distribution matching, and explains how state distribution matching can be performed properly. This perspective provides a clearer picture of exploration, and this observation is useful particularly because many of the underlying ingredients, such as adversarial games and density estimation, have seen recent progress and therefore might be adopted to improve exploration methods.
# 3 STATE MARGINAL MATCHING
In this section, we propose the State Marginal Matching problem as a principled objective for learning to explore, and offer an algorithm for optimizing it. We consider a parametric policy $\pi _ { \theta } \in \Pi \triangleq \{ \pi _ { \theta } \mid \theta \in \Theta \}$ that chooses actions $a \in { \mathcal { A } }$ in a Markov Decision Process (MDP) $\mathcal { M }$ with fixed episode lengths $T$ , dynamics distribution $p ( s _ { t + 1 } \mid s _ { t } , a _ { t } )$ , and initial state distribution $p _ { 0 } ( s )$ . The MDP $\mathcal { M }$ together with the policy $\pi _ { \theta }$ form an implicit generative model over states. We define the state marginal distribution $\rho _ { \pi } ( s )$ as the probability that the policy visits state $s$ :
$$\rho _ { \pi } ( s ) \triangleq \mathbb { E } _ { \begin{array} { c } { s _ { 1 } \sim p _ { 0 } ( S ) , } \\ { a _ { t } \sim \pi _ { \theta } ( A \vert s _ { t } ) } \end{array} } \left[ \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { 1 } ( s _ { t } = s ) \right]$$
We emphasize that $\rho _ { \pi } ( s )$ is not a distribution over trajectories, and is not the stationary distribution of the policy after infinitely many steps, but rather the distribution over states visited in a finite-length episode.2 We also note that any trajectory distribution matching problem can be reduced to a state marginal matching problem by augmenting the current state to include all previous states.
We assume that we are given a target distribution $p ^ { * } ( s )$ over states $s \in S$ that encodes our belief about the tasks we may be given at test-time. For example, a roboticist might assign small values of $p ^ { * } ( s )$ to states that are dangerous, regardless of the desired task. Alternatively, we might also learn $p ^ { * } ( s )$ from data about human preferences (Christiano et al., 2017). For goal-reaching tasks, we can analytically derive the optimal target distribution (Appendix C). Given $p ^ { * } ( s )$ , our goal is to find a parametric policy that is “closest” to this target distribution, where we measure discrepancy using the Kullback-Leibler (KL) divergence:
 Figure 1: State Marginal Matching: (Left) Our goal is to learn a policy whose distribution over states (blue histogram) matches some target density (black line). Our algorithm iteratively increases the reward on states visited too infrequently (green arrow) and decreases the reward on states visited too frequently (red arrow). (Center) At convergence, these two distributions are equal. (Right) For complex target distributions, we use a mixture of policies $\begin{array} { r } { { \dot { \rho } } _ { \pi } ( s ) = \int \rho _ { \pi _ { z } } ( s ) p ( z ) d z } \end{array}$ . (See Appendix B.)
$$\begin{array} { r l } { \displaystyle \underset { \pi \in \Pi } { \operatorname* { m a x } } \mathcal { F } ( \rho _ { \pi } ( s ) , p ^ { * } ( s ) ) \triangleq \underset { \pi \in \Pi } { \operatorname* { m a x } } - D _ { \mathrm { K L } } ( \rho _ { \pi } ( s ) \parallel p ^ { * } ( s ) ) } & { } \\ { = \underset { \pi \in \Pi } { \operatorname* { m a x } } \mathbb { E } _ { s \sim \rho _ { \pi } ( s ) } \left[ \log p ^ { * } ( s ) - \log \rho _ { \pi } ( s ) \right] } & { } \\ { = \underset { \pi \in \Pi } { \operatorname* { m a x } } \mathbb { E } _ { s \sim \rho _ { \pi } ( s ) } [ \log p ^ { * } ( s ) ] + \mathcal { H } _ { \pi } [ s ] } \end{array}$$
This is the same objective as in Hazan et al. (2018). Note that we use the reverse-KL (Bishop, 2006), which is mode-seeking (i.e., exploratory). We show in Appendix C that the policies obtained via State Marginal Matching provide an optimal exploration strategy for a particular distribution over reward functions. To gain intuition for the State Marginal Matching objective, we decomposed it in two ways. In Equation 2, we see that State Marginal Matching is equivalent to maximizing the reward function $r ( s ) \triangleq \log p ^ { * } ( s )$ while simultaneously maximizing the entropy of states. Note that, unlike traditional MaxEnt RL algorithms (Ziebart et al., 2008; Haarnoja et al., 2018), we regularize the entropy of the state distribution, not the conditional distribution of actions given states, which results in exploration in the space of states rather than in actions. Moreover, Equation 1 suggests that State Marginal Matching maximizes a pseudo-reward $r ( s ) \triangleq \log p ^ { * } ( s ) - \log \rho _ { \pi } ( s )$ , which assigns positive utility to states that the agent visits too infrequently and negative utility to states visited too frequently (see Figure 1). We emphasize that maximizing this pseudo-reward is not a RL problem because the pseudo-reward depends on the policy.
# 3.1 OPTIMIZING THE STATE MARGINAL MATCHING OBJECTIVE
Optimizing Equation 1 to obtain a single exploration policy is more challenging than standard RL because the reward function itself depends on the policy. To break this cyclic dependency, we introduce a parametric state density model $q _ { \psi } ( s ) \in Q \triangleq \{ q _ { \psi } \mid \psi \in \Psi \}$ to approximate the policy’s state marginal distribution, $\rho _ { \pi } ( s )$ . We assume that the class of density models $Q$ is sufficiently expressive to represent every policy:
Assumption 1. For every policy $\pi \in \Pi$ , there exists $q \in Q$ such that $D _ { K L } ( \rho _ { \pi } ( s ) \parallel q ( s ) ) = 0 .$ .
Under this assumption, optimizing the policy w.r.t. this approximate distribution $q ( s )$ will yield the same solution as Equation 1 (see Appendix A for the proof):
Proposition 3.1. Let policies $\Pi$ and density models $Q$ satisfying Assumption $^ { l }$ be given. For any target distribution $p ^ { * }$ , the following optimization problems are equivalent:
$$\operatorname* { m a x } _ { \pi } \mathbb { E } _ { \rho _ { \pi } ( s ) } [ \log p ^ { * } ( s ) - \log \rho _ { \pi } ( s ) ] = \operatorname* { m a x } _ { \pi } \operatorname* { m i n } _ { q } \mathbb { E } _ { \rho _ { \pi } ( s ) } [ \log p ^ { * } ( s ) - \log q ( s ) ]$$
Solving the new max-min optimization problem is equivalent to finding the Nash equilibrium of a two-player, zero-sum game: a policy player chooses the policy $\pi$ while the density player chooses the density model $q$ . To avoid confusion, we use actions to refer to controls $a \in { \mathcal { A } }$ output by the policy $\pi$ in the traditional RL problem and strategies to refer to the decisions $\pi \in \Pi$ of the policy player and decisions $q \in Q$ of the density player. The Nash existence theorem (Nash, 1951) proves that such a stationary point always exists for such a two-player, zero-sum game.
One common approach to saddle point games is to alternate between updating player A w.r.t. player B, and updating player B w.r.t. player A. However, games such as Rock-Paper-Scissors illustrate that such a greedy approach is not guaranteed to converge to a stationary point. A slight variant,
# Algorithm 1 Learning to Explore via Fictitious Play
<table><tr><td>Input: Target distribution p*(s) Initialize policy π(a | s),density model q(s),and replay buffer B.</td></tr><tr><td>while not converged do</td></tr><tr><td>q(m) ← arg maxqEs~B(m-1)[logq(s)]</td></tr><tr><td>π(m) ← arg maxπ Es~pπ(s)[r(s)] wherer(s)=logp*(s)-logq(m)(s)</td></tr><tr><td>B(m)← B(m-1) U{(st,at,St+1)}T=1 with new transitions{(st,at,St+1)}T=1 sampled from π(m)</td></tr><tr><td>return historical policies {(1),.,π(m)}</td></tr></table>
Algorithm 1: An algorithm for optimizing the State Marginal Matching objective (Equation 1). The algorithm iterates between (1) fitting a density model ${ \boldsymbol q } ^ { ( m ) }$ and (2) training the policy $\bar { \pi } ^ { ( m ) }$ with a RL objective to optimize the expected return w.r.t. the updated reward function $r ( s )$ . The algorithm returns the collection of policies from each iteration, which do distribution matching in aggregate.
fictitious play (Brown, 1951) does converge to a Nash equilibrium in finite time (Robinson, 1951; Daskalakis & Pan, 2014). At each iteration, each player chooses their best strategy in response to the historical average of the opponent’s strategies. In our setting, fictitious play alternates between fitting the density model to the historical average of policies (Equation 4), and updating the policy with RL to minimize the log-density of the state, using a historical average of the density models (Equation 5):
$$\begin{array} { l l } { { q _ { m + 1 } \displaystyle \operatorname * { a r g m a x } _ { q } \mathbb E _ { s \sim \bar { \rho } _ { m } ( s ) } [ \log q ( s ) ] } } & { { \quad \mathrm { w h e r e } \quad \bar { \rho } _ { \pi } ^ { ( m ) } ( s ) \triangleq \displaystyle \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \rho _ { \pi _ { i } } ( s ) } } \\ { { \displaystyle \pi _ { m + 1 } \operatorname * { a r g m a x } _ { \pi } \mathbb E _ { s \sim \rho _ { \pi } ( s ) } \mathbb { I o g } p ^ { * } ( s ) - \log \bar { q } _ { m } ( s ) ] } } & { { \quad \mathrm { ~ w h e r e } \quad \bar { q } _ { m } ( s ) \triangleq \displaystyle \frac { 1 } { m } \sum _ { i = 1 } ^ { m } q _ { i } ( s ) } } \end{array}$$
Crucially, the exploration policy is not the last policy, $\pi _ { m + 1 }$ , but rather the historical average policy:
Definition 3.1. A historical average policy $\bar { \pi } ( \boldsymbol { a } \ \mid \ \boldsymbol { s } )$ , parametrized by a collection of policies $\pi _ { 1 } , \cdots , \pi _ { m }$ , is a policy that randomly samples one of the policy iterates $\pi _ { i } \sim \operatorname { U n i f } [ \pi _ { 1 } , \cdot \cdot \cdot , \pi _ { m } ]$ at the start of each episode and takes actions according to that policy for each step in the episode. A new policy is sampled for the next episode.
We summarize the resulting algorithm in Algorithm 1. In practice, we can efficiently implement Equation 4 and avoid storing the policy parameters from every iteration by instead storing sampled states from each iteration.3 We cannot perform the same trick for Equation 5, and instead resort to approximating the historical average of density models with the most recent iterate. Algorithm 1 looks similar to prior exploration methods based on prediction-error, suggesting that we might use SMM to understand how these prior methods work.
# 4 WHY DOES PREDICTION-ERROR EXPLORATION WORK?
Exploration methods based on prediction error (Burda et al., 2018; Stadie et al., 2015; Pathak et al., 2017; Schmidhuber, 1991; Chentanez et al., 2005) do not converge to an exploratory policy, even in the absence of extrinsic reward. For example, consider the asymptotic behavior of ICM (Pathak et al., 2017) in a deterministic MDP, such as the Atari games where it was evaluated. At convergence, the predictive model will have zero error in all states, so the exploration bonus is zero – the ICM objective has no effect on the policy at convergence. Similarly, consider the exploration bonus in Pseudocounts (Bellemare et al., 2016): $1 / \hat { n } ( s )$ , where $\hat { n } ( s )$ is the (estimated) number of times that state $s$ has been visited. In the infinite limit, each state has been visited infinitely many times, so the Pseudocount exploration bonus also goes to zero — Pseudocounts has no effect at convergence. Similar reasoning can be applied to other methods based on prediction error (Burda et al., 2018; Stadie et al., 2015). More broadly, we can extend this analysis to stochastic MDPs, where we consider an abstract exploration algorithm that alternates between computing some intrinsic reward and performing RL (to convergence) on that intrinsic reward. Existing prediction-error exploration methods are all special cases. At each iteration, the RL step solves a fully-observed MDP, which always admits a deterministic policy as a solution (Puterman, 2014). Thus, any exploration algorithm in this class cannot converge to a single, exploratory policy.
 Figure 2: Exploration in State Space (SMM) vs. Action Space (SAC) for Navigation: (a): A point-mass agent is spawned at the center of $m$ long hallways that extend radially outward, and the target state distribution places uniform probability mass $\frac { 1 } { m }$ at the end of each hallway. We can vary the length of the hallway and the number of hallways to control the task difficulty. (b) A heatmap showing states visited by SAC and SMM during training illustrates that SMM explores a wider range of states. (c) SMM reaches more goals than the MaxEnt baseline. SM4 is an extension of SMM that incorporates mixture modelling with $n > 1$ skills (see Appendix B), and further improves exploration of SMM.
Despite these observations, prior methods do excel at solving hard exploration tasks. We draw an analogy to fictitious play to explain their success. While these methods never acquire an exploratory policy, over the course of training they will eventually visit all states. In other words, the historical average over policies will visit a wide range of states. Since the replay buffer exactly corresponds to this historical average over states, these methods will obtain a replay buffer with a diverse range of experience, possibly explaining why they succeed at solving hard exploration tasks. Moreover, this analysis suggests a surprisingly simple method for obtaining an exploration from these prior methods: use a mixture of the policy iterates throughout training. The following section will not only compare SMM against prior exploration methods, but also show that this historical averaging trick can be used to improve existing exploration methods.
# 5 SIMULATED EXPERIMENTS
We used simulated control tasks to determine if SMM learns an exploratory policy, to compare SMM to prior exploration methods, and to study the effect of historical averaging. More details can be found in Appendix D, and code will be released upon publication.
Baselines and Implementation Details: We compare to a state-of-the-art off-policy MaxEnt RL algorithm, Soft Actor-Critic (SAC) (Haarnoja et al., 2018); an inverse RL algorithm, Generative Adversarial Imitation Learning (GAIL) (Ho & Ermon, 2016); and three exploration methods:
• Count-based Exploration (C), which discretizes states and uses − $\log \hat { \pi } ( s )$ as an exploration bonus • Pseudo-counts (PC) (Bellemare et al., 2016), which uses the recoding probability as a bonus. • Intrinsic Curiosity Module (ICM) (Pathak et al., 2017), which uses prediction error as a bonus.
We used SAC as the base RL algorithm for all exploration methods (SMM, C, PC, ICM). To implement SMM, we define the target distribution in terms of the extrinsic environment reward: $p ^ { * } \bar { ( } s ) \propto \exp ( r _ { \mathrm { e n v } } ( s ) )$ . We use a variational autoencoder (VAE) to model the density $q ( s )$ for both SMM and Pseudocounts (PC). For the GAIL baseline, we generated synthetic expert data by sampling expert states from the target distribution $p ^ { * } ( s )$ (see Appendix D.2 for details). Results for all experiments are averaged over 4-5 random seeds.
We start with a sanity check: Is exploration in state space (as done by SMM) better than exploration in action space (as done by MaxEnt RL, e.g., SAC)? To study this question, we implemented a 2D Navigation environment, shown in Figure 2a. To evaluate each method, we counted the number of hallways that the agent fully explored (i.e., reached the end) during training. Figure 2b shows the state visitations for the three hallway environment, illustrating that SAC only explores one hallway, whereas SMM explores all three. Figure 2c also shows that SMM consistently explores $60 \%$ of hallways, whereas SAC rarely visits more than $20 \%$ of hallways.
The remaining simulated experiments used the Manipulation environment (Plappert et al., 2018), shown in Figure 3a. Our first experiment evaluates whether the exploration policy acquired by SMM allows us to solve downstream tasks more quickly. We defined the target distribution to be uniform over the entire state space (joint $^ +$ block configuration), with the constraints that we put low probability mass on states where the block has fallen off the table; that actions should be small; and that the arm should be close to the object. As shown in Figure 3b, SMM adapts substantially more quickly than other exploration methods, achieving a success rate $20 \%$ higher than the next best method, and reaching the same level of performance of the next baseline (ICM) in $4 \mathbf { x }$ fewer episodes. SMM without historical averaging attains similar performance as the next best baseline (ICM), suggesting that historical averaging is the key ingredient, while the particular choice of prediction error or VAE is less important. We provide further ablation studies of SMM in Appendix B.2.
 Figure 3: Exploration for Manipulation. (a) Task: The robot agent controls a single gripper arm to move a block object to a goal location on the table surface. The goal is not observed by the robot, thus requiring the robot to explore by moving the block to different locations on the table. (b) Test-Time Exploration: At test-time, we sample goal locations uniformly on the table, and plot the percentage of goals found within $N$ episodes. SMM and its mixture-model variant SM4 (Algorithm 2) both explore faster than the baselines, allowing it to successfully find the goal in fewer episodes. (c) State Entropy: After training, we rollout the policy for 1e3 epochs, and record the entropy of the object and gripper positions. SMM achieves higher state entropy than the other methods. Historical averaging also improves the exploration of prior methods. (d) Non-Uniform Exploration: We measure the discrepancy between the state marginal distribution, $\rho _ { \pi } ( s )$ , and a non-uniform target distribution. SMM matches the target distribution better than SAC and is on par with Count. Error bars show std. dev. across 4 random seeds.
While historical averaging is necessary to guarantee convergence $( \ S \ 3 . 1 )$ , most prior exploration methods do not employ historical averaging, raising the question of whether it is necessary in practice. To answer this question, we compare SMM to three exploration methods. In Figure 3c, we compare the policy obtained at convergence with the historical average of policy iterates over training for each method. We measure how well each method explores by computing the marginal state entropy, which we compute by discretizing the state space.4 The results show that SMM maximizes state entropy at least as effectively as prior methods, if not better. While this comparison is somewhat unfair, as we measure exploration using the objective that SMM maximizes, none of the methods we compare against propose metrics for exploration that we could use instead. Furthermore, we see that historical averaging is not only beneficial to SMM, but also improves the exploration of prior methods.
In our final simulated experiment, we check whether prior knowledge injected via the target distribution is reflected in the policy obtained from State Marginal Matching. Using the same Manipulation environment as above, we modified the target distribution to assign larger probability to states where the block was on the left half of the table than on the right half. In Figure 3d, we measure whether SMM is able to achieve the target distribution by measuring the discrepancy between the block’s horizontal coordinate and the target distribution. Compared to the SAC baseline, SMM and the Count baseline are half the distance to the target distribution. No method achieves zero discrepancy, suggesting that future methods could be better at matching state marginals.
# 6 REAL-WORLD EXPERIMENTS
While almost all research on exploration focus on simulated domains, attributes of the real world such as partial observability, nonstationarity, and stochasticity may make the exploration more challenging. The aim of this section is to see if SMM explores effectively on a real-world robotic control task. We used the $D$ ’Claw (Ahn et al., 2019) robotic manipulator, which is a 3-fingered hand positioned vertically above a handle that it can turn. For all experiments on the $D$ ’Claw, we used a target distribution that places uniform mass over all object angles $\left[ - 1 8 0 ^ { \circ } , 1 8 0 ^ { \circ } \right]$ .
 Figure 4: Real-World Exploration: (a) D’Claw is a 9-DoF robotic hand (Ahn et al., 2019) that is trained to turn a valve object. (b) Sim2Real: We trained each algorithm in simulation, and then measured how far the trained policy rotated the knob on the hardware robot. We also measured the maximum angle that the agent turned the knob in the clockwise and counter-clockwise directions within one episode. (c) Training on Hardware: We trained SAC and SMM on the real robot for 1e5 environment steps (about 9 hours in real time), and measured the maximum angle turned throughout training. We see that SMM moves the knob more and visits a wider range of states than SAC. All results are averaged over 4-5 seeds.
In a first experiment, we trained SMM and other baselines in simulation, and then evaluated the acquired exploration policy on the real robot using two metrics: the total number of rotations (in either direction), and the maximum radians turned (in both directions). For each method, we computed the average metric across 100 evaluation episodes. We repeated this process for 5 independent training runs. Figure 4b shows that SMM turns the knob more than the baselines, and it turns the knob to a wider range of angles. To test for statistical significance, we used a 1-sided Student’s t-test to test the hypothesis that SMM turned the knob more and to a wider range of angles than SAC. The p-values were all less than 0.05: $p = 0 . 0 4 6$ for number of rotations, $p = 0 . 0 1 9$ for maximum clockwise angle, and $p = 0 . 0 0 1$ for maximum counter-clockwise angle.
In our second experiment, we investigated whether it was possible to learn an exploration policy directly in the real world, without the need for a simulator. Learning to explore in the real world is quite important, as building faithful simulators of complex systems is challenging. The physical constraints of the real robot make data efficiency paramount, suggesting that learning to explore will require an effective exploration strategy. In Figure $_ { 4 \mathrm { c } }$ , we plot the range of angles that the policy explores throughout training. Not only does SMM explore a wider range of angles than SAC, but its ability to explore increases throughout training, suggesting that the SMM objective is correlated with real-world metrics of exploration.
In summary, the results in this section suggests that exploration techniques may actually be useful in the real world, which may encourage future work to study exploration methods on real-world tasks.
# 7 DISCUSSION
In this paper, we introduced a formal objective for exploration. While it is often unclear what existing exploration algorithms will converge to, our State Marginal Matching objective has a clear solution: at convergence, the policy should visit states in proportion to their density under a target distribution. Not only does this objective encourage exploration, it also provides human users with a flexible mechanism to bias exploration towards states they prefer and away from dangerous states. Upon convergence, the resulting policy can thereafter be used as a prior in a multi-task setting, amortizing exploration and enabling faster adaptation to new, potentially sparse, reward functions. The algorithm we proposed looks quite similar to previous exploration methods based on prediction error, suggesting that those methods are also performing some form of distribution matching. However, by deriving our method from first principles, we note that these prior methods omit a crucial historical averaging step, without which the algorithm is not guaranteed to converge. Experiments on both simulated and real-world tasks demonstrated how SMM learns to explore, enabling an agent to efficiently explore in new tasks provided at test time.
In future work, we aim to study connections between inverse RL, MaxEnt RL and state marginal matching, all of which perform some form of distribution matching. Empirically, we aim to scale to more complex tasks by parallelizing the training of all mixture components simultaneously. Broadly, we expect the state distribution matching problem formulation to enable the development of more effective and principled RL methods that reason about distributions rather than individual states.
# REFERENCES
Abbas Abdolmaleki, Jost Tobias Springenberg, Yuval Tassa, Remi Munos, Nicolas Heess, and Martin Riedmiller. Maximum a posteriori policy optimisation. arXiv preprint arXiv:1806.06920, 2018.
Joshua Achiam, Harrison Edwards, Dario Amodei, and Pieter Abbeel. Variational option discovery algorithms. arXiv preprint arXiv:1807.10299, 2018.
David Barber Felix Agakov. The im algorithm: a variational approach to information maximization. Advances in Neural Information Processing Systems, 16:201, 2004.
Michael Ahn, Henry Zhu, Kristian Hartikainen, Hugo Ponte, Abhishek Gupta, Sergey Levine, and VIKASH KUMAR. ROBEL: RObotics BEnchmarks for Learning with low-cost robots. In Conference on Robot Learning (CoRL), 2019.
Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems, pp. 1471–1479, 2016.
Christopher M Bishop. Pattern recognition and machine learning. springer, 2006.
G. Brown. Iterative solution of games by fictitious play. Activity Analysis of Production and Allocation, 1951.
Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018.
Nuttapong Chentanez, Andrew G Barto, and Satinder P Singh. Intrinsically motivated reinforcement learning. In Advances in neural information processing systems, pp. 1281–1288, 2005.
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, pp. 4299–4307, 2017.
John D Co-Reyes, YuXuan Liu, Abhishek Gupta, Benjamin Eysenbach, Pieter Abbeel, and Sergey Levine. Self-consistent trajectory autoencoder: Hierarchical reinforcement learning with trajectory embeddings. arXiv preprint arXiv:1806.02813, 2018.
Cédric Colas, Olivier Sigaud, and Pierre-Yves Oudeyer. Curious: Intrinsically motivated multi-task, multi-goal reinforcement learning. arXiv preprint arXiv:1810.06284, 2018.
Constantinos Daskalakis and Qinxuan Pan. A counter-example to karlin’s strong conjecture for fictitious play. In 2014 IEEE 55th Annual Symposium on Foundations of Computer Science, pp. 11–20. IEEE, 2014.
Maria Dimakopoulou and Benjamin Van Roy. Coordinated exploration in concurrent reinforcement learning. arXiv preprint arXiv:1802.01282, 2018.
Yan Duan, John Schulman, Xi Chen, Peter L Bartlett, Ilya Sutskever, and Pieter Abbeel. Rl2: Fast reinforcement ˆ learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016.
Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018.
Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, pp. 49–58, 2016.
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1126– 1135. JMLR. org, 2017.
Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, et al. Noisy networks for exploration. arXiv preprint arXiv:1706.10295, 2017.
Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248, 2017.
Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adverserial inverse reinforcement learning. In International Conference on Learning Representations, 2018. URL https://openreview. net/forum?id $_ { \cdot } =$ rkHywl-A-.
Abhishek Gupta, Russell Mendonca, YuXuan Liu, Pieter Abbeel, and Sergey Levine. Meta-reinforcement learning of structured exploration strategies. In Advances in Neural Information Processing Systems, pp. 5302–5311, 2018.
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.
Elad Hazan, Sham M Kakade, Karan Singh, and Abby Van Soest. Provably efficient maximum entropy exploration. arXiv preprint arXiv:1812.02690, 2018.
David Held, Xinyang Geng, Carlos Florensa, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. arXiv preprint arXiv:1705.06366, 2017.
Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Vime: Variational information maximizing exploration. In Advances in Neural Information Processing Systems, pp. 1109–1117, 2016.
Leslie Pack Kaelbling. Learning to achieve goals. In IJCAI, pp. 1094–1099. Citeseer, 1993.
Hilbert J Kappen, Vicenç Gómez, and Manfred Opper. Optimal control as a graphical model inference problem. Machine learning, 87(2):159–182, 2012.
Sergey Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909, 2018.
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.
Nancy A Lynch. Distributed algorithms. Elsevier, 1996.
Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive meta-learner. arXiv preprint arXiv:1707.03141, 2017.
Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, pp. 9191–9200, 2018.
John Nash. Non-cooperative games. Annals of mathematics, pp. 286–295, 1951.
Pierre-Yves Oudeyer, Frdric Kaplan, and Verena V Hafner. Intrinsic motivation systems for autonomous mental development. IEEE transactions on evolutionary computation, 11(2):265–286, 2007.
Emilio Parisotto, Soham Ghosh, Sai Bhargav Yalamanchi, Varsha Chinnaobireddy, Yuhuai Wu, and Ruslan Salakhutdinov. Concurrent meta reinforcement learning. arXiv preprint arXiv:1903.02710, 2019.
Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by selfsupervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 16–17, 2017.
Jan Peters, Katharina Mulling, and Yasemin Altun. Relative entropy policy search. In Twenty-Fourth AAAI Conference on Artificial Intelligence, 2010.
Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv preprint arXiv:1706.01905, 2017.
Matthias Plappert, Marcin Andrychowicz, Alex Ray, Bob McGrew, Bowen Baker, Glenn Powell, Jonas Schneider, Josh Tobin, Maciek Chociej, Peter Welinder, et al. Multi-goal reinforcement learning: Challenging robotics environments and request for research. arXiv preprint arXiv:1802.09464, 2018.
Vitchyr H Pong, Murtaza Dalal, Steven Lin, Ashvin Nair, Shikhar Bahl, and Sergey Levine. Skew-fit: Statecovering self-supervised reinforcement learning. arXiv preprint arXiv:1903.03698, 2019.
Martin L Puterman. Markov Decision Processes.: Discrete Stochastic Dynamic Programming. John Wiley & Sons, 2014.
Kate Rakelly, Aurick Zhou, Deirdre Quillen, Chelsea Finn, and Sergey Levine. Efficient off-policy metareinforcement learning via probabilistic context variables. arXiv preprint arXiv:1903.08254, 2019.
Konrad Rawlik, Marc Toussaint, and Sethu Vijayakumar. On stochastic optimal control and reinforcement learning by approximate inference. In Twenty-Third International Joint Conference on Artificial Intelligence, 2013.
Julia Robinson. An iterative method of solving a game. Annals of mathematics, pp. 296–301, 1951.
Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function approximators. In International conference on machine learning, pp. 1312–1320, 2015.
Jürgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building neural controllers. In Proc. of the international conference on simulation of adaptive behavior: From animals to animats, pp. 222–227, 1991.
Jürgen Schmidhuber. Formal theory of creativity, fun, and intrinsic motivation (1990–2010). IEEE Transactions on Autonomous Mental Development, 2(3):230–247, 2010.
John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pp. 1889–1897, 2015.
Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. arXiv preprint arXiv:1507.00814, 2015.
Adrien Ali Taïga, William Fedus, Marlos C Machado, Aaron Courville, and Marc G Bellemare. Benchmarking bonus-based exploration methods on the arcade learning environment. arXiv preprint arXiv:1908.02388, 2019.
Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, OpenAI Xi Chen, Yan Duan, John Schulman, Filip DeTurck, and Pieter Abbeel. # exploration: A study of count-based exploration for deep reinforcement learning. In Advances in neural information processing systems, pp. 2753–2762, 2017.
Evangelos A Theodorou and Emanuel Todorov. Relative entropy and free energy dualities: Connections to path integral and kl control. In 2012 IEEE 51st IEEE Conference on Decision and Control (CDC), pp. 1466–1473. IEEE, 2012.
Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033. IEEE, 2012.
Marc Toussaint and Amos Storkey. Probabilistic inference for solving discrete and continuous state markov decision processes. In Proceedings of the 23rd international conference on Machine learning, pp. 945–952. ACM, 2006.
Dan Xie, Sinisa Todorovic, and Song-Chun Zhu. Inferring "dark matter" and "dark energy" from videos. In The IEEE International Conference on Computer Vision (ICCV), December 2013.
Tianbing Xu, Qiang Liu, Liang Zhao, and Jian Peng. Learning to explore with meta-policy gradient. arXiv preprint arXiv:1803.05044, 2018.
Henry Zhu, Abhishek Gupta, Aravind Rajeswaran, Sergey Levine, and Vikash Kumar. Dexterous manipulation with deep reinforcement learning: Efficient, general, and low-cost. In International Conference on Robotics and Automation, ICRA 2019, Montreal, QC, Canada, May 20-24, 2019, pp. 3651–3657, 2019. doi: 10.1109/ ICRA.2019.8794102. URL https://doi.org/10.1109/ICRA.2019.8794102.
Brian D Ziebart. Modeling purposeful adaptive behavior with the principle of maximum causal entropy. 2010.
Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In Aaai, volume 8, pp. 1433–1438. Chicago, IL, USA, 2008.
Brian D Ziebart, Nathan Ratliff, Garratt Gallagher, Christoph Mertz, Kevin Peterson, J Andrew Bagnell, Martial Hebert, Anind K Dey, and Siddhartha Srinivasa. Planning-based prediction for pedestrians. In 2009 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 3931–3936. IEEE, 2009.
# A PROOFS
Proof of Proposition 3.1. Note that
$$\mathbb { E } _ { \rho _ { \pi } ( s ) } [ \log p ^ { * } ( s ) - \log q ( s ) ] = \mathbb { E } _ { \rho _ { \pi } ( s ) } [ \log p ^ { * } ( s ) - \log \rho _ { \pi } ( s ) ] + D _ { \mathrm { K L } } ( \rho _ { \pi } ( s ) \parallel q ( s ) ) .$$
By Assumption 1, $D _ { \mathrm { K L } } ( \rho _ { \pi } ( s ) \parallel q ( s ) ) = 0$ for some $q \in Q$ , so we obtain the desired result:
$$\begin{array} { l } { \displaystyle \operatorname* { m a x } _ { \boldsymbol \pi } \bigg ( \operatorname* { m i n } _ { \boldsymbol q } \mathbb { E } _ { \rho _ { \boldsymbol \pi } ( s ) } \big [ \log p ^ { * } ( s ) - \log q ( s ) \big ] \bigg ) = \operatorname* { m a x } _ { \boldsymbol \pi } \bigg ( \mathbb { E } _ { \rho _ { \boldsymbol \pi } ( s ) } \big [ \log p ^ { * } ( s ) - \log \rho _ { \boldsymbol \pi } ( s ) \big ] + \operatorname* { m i n } _ { \boldsymbol q } D _ { \mathrm { K L } } \big ( \rho _ { \boldsymbol \pi } ( s ) \ \big \| } \\ { \displaystyle \qquad = \operatorname* { m a x } _ { \boldsymbol \pi } \mathbb { E } _ { \rho _ { \boldsymbol \pi } ( s ) } \big [ \log p ^ { * } ( s ) - \log \rho _ { \boldsymbol \pi } ( s ) \big ] . \qquad \quad \qquad \quad \big | } \end{array}$$
# B BETTER MARGINAL MATCHING WITH MIXTURES OF MIXTURES
This section introduces an extension of SMM, SM4, that incorporates mixure modelling. Given the challenging problem of exploration in large state spaces, it is natural to wonder whether we can accelerate exploration by automatically decomposing the potentially-multimodal target distribution into a mixture of “easier-to-learn” distributions and learn a corresponding set of policies to do distribution matching for each component. Note that the mixture model we introduce here is orthogonal to the historical averaging step discussed before. Using $\rho _ { \pi _ { z } } ( s )$ to denote the state distribution of the policy conditioned on the latent variable $z \in { \mathcal { Z } }$ , the state marginal distribution of the mixture of policies is
$$\rho _ { \pi } ( s ) = \int _ { \mathcal Z } \rho _ { \pi _ { z } } ( s ) p ( z ) d z = \mathbb { E } _ { z \sim p ( z ) } \left[ \rho _ { \pi _ { z } } ( s ) \right] ,$$
where $p ( z )$ is a latent prior. As before, we will minimize the $\mathrm { K L }$ divergence between this mixture distribution and the target distribution. Using Bayes’ rule to re-write $\rho _ { \pi } ( s )$ in terms of conditional probabilities, we obtain the following optimization problem:
$$\operatorname* { m a x } _ { \pi _ { z } ) _ { z \in z } } \mathbb { E } _ { \underset { s \sim p _ { \pi _ { z } } ( s ) } { z } } \left[ \log \frac { p ^ { * } ( s ) } { \frac { \rho _ { \pi _ { z } } ( s ) p ( z ) } { p ( z | s ) } } \right] = \mathbb { E } _ { \underset { s \sim \rho _ { \pi _ { z } } ( s ) } { z \sim p ( z ) } } \left[ \underbrace { \log p ^ { * } ( s ) } _ { ( a ) } - \underbrace { \log \rho _ { \pi _ { z } } ( s ) } _ { ( b ) } + \underbrace { \log p ( z \mid s ) } _ { ( c ) } - \underbrace { \log p ( z ) } _ { ( d ) } \right]$$
Intuitively, this says that the agent should go to states (a) with high density under the target state distribution, (b) where this agent has not been before, and (c) where this agent is clearly distinguishable from the other agents. The last term (d) says to explore in the space of mixture components $z$ . This decomposition bears a resemblance to the mutual-information objectives in recent work (Achiam et al., 2018; Eysenbach et al., 2018; Co-Reyes et al., 2018). Thus, one interpretation of our work is as explaining that mutual information objectives almost perform distribution matching. The caveat is that prior work omits the state entropy term $- \log \rho _ { \pi _ { z } } ( s )$ which provides high reward for visiting novel states, possibly explaining why these previous works have failed to scale to complex tasks.
# B.1 ALGORITHMIC SUMMARY
We summarize the resulting procedure in Algorithm 2, which we refer to as SM4 (State Marginal Matching with Mixtures of Mixtures). The algorithm (1) fits a density model $q _ { z } ^ { ( m ) } ( s )$ to approximate the state marginal distribution for each policy $\pi _ { z }$ ; (2) learns a discriminator $d ^ { ( m ) } ( z \mid s )$ to predict which policy $\pi _ { z }$ will visit state $s$ ; and (3) uses RL to update each policy $\pi _ { z }$ to maximize the expected return of its corresponding reward function $r _ { z } ( s ) \triangleq \log p ^ { * } ( s ) - \log \rho _ { \pi _ { z } } ( s ) + \log p ( z \mid s ) - \log p ( z )$ derived in Equation 8.
The only difference from Algorithm 1 is that we learn a discriminator $d ( z \mid s )$ , in addition to updating the density models $q _ { z } ( s )$ and the policies $\pi _ { z } ( a \mid s )$ . Jensen’s inequality tells us that maximizing the log-density of the learned discriminator will maximize a lower bound on the true density (see Agakov (2004)):
$$\mathbb { E } _ { s \sim \rho _ { \pi _ { z } } ( s ) , z \sim p ( z ) } [ \log d ( z \mid s ) ] \le \mathbb { E } _ { s \sim \rho _ { \pi _ { z } } ( s ) , z \sim p ( z ) } [ \log p ( z \mid s ) ]$$
# Algorithm 2 State Marginal Matching with Mixtures of Mixtures (SM4)
<table><tr><td>Input: Target distribution p*(s) Initialize policy πz(a | s),density model qz(s), discriminator d(z | s),and replay buffer B. while not converged do >(1) Update density model for each policy πz.</td></tr><tr><td>for z = 1,.. ,n do</td></tr><tr><td>d(m) ← arg maxdE(z,s)~B(m-1)[logd(z | s)] > (2) Update discriminator.</td></tr><tr><td>for z = 1,.. ,n do r(m)(s)=logp*(s)-logm)(s)+lgd(m)(z|s)-logp(z)</td></tr><tr><td>π(m)← argmaxx Ep(s) [(m)(s)] (3) Update each policy Tz.</td></tr><tr><td>Sample latent skill z(m) ~ p(z)</td></tr><tr><td>Sample transitions {(Sst,at,St+1)}T=1 with πm (m)(a|s) return {π(1),</td></tr></table>
Algorithm 2. An algorithm for learning a mixture of policies $\pi _ { 1 } , \pi _ { 2 } , \cdots , \pi _ { n }$ that do state marginal matching in aggregate. The algorithm (1) fits a density model $\overset { \cdot } { q } _ { z } ^ { ( m ) } ( s )$ to approximate the state marginal distribution for each policy $\pi _ { z }$ ; (2) learns a discriminator $d ^ { ( m ) } ( z \mid s )$ to predict which policy $\pi _ { z }$ will visit state $s$ ; and (3) uses RL to update each policy $\pi _ { z }$ to maximize the expected return of its corresponding reward function derived in Equation 8: $r _ { z } ( s ) \triangleq \log p ^ { * } ( s ) - \log \rho _ { \pi _ { z } } ( s ) + \log p ( z \mid s ) - \log p ( z )$ . In our implementation, the density model $q _ { z } \left( s \right)$ is a VAE that inputs the concatenated vector $\{ s , z \}$ of the state $s$ and the latent skill $z$ used to obtain this sample $s$ ; and the discriminator is a feedforward MLP. The algorithm returns the historical average of mixtures of policies (a total of $n \cdot m$ policies).
In our implementation, the density model $q _ { z } ( s )$ is a VAE that inputs the concatenated vector $\{ s , z \}$ of the state $s$ and the latent skill $z$ used to obtain this sample $s$ ; and the discriminator is a feedforward MLP. The algorithm returns the historical average of mixtures of policies (a total of $n \cdot m$ policies). Our implementation uses a uniform categorical distribution for the prior $p ( z )$ , and does not implement the update for $p ( z )$ .
Note that the updates for each $z$ can be conducted in parallel. A distributed implementation would emulate broadcast-collect algorithms (Lynch, 1996), with each worker updating the policy independently, and periodically aggregating results to update the discriminator $\bar { d } ( z \mid s )$ . Such a distributed implementation has the appealing property that each compute node would explore a different part of the state space. While there has been some work on multi-agent coordinated exploration (Parisotto et al., 2019) and concurrent exploration (Dimakopoulou & Van Roy, 2018), it remains a fairly unexplored area (pun intended) and we believe that SMM with Mixtures of Mixtures offers a simple approach to this problem.
# B.2 ABLATION STUDY
To understand the relative contribution of each component in the SM4 objective (Equation 8), we compare SM4 to baselines that lack conditional state entropy $\mathcal { H } _ { \pi _ { z } } [ s ] = - \log \rho _ { \pi _ { z } } ( s )$ , latent conditional action entropy $\log p ( z \mid s )$ , or both (i.e, SAC). In Figure 5a, we plot the training time performance on the Navigation task with 3 halls of length 50. We see that SM4 relies heavily on both key differences from SAC.
In Figure 5b, we study the effect of mixture modelling on test-time exploration in the Manipulation environment. After running SMM/SM4 with a uniform distribution, we count the number of episodes required to find an (unknown) goal state. We run each method for the same number of environment transitions; a mixture of three policies does not get to take three times more transitions. We find that increasing the number of mixture components increases the agents success. However, the effect was smaller when using historical averaging. Taken together, this result suggests that efficient exploration requires either historical averaging or mixture modelling, but might not need both.
 Figure 5: Ablation Analysis of State Marginal Matching with Mixtures of Mixtures (SM4). (a): On the Navigation task, we compare SM4 (with three mixture components) against ablation baselines that lack conditional state entropy, latent conditional action entropy, or both (i.e., SAC) in the SM4 objective (Equation 8). We see that both terms contribute heavily to the exploration ability of SM4, but the state entropy term is especially critical. (b): We compare SMM/SM4 with different numbers of mixtures, and with vs. without historical averaging. We found that increasing the number of latent mixture components $n \in \{ 1 , 2 , 4 \}$ accelerates exploration, as does historical averaging. Error bars show std. dev. across 4 random seeds.
# C CHOOSING $p ^ { * } ( s )$ FOR GOAL-REACHING TASKS
In general, the choice of the target distribution $p ^ { * } ( s )$ will depend on the distribution of test-time tasks. In this section, we consider the special case where the test-time tasks correspond to goal-reaching derive the optimal target distribution $p ^ { * } ( s )$ . We consider the setting where goals $g \sim p _ { g } ( g )$ are sampled from some known distribution. Our goal is to minimize the number of episodes required to reach that goal state. We define reaching the goal state as visiting a state that lies within an $\epsilon$ ball of the goal, where both $\epsilon > 0$ and the distance metric are known.
We start with a simple lemma that shows that the probability that we reach the goal at any state in a trajectory is at least the probability that we reach the goal at a randomly chosen state in that same trajectory. Defining the binary random variable $z _ { t } \triangleq \mathbb { 1 } ( \left. s _ { t } - g \right. \leq \epsilon )$ as the event that the state at time $t$ reaches the goal state, we can formally state the claim as follows:
Lemma C.1.
$$p \left( \sum _ { t = 1 } ^ { T } z _ { t } > 0 \right) \geq p ( z _ { \mathbf { t } } ) \qquad w h e r e \quad \mathbf { t } \sim U n i f [ 1 , \cdots , H ]$$
Proof. We start by noting the following implication:
$$z _ { \mathbf { t } } = 1 \implies \sum _ { t = 1 } ^ { T } z _ { t } > 0$$
Thus, the probability of the event on the RHS must be at least as large as the probability of the event on the LHS:
$$p ( z _ { \mathbf { t } } ) \leq p \left( \sum _ { t = 1 } ^ { T } z _ { t } > 0 \right)$$
Next, we look at the expected number of episodes to reach the goal state. Since each episode is independent, the expected hitting time is simply
$$\mathrm { H I T T I N G T I M E } ( s ) = { \frac { 1 } { p ( { \mathrm { s o m e ~ s t a t e ~ r e a c h e s ~ } } s ) } } = { \frac { 1 } { p \left( \sum _ { t = 1 } ^ { T } z _ { t } > 0 \right) } } \leq { \frac { 1 } { p ( z _ { \mathbf { t } } ) } }$$
Note that we have upper-bounded the hitting time using Lemma C.1. Since the goal $g$ is a random variable, we take an expectation over $g$ :
$$\mathbb { E } _ { s \sim p _ { g } ( s ) } \left[ \mathrm { H I T T I N G T I M E } ( s ) \right] \le \mathbb { E } _ { s \sim p ( s ) } \left[ \frac { 1 } { p ( z _ { \mathbf { t } } ) } \right]$$
We can rewrite the RHS using $p ^ { * } ( s )$ to denote the target state marginal distribution:
$$\mathbb { E } _ { s \sim p ^ { * } ( s ) } \left[ \mathrm { H r T T I N G T I M E } ( s ) \right] \le \mathbb { E } _ { s \sim p _ { g } ( s ) } \left[ \frac { 1 } { \int p ^ { * } ( \tilde { s } ) \mathbb { 1 } ( \| s - \tilde { s } \| \le \epsilon ) d \tilde { s } } \right] \triangleq \mathcal { F } ( p ^ { * } )$$
We will minimize $\mathcal { F }$ , an upper bound on the expected hitting time.
Lemma C.2. The state marginal distribution $\begin{array} { r l r } { p ^ { * } ( s ) } & { { } \propto } & { \sqrt { \tilde { p } ( s ) } } \end{array}$ minimizes $\mathcal { F } ( p ^ { * } )$ , where $\begin{array} { r } { \tilde { p } ( s ) \triangleq \int p _ { g } ( \tilde { s } ) \mathbb { 1 } ( \lVert s - \tilde { s } \rVert \leq \epsilon ) d \tilde { s } } \end{array}$ is a smoothed version of the target density.
Before presenting the proof, we provide a bit of intuition. In the case where $\epsilon \to 0$ , the optimal target distribution is $p ^ { * } ( s ) \propto \sqrt { p _ { g } ( s ) }$ . For non-zero $\epsilon$ , the policy in Lemma C.2 is equivalent to convolving $p _ { g } ( s )$ with a box filter before taking the square root. In both cases, we see that the optimal policy does distribution matching to some function of the goal distribution. Note that $\tilde { p } ( \cdot )$ may not sum to one and therefore is not a proper probability distribution.
Proof. We start by forming the Lagrangian:
$$\mathcal { L } ( p ^ { * } ) \triangleq \int \frac { p _ { g } ( s ) } { \int p ^ { * } ( \tilde { s } ) \mathbb { 1 } ( \lVert s - \tilde { s } \rVert \leq \epsilon ) d \tilde { s } } d s + \lambda \left( \int p ^ { * } ( \tilde { s } ) d \tilde { s } - 1 \right)$$
The first derivative is
$$\frac { d \mathcal { L } } { d p ^ { * } ( \tilde { s } ) } = \int \frac { - p _ { g } ( s ) \mathbb { 1 } ( \lVert s - \tilde { s } \rVert \leq \epsilon ) } { { p ^ { * } } ^ { 2 } ( \tilde { s } ) } d s + \lambda = 0$$
Note that the second derivative is positive, indicating that this Lagrangian is convex, so all stationary points must be global minima:
$$\frac { d ^ { 2 } \mathcal { L } } { d p ^ { \ast } ( \tilde { s } ) ^ { 2 } } = \int \frac { 2 p _ { g } ( s ) \mathbb { 1 } ( \| s - \tilde { s } \| \leq \epsilon ) } { { p ^ { \ast } } ^ { 3 } ( \tilde { s } ) } d s > 0$$
Setting the first derivative equal to zero and rearranging terms, we obtain
$$\pi ( { \tilde { s } } ) \propto \sqrt { \int p _ { g } ( s ) \mathbb { 1 } ( \| s - { \tilde { s } } \| \leq \epsilon ) d s }$$
Renaming ${ \tilde { s } } s$ , we obtain the desired result.
# C.1 CONNECTIONS TO GOAL-CONDITIONED RL
Goal-Conditioned RL (Kaelbling, 1993; Nair et al., 2018; Held et al., 2017) can be viewed as a special case of State Marginal Matching when the goal-sampling distribution is learned jointly with the policy. In particular, consider the State Marginal Matching with a mixture policy (Algorithm 2), where the mixture component $z$ maps bijectively to goal states $g$ . In this case, we learn goal-conditioned policies of the form $\pi ( \boldsymbol { a } \mid s , g )$ . We start by swapping $g$ for $z$ in the SMM objective with Mixtures of Policies (Equation 8):
$$D _ { \mathrm { K L } } ( \rho _ { \pi } ( s ) \parallel p ^ { * } ( s ) ) = \mathbb { E } _ { \underset { s \sim \pi ( s | g ) } { \mathbb { E } _ { g \sim \pi ( g ) } } } \left[ \log p ^ { * } ( s ) + \log p ( g \mid s ) - \log \rho _ { \pi } ( s \mid g ) - \log \pi ( g ) \right]$$
The second term $p ( g \mid s )$ is an estimate of which goal the agent is trying to reach, similar to objectives in intent inference (Ziebart et al., 2009; Xie et al., 2013). The third term $\pi ( s \mid g )$ is the distribution over states visited by the policy when attempting to reach goal $g$ . For an optimal goal-conditioned policy in an infinite-horizon MDP, both of these terms are Dirac functions:
$$\pi ( g \mid s ) = \rho _ { \pi } ( s \mid g ) = \mathbb { 1 } ( s = g )$$
In this setting, the State Marginal Matching objective simply says to sample goals $g \sim \pi ( g )$ with probability equal to the density of that goal under the target distribution.
$$D _ { \mathrm { K L } } ( \rho _ { \pi } ( s ) \parallel p ^ { * } ( s ) ) = \mathbb { E } _ { \underset { s \sim \pi ( s \mid g ) } { \mathbb { E } } } \left[ \log p ^ { * } ( s ) - \log \pi ( g ) \right]$$
Whether goal-conditioned RL is the preferable way to do distribution matching depends on (1) the difficulty of sampling goals and (2) the supervision that will be provided at test time. It is natural to use goal-conditioned RL in settings where it is easy to sample goals, such as when the space of goals is small and finite or otherwise low-dimensional. If a large collection of goals is available apriori, we could use importance sampling to generate goals to train the goal-conditioned policy (Pong et al., 2019). However, many real-world settings have high-dimensional goals, which can be challenging to sample. While goal-conditioned RL is likely the right approach when we will be given a test-time task, a latent-conditioned policy may explore better in settings where the goal-state is not provided at test-time.
# D ADDITIONAL EXPERIMENTS & EXPERIMENTAL DETAILS
# D.1 ENVIRONMENT DETAILS
We summarize the environment parameters for Navigation (Figures 2, 5a), Manipulation (Figures 3, 5b, 7, 8, 9, 10), and $D$ ’Claw (Figure 4) in Table 1.
Navigation: Episodes have a maximum time horizon of 100 steps. The environment reward is
$$r _ { \mathrm { e n v } } ( s ) = { \left\{ \begin{array} { l l } { p _ { i } } & { { \mathrm { i f ~ } } \| s _ { \mathrm { r o b o t } } - g _ { i } \| _ { 2 } ^ { 2 } < \epsilon { \mathrm { ~ f o r ~ a n y ~ } } i \in [ n ] } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }$$
where $s _ { x y }$ is the xy-position of the agent. We used a uniform target distribution over the end of all $m$ halls, so the environment reward at training time is $\textstyle r _ { \mathrm { e n v } } ( s ) = { \frac { 1 } { m } }$ if the robot is close enough to the end of any of the halls.
We used a fixed hall length of 10 in Figures 2b and 2c, and length 50 in Figure 5a. All experiments used $m = 3$ halls, except in Figure 2c where we varied the number of halls $\{ 3 , 5 , 7 \}$ .
Manipulation. We used the simulated Fetch Robotics $\mathrm { a r m } ^ { 5 }$ implemented by Plappert et al. (2018) using the MuJoCo simulator Todorov et al. (2012). The state vector $s \in \mathbb { R } ^ { 2 8 }$ includes the xyzcoordinates $s _ { \mathrm { o b j } }$ , $s _ { \mathrm { r o b o t } } \in \mathbb { R } ^ { 3 }$ of the block and the robot gripper respectively, as well as their velocities, orientations, and relative position $s _ { \mathrm { o b j } } - s _ { \mathrm { r o b o t } }$ . At the beginning of each episode, we spawn the object at the center of the table, and the robot gripper above the initial block position. We terminate each episode after 50 environment steps, or if the block falls off the table.
We considered two target state marginal distributions. In Manipulation-Uniform, the target density is given by
$$p ^ { * } ( s ) \propto \exp \left( \alpha _ { 1 } r _ { \mathrm { g o a l } } ( s ) + \alpha _ { 2 } r _ { \mathrm { r o b o t } } ( s ) + \alpha _ { 3 } r _ { \mathrm { a c t i o n } } ( s ) \right)$$
where $\alpha _ { 1 } , \alpha _ { 2 } , \alpha _ { 3 } > 0$ are fixed weights, and the rewards
$$\begin{array} { r l } & { r _ { \mathrm { g o a l } } ( s ) : = 1 - \mathbb { 1 } \left( s _ { \mathrm { o b j } } \mathrm { ~ i s ~ o n ~ t h e ~ t a b l e } \right. } \\ & { r _ { \mathrm { r o b o t } } ( s ) : = \mathbb { 1 } \left( \| s _ { \mathrm { o b j } } - s _ { \mathrm { r o b o t } } \| _ { 2 } ^ { 2 } < 0 . 1 \right) } \\ & { r _ { \mathrm { a c t i o n } } ( s ) : = - \| a \| _ { 2 } ^ { 2 } } \end{array}$$
correspond to (1) a uniform distribution of the block position over the table surface (the agent receives $+ 0$ reward while the block is on the table), (2) an indicator reward for moving the robot gripper close to the block, and (3) action penalty, respectively. The environment reward is a weighted sum of the three reward terms: $r _ { \mathrm { e n v } } ( s ) \triangleq 2 0 r _ { \mathrm { g o a l } } ( s ) + r _ { \mathrm { r o b o t } } ( s ) + 0 . 1 r _ { \mathrm { a c t i o n } } ( s )$ . At test-time, we sample a goal block location $g \in \mathbb { R } ^ { 3 }$ uniformly on the table surface, and the goal is not observed by the agent.
In Manipulation-Half, the target state density places higher probability mass to states where the block is on the left-side of the table. This is implemented by replacing $r _ { \mathrm { g o a l } } ( s )$ with a reward function that gives a slightly higher reward $+ 0 . 1$ for states where the block is on the left-side of the table.
D’Claw. The $D$ ’Claw robot (Ahn et al., 2019; Zhu et al., $2 0 1 9 ) ^ { 6 }$ controls three claws to rotate a valve object. The environment consists of a 9-dimensional action space (three joints per claw) and a 12-dimensional observation space that encodes the joint angles and object orientation. We fixed each episode at 50 timesteps, which is about 5 seconds on the real robot. In the hardware experiments, each algorithm was trained on the same four $D$ ’Claw robots to ensure consistency.
Table 1: Environment parameters specifying the observation space dimension $| S |$ ; action space dimension $| { \cal A } |$ ; max episode length $T$ ; the environment reward, related to the target distribution by $\exp \{ r _ { \mathrm { e n v } } ( s ) \} \propto p ^ { * } ( s )$ , and other environment parameters.
<table><tr><td rowspan=1 colspan=1>Environment</td><td rowspan=1 colspan=1>[S</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>T</td><td rowspan=1 colspan=1>Env Reward (log p*(s))</td><td rowspan=1 colspan=1>Other Parameters</td><td rowspan=1 colspan=1>Figure</td></tr><tr><td rowspan=2 colspan=1>Navigation</td><td rowspan=2 colspan=2>2</td><td rowspan=2 colspan=1>2</td><td rowspan=2 colspan=1>100</td><td rowspan=1 colspan=1>Uniformoverallmhalls</td><td rowspan=1 colspan=1>#Halls: 3,5,7Hall length: 10</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>Uniformoverallmhalls</td><td rowspan=1 colspan=1># Halls: 3Hall length: 50</td><td rowspan=1 colspan=1>5a</td></tr><tr><td rowspan=2 colspan=1>Manipulation</td><td rowspan=2 colspan=2>25</td><td rowspan=2 colspan=1>4</td><td rowspan=2 colspan=1>50</td><td rowspan=1 colspan=1>Uniform block pos.over table surface</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3b,3c,5b</td></tr><tr><td rowspan=1 colspan=1>More block pos. densityon left-half of table</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3d</td></tr><tr><td rowspan=1 colspan=1>D'Claw</td><td rowspan=1 colspan=2>12</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>Uniform object angleover[-180°,180°]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>4</td></tr></table>
We defined the target state distribution to place uniform probability mass over all object angles in $\left[ - 1 8 0 ^ { \circ } , 1 8 0 ^ { \circ } \right]$ . It also incorporates reward shaping terms that place lower probability mass on states with high joint velocity and on states with joint positions that deviate far from the initial position (see (Zhu et al., 2019)).
# D.2 GAIL
GAIL assumes access to expert demonstrations, which SMM and the other exploration methods do not require. To compare GAIL with the exploration methods on a level footing, we sampled synthetic states from $p ^ { * } ( s )$ to train GAIL, and restricted the GAIL discriminator input to states only (no actions).
For $D$ ’Claw (Fig. 4), we sampled the valve object angle uniformly in $\left[ - 1 8 0 ^ { \circ } , 1 8 0 ^ { \circ } \right]$ . For Manipulation-Uniform (Fig. 3c), we sampled object positions $\boldsymbol { s } _ { \mathrm { o b j e c t } }$ uniformly on the table surface, and tried two different sampling distributions for the gripper position $s _ { \mathrm { r o b o t } }$ (see Fig. 6). For both environments, all other state dimensions were sampled uniformly in $[ - 1 0 , 1 0 ]$ , and used 1e4 synthetic state samples to train GAIL.
Since the state samples from $p ^ { * } ( s )$ may not be reachable from the initial state, the policy may not be able to fool the discriminator. To get around this problem, we also tried training GAIL with the discriminator input restricted to only the state dimensions corresponding to the object position or gripper position (Manipulation), or the object angle $( D ^ { \prime } C l a w )$ . We summarize these GAIL ablation experiments in Fig. 6. In our experiments, we used the best GAIL ablation model to compare against the exploration baselines in Figures 3c and 4.
# D.3 VAE DENSITY MODEL
In our SMM implementation, we estimated the density of data $x$ as $p ( x ) \approx \operatorname { d e c o d e r } ( { \hat { x } } = x | z =$ encoder $\left( x \right)$ ). That is, we encoded $x$ to $z$ , reconstruction $\hat { x }$ from $z$ , and then took the likelihood of the true data $x$ under a unit-variance Gaussian distribution centered at the reconstructed $\hat { x }$ . The log-likelihood is therefore given by the mean-squared error between the data $x$ and the reconstruction $\hat { x }$ , plus a constant that is independent of $x$ : $\begin{array} { r } { \log ^ { * } { q ( x ) } = \frac { 1 } { 2 } \| x - \hat { x } \| _ { 2 } ^ { 2 } + C } \end{array}$ .
# D.4 COMPUTATIONAL COMPLEXITY
We compare the wall-clock time of each exploration method in Table 2. The computational cost of our method is comparable with prior work.
 Figure 6: GAIL Ablation Study: We studied the effect of restricting the GAIL discriminator input to fewer state dimensions. (a) Manipulation: We trained the GAIL discriminator on the entire state vector $s$ ; on the object and gripper positions $\{ s _ { \mathrm { o b j e c t } } , s _ { \mathrm { r o b o t } } \}$ only; or on the object position $\boldsymbol { s } _ { \mathrm { o b j e c t } }$ only. We also varied the sampling distribution for the gripper position, $p ^ { * } ( s _ { \mathrm { r o b o t } } )$ : we compare using a normal distribution, $\mathcal { N } ( s _ { \mathrm { o b j e c t } } , I _ { 3 } )$ , to sample gripper positions closer to the object, versus a uniform distribution, Uniform $\left[ - 1 0 , 1 0 \right]$ , for greater entropy of the sampled gripper positions. We observe that sampling gripper positions closer to the object position improves the entropy of the object position ${ \mathcal { H } } _ { \pi } [ s _ { \mathrm { o b j e c t } } ]$ , but hurts the entropy of the gripper position $\bar { \mathcal { H } } _ { \pi } [ s _ { \mathrm { r o b o t } } ]$ . (b) $\mathbf { \nabla } D ^ { \prime } C l a w$ : We restricted the discriminator to the entire state vector $s$ , or to the object angle and position $\boldsymbol { s } _ { \mathrm { o b j e c t } }$ . Analysis: In both domains, we observe that restricting the discriminator input to fewer state dimensions (e.g., to $s _ { \mathrm { o b j e c t } } )$ makes the discriminator less capable of distinguishing between expert and policy states (orange and green curves). On the other hand, training on the entire state vector $s$ causes the discriminator loss to approach 0 (i.e., perfect classification), partly because some of the “expert” states sampled from $p ^ { * } ( s )$ are not reachable from the initial state, and the policy is thus unable to fool the discriminator.
Table 2: Per-epoch wall-clock time on the Manipulation environment. One epoch is 1e3 env. steps.
<table><tr><td>SAC</td><td>ICM</td><td>Count</td><td>SMM (ours)</td><td>PseudoCounts</td></tr><tr><td>17.95s (+0%)</td><td>22.74s (+27%)</td><td>25.24s (+41%)</td><td>25.82s (+44%)</td><td>33.87s (+89%)</td></tr></table>
# D.5 ALGORITHM HYPERPARAMETERS
We summarize hyperparameter settings in Table 3. All algorithms were trained for 1e5 steps on Navigation, 1e6 steps on Manipulation, 1e6 steps on $D$ ’Claw Sim2Real, and 1e5 steps on $D$ ’Claw hardware.
Loss Hyperparameters. For each exploration method, we tuned the weights of the different loss components. SAC reward scale controls the weight of the action entropy reward relative to the extrinsic reward. Count coeff controls the intrinsic count-based exploration reward w.r.t. the extrinsic reward and SAC action entropy reward. Similarly, Pseudocount coeff controls the intrinsic pseudocount exploration reward. SMM coeff for $\mathcal { H } [ s \mid z ]$ and $\mathcal { H } [ z \mid s ]$ control the weight of the different loss components (state entropy and latent conditional entropy) of the SMM objective in Equation 8.
Historical Averaging. In the Manipulation experiments, we tried the following sampling strategies for historical averaging: (1) Uniform: Sample policies uniformly across training iterations. (2) Exponential: Sample policies, with recent policies sampled exponentially more than earlier ones. (3) Last: Sample the $N$ latest policies uniformly at random. We found that Uniform worked less well, possibly due to the policies at early iterations not being trained enough. We found negligible difference in the state entropy metric between Exponential vs. Last, and between sampling 5 vs. 10 historical policies, and we also note that it is unnecessary to keep checkpoints from every iteration.
Network Hyperparameters. For all algorithms, we use a Gaussian policy with two hidden layers with Tanh activation and a final fully-connected layer. The Value function and Q-function each are a feedforward MLP with two hidden layers with ReLU activation and a final fully-connected layer. Each hidden layer is of size 300 (SMM, SAC, ICM, C, PC) or 256 (GAIL). The same network configuration is used for the SMM discriminator, $d ( z \mid s )$ , and the GAIL discriminator, but with different input and output sizes. The SMM density model, $q ( s )$ , is modeled by a VAE with encoder and decoder networks each consisting of two hidden layers of size (150, 150) with ReLU activation. The same VAE network configuration is used for Pseudocount.
GAIL Hyperparameters: The replay buffer is filled with 1e4 random actions before training, for training stability. We perform one discriminator update per SAC update. For both Manipulation and $D ^ { \prime } C l a w$ , we used 1e4 states sampled from $p ^ { * } ( s )$ . Other hyperparameter settings, such as batch size for both discriminator and policy updates, are summarized in Table 3. We observed that GAIL training is more unstable compared to the exploration baselines. Thus, for GAIL, we did not take the final iterate (e.g., policy at convergence) but instead used early termination (e.g., take the best iterate according to the state entropy metric).
# D.6 VISUALIZING THE MANIPULATION ENVIRONMENT
We visualize where different methods push the block in the Manipulation environment. More precisely, we visualize the log state marginal $\log \rho _ { \pi _ { z } } ( s )$ over block XY-coordinates $\boldsymbol { s } = ( x , y )$ in Figures 7 and 8. In Figure 9, we plot goals sampled at test-time, colored by the number of episodes each method required to push the block to that goal location. Blue dots indicate that the agent found the goal quickly. We observe that SMM has the most blue dots, indicating that it succeeds in exploring a wide range of states at test-time.
 Figure 7: The log state marginal $\log \rho _ { \pi } ( s )$ over block XY-coordinates, averaged over 1e3 epochs.
 Figure 8: SM4 with Eight Mixture Components. The log state marginal $\log \rho _ { \pi _ { z } } ( s )$ over block XY-coordinates for each latent skill $z \in \{ 0 , \ldots , 7 \}$ , averaged over 1000 epochs.
 Figure 9: Goals sampled uniformly on the table surface, colored by the number of episodes until the policy finds the goal. Red (100 episodes) indicates failure. The block always starts at the center.
 Figure 10: Train curves on Manipulation. One epoch is 1e3 steps. (a) . The environment reward is a weighted sum of three terms: $r _ { \mathrm { g o a l } } ( s )$ $_ { + 0 }$ if object is on table, $^ { - 1 }$ otherwise), $r _ { \mathrm { r o b o t } } ( s )$ $( + 1$ if robot gripper is close to block), and $r _ { \mathrm { a c t i o n } }$ (action penalty term), with weights -20, 1, 0.1 respectively (see Appendix D.1). The three exploration methods (ICM, Count, SMM) also optimize an auxilliary exploration loss, which makes the agent more likely to move around the block. Compared to SAC, this causes the exploration methods to get worse returns for $r _ { \mathrm { g o a l } } ( s )$ and $r _ { \mathrm { a c t i o n } } ( s )$ (due to the agent moving the block around), but also quickly learns to maximize the sparse reward $r _ { \mathrm { r o b o t } } ( s )$ (indicator reward for moving gripper within a threshold distance to the block). (b) The latent action entropy $\mathcal { H } [ \boldsymbol { z } \mid s ]$ (discriminator) and latent state entropy $\mathcal { H } [ s \ | \ z ]$ (density model) per epoch.
Table 3: Hyperparameter Settings. Hyperparameters were chosen according to the following eval metrics: Manip.-Uniform: State entropy of the discretized gripper and block positions (bin size 0.05), after rolling out the trained policy for 50K env steps. Manip.-Half : $D _ { \mathrm { K L } } ( p ^ { * } ( s ) \parallel \rho _ { \pi } ( \bar { s } ) )$ and $\mathrm { T V } ( p ^ { * } ( s ) , \rho _ { \pi } ( s ) )$ of the discretized gripper and block positions (bin size 0.01), after rolling out the trained policy for 50K env steps. 2D Navigation: State entropy of the discretized XY-positions of the trained policy. $D ^ { \prime } C l a w$ : State entropy of the object angle.
<table><tr><td rowspan=1 colspan=1>Environment</td><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>HyperparametersUsed</td><td rowspan=1 colspan=1>HyperparametersConsidered</td></tr><tr><td rowspan=2 colspan=1>All</td><td rowspan=1 colspan=1>SMM, SAC,ICM, Count,Pseudocount</td><td rowspan=1 colspan=1>Batch size: 128le6 env training stepsRL discount: 0.99Network size: 300Policy lr: 3e-4Q-function lr: 3e-4Value function lr: 3e-4</td><td rowspan=1 colspan=1> N/A (Default SAC hyperparameters)</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>1e6 env training stepsPolicy lr: 1e-5Critic Ir: 1e-3# Random actionsbefore training: le4Network size: 256</td><td rowspan=1 colspan=1>N/A (Default GAIL hyperparameters)</td></tr><tr><td rowspan=2 colspan=1>Navigation(Fig. 2, 5a)</td><td rowspan=1 colspan=1>SMM, SAC</td><td rowspan=1 colspan=1>SAC reward scale: 25</td><td rowspan=1 colspan=1>SAC reward scale: 1e-2, 0.1,1,10,25,100</td></tr><tr><td rowspan=1 colspan=1>SMM</td><td rowspan=1 colspan=1>SMMH[sz]coeff: 1SMMHzscoeff:1</td><td rowspan=1 colspan=1>SMMH[s|z]coeff: 1e-3,1e-2,1e-1,1,10SMMH[z|s]coeff: 1e-3,1e-2,1e-1,1,10</td></tr><tr><td rowspan=6 colspan=1>Manip.-Uniform(Fig.3b,3c,5b)</td><td rowspan=1 colspan=1>SMM</td><td rowspan=1 colspan=1>Num skills: 4VAE Ir: 1e-2SMM H[s|z]coeff: 1SMM H[z|s]coeff: 1HA sampling: Exponential# HA policies: 10SMM Latent Prior Coeff: 1</td><td rowspan=1 colspan=1>Num skills: 1,2, 4,8, 16VAE lr: 1e-4,1e-3,1e-2HA sampling: Exponential, Uniform, Last#HA policies: 5,10SMMLatent Prior Coeff: 1, 4</td></tr><tr><td rowspan=1 colspan=1>SAC</td><td rowspan=1 colspan=1>SAC reward scale: 0.1</td><td rowspan=1 colspan=1>SAC reward scale: 0.1,1,10,100</td></tr><tr><td rowspan=1 colspan=1>Count</td><td rowspan=1 colspan=1>Count coeff: 10Histogram bin width: 0.05</td><td rowspan=1 colspan=1>Count coeff: O.1,1,10</td></tr><tr><td rowspan=1 colspan=1>Pseudocount</td><td rowspan=1 colspan=1>Pseudocount coeff: 1VAE lr: 1e-2</td><td rowspan=1 colspan=1>Pseudocount coeff: 0.1,1,10(Use same VAE lr as SMM)</td></tr><tr><td rowspan=1 colspan=1>ICM</td><td rowspan=1 colspan=1>Learning rate: le-3</td><td rowspan=1 colspan=1>Learning rate:le-4,le-3,1e-2</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>Batch size: 512# SAC updates per step: 1Discriminator input: sTraining iterate: 1e6# State Samples: le4</td><td rowspan=1 colspan=1>Batch size:128,512,1024# SAC updates per step: 1, 4Discriminator input: s,Sobject,{Sobject, Srobot}Training iterate: 1e5,2e5,3e5,...,9e5,1e6# State Samples: le4</td></tr><tr><td rowspan=4 colspan=1>Manip.-Half(Fig.3d)</td><td rowspan=1 colspan=1>SMM, SAC,ICM, Count</td><td rowspan=1 colspan=1>SAC reward scale: 0.1</td><td rowspan=1 colspan=1>(Best reward scale for Manip.-Uniform)</td></tr><tr><td rowspan=1 colspan=1>SMM</td><td rowspan=1 colspan=1>Num skills: 4SMMH[s| z] coeff: 1SMMH[z|s] coeff:1</td><td rowspan=1 colspan=1>Num skills: 1, 2, 4, 8</td></tr><tr><td rowspan=1 colspan=1>Count</td><td rowspan=1 colspan=1>Count coeff: 10Histogram bin width: 0.05</td><td rowspan=1 colspan=1>Count coeff: 0.1,1,10</td></tr><tr><td rowspan=1 colspan=1>ICM</td><td rowspan=1 colspan=1>Learning rate: le-3</td><td rowspan=1 colspan=1>Learning rate:le-4,le-3,1e-2</td></tr><tr><td rowspan=6 colspan=1>D'Claw(Fig.4)</td><td rowspan=1 colspan=1>SMM, SAC</td><td rowspan=1 colspan=1>SAC reward scale: 5</td><td rowspan=1 colspan=1>SAC reward scale:1e-2,0.1,1,5,10, 100</td></tr><tr><td rowspan=1 colspan=1>SMM</td><td rowspan=1 colspan=1>SMMHs|zcoeff: 250</td><td rowspan=1 colspan=1>SMMH[s|z]c0eff: 1,10,100,250,500,1e3</td></tr><tr><td rowspan=1 colspan=1>Count</td><td rowspan=1 colspan=1>Count coeff: 1Histogram bin width: 0.05</td><td rowspan=1 colspan=1>Count coeff: 1,10Histogram bin width: 0.05, 0.1</td></tr><tr><td rowspan=1 colspan=1>Pseudocount</td><td rowspan=1 colspan=1>Pseudocount coeff: 1VAE lr: 1e-3</td><td rowspan=1 colspan=1>Pseudocount coeff: 1, 10VAE lr: le-1,1e-2, 1e-3</td></tr><tr><td rowspan=1 colspan=1>ICM</td><td rowspan=1 colspan=1>Learning rate: le-3VAE lr: 1e-1</td><td rowspan=1 colspan=1>Learning rate:1e-2,1e-3,1e-4VAE lr: 1e-1,1e-2, 1e-3</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>Batch size: 512 # SAC updates per step: 4Discriminator input: SobjectTraining iterate: 1e5# State Samples: 1e4</td><td rowspan=1 colspan=1>Batch size:128,512,1024# SAC updates per step: 1, 4Discriminator input: s, SobjectTraining iterate: 1e5,2e5,3e5,...,9e5,1e6# State Samples: 1e4</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443# META-LEARN ING PROBAB IL IST IC INFERENCE FOR PRED ICT ION
Jonathan Gordon∗, John Bronskill∗ University of Cambridge {jg801,jfb54}@cam.ac.uk
Matthias Bauer University of Cambridge Max Planck Institute for Intelligent Systems bauer@tue.mpg.de
Sebastian Nowozin† Google AI Berlin nowozin@google.com
Richard E. Turner University of Cambridge Microsoft Research ret26@cam.ac.uk
# ABSTRACT
This paper introduces a new framework for data efficient and versatile learning. Specifically: 1) We develop ML-PIP, a general framework for Meta-Learning approximate Probabilistic Inference for Prediction. ML-PIP extends existing probabilistic interpretations of meta-learning to cover a broad class of methods. 2) We introduce VERSA, an instance of the framework employing a flexible and versatile amortization network that takes few-shot learning datasets as inputs, with arbitrary numbers of shots, and outputs a distribution over task-specific parameters in a single forward pass. VERSA substitutes optimization at test time with forward passes through inference networks, amortizing the cost of inference and relieving the need for second derivatives during training. 3) We evaluate VERSA on benchmark datasets where the method sets new state-of-the-art results, handles arbitrary numbers of shots, and for classification, arbitrary numbers of classes at train and test time. The power of the approach is then demonstrated through a challenging few-shot ShapeNet view reconstruction task.
# 1 INTRODUCT ION
Many applications require predictions to be made on myriad small, but related datasets. In such cases, it is natural to desire learners that can rapidly adapt to new datasets at test time. These applications have given rise to vast interest in few-shot learning (Fei-Fei et al., 2006; Lake et al., 2011), which emphasizes data efficiency via information sharing across related tasks. Despite recent advances, notably in meta-learning based approaches (Ravi and Larochelle, 2017; Vinyals et al., 2016; Edwards and Storkey, 2017; Finn et al., 2017; Lacoste et al., 2018), there remains a lack of general purpose methods for flexible, data-efficient learning.
Due to the ubiquity of recent work, a unifying view is needed to understand and improve these methods. Existing frameworks (Grant et al., 2018; Finn et al., 2018) are limited to specific families of approaches. In this paper we develop a framework for meta-learning approximate probabilistic inference for prediction (ML-PIP), providing this view in terms of amortizing posterior predictive distributions. In Section 4, we show that ML-PIP re-frames and extends existing point-estimate probabilistic interpretations of meta-learning (Grant et al., 2018; Finn et al., 2018) to cover a broader class of methods, including gradient based meta-learning (Finn et al., 2017; Ravi and Larochelle, 2017), metric based meta-learning (Snell et al., 2017), amortized MAP inference (Qiao et al., 2017) and conditional probability modelling (Garnelo et al., 2018a;b).
The framework incorporates three key elements. First, we leverage shared statistical structure between tasks via hierarchical probabilistic models developed for multi-task and transfer learning (Heskes,
2000; Bakker and Heskes, 2003). Second, we share information between tasks about how to learn and perform inference using meta-learning (Naik and Mammone, 1992; Thrun and Pratt, 2012; Schmidhuber, 1987). Since uncertainty is rife in small datasets, we provide a procedure for metalearning probabilistic inference. Third, we enable fast learning that can flexibly handle a wide range of tasks and learning settings via amortization (Kingma and Welling, 2014; Rezende et al., 2014).
Building on the framework, we propose a new method – VERSA – which substitutes optimization procedures at test time with forward passes through inference networks. This amortizes the cost of inference, resulting in faster test-time performance, and relieves the need for second derivatives during training. VERSA employs a flexible amortization network that takes few-shot learning datasets, and outputs a distribution over task-specific parameters in a single forward pass. The network can handle arbitrary numbers of shots, and for classification, arbitrary numbers of classes at train and test time (see Section 3). In Section 5, we evaluate VERSA on (i) standard benchmarks where the method sets new state-of-the-art results, (ii) settings where test conditions (shot and way) differ from training, and (iii) a challenging one-shot view reconstruction task.
# 2 META-LEARN ING PROBAB IL IST IC INFERENCE FOR PRED ICT ION
We now present the framework that consists of (i) a multi-task probabilistic model, and (ii) a method for meta-learning probabilistic inference.
# 2.1 PROBAB IL IST IC MODEL
Two principles guide the choice of model. First, the use of discriminative models to maximize predictive performance on supervised learning tasks $\mathrm { N g }$ and Jordan, 2002). Second, the need to leverage shared statistical structure between tasks (i.e. multi-task learning). These criteria are met by the standard multi-task directed graphical model shown in Fig. 1 that employs shared parameters $\theta$ , which are common to all tasks, and task specific parameters $\{ \psi ^ { ( t ) } \} _ { t = 1 } ^ { T }$ . Inputs are denoted $x$ and outputs $y$ . Training data $D ^ { ( t ) } = \{ ( x _ { n } ^ { ( t ) } , y _ { n } ^ { ( t ) } ) \} _ { n = 1 } ^ { N _ { t } }$ , and test data $\{ ( \tilde { x } _ { m } ^ { ( t ) } , \tilde { y } _ { m } ^ { ( t ) } ) \} _ { m = 1 } ^ { M _ { t } }$ are explicitly distinguished for each task , as this is key for few-shot learning.
 Figure 1: Directed graphical model for multi-task learning.
Let $X ^ { ( t ) }$ and $Y ^ { ( t ) }$ denote all the inputs and outputs (both test and train) for task $t$ . The joint probability of the outputs and task specific parameters for $T$ tasks, given the inputs and global parameters is:
$$\small \rho \left( \{ Y ^ { ( t ) } , \psi ^ { ( t ) } \} _ { t = 1 } ^ { T } | \{ X ^ { ( t ) } \} _ { t = 1 } ^ { T } , \boldsymbol \theta \right) = \prod _ { t = 1 } ^ { T } p \left( \psi ^ { ( t ) } | \theta \right) \prod _ { n = 1 } ^ { N _ { t } } p \left( y _ { n } ^ { ( t ) } | x _ { n } ^ { ( t ) } , \psi ^ { ( t ) } , \theta \right) \prod _ { m = 1 } ^ { M _ { t } } p \left( \tilde { y } _ { m } ^ { ( t ) } | \tilde { x } _ { m } ^ { ( t ) } , \psi ^ { ( t ) } , \theta \right)$$
In the next section, the goal is to meta-learn fast and accurate approximations to the posterior predictive distribution $\begin{array} { r } { p ( \tilde { y } ^ { ( t ) } | \tilde { x } ^ { ( t ) } , \theta ) = \int p ( \tilde { y } ^ { ( t ) } | \tilde { x } ^ { ( t ) } , \psi ^ { ( t ) } , \theta ) p ( \psi ^ { ( t ) } | \tilde { x } ^ { ( t ) } , D ^ { ( t ) } , \theta ) \mathrm { d } \psi ^ { ( t ) } } \end{array}$ for unseen tasks $t$ .
# 2.2 PROBAB IL IST IC INFERENCE
This section provides a framework for meta-learning approximate inference that is a simple reframing and extension of existing approaches (Finn et al., 2017; Grant et al., 2018). We will employ point estimates for the shared parameters $\theta$ since data across all tasks will pin down their value. Distributional estimates will be used for the task-specific parameters since only a few shots constrain them.
Once the shared parameters are learned, the probabilistic solution to few-shot learning in the model above comprises two steps. First, form the posterior distribution over the task-specific parameters $p ( \psi ^ { ( t ) } | \tilde { x } ^ { ( t ) } , D ^ { ( t ) } , \theta )$ . Second, compute the posterior predictive $p ( \tilde { y } ^ { ( t ) } | \tilde { x } ^ { ( t ) } , \theta )$ . These steps will require approximation and the emphasis here is on performing this quickly at test time. We will describe the form of the approximation, the optimization problem used to learn it, and how to implement this efficiently below. In what follows we initially suppress dependencies on the inputs $\tilde { x }$ and shared parameters $\theta$ to reduce notational clutter, but will reintroduce these at the end of the section.
Specification of the approximate posterior predictive distribution. Our framework approximates the posterior predictive distribution by an amortized distribution $q _ { \phi } ( \tilde { y } | D )$ . That is, we learn a feed-forward inference network with parameters $\phi$ that takes any training dataset $D ^ { ( t ) }$ and test input $\tilde { x }$ as inputs and returns the predictive distribution over the test output $\tilde { y } ^ { ( t ) }$ . We construct this by amortizing the approximate posterior $q _ { \phi } ( \psi | D )$ and then form the approximate posterior predictive distribution using:
$$q _ { \phi } ( \tilde { y } | D ) = \int p ( \tilde { y } | \psi ) q _ { \phi } ( \psi | D ) \mathrm { d } \psi .$$
This step may require additional approximation e.g. Monte Carlo sampling. The amortization will enable fast predictions at test time. The form of these distributions is identical to those used in amortized variational inference (Edwards and Storkey, 2017; Kingma and Welling, 2014). In this work, we use a factorized Gaussian distribution for $q _ { \phi } \big ( \psi | D ^ { ( t ) } \big )$ with means and variances set by the amortization network. However, the training method described next is different.
Meta-learning the approximate posterior predictive distribution. The quality of the approximate posterior predictive for a single task will be measured by the KL-divergence between the true and approximate posterior predictive distribution KL $[ p ( \tilde { y } | D ) \rvert | \dot { q } _ { \phi } ( \tilde { y } | D ) ]$ . The goal of learning will be to minimize the expected value of this KL averaged over tasks,
$$\phi ^ { * } = \underset { \phi } { \operatorname { a r g m i n } } \ \underset { p ( D ) } { \mathbb { E } } \left[ \mathrm { K L } \left[ p ( \tilde { y } | D ) \lVert q _ { \phi } ( \tilde { y } | D ) \right] \right] = \underset { \phi } { \operatorname { a r g m a x } } \ \underset { p ( \tilde { y } , D ) } { \mathbb { E } } \left[ \log \int p ( \tilde { y } | \psi ) q _ { \phi } ( \psi | D ) \mathrm { d } \psi \right] .$$
Training will therefore return parameters $\phi$ that best approximate the posterior predictive distribution in an average KL sense. So, if the approximate posterior $q _ { \phi } ( \psi | D )$ is rich enough, global optimization will recover the true posterior $p ( \psi | D )$ (assuming $p ( \psi | D )$ obeys identifiability conditions (Casella and Berger, 2002)).1 Thus, the amortized procedure meta-learns approximate inference that supports accurate prediction. Appendix A provides a generalized derivation of the framework, grounded in Bayesian decision theory (Jaynes, 2003).
The right hand side of Eq. (2) indicates how training could proceed: (i) select a task $t$ at random, (ii) sample some training data $D ^ { ( t ) }$ , (iii) form the posterior predictive $q _ { \phi } \big ( \cdot | D ^ { ( t ) } \big )$ and, (iv) compute the log-density $\log q _ { \phi } ( \tilde { y } ^ { ( t ) } | D ^ { ( t ) } )$ at test data $\tilde { y } ^ { ( t ) }$ not included in $D ^ { ( t ) }$ . Repeating this process many times and averaging the results would provide an unbiased estimate of the objective which can then be optimized. This perspective also makes it clear that the procedure is scoring the approximate inference procedure by simulating approximate Bayesian held-out log-likelihood evaluation. Importantly, while an inference network is used to approximate posterior distributions, the training procedure differs significantly from standard variational inference. In particular, rather than minimizing $\mathrm { K L } ( q _ { \phi } ( \psi | D \bar { ) } | | p ( \psi | D \bar { ) } )$ , our objective function directly focuses on the posterior predictive distribution and minimizes $\mathrm { K L } ( p ( \tilde { y } | D ) \| q _ { \phi } ( \tilde { y } | D ) )$ .
End-to-end stochastic training. Armed by the insights above we now layout the full training procedure. We reintroduce inputs and shared parameters $\theta$ and the objective becomes:
$$\mathcal { L } \left( \phi \right) = - \underset { p ( D , \tilde { y } , \tilde { x } ) } { \mathbb { E } } \left[ \log q _ { \phi } ( \tilde { y } | \tilde { x } , \theta ) \right] = - \underset { p ( D , \tilde { y } , \tilde { x } ) } { \mathbb { E } } \left[ \log \int p ( \tilde { y } | \tilde { x } , \psi , \theta ) q _ { \phi } ( \psi | D , \theta ) \mathrm { d } \psi \right] .$$
We optimize the objective over the shared parameters $\theta$ as this will maximize predictive performance (i.e., Bayesian held out likelihood). An end-to-end stochastic training objective for $\theta$ and $\phi$ is:
$$\hat { \mathcal { L } } \left( \boldsymbol { \theta } , \boldsymbol { \phi } \right) = \frac { 1 } { M T } \sum _ { M , T } \log \frac { 1 } { L } \sum _ { l = 1 } ^ { L } p \left( \tilde { y } _ { m } ^ { ( t ) } | \tilde { x } _ { m } ^ { ( t ) } , \psi _ { l } ^ { ( t ) } , \boldsymbol { \theta } \right) , \quad \mathrm { w i t h ~ } \psi _ { l } ^ { ( t ) } \sim q _ { \boldsymbol { \phi } } ( \boldsymbol { \psi } | D ^ { ( t ) } , \boldsymbol { \theta } )$$
 Figure 2: Computational flow of VERSA for few-shot classification with the context-independent approximation. Left: A test point $\tilde { x }$ is mapped to its softmax output through a feature extractor neural network and a linear classifier (fully connected layer). The global parameters $\theta$ of the feature extractor are shared between tasks whereas the weight vectors $\dot { w } _ { t } ^ { ( c ) }$ of the linear classifier are task specific and inferred through an amortization network with parameters $\phi$ . Right: Amortization network that maps the extracted features of the $k$ training examples of a particular class to the corresponding weight vector of the linear classifier.
and $\{ \tilde { y } _ { m } ^ { ( t ) } , \tilde { x } _ { m } ^ { ( t ) } , D ^ { ( t ) } \} \sim p ( \tilde { y } , \tilde { x } , D )$ , where $p$ represents the data distribution (e.g., sampling tasks and splitting them into disjoint training data $D$ and test data $\{ ( \tilde { x } _ { m } ^ { ( t ) } , \tilde { y } _ { m } ^ { ( t ) } ) \} _ { m = 1 } ^ { M _ { t } } )$ . This type of training therefore uses episodic train / test splits at meta-train time. We have also approximated the integral over $\psi$ using $L$ Monte Carlo samples. The local reparametrization (Kingma et al., 2015) trick enables optimization. Interestingly, the learning objective does not require an explicit specification of the prior distribution over parameters, $p ( \psi ^ { ( t ) } | \theta )$ , learning it implicitly through $q _ { \phi } ( \psi | D , \theta )$ instead.
In summary, we have developed an approach for Meta-Learning Probabilistic Inference for Prediction (ML-PIP). A simple investigation of the inference method with synthetic data is provided in Section 5.1. In Section 4 we will show that this formulation unifies a number of existing approaches, but first we discuss a particular instance of the ML-PIP framework that supports versatile learning.
# 3 VERSAT ILE AMORT IZED INFERENCE
A versatile system is one that makes inferences both rapidly and flexibly. By rapidly we mean that test-time inference involves only simple computation such as a feed-forward pass through a neural network. By flexibly we mean that the system supports a variety of tasks – including variable numbers of shots or numbers of classes in classification problems – without retraining. Rapid inference comes automatically with the use of a deep neural network to amortize the approximate posterior distribution $q$ . However, it typically comes at the cost of flexibility: amortized inference is usually limited to a single specific task. Below, we discuss design choices that enable us to retain flexibility.
Inference with sets as inputs. The amortization network takes data sets of variable size as inputs whose ordering we should be invariant to. We use permutation-invariant instance-pooling operations to process these sets similarly to Qi et al. (2017) and as formalized in Zaheer et al. (2017). The instance-pooling operation ensures that the network can process any number of training observations.
VERSA for Few-Shot Image Classification. For few-shot image classification, our parameterization of the probabilistic model is inspired by early work from Heskes (2000); Bakker and Heskes (2003) and recent extensions to deep learning (Bauer et al., 2017; Qiao et al., 2017). A feature extractor neural network $h _ { \theta } ( x ) \in \mathbb { R } ^ { d _ { \theta } }$ , shared across all tasks, feeds into a set of task-specific linear classifiers with softmax outputs and weights and biases $\psi ^ { ( t ) } = \{ W ^ { ( t ) } , b ^ { ( t ) } \}$ (see Fig. 2).
A naive amortization requires the approximate posterior $q _ { \phi } ( \psi | D , \theta )$ to model the distribution over full weight matrices in $\mathbb { R } ^ { d _ { \theta } \times C }$ (and biases). This requires the specification of the number of few-shot classes $C$ ahead of time and limits inference to this chosen number. Moreover, it is difficult to metalearn systems that directly output large matrices as the output dimensionality is high. We therefore propose specifying $q _ { \phi } ( \psi | D , \theta )$ in a context independent manner such that each weight vector $\psi _ { c }$ depends only on examples from class $c$ , by amortizing individual weight vectors associated with a single softmax output instead of the entire weight matrix directly. To reduce the number of learned parameters, the amortization network operates directly on the extracted features $h _ { \theta } ( x )$ :
 Figure 3: Computational flow of VERSA for few-shot view reconstruction. Left: A set of training images and angles $\{ ( y _ { n } ^ { ( t ) } , x _ { n } ^ { ( t ) } ) \} _ { n = 1 } ^ { k }$ are mapped to a stochastic input $\psi ^ { ( t ) }$ through the amortization network $q _ { \phi }$ . $\psi ^ { ( t ) }$ is then concatenated with a test angle $\tilde { x }$ and mapped onto a new image through the generator $\theta$ . Right: Amortization network that maps $k$ image/angle examples of a particular object-instance to the corresponding stochastic input.
$$q _ { \phi } ( \psi | D , \theta ) = \prod _ { c = 1 } ^ { C } q _ { \phi } \left( \psi _ { c } | \{ h _ { \theta } \left( x _ { n } ^ { c } \right) \} _ { n = 1 } ^ { k _ { c } } , \theta \right) .$$
Note that in our implementation, end-to-end training is employed, i.e., we backpropagate to $\theta$ through the inference network. Here $k _ { c }$ is the number of observed examples in class $c$ and $\psi _ { c } = \{ w _ { c } , b _ { c } \}$ denotes the weight vector and bias of the linear classifier associated with that class. Thus, we construct the classification matrix $\psi ^ { ( t ) }$ by performing $C$ feed-forward passes through the inference network $q _ { \phi } ( \psi | D , \theta )$ (see Fig. 2).
The assumption of context independent inference is an approximation. In Appendix B, we provide theoretical and empirical justification for its validity. Our theoretical arguments use insights from Density Ratio Estimation (Mohamed, 2018; Sugiyama et al., 2012), and we empirically demonstrate that full approximate posterior distributions are close to their context independent counterparts. Critically, the context independent approximation addresses all the limitations of a naive amortization mentioned above: (i) the inference network needs to amortize far fewer parameters whose number does not scale with number of classes $C$ (a single weight vector instead of the entire matrix); (ii) the amortization network can be meta-trained with different numbers of classes per task, and (iii) the number of classes $C$ can vary at test-time.
VERSA for Few-Shot Image Reconstruction (Regression). We consider a challenging few-shot learning task with a complex (high dimensional and continuous) output space. We define view reconstruction as the ability to infer how an object looks from any desired angle based on a small set of observed views. We frame this as a multi-output regression task from a set of training images with known orientations to output images with specified orientations.
Our generative model is similar to the generator of a GAN or the decoder of a VAE: A latent vector $\psi ^ { ( t ) } \in \mathbb { R } ^ { d _ { \psi } }$ , which acts as an object-instance level input to the generator, is concatenated with an angle representation and mapped through the generator to produce an image at the specified orientation. In this setting, we treat all parameters $\theta$ of the generator network as global parameters (see Appendix E.1 for full details of the architecture), whereas the latent inputs $\psi ^ { ( t ) }$ are the task-specific parameters. We use a Gaussian likelihood in pixel space for the outputs of the generator. To ensure that the output means are between zero and one, we use a sigmoid activation after the final layer. $\phi$ parameterizes an amortization network that first processes the image representations of an object, concatenates them with their associated view orientations, and processes them further before instance-pooling. From the pooled representations, $q _ { \phi } ( \psi | D , \theta )$ produces a distribution over vectors $\psi ^ { ( t ) }$ . This process is illustrated in Fig. 3.
# 4 ML-PIP UN IFIES DISPARATE RELATED WORK
In this section, we continue in the spirit of Grant et al. (2018), and recast a broader class of metalearning approaches as approximate inference in hierarchical models. We show that ML-PIP unifies a number of important approaches to meta-learning, including both gradient and metric based variants, as well as amortized MAP inference and conditional modelling approaches (Garnelo et al., 2018a). We lay out these connections, most of which rely on point estimates for the task-specific parameters corresponding to $q ( \psi ^ { ( t ) } | D ^ { ( t ) } , \theta ) = \delta \left( \psi ^ { ( t ) } \bar { - } \psi ^ { * } ( D ^ { ( t ) } , \theta ) \right)$ . In addition, we compare previous approaches to VERSA.
Gradient-Based Meta-Learning. Let the task-specific parameters $\psi ^ { ( t ) }$ be all the parameters in a neural network. Consider a point estimate formed by taking a step of gradient ascent of the training loss, initialized at $\psi _ { 0 }$ and with learning rate $\eta$ .
$$\psi ^ { * } ( D ^ { ( t ) } , \theta ) = \psi _ { 0 } + \eta \frac { \partial } { \partial \psi } \log \sum _ { n = 1 } ^ { N _ { t } } p ( y _ { n } ^ { ( t ) } | x _ { n } ^ { ( t ) } , \psi , \theta ) \bigg | _ { \psi _ { 0 } } .$$
This is an example of semi-amortized inference (Kim et al., 2018b), as the only shared inference parameters are the initialization and learning rate, and optimization is required for each task (albeit only for one step). Importantly, Eq. (6) recovers Model-agnostic meta-learning (Finn et al., 2017), providing a perspective as semi-amortized ML-PIP. This perspective is complementary to that of Grant et al. (2018) who justify the one-step gradient parameter update employed by MAML through MAP inference and the form of the prior $p ( \psi | \theta )$ . Note that the episodic meta-train / meta-test splits do not fall out of this perspective. Instead we view the update choice as one of amortization which is trained using the predictive KL and naturally recovers the test-train splits. More generally, multiple gradient steps could be fed into an RNN to compute $\psi ^ { * }$ which recovers Ravi and Larochelle (2017). In comparison to these methods, besides being distributional over $\psi$ , VERSA relieves the need to back-propagate through gradient based updates during training and compute gradients at test time, as well as enables the treatment of both local and global parameters which simplifies inference.
Metric-Based Few-Shot Learning. Let the task-specific parameters be the top layer softmax weights and biases of a neural network $\boldsymbol { \psi } ^ { ( t ) } = \{ w _ { c } ^ { ( t ) } , b _ { c } ^ { ( t ) } \} _ { c = 1 } ^ { C }$ . The shared parameters are the lower layer weights. Consider amortized point estimates for these parameters constructed by averaging the top-layer activations for each class,
$$\psi ^ { * } ( D ^ { ( t ) } , \theta ) = \big \{ w _ { c } ^ { * } , b _ { c } ^ { * } \big \} _ { c = 1 } ^ { C } = \Big \{ \mu _ { c } ^ { ( t ) } , - \| \mu _ { c } ^ { ( t ) } \| ^ { 2 } / 2 \Big \} _ { c = 1 } ^ { C } \mathrm { ~ w h e r e ~ } \mu _ { c } ^ { ( t ) } = \frac { 1 } { k _ { c } } \sum _ { n = 1 } ^ { k _ { c } } h _ { \theta } ( x _ { n } ^ { ( c ) } )$$
These choices lead to the following predictive distribution:
$$p ( \tilde { y } ^ { ( t ) } = c | \tilde { x } ^ { ( t ) } , \theta ) \propto \exp \left( - d ( h _ { \theta } ( \tilde { x } ^ { ( t ) } ) , \mu _ { c } ^ { ( t ) } ) \right) = \exp \left( h _ { \theta } ( \tilde { x } ^ { ( t ) } ) ^ { T } \mu _ { c } ^ { ( t ) } - \frac { 1 } { 2 } \| \mu _ { c } ^ { ( t ) } \| ^ { 2 } \right) ,$$
which recovers prototypical networks (Snell et al., 2017) using a Euclidean distance function $d$ with the final hidden layer being the embedding space. In comparison, VERSA is distributional and it uses a more flexible amortization function that goes beyond averaging of activations.
Amortized MAP inference. Qiao et al. (2017) proposed a method for predicting weights of classes from activations of a pre-trained network to support i) online learning on a single task to which new few-shot classes are incrementally added, ii) transfer from a high-shot classification task to a separate low-shot classification task. This is an example usage of hyper-networks (Ha et al., 2016) to amortize learning about weights, and can be recovered by the ML-PIP framework by pre-training $\theta$ and performing MAP inference for $\psi$ . VERSA goes beyond point estimates and although its amortization network is similar in spirit, it is more general, employing end-to-end training and supporting full multi-task learning by sharing information between many tasks.
Conditional models trained via maximum likelihood. In cases where a point estimate of the task-specific parameters are used the predictive becomes
$$q _ { \phi } ( \tilde { y } | D , \theta ) = \int p ( \tilde { y } | \psi , \theta ) q _ { \phi } ( \psi | D , \theta ) \mathrm { d } \psi = p ( \tilde { y } | \psi ^ { * } ( D , \theta ) , \theta ) .$$
In such cases the amortization network that computes $\psi ^ { * } ( D , \theta )$ can be equivalently viewed as part of the model specification rather than the inference scheme. From this perspective, the ML-PIP training procedure for $\phi$ and $\theta$ is equivalent to training a conditional model $p ( \tilde { y } | \psi _ { \phi } ^ { * } ( D , \theta ) , \theta )$ via maximum likelihood estimation, establishing a strong connection to neural processes (Garnelo et al., 2018a;b).
Comparison to Variational Inference (VI). Standard application of amortized VI (Kingma and Welling, 2014; Rezende et al., 2014; Kingma et al., 2015; Blundell et al., 2015) for $\psi$ in the multi-task discriminative model optimizes the Monte Carlo approximated free-energy w.r.t. $\phi$ and $\theta$ :
$$\hat { \mathcal { L } } ( \boldsymbol { \theta } , \boldsymbol { \phi } ) = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \left( \sum _ { ( \boldsymbol { x } , \boldsymbol { y } ) \in D ^ { ( t ) } } \left( \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \log p ( \boldsymbol { y } ^ { ( t ) } | \boldsymbol { x } ^ { ( t ) } , \boldsymbol { \psi } _ { l } ^ { ( t ) } , \boldsymbol { \theta } ) \right) - \mathrm { K L } \left[ q _ { \boldsymbol { \phi } } ( \boldsymbol { \psi } | D ^ { ( t ) } , \boldsymbol { \theta } ) \| p ( \boldsymbol { \psi } | \boldsymbol { \theta } ) \right] \right) ,$$
where $\psi _ { l } ^ { ( t ) } \sim q _ { \phi } ( \psi | D ^ { ( t ) } , \theta )$ . In addition to the conceptual difference from ML-PIP (discussed in Section 2.1), this differs from the ML-PIP objective by i) not employing meta train / test splits, and ii) including the KL for regularization instead. In Section 5, we show that VERSA significantly improves over standard VI in the few-shot classification case and compare to recent VI/meta-learning hybrids.
# 5 EXPER IMENTS AND RESULTS
We evaluate VERSA on several few-shot learning tasks. We begin with toy experiments to investigate the properties of the amortized posterior inference achieved by VERSA. We then report few-shot classification results using the Omniglot and miniImageNet datasets in Section 5.2, and demonstrate VERSA’s ability to retain high accuracy as the shot and way are varied at test time. In Section 5.3, we examine VERSA’s performance on a one-shot view reconstruction task with ShapeNet objects.2
# 5.1 POSTER IOR INFERENCE W ITH TOY DATA
To investigate the approximate inference performed by our training procedure, we run the following experiment. We first generate data from a Gaussian distribution with a mean that varies across tasks:
$$p ( \theta ) = \delta ( \theta - 0 ) ; \quad p \left( \psi ^ { ( t ) } | \theta \right) = \mathcal { N } \left( \psi ^ { ( t ) } ; \theta , \sigma _ { \psi } ^ { 2 } \right) ; \quad p \left( y _ { n } ^ { ( t ) } | \psi ^ { ( t ) } \right) = \mathcal { N } \left( y _ { n } ^ { ( t ) } ; \psi ^ { ( t ) } , \sigma _ { y } ^ { 2 } \right) .$$
We generate $T = 2 5 0$ tasks in two separate experiments, having $N \in \{ 5 , 1 0 \}$ train observations and $M = 1 5$ test observations. We introduce the inference network $q _ { \phi } ( \psi | D ^ { ( t ) } ) = \mathcal { N } ( \psi ; \mu _ { q } ^ { ( t ) } , \sigma _ { q } ^ { ( t ) 2 } )$ amortizing inference as:
$$\mu _ { q } ^ { ( t ) } = w _ { \mu } \sum _ { n = 1 } ^ { N } y _ { n } ^ { ( t ) } + b _ { \mu } , \quad \sigma _ { q } ^ { ( t ) 2 } = \exp \left( w _ { \sigma } \sum _ { n = 1 } ^ { N } y _ { n } ^ { ( t ) } + b _ { \sigma } \right) .$$
The learnable parameters $\phi = \{ w _ { \boldsymbol { \mu } } , b _ { \boldsymbol { \mu } } , w _ { \sigma } , b _ { \sigma } \}$ are trained with the objective function in Eq. (4). The model is trained to convergence with Adam (Kingma and Ba, 2015) using mini-batches of tasks from the generated dataset. Then, a separate set of tasks is generated from the same generative process, and the posterior $q _ { \phi } ( \psi | D )$ is inferred with the learned amortization parameters. The true posterior over $\psi$ is Gaussian with a mean that depends on the task, and may be computed analytically. Fig. 4 shows the approximate posterior distributions inferred for unseen test sets by the trained amortization networks. The evaluation shows that the inference procedure is able to recover accurate posterior distributions over $\psi$ , despite minimizing a predictive KL divergence in data space.
# 5.2 FEW-SHOT CLASS IFICAT ION
We evaluate VERSA on standard few-shot classification tasks in comparison to previous work. Specifically, we consider the Omniglot (Lake et al., 2011) and miniImageNet (Ravi and Larochelle, 2017) datasets which are $C$ -way classification tasks with $k _ { c }$ examples per class. VERSA follows the implementation in Sections 2 and 3, and the approximate inference scheme in Eq. (5). We follow the experimental protocol established by Vinyals et al. (2016) for Omniglot and Ravi and Larochelle (2017) for miniImagenet, using equivalent architectures for $h _ { \theta }$ . Training is carried out in an episodic manner: for each task, $k _ { c }$ examples are used as training inputs to infer $q _ { \phi } ( \psi ^ { ( c ) } | D , \theta )$ for each class, and an additional set of examples is used to evaluate the objective function. Full details of data preparation and network architectures are provided in Appendix D.
 Figure 4: True posteriors $p ( \psi | D )$ ( ) and approximate posteriors $q _ { \phi } ( \psi | D )$ ( ) for unseen test sets $( { \star } )$ in the experiment. In both cases (five and ten shot), the approximate posterior closely resembles the true posterior given the observed data.
Table 3 details few-shot classification performance for VERSA as well as competitive approaches. The tables include results for only those approaches with comparable training procedures and convolutional feature extraction architectures. Approaches that employ pre-training and/or residual networks (Bauer et al., 2017; Qiao et al., 2017; Rusu et al., 2018; Gidaris and Komodakis, 2018; Oreshkin et al., 2018; Garcia and Bruna, 2017; Lacoste et al., 2018) have been excluded so that the quality of the learning algorithm can be assessed separately from the power of the underlying discriminative model.
For Omniglot, the training, validation, and test splits have not been specified for previous methods, affecting the comparison. VERSA achieves a new state-of-the-art results $( 6 7 . 3 7 \%$ - up $1 . 3 8 \%$ over the previous best) on 5-way - 5-shot classification on the miniImageNet benchmark and $9 7 . 6 6 \%$ - up $0 . 0 2 \% )$ on the 20-way - 1 shot Omniglot benchmark for systems using a convolution-based network architecture and an end-to-end training procedure. VERSA is within error bars of state-of-the-art on three other benchmarks including 5-way - 1-shot miniImageNet, 5-way - 5-shot Omniglot, and 5-way - 1-shot Omniglot. Results on the Omniglot 20 way - 5-shot benchmark are very competitive with, but lower than other approaches. While most of the methods evaluated in Table 3 adapt all of the learned parameters for new tasks, VERSA is able to achieve state-of-the-art performance despite adapting only the weights of the top-level classifier.
Comparison to standard and amortized VI. To investigate the performance of our inference procedure, we compare it in terms of log-likelihood (Table 1) and accuracy (Table 3) to training the same model using both amortized and non-amortized VI (i.e., Eq. (10)). Derivations and further experimental details are provided in Appendix C. VERSA improves substantially over amortized VI even though the same amortization network is used for both. This is due to VI’s tendency to under-fit, especially for small numbers of data points (Trippe and Turner, 2018; Turner and Sahani, 2011) which is compounded when using inference networks (Cremer et al., 2018). Using non-amortized VI improves performance substantially, but does not reach the level of VERSA and forming the posterior is significantly slower as it requires many forward / backward passes through the network. This is similar in spirit to MAML (Finn et al., 2017), though MAML dramatically reduces the number of required iterations by finding good global initializations e.g., five gradient steps for miniImageNet. This is in contrast to the single forward pass required by VERSA.
Table 1: Negative Log-likelihood (NLL) results for different few-shot settings on Omniglot and miniImageNet. The $\pm$ sign indicates the $9 5 \%$ confidence interval over tasks using a Student’s t-distribution approximation.
<table><tr><td></td><td colspan="4">Omniglot</td><td colspan="2">minilmageNet</td></tr><tr><td></td><td colspan="2">5-way NLL</td><td colspan="2">20-way NLL</td><td colspan="2">5-way NLL</td></tr><tr><td>Method</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>Amortized VI</td><td>0.179 ± 0.009</td><td>0.137 ± 0.004</td><td>0.456± 0.010</td><td>0.253 ± 0.004</td><td>1.328 ± 0.024</td><td>1.165 ± 0.010</td></tr><tr><td>Non-Amortized VI</td><td>0.144 ± 0.005</td><td>0.025 ± 0.001</td><td>0.393 ± 0.005</td><td>0.078 ± 0.002</td><td></td><td></td></tr><tr><td>VERSA</td><td>0.010± 0.005</td><td>0.007 ± 0.003</td><td>0.079 ± 0.009</td><td>0.031 ± 0.004</td><td>1.183 ± 0.023</td><td>0.859 ± 0.015</td></tr></table>
Versatility. VERSA allows us to vary the number of classes $C$ and shots $k _ { c }$ between training and testing (Eq. (5)). Fig. 5a shows that a model trained for a particular $C$ -way retains very high accuracy as $C$ is varied. For example, when VERSA is trained for the 20-Way, 5-Shot condition, at test-time it can handle $C = 1 0 0$ way conditions and retain an accuracy of approximately $94 \%$ . Fig. 5b shows similar robustness as the number of shots $k _ { c }$ is varied. VERSA therefore demonstrates considerable flexibility and robustness to the test-time conditions, but at the same time it is efficient as it only requires forward passes through the network. The time taken to evaluate 1000 test tasks with a 5-way, 5-shot miniImageNet trained model using MAML (https://github.com/cbfinn/maml) is 302.9 seconds whereas VERSA took 53.5 seconds on a NVIDIA Tesla P100-PCIE-16GB GPU. This is more than $5 \times$ speed advantage in favor of VERSA while bettering MAML in accuracy by $4 . 2 6 \%$ .
 Figure 5: Test accuracy on Omniglot when varying (a) way (fixing shot to be that used for training) and (b) shot. In Fig. 5b, all models are evaluated on 5-way classification. Colors indicate models trained with different way-shot episodic combinations. Table 2: View reconstruction test results. Mean squared error (MSE – lower is better) and the structural similarity index (SSIM - higher is better) (Wang et al., 2004) are measured between the generated and ground truth images. Error bars not shown as they are insignificant.
# 5.3 SHAPENET VIEW RECONSTRUCT ION
ShapeNetCore v2 (Chang et al., 2015) is a database of 3D objects covering 55 common object categories with ${ \sim } 5 1 { , } 3 0 0$ unique objects. For our experiments, we use 12 of the largest object categories. We concatenate all instances from all 12 of the object categories together to obtain a dataset of 37,108 objects. This dataset is then randomly shuffled and we use $70 \%$ of the objects for training, $10 \%$ for validation, and $20 \%$ for testing. For each object, we generate 36 views of size $3 2 \times 3 2$ pixels spaced evenly every 10 degrees in azimuth around the object.
We evaluate VERSA by comparing it to a conditional variational autoencoder (C-VAE) with view angles as labels (Kingma et al., 2014; Narayanaswamy et al., 2017) and identical architectures. We train VERSA in an episodic manner and the C-VAE in batch-mode on all 12 object classes at once. We train on a single view selected at random and use the remaining views to evaluate the objective function. For full experimentation details see Appendix E. Fig. 6 shows views of unseen objects from the test set generated from a single shot with VERSA as well as a C-VAE and compares both to ground truth views. Both VERSA and the C-VAE capture the correct orientation of the object in the generated images. However, VERSA produces images that contain much more detail and are visually sharper than the C-VAE images. Although important information is missing due to occlusion in the single shot, VERSA is often able to accurately impute this information presumably due to learning the statistics of these objects. Table 2 provides quantitative comparison results between VERSA with varying shot and the C-VAE. The quantitative metrics all show the superiority of VERSA over a C-VAE. As the number of shots increase to 5, the measurements show a corresponding improvement.
<table><tr><td>Model</td><td>MSE</td><td>SSIM</td></tr><tr><td>C-VAE 1-shot</td><td>0.0269</td><td>0.5705</td></tr><tr><td>VERSA 1-shot</td><td>0.0108</td><td>0.7893</td></tr><tr><td>VERSA 5-shot</td><td>0.0069</td><td>0.8483</td></tr></table>
# 6 CONCLUS IONS
We have introduced ML-PIP, a probabilistic framework for meta-learning. ML-PIP unifies a broad class of recently proposed meta-learning methods, and suggests alternative approaches. Building on ML-PIP, we developed VERSA, a few-shot learning algorithm that avoids the use of gradient based optimization at test time by amortizing posterior inference of task-specific parameters. We evaluated VERSA on several few-shot learning tasks and demonstrated state-of-the-art performance and compelling visual results on a challenging 1-shot view reconstruction task.
Table 3: Accuracy results for different few-shot settings on Omniglot and miniImageNet. The $\pm$ sign indicates the $9 5 \%$ confidence interval over tasks using a Student’s t-distribution approximation. Bold text indicates the highest scores that overlap in their confidence intervals.
<table><tr><td colspan="4">Omniglot</td><td colspan="2">minilmageNet</td></tr><tr><td rowspan="2">Method</td><td>5-way accuracy (%)</td><td>5-shot</td><td>20-way accuracy(%) 1-shot</td><td>5-shot</td><td>5-way accuracy (%) 1-shot 5-shot</td></tr><tr><td>1-shot</td><td>98.4</td><td>88.1</td><td>97.0</td><td></td></tr><tr><td>Siamese Nets (Koch et al., 2015)</td><td>97.3</td><td>98.9</td><td></td><td></td><td>46.6</td></tr><tr><td>Matching Nets (Vinyals et al.,2016)</td><td>98.1</td><td></td><td>93.8</td><td>98.5</td><td>60.0</td></tr><tr><td>Neural Statistician (Edwards and Storkey, 2017)</td><td>98.1</td><td>99.5</td><td>93.2</td><td>98.1</td><td></td></tr><tr><td>Memory Mod (Kaiser et al.,2017)</td><td>98.4</td><td>99.6</td><td>95.0</td><td>98.6</td><td></td></tr><tr><td>Meta LSTM (Ravi and Larochelle, 2017)</td><td></td><td></td><td></td><td></td><td>43.44 ± 0.77 60.60± 0.71</td></tr><tr><td>MAML (Finn et al., 2017)</td><td>98.7 ± 0.4</td><td>99.9 ± 0.1</td><td>95.8 ± 0.3</td><td>98.9± 0.2</td><td>48.7 ± 1.84 63.11 ± 0.92</td></tr><tr><td>Prototypical Netsa (Snell et al., 2017)</td><td>97.4</td><td>99.3</td><td>95.4</td><td>98.7 46.61 ± 0.78</td><td>65.77 ± 0.70</td></tr><tr><td>mAP-SSVM (Triantafillou et al., 2017)</td><td>98.6</td><td>99.6</td><td>95.2</td><td>98.6</td><td>50.32 ± 0.80 63.94 ± 0.72</td></tr><tr><td>mAP-DLM (Triantafillou et al., 2017)</td><td>98.8</td><td>99.6</td><td>95.4</td><td>98.6 50.28 ± 0.80</td><td>63.70± 0.70</td></tr><tr><td>LLAMA (Grant et al., 2018)</td><td></td><td></td><td></td><td></td><td>49.40 ± 1.83</td></tr><tr><td>PLATIPUS (Finn et al., 2018)</td><td></td><td></td><td></td><td></td><td>50.13 ± 1.86</td></tr><tr><td>Meta-SGD (Li et al., 2017)</td><td>99.53± 0.26</td><td>99.93 ± 0.09</td><td>95.93 ± 0.38</td><td>98.97 ± 0.19</td><td>50.47 ± 1.87 64.03 ± 0.94</td></tr><tr><td>SNAIL (Mishra et al., 2018)</td><td>99.07 ± 0.16</td><td>99.78 ± 0.09</td><td>97.64 ± 0.30</td><td>99.36 ± 0.18 45.1</td><td>55.2</td></tr><tr><td>Relation Net (Yang et al.,2018)</td><td>99.6 ± 0.2</td><td>99.8 ± 0.1</td><td>97.6 ± 0.2</td><td>99.1 ± 0.1 50.44 ± 0.82</td><td>65.32 ± 0.70</td></tr><tr><td>Reptile (Nichol and Schulman,2018)</td><td>97.68 ± 0.04</td><td>99.48 ± 0.06</td><td>89.43 ± 0.14</td><td>97.12 ± 0.32 49.97 ± 0.32</td><td>65.99 ± 0.58</td></tr><tr><td>BMAML (Kim et al., 2018a)</td><td></td><td></td><td></td><td></td><td>53.8 ± 1.46</td></tr><tr><td>Amortized VI</td><td></td><td>98.71 ± 0.22</td><td>90.56 ± 0.54</td><td></td><td>44.13 ± 1.78</td></tr><tr><td>Non-Amortized VI</td><td>97.77 ± 0.55 98.77 ± 0.18</td><td>99.74 ± 0.06</td><td>95.28 ± 0.19</td><td>96.12 ± 0.23 98.84± 0.09</td><td>55.68 ± 0.91</td></tr><tr><td>VERSA (Ours)</td><td>99.70 ± 0.20</td><td>99.75 ± 0.13</td><td>97.66 ± 0.29</td><td>98.77 ± 0.18</td><td>53.40 ± 1.82 67.37 ± 0.86</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
 Figure 6: Results for ShapeNet view reconstruction for unseen objects from the test set (shown left). The model was trained to reconstruct views from a single orientation. Top row: images/views generated by a C-VAE model; middle row images/views generated by VERSA; bottom row: ground truth images. Views are spaced evenly every 30 degrees in azimuth.
# ACKNOWLEDGEMENTS
We thank Ravi and Larochelle for providing the miniImageNet dataset, and Yingzhen Li, Niki Kilbertus, Will Tebbutt, Maria Lomelli, and Robert Pinsler for their useful feedback. J.G. acknowledges funding from a Samsung Doctoral Scholarship. M.B. acknowledges funding by the EPSRC and a Qualcomm European Scholarship in Technology. R.E.T. acknowledges support from EPSRC grants EP/M0269571 and EP/L000776/1.
# REFERENCES
B. Bakker and T. Heskes. Task clustering and gating for Bayesian multitask learning. Journal of Machine Learning Research, 4(May):83–99, 2003. M. Bauer, M. Rojas-Carulla, J. B. Swiatkowski, B. Sch ´ olkopf, and R. E. Turner. Discriminative k-shot ¨ learning using probabilistic models. arXiv preprint arXiv:1706.00326, 2017. J. O. Berger. Statistical decision theory and Bayesian analysis. Springer Science & Business Media, 2013. C. Blundell, J. Cornebise, K. Kavukcuoglu, and D. Wierstra. Weight uncertainty in neural network. In International Conference on Machine Learning, pages 1613–1622, 2015. G. Casella and R. L. Berger. Statistical inference, volume 2. Duxbury Pacific Grove, CA, 2002. A. X. Chang, T. Funkhouser, L. Guibas, P. Hanrahan, Q. Huang, Z. Li, S. Savarese, M. Savva, S. Song, H. Su, J. Xiao, L. Yi, and F. Yu. ShapeNet: An Information-Rich 3D Model Repository. Technical Report arXiv:1512.03012 [cs.GR], Stanford University — Princeton University — Toyota Technological Institute at Chicago, 2015. C. Cremer, X. Li, and D. Duvenaud. Inference suboptimality in variational autoencoders. arXiv preprint arXiv:1801.03558, 2018. A. P. Dawid. The geometry of proper scoring rules. Annals of the Institute of Statistical Mathematics, 59(1):77–93, 2007. H. Edwards and A. Storkey. Towards a neural statistician. In Proceedings of the International Conference on Learning Representations (ICLR), 2017. L. Fei-Fei, R. Fergus, and P. Perona. One-shot learning of object categories. IEEE transactions on pattern analysis and machine intelligence, 28(4):594–611, 2006. C. Finn, P. Abbeel, and S. Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pages 1126–1135, 2017. C. Finn, K. Xu, and S. Levine. Probabilistic model-agnostic meta-learning. arXiv preprint arXiv:1806.02817, 2018. V. Garcia and J. Bruna. Few-shot learning with graph neural networks. arXiv preprint arXiv:1711.04043, 2017. M. Garnelo, D. Rosenbaum, C. J. Maddison, T. Ramalho, D. Saxton, M. Shanahan, Y. W. Teh, D. J. Rezende, and S. Eslami. Conditional neural processes. arXiv preprint arXiv:1807.01613, 2018a. M. Garnelo, J. Schwarz, D. Rosenbaum, F. Viola, D. J. Rezende, S. Eslami, and Y. W. Teh. Neural processes. arXiv preprint arXiv:1807.01622, 2018b. S. Gidaris and N. Komodakis. Dynamic few-shot visual learning without forgetting. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4367–4375, 2018. E. Grant, C. Finn, S. Levine, T. Darrell, and T. Griffiths. Recasting gradient-based meta-learning as hierarchical Bayes. In Proceedings of the International Conference on Learning Representations (ICLR), 2018. D. Ha, A. Dai, and Q. V. Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016. T. Heskes. Empirical bayes for learning to learn. 2000. G. E. Hinton, P. Dayan, B. J. Frey, and R. M. Neal. The” wake-sleep” algorithm for unsupervised neural networks. Science, 268(5214):1158–1161, 1995. F. Huszar. Scoring rules, divergences and information in Bayesian machine learning. PhD thesis, University of Cambridge, 2013. E. T. Jaynes. Probability theory: the logic of science. Cambridge university press, 2003. Ł. Kaiser, O. Nachum, R. Aurko, and S. Bengio. Learning to remember rare events. In International Conference on Learning Representations (ICLR), 2017. T. Kim, J. Yoon, O. Dia, S. Kim, Y. Bengio, and S. Ahn. Bayesian model-agnostic meta-learning. arXiv preprint arXiv:1806.03836, 2018a. Y. Kim, S. Wiseman, A. C. Miller, D. Sontag, and A. M. Rush. Semi-amortized variational autoencoders. In Proceedings of the 35th International Conference on Machine Learning, 2018b. D. Kingma and J. Ba. Adam: A method for stochastic optimization. In Proceedings of the International Conference on Learning Representations (ICLR), 2015. D. P. Kingma and M. Welling. Auto-encoding variational Bayes. In Proceedings of the International Conference on Learning Representations (ICLR), 2014. D. P. Kingma, S. Mohamed, D. J. Rezende, and M. Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pages 3581–3589, 2014. D. P. Kingma, T. Salimans, and M. Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems, pages 2575–2583, 2015. G. Koch, R. Zemel, and R. Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML Deep Learning Workshop, volume 2, 2015. A. Lacoste, B. Oreshkin, W. Chung, T. Boquet, N. Rostamzadeh, and D. Krueger. Uncertainty in multitask transfer learning. arXiv preprint arXiv:1806.07528, 2018. S. Lacoste-Julien, F. Huszar, and Z. Ghahramani. Approximate inference for the loss-calibrated ´ Bayesian. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pages 416–424, 2011. B. Lake, R. Salakhutdinov, J. Gross, and J. Tenenbaum. One shot learning of simple visual concepts. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 33, 2011. Z. Li, F. Zhou, F. Chen, and H. Li. Meta-sgd: Learning to learn quickly for few shot learning. arXiv preprint arXiv:1707.09835, 2017. L. v. d. Maaten and G. Hinton. Visualizing data using t-SNE. Journal of machine learning research, 9(Nov):2579–2605, 2008. N. Mishra, M. Rohaninejad, X. Chen, and P. Abbeel. A simple neural attentive meta-learner. 2018. S. Mohamed. Density ratio trick. http://blog.shakirm.com/2018/01/ machine-learning-trick-of-the-day-7-density-ratio-trick/, 2018. D. K. Naik and R. Mammone. Meta-neural networks that learn by learning. In Neural Networks, 1992. IJCNN., International Joint Conference on, volume 1, pages 437–442. IEEE, 1992. S. Narayanaswamy, T. B. Paige, J.-W. van de Meent, A. Desmaison, N. Goodman, P. Kohli, F. Wood, and P. Torr. Learning disentangled representations with semi-supervised deep generative models. In Advances in Neural Information Processing Systems, pages 5927–5937, 2017. A. Y. Ng and M. I. Jordan. On discriminative vs. generative classifiers: A comparison of logistic regression and naive bayes. In Advances in Neural Information Processing Systems, pages 841–848, 2002. A. Nichol and J. Schulman. Reptile: a scalable metalearning algorithm. arXiv preprint arXiv:1803.02999, 2018. B. N. Oreshkin, A. Lacoste, and P. Rodriguez. Tadam: Task dependent adaptive metric for improved few-shot learning. arXiv preprint arXiv:1805.10123, 2018. C. R. Qi, H. Su, K. Mo, and L. J. Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. Proc. Computer Vision and Pattern Recognition (CVPR), IEEE, 1(2):4, 2017. S. Qiao, C. Liu, W. Shen, and A. Yuille. Few-shot image recognition by predicting parameters from activations. arXiv preprint arXiv:1706.03466, 2017. S. Ravi and H. Larochelle. Optimization as a model for few-shot learning. In Proceedings of the International Conference on Learning Representations (ICLR), 2017. D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pages 1278–1286, 2014. A. A. Rusu, D. Rao, J. Sygnowski, O. Vinyals, R. Pascanu, S. Osindero, and R. Hadsell. Meta-learning with latent embedding optimization. arXiv preprint arXiv:1807.05960, 2018. J. Schmidhuber. Evolutionary principles in self-referential learning. PhD thesis, Technische Universitat M¨ unchen, 1987. ¨ J. Snell, K. Swersky, and R. Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pages 4080–4090, 2017. M. Sugiyama, T. Suzuki, and T. Kanamori. Density ratio estimation in machine learning. Cambridge University Press, 2012. S. Thrun and L. Pratt. Learning to learn. Springer Science & Business Media, 2012. E. Triantafillou, R. Zemel, and R. Urtasun. Few-shot learning through an information retrieval lens. In Advances in Neural Information Processing Systems, pages 2255–2265, 2017. B. Trippe and R. Turner. Overpruning in variational bayesian neural networks. arXiv preprint arXiv:1801.06230, 2018. R. E. Turner and M. Sahani. Two problems with variational expectation maximisation for time-series models. Bayesian Time series models, 1(3.1):3–1, 2011. O. Vinyals, C. Blundell, T. Lillicrap, D. Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pages 3630–3638, 2016. M. J. Wainwright and M. I. Jordan. Graphical models, exponential families, and variational inference. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 1(1-2):1–305, 2008. Z. Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600–612, 2004. F. S. Y. Yang, L. Zhang, T. Xiang, P. H. Torr, and T. M. Hospedales. Learning to compare: Relation network for few-shot learning. 2018. M. Zaheer, S. Kottur, S. Ravanbakhsh, B. Poczos, R. R. Salakhutdinov, and A. J. Smola. Deep sets. In Advances in Neural Information Processing Systems, pages 3394–3404, 2017.
# A BAYES IAN DEC IS ION THEORET IC GENERAL IZAT ION OF ML-PIP
A generalization of the new inference framework presented in Section 2 is based upon Bayesian decision theory (BDT). BDT provides a recipe for making predictions $\hat { y }$ for an unknown test variable $\tilde { y }$ by combining information from observed training data $\bar { D } ^ { ( t ) }$ (here from a single task $t$ ) and a loss function $L ( \tilde { y } , \hat { y } )$ that encodes the cost of predicting $\hat { y }$ when the true value is $\tilde { y }$ (Berger, 2013; Jaynes, 2003). In BDT an optimal prediction minimizes the expected loss (suppressing dependencies on the inputs and $\theta$ to reduce notational clutter):3
$$\hat { y } ^ { * } = \underset { \hat { y } } { \mathrm { a r g m i n } } \int p ( \tilde { y } | D ^ { ( t ) } ) L ( \tilde { y } , \hat { y } ) \mathrm { d } \tilde { y } , \quad \mathrm { w h e r e } \quad p ( \tilde { y } | D ^ { ( t ) } ) = \int p ( \tilde { y } | \psi ^ { ( t ) } ) p ( \psi ^ { ( t ) } | D ^ { ( t ) } ) \mathrm { d } \psi ^ { ( t ) }$$
is the Bayesian predictive distribution and $p ( \psi ^ { ( t ) } | D ^ { ( t ) } )$ the posterior distribution of $\psi ^ { ( t ) }$ given the training data from task $t$ .
BDT separates test and training data and so is a natural lens through which to view recent episodic approaches to training that utilize many internal training/test splits (Vinyals et al., 2016). Based on this insight, what follows is a fairly dense derivation of an ultimately simple stochastic variational objective for meta-learning probabilistic inference that is rigorously grounded in Bayesian inference and decision theory.
Distributional BDT. We generalize BDT to cases where the goal is to return a full predictive distribution $q ( \cdot )$ over the unknown test variable $\tilde { y }$ rather than a point prediction. The quality of $q$ is quantified through a distributional loss function $L ( \tilde { y } , q ( \cdot ) )$ . Typically, if $\tilde { y }$ (the true value of the underlying variable) falls in a low probability region of $q ( \cdot )$ the loss will be high, and vice versa. The optimal predictive $q ^ { * }$ is found by optimizing the expected distributional loss with $q$ constrained to a distributional family $\mathcal { Q }$ :
$$q ^ { * } = \operatorname * { a r g m i n } _ { \boldsymbol { q } \in \mathcal { Q } } \int p ( \boldsymbol { \tilde { y } } | D ^ { ( t ) } ) L ( \boldsymbol { \tilde { y } } , \boldsymbol { q } ( \cdot ) ) \mathrm { d } \boldsymbol { \tilde { y } } .$$
Amortized variational training. Here, we amortize $q$ to form quick predictions at test time and learn parameters by minimizing average expected loss over tasks. Let $\phi$ be a set of shared variational parameters such that $q ( \tilde { y } ) = q _ { \phi } \overline { { ( \tilde { y } | D ) } }$ (or $q _ { \phi }$ for shorthand). Now the approximate predictive distribution can take any training dataset $D ^ { ( t ) }$ as an argument and directly perform prediction of $\tilde { y } ^ { ( t ) }$ . The optimal variational parameters are found by minimizing the expected distributional loss across tasks
$$\phi ^ { * } = \underset { \phi } { \mathrm { a r g m i n } } \mathcal { L } \left[ q _ { \phi } \right] , \mathcal { L } \left[ q _ { \phi } \right] = \int p ( D ) p ( \tilde { y } | D ) L ( \tilde { y } , q _ { \phi } ( \cdot | D ) ) \mathrm { d } \tilde { y } \mathrm { d } D = \mathbb { E } _ { p ( D , \tilde { y } ) } [ L ( \tilde { y } , q _ { \phi } ( \cdot | D ) ) ] .$$
Here the variables $D , { \tilde { x } }$ and $\tilde { y }$ are placeholders for integration over all possible datasets, test inputs and outputs. Note that Eq. (A.3) can be stochastically approximated by sampling a task $t$ and randomly partitioning into training data $D$ and test data $\{ \tilde { x } _ { m } , \bar { \tilde { y } } _ { m } \} _ { m = 1 } ^ { M }$ , which naturally recovers episodic minibatch training over tasks and data (Vinyals et al., 2016; Ravi and Larochelle, 2017). Critically, this does not require computation of the true predictive distribution. It also emphasizes the meta-learning aspect of the procedure, as the model is learning how to infer predictive distributions from training tasks.
Loss functions. We employ the log-loss: the negative log density of $q _ { \phi }$ at $\tilde { y }$ . In this case,
$$\mathcal { L } \left[ q _ { \phi } \right] = \mathbb { E } _ { p \left( D , \tilde { y } \right) } \left[ - \log q _ { \phi } ( \tilde { y } | D ) \right] = \mathbb { E } _ { p \left( D \right) } \left[ \mathrm { K L } \left[ p ( \tilde { y } | D ) \| q _ { \phi } ( \tilde { y } | D ) \right] + \mathrm { H } \left[ p ( \tilde { y } | D ) \right] \right] ,$$
where $\mathrm { K L } [ p ( y ) | | q ( y ) ]$ is the KL-divergence, and $\mathrm { ~ H ~ } [ p ( y ) ]$ is the entropy of $p$ . Eq. (A.4) has the elegant property that the optimal $q _ { \phi }$ is the closest member of $\mathcal { Q }$ (in a KL sense) to the true predictive $p ( \tilde { y } | D )$ , which is unsurprising as the log-loss is a proper scoring rule (Huszar, 2013). This is reminiscent of the sleep phase in the wake-sleep algorithm (Hinton et al., 1995). Exploration of alternative proper scoring rules (Dawid, 2007) and more task-specific losses (Lacoste-Julien et al., 2011) is left for future work.
Specification of the approximate predictive distribution. Next, we consider the form of $q _ { \phi }$ . Motivated by the optimal predictive distribution, we replace the true posterior by an approximation:
$$q _ { \phi } ( \tilde { y } | D ) = \int p ( \tilde { y } | \psi ) q _ { \phi } ( \psi | D ) \mathrm { d } \psi .$$
# B JUST IFICAT ION FOR CONTEXT-INDEPENDENT APPROX IMAT ION
In this section we lay out both theoretical and empirical justifications for the context-independent approximation detailed in Section 3.
# B.1 THEORET ICAL ARGUMENT – DENS ITY RAT IO EST IMAT ION
A principled justification for the approximation is best understood through the lens of density ratio estimation (Mohamed, 2018; Sugiyama et al., 2012). We denote the conditional density of each class as $p ( x | y = c )$ and assume equal a priori class probability $p ( y = c ) = 1 / C$ . Density ratio theory then uses Bayes’ theorem to show that the optimal softmax classifier can be expressed in terms of the conditional densities (Mohamed, 2018; Sugiyama et al., 2012):
$$\mathrm { S o f t m a x } ( y = c | x ) = \frac { \exp ( h ( x ) ^ { \top } w _ { c } ) } { \sum _ { c ^ { \prime } } \exp ( h ( x ) ^ { \top } w _ { c ^ { \prime } } ) } = p ( y = c | x ) = \frac { p ( x | y = c ) } { \sum _ { c ^ { \prime } } p ( x | y = c ^ { \prime } ) } ,$$
This implies that the optimal classifier will construct estimators for the conditional density for each class, that is $\mathrm { e x p } ( h ( x ) ^ { \top } w _ { c } ) \propto p ( x | y = c )$ . Importantly for our approximation, notice that these estimates are constructed independently for each class, similarly to training a naive Bayes classifier. VERSA mirrors this optimal form using:
$$\log p ( x | y = c ) \propto h _ { \theta } ( \tilde { x } ) ^ { \top } w _ { c } ,$$
where $w _ { c } \sim q _ { \phi } \left( w | \{ x _ { n } | y _ { n } = c \} \right)$ ) for each class in a given task. Under ideal conditions (i.e., if one could perfectly estimate $p ( \tilde { x } | y = c )$ ), the context-independent assumption holds, further motivating our design.
# B.2 EMP IR ICAL JUST IFICAT ION
Here we detail a simple experiment to evaluate the validity of the context-independent inference assumption. The goal of the experiment is to examine if weights may be context-independent without imposing the assumption on the amortization network. To see this, we randomly generate fifty tasks from a dataset, where classes may appear a number of times in different tasks. We then perform free-form (non-amortized) variational inference on the weights for each of the tasks, with a Gaussian variational distribution:
$$\begin{array} { r } { q _ { \phi } \left( W ^ { ( t ) } | \mathcal { D } ^ { ( t ) } , \theta \right) = \mathcal { N } \left( W ^ { ( t ) } ; \mu _ { \phi } ^ { ( t ) } , \sigma _ { \phi } ^ { ( t ) 2 } \right) . } \end{array}$$
If the assumption is reasonable, we may expect the distribution of the weights of a specific class to be similar regardless of the additional classes in the task.
We examine 5-way classification in the MNIST dataset. We randomly sample and fix fifty such tasks. We train the model twice using the same feature extraction network used in the few-shot classification experiments, and fix the $d _ { \theta }$ to be 16 and 2. We then train the model in an episodic manner by minibatching tasks at each iteration. The model is trained to convergence, and achieves $9 9 \%$ accuracy on held out test examples for the tasks. After training is complete we examine the optimized $\mu _ { \phi } ^ { ( t ) }$ for each class in each task. Fig. B.1a shows a t-SNE (Maaten and Hinton, 2008) plot for the 16-dimensional weights. We see that when reduced to 2-dimensions, the weights cluster according to class. Fig. B.1b visualizes the weights in their original space. In this plot, weights from the same class are grouped together, and clear similarity patterns are evident across the image, showing that weights from the same class have similar means across tasks. Fig. B.2 details the task weights in 2-dimensional space. Here, each pentagon represents the weight means learned for one training task, where the nodes of the pentagon are colored according to the class the weights represent. In Fig. B.2a we see that overall, the classes cluster in 2-dimensional space as well. However, there is some overlap (e.g., classes ‘1’ and $\cdot _ { 2 } \cdot ,$ ), and that for some tasks a class-weight may appear away from the cluster. Fig. B.2b shows the same plot, but only for tasks that contain both class ‘1’ and ‘2’. Here we can see that for these tasks, class $\bullet _ { 2 } \cdot$ weights are all located away from their cluster.
 Figure B.1: Visualizing the learned weights for $d _ { \theta } = 1 6$ . (a) Weight dimensionality is reduced using T-SNE (Maaten and Hinton, 2008). Weights are colored according to class. (b) Each weight represents one column of the image. Weights are grouped by class.
 Figure B.2: Visualizing the task weights for $d _ { \theta } = 2$ . (a) All training tasks. (b) Only training tasks containing both ‘1’s and $\mathrm { { } ^ { \circ } 2 \mathrm { { } s } }$ .
This implies that each class-weights are typically well-approximated as being independent of the task. However, if the model lacks capacity to properly assign each set of class weights to different regions of space, for tasks where classes from similar regions of space appear, the inference procedure will ‘move’ one of the class weights to an ‘empty’ region of the space.
# C VAR IAT IONAL INFERENCE DER IVAT IONS FOR THE MODEL
We derive a VI-based objective for our probabilistic model. By “amortized” VI we mean that $q _ { \phi } ( \psi | D ^ { ( t ) } , \theta )$ is parameterized by a neural network with a fixed-sized $\phi$ . Conversely, “non-amortized” VI refers to local parameters $\phi ^ { ( t ) }$ that are optimized independently (at test time) for each new task $t$ , such that $\begin{array} { r } { q ( \psi | D ^ { ( t ) } , \theta ) = \mathcal { N } ( \psi | \mu _ { \phi ^ { ( t ) } } , \Sigma _ { \phi ^ { ( t ) } } ) } \end{array}$ . However, the derivation of the objective function does not change between these options. For a single task $t$ , an evidence lower bound (ELBO; (Wainwright and Jordan, 2008)) may be expressed as:
$$\mathcal { L } _ { t } = \mathbb { E } _ { q _ { \phi } ( \psi | D ^ { ( t ) } , \theta ) } \left[ \sum _ { ( \boldsymbol { x } , \boldsymbol { y } ) \in D ^ { ( t ) } } \log p ( \boldsymbol { y } | \boldsymbol { x } , \psi , \theta ) \right] - \mathrm { K L } \left[ q _ { \phi } ( \psi | D ^ { ( t ) } , \theta ) \| p ( \psi | \theta ) \right] .$$
We can then derive a stochastic estimator to optimize Eq. (C.1) by sampling $D ^ { ( t ) } \sim p ( D )$ (approximated with a training set of tasks) and simple Monte Carlo integration over $\psi$ such that $\mathsf { \bar { \psi } } ^ { ( l ) } \sim q _ { \phi } ( \psi | D ^ { ( t ) } , \theta )$ :
$$\hat { \mathcal { L } } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \left( \sum _ { \left( x , y \right) \in D ^ { \left( t \right) } } \left( \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \log p ( y | x , \psi ^ { \left( l \right) } , \theta ) \right) - \mathrm { K L } \left[ q _ { \phi } ( \psi | D ^ { \left( t \right) } , \theta ) \| p ( \psi | \theta ) \right] \right) ,$$
Eq. (C.2) differs from our objective function in Eq. (4) in two important ways: (i) Eq. (4) does not contain a KL term for ${ q _ { \phi } } ( \psi | D ^ { ( t ) } , \theta )$ (nor any other form of prior distribution over $\psi$ , and (ii) Eq. (C.1) does not distinguish between training and test data within a task, and therefore does not explicitly encourage the model to generalize in any way.
# D EXPER IMENTAT ION DETA ILS
In this section we provide comprehensive details on the few-shot classification experiments.
# D.1 OMN IGLOT FEW-SHOT CLASS IFICAT ION TRA IN ING PROCEDURE
Omniglot (Lake et al., 2011) is a few-shot learning dataset consisting of 1623 handwritten characters (each with 20 instances) derived from 50 alphabets. We follow a pre-processing and training procedure akin to that defined in (Vinyals et al., 2016). First the images are resized to $2 8 \times 2 8$ pixels and then character classes are augmented with rotations of 90 degrees. The training, validation and test sets consist of a random split of 1100, 100, and 423 characters, respectively. When augmented this results in 4400 training, 400 validation, and 1292 test classes, each having 20 character instances. For $C$ -way, $k _ { c }$ -shot classification, training proceeds in an episodic manner. Each training iteration consists of a batch of one or more tasks. For each task $C$ classes are selected at random from the training set. During training, $k _ { c }$ character instances are used as training inputs and 15 character instances are used as test inputs. The validation set is used to monitor the progress of learning and to select the best model to test, but does not affect the training process. Final evaluation of the trained model is done on 600 randomly selected tasks from the test set. During evaluation, $k _ { c }$ character instances are used as training inputs and $k _ { c }$ character instances are used as test inputs. We use the Adam (Kingma and Ba, 2015) optimizer with a constant learning rate of 0.0001 with 16 tasks per batch to train all models. The 5-way - 5-shot and 5-way - 1-shot models are trained for 80,000 iterations while the 20-way - 5-shot model is trained for 60,000 iterations, and the 20-way - 1-shot model is trained for 100,000 iterations. In addition, we use a Gaussian form for $q$ and set the number of $\psi$ samples to $L = 1 0$ .
# D.2 miniIMAGENET FEW-SHOT CLASS IFICAT ION TRA IN ING PROCEDURE
miniImageNet (Vinyals et al., 2016) is a dataset of 60,000 color images that is sub-divided into 100 classes, each with 600 instances. The images have dimensions of $8 4 \times 8 4$ pixels. For our experiments, we use the 64 training, 16 validation, and 20 test class splits defined by (Ravi and Larochelle, 2017). Training proceeds in the same episodic manner as with Omniglot. We use the Adam (Kingma and Ba, 2015) optimizer and a Gaussian form for $q$ and set the number of $\psi$ samples to $L = 1 0$ . For the 5-way - 5-shot model, we train using 4 tasks per batch for 100,000 iterations and use a constant learning rate of 0.0001. For the 5-way - 1-shot model, we train with 8 tasks per batch for 50,000 iterations and use a constant learning rate of 0.00025.
# D.3 FEW-SHOT CLASS IFICAT ION NETWORK ARCH ITECTURES
Tables D.1 to D.4 detail the neural network architectures for the feature extractor $\theta$ , amortization network $\phi$ , and linear classifier $\psi$ , respectively. The feature extraction network is very similar to that used in (Vinyals et al., 2016). The output of the amortization network yields mean-field Gaussian parameters for the weight distributions of the linear classifier $\psi$ . When sampling from the weight distributions, we employ the local-reparameterization trick (Kingma et al., 2015), that is we sample from the implied distribution over the logits rather than directly from the variational distribution. To reduce the number of learned parameters, we share the feature extraction network $\theta$ with the pre-processing phase of the amortizaion network $\psi$ .
Table D.1: Feature extraction network used for Omniglot few-shot learning. Batch Normalization and dropout with a keep probability of 0.9 used throughout. Omniglot Shared Feature Extraction Network $\mathbf { \eta } ^ { ( \theta ) }$ : $\tilde { x } h _ { \theta } ( \tilde { x } )$
<table><tr><td>Output size</td><td>Layers</td></tr><tr><td>28×28×1</td><td>Input image</td></tr><tr><td>14 ×14 × 64</td><td>conv2d (3 × 3, stride 1, SAME,RELU),dropout, pool (2 × 2, stride 2, SAME)</td></tr><tr><td>7×7×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU),dropout, pool (2 × 2, stride 2, SAME)</td></tr><tr><td>4×4×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU),dropout, pool (2 × 2, stride 2, SAME)</td></tr><tr><td>2×2×64</td><td>conv2d (3 × 3,stride 1, SAME,RELU),dropout,pool (2 × 2, stride 2, SAME)</td></tr><tr><td>256</td><td>flatten</td></tr></table>
Table D.2: Feature extraction network used for miniImageNet few-shot learning. Batch Normalization and dropout with a keep probability of 0.5 used throughout.
miniImageNet Shared Feature Extraction Network (θ): $\tilde { x } h _ { \theta } ( \tilde { x } )$
<table><tr><td>Output size</td><td>Layers</td></tr><tr><td>84×84×1</td><td>Input image</td></tr><tr><td>42 × 42× 64</td><td>conv2d (3 × 3, stride 1, SAME,RELU), dropout, pool (2 × 2, stride 2, VALID)</td></tr><tr><td>21×21×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU), dropout, pool (2 × 2, stride 2, VALID)</td></tr><tr><td>10 ×10×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU), dropout, pool (2 × 2, stride 2, VALID)</td></tr><tr><td>5×5×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU), dropout, pool (2 × 2, stride 2, VALID)</td></tr><tr><td>2×2×64 256</td><td>conv2d (3 × 3, stride 1, SAME,RELU), dropout, pool (2 × 2, stride 2, VALID) flatten</td></tr></table>
# E SHAPENET EXPER IMENTAT ION DETA ILS
# E.1 VIEW RECONSTRUCT ION TRA IN ING PROCEDURE AND NETWORK ARCH ITECTURES
ShapeNetCore v2 (Chang et al., 2015) is an annotated database of 3D objects covering 55 common object categories with ${ \sim } 5 1 { , } 3 0 0$ unique objects. For our experiments, we use 12 of the largest object categories. Refer to Table E.1 for a complete list. We concatenate all instances from all 12 of the object categories together to obtain a dataset of 37,108 objects. This concatenated dataset is then randomly shuffled and we use $70 \%$ of the objects (25,975 in total) for training, $10 \%$ for validation (3,710 in total) , and $20 \%$ (7423 in total) for testing. For each object, we generate $V = 3 6$ , $1 2 8 \times 1 2 8$ pixel image views spaced evenly every 10 degrees in azimuth around the object. We then convert the rendered images to gray-scale and reduce their size to be $3 2 \times 3 2$ pixels. Again, we train our model in an episodic manner. Each training iteration consists a batch of one or more tasks. For each task an object is selected at random from the training set. We train on a single view selected at random from the $V = 3 6$ views associated with each object and use the remaining 35 views to evaluate the objective function. We then generate 36 views of the object with a modified version of our amortization network which is shown diagrammatically in Fig. 3. To evaluate the system, we generate views and compute quantitative metrics over the entire test set. Tables E.2 to E.4 describe the network architectures for the encoder, amortization, and generator networks, respectively. To train, we use the Adam (Kingma and Ba, 2015) optimizer with a constant learning rate of 0.0001 with 24 tasks per batch for 500,000 training iterations. In addition, we set $d _ { \phi } = 2 5 6$ , $d _ { \psi } = 2 5 6$ and number of $\psi$ samples to 1.
Table D.3: Amortization network used for Omniglot and miniImageNet few-shot learning.
<table><tr><td colspan="3"></td></tr><tr><td>Phase</td><td>Output size Layers</td><td></td></tr><tr><td rowspan="4">feature extraction instance pooling weight distribution</td><td>k×256</td><td>shared feature network (0)</td></tr><tr><td>256</td><td>mean</td></tr><tr><td>256</td><td>2 × fully connected, ELU+</td></tr><tr><td></td><td>linear fully connected to μw(c), ² .2 w(c)</td></tr></table>
Table D.4: Linear classifier used for Omniglot and miniImageNet few-shot learning.
<table><tr><td colspan="2">Linear Classifier (ψ): hθ(x) →p(y|𝑥,0,ψt)</td></tr><tr><td>Output size</td><td>Layers</td></tr><tr><td>256</td><td>Input features</td></tr><tr><td>C</td><td>fully connected, softmax</td></tr></table>
Table E.1: List of ShapeNet categories used in the VERSA view reconstruction experiments.
<table><tr><td>Object Category</td><td>sysnet ID</td><td>Instances</td></tr><tr><td>airplane</td><td>02691156</td><td>4045</td></tr><tr><td>bench</td><td>02828884</td><td>1813</td></tr><tr><td>cabinet</td><td>02933112</td><td>1571</td></tr><tr><td>car</td><td>02958343</td><td>3533</td></tr><tr><td>phone</td><td>02992529</td><td>831</td></tr><tr><td>chair</td><td>03001627</td><td>6778</td></tr><tr><td>display</td><td>03211117</td><td>1093</td></tr><tr><td>lamp</td><td>03636649</td><td>2318</td></tr><tr><td>speaker</td><td>03691459</td><td>1597</td></tr><tr><td>sofa</td><td>04256520</td><td>3173</td></tr><tr><td>table</td><td>04379243</td><td>8436</td></tr><tr><td>boat</td><td>04530566</td><td>1939</td></tr></table>
Table E.2: Encoder network used for ShapeNet few-shot learning. No dropout or batch normalization is used. ShapeNet Encoder Network (φ): $y h$
<table><tr><td>Output size Layers</td><td></td></tr><tr><td>32 ×32×1</td><td>Input image</td></tr><tr><td>16 ×16×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU), pool (2 × 2, stride2,VALID)</td></tr><tr><td>8×8×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU),pool (2 × 2, stride 2, VALID)</td></tr><tr><td>4×4×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU), pool (2 × 2, stride 2,VALID)</td></tr><tr><td>2×2×64</td><td>conv2d (3 × 3, stride 1, SAME,RELU),pool (2 × 2, stride 2, VALID)</td></tr><tr><td>d</td><td>fully connected, RELU</td></tr></table>
Table E.3: Amortization network used for ShapeNet few-shot learning. ShapeNet Amortization Network $( \phi )$ $: x _ { 1 } ^ { ( t ) } , . . . , x _ { k } ^ { ( t ) } , y _ { 1 } ^ { ( t ) } , . . . , y _ { k } ^ { ( t ) } \mu _ { \psi } , \sigma _ { \psi } ^ { 2 }$
<table><tr><td>Phase</td><td>Output size</td><td>Layers</td></tr><tr><td>Φpre</td><td>k×d</td><td>encoder network ()</td></tr><tr><td>concatenate h and X</td><td>k ×(dp+dx)</td><td>concat(h, X)</td></tr><tr><td>Φmid</td><td>kxd</td><td>2 × 2 fully connected,ELU</td></tr><tr><td>instance pooling</td><td>1×d</td><td>average</td></tr><tr><td>post</td><td>1×d</td><td>2× fully connected, ELU</td></tr><tr><td> distribution</td><td>d</td><td>fully connected linear layers to μψ,</td></tr></table>
Table E.4: Generator network used for ShapeNet few-shot learning. No dropout or batch normalization is used. ShapeNet Generator Network (θ): $\tilde { x } p ( \tilde { y } | \tilde { x } , \theta , \psi ^ { ( t ) } )$
<table><tr><td>Output size</td><td>Layers</td></tr><tr><td>d+dx</td><td>concat(y,x)</td></tr><tr><td>512</td><td>fully connected, RELU</td></tr><tr><td>1024</td><td>fully connected, RELU</td></tr><tr><td>2×2×256</td><td>reshape</td></tr><tr><td>4×4×128</td><td>deconv2d (3 × 3, stride 2, SAME, RELU)</td></tr><tr><td>8×8×64</td><td>deconv2d (3 × 3, stride 2, SAME,RELU)</td></tr><tr><td>16 ×16 × 32</td><td>deconv2d (3 × 3, stride 2, SAME,RELU)</td></tr><tr><td>32×32×1</td><td>deconv2d (3 × 3, stride 2, SAME,sigmoid)</td></tr></table>md/train/0-EYBhgw80y/0-EYBhgw80y.mdAdded+332
md/train/3SV-ZePhnZM/3SV-ZePhnZM.mdAdded+317
md/train/519VBzfEaKW/519VBzfEaKW.mdAdded+219
md/train/6xHJ37MVxxp/6xHJ37MVxxp.mdAdded+331
md/train/AAes_3W-2z/AAes_3W-2z.mdAdded+487
md/train/AYAgKFl78z/AYAgKFl78z.mdAdded+359
md/train/B14rPj0qY7/B14rPj0qY7.mdAdded+206
md/train/B1xwcyHFDr/B1xwcyHFDr.mdAdded
md/train/BJMvBjC5YQ/BJMvBjC5YQ.mdAdded+428
md/train/BJgPCveAW/BJgPCveAW.mdAdded+163
md/train/Byk-VI9eg/Byk-VI9eg.mdAdded+345
md/train/DHSNrGhAY7W/DHSNrGhAY7W.mdAdded
md/train/H1gDNyrKDS/H1gDNyrKDS.mdAdded+496
md/train/H1ldzA4tPr/H1ldzA4tPr.mdAdded+329
md/train/H1xQSjCqFQ/H1xQSjCqFQ.mdAdded+264
md/train/Hke12T4KPS/Hke12T4KPS.mdAdded+385
md/train/Hkla1eHFvS/Hkla1eHFvS.mdAdded+519
md/train/HkxStoC5F7/HkxStoC5F7.mdAdded+443
md/train/HwGNkx1WcIs/HwGNkx1WcIs.mdAdded
md/train/Hyewf3AqYX/Hyewf3AqYX.mdAdded
md/train/JUgC3lqn6r2/JUgC3lqn6r2.mdAdded
md/train/KJSC_AsN14/KJSC_AsN14.mdAdded
md/train/S1X7nhsxl/S1X7nhsxl.mdAdded
md/train/S1xh5sYgx/S1xh5sYgx.mdAdded
md/train/SkFEGHx0Z/SkFEGHx0Z.mdAdded
md/train/Svfh1_hYEtF/Svfh1_hYEtF.mdAdded
md/train/Sy4lojC9tm/Sy4lojC9tm.mdAdded
md/train/SyGjjsC5tQ/SyGjjsC5tQ.mdAdded
md/train/SyMDXnCcF7/SyMDXnCcF7.mdAdded
md/train/Syx7A3NFvH/Syx7A3NFvH.mdAdded
md/train/aLE2sEtMNXv/aLE2sEtMNXv.mdAdded
md/train/auGY2UQfhSu/auGY2UQfhSu.mdAdded
md/train/dvSExzhjG9D/dvSExzhjG9D.mdAdded
md/train/iktA2PtTRsK/iktA2PtTRsK.mdAdded
md/train/jLHWRxwc7_f/jLHWRxwc7_f.mdAdded
md/train/jQSBcVURlpW/jQSBcVURlpW.mdAdded
md/train/ks5nebunVn_/ks5nebunVn_.mdAdded
md/train/mEdwVCRJuX4/mEdwVCRJuX4.mdAdded
md/train/r1gR2sC9FX/r1gR2sC9FX.mdAdded
md/train/r1kGbydxg/r1kGbydxg.mdAdded
md/train/r1xwKoR9Y7/r1xwKoR9Y7.mdAdded
md/train/rJVorjCcKQ/rJVorjCcKQ.mdAdded
md/train/rJbbOLcex/rJbbOLcex.mdAdded
md/train/rkxoh24FPH/rkxoh24FPH.mdAdded
md/train/rkzfuiA9F7/rkzfuiA9F7.mdAdded
md/train/rkzjUoAcFX/rkzjUoAcFX.mdAdded
md/train/rqfq0CYIekd/rqfq0CYIekd.mdAdded
md/train/ryxhB3CcK7/ryxhB3CcK7.mdAdded
md/train/vQTYEUtSUr/vQTYEUtSUr.mdAdded
md/train/vujTf_I8Kmc/vujTf_I8Kmc.mdAdded